From 960c8da755f79d72a6d839816f865d1f4ea3f287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20T=C3=A9treault-Pinard?= Date: Mon, 19 Jun 2017 11:57:50 -0400 Subject: [PATCH] 1.28.0 --- dist/README.md | 48 +- dist/npm-ls.json | 733 +-- dist/plotly-basic.js | 3934 ++++++++------ dist/plotly-basic.min.js | 45 +- dist/plotly-cartesian.js | 4113 +++++++++------ dist/plotly-cartesian.min.js | 50 +- dist/plotly-finance.js | 4048 +++++++++------ dist/plotly-finance.min.js | 47 +- dist/plotly-geo-assets.js | 4 +- dist/plotly-geo.js | 3910 +++++++++----- dist/plotly-geo.min.js | 47 +- dist/plotly-gl2d.js | 7501 ++++++++++++++++----------- dist/plotly-gl2d.min.js | 76 +- dist/plotly-gl3d.js | 5928 ++++++++++++--------- dist/plotly-gl3d.min.js | 75 +- dist/plotly-mapbox.js | 3877 +++++++++----- dist/plotly-mapbox.min.js | 73 +- dist/plotly-with-meta.js | 9343 +++++++++++++++++++++------------- dist/plotly.js | 9258 ++++++++++++++++++++------------- dist/plotly.min.js | 145 +- package.json | 2 +- src/assets/geo_assets.js | 2 +- src/core.js | 2 +- 23 files changed, 32990 insertions(+), 20271 deletions(-) diff --git a/dist/README.md b/dist/README.md index 8f3b2a28c77..a37eb7a244e 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-latest.min.js OR https://cdn.plot.ly/plotly-1.27.1.min.js +- using CDN URL https://cdn.plot.ly/plotly-latest.min.js OR https://cdn.plot.ly/plotly-1.28.0.min.js or as raw javascript: - using dist file `dist/plotly.js` -- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.27.1.js +- using CDN URL https://cdn.plot.ly/plotly-latest.js OR https://cdn.plot.ly/plotly-1.28.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 | |-----------|---------------|----------------------|---------------------| -| 5.3 MB | 2.1 MB | 655.3 kB | 5.5 MB | +| 5.4 MB | 2.2 MB | 661.9 kB | 5.5 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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-basic-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-basic-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-basic')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.7 MB | 653.8 kB | 212.1 kB | +| 1.8 MB | 664.4 kB | 215.7 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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-cartesian-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-cartesian-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-cartesian')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.9 MB | 728.9 kB | 234.7 kB | +| 2 MB | 739.4 kB | 238.2 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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-geo-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-geo-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-geo')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.8 MB | 676.7 kB | 220.6 kB | +| 1.8 MB | 687.2 kB | 224.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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl3d-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl3d-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-gl3d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.7 MB | 1.1 MB | 349.9 kB | +| 2.7 MB | 1.1 MB | 354 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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-gl2d-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-gl2d-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-gl2d')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.8 MB | 1.1 MB | 356.9 kB | +| 2.8 MB | 1.1 MB | 362.9 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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-mapbox-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-mapbox-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-mapbox')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 2.8 MB | 1.1 MB | 325 kB | +| 2.8 MB | 1.1 MB | 328.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.27.1.js | -| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.27.1.min.js | +| CDN URL (tagged) | https://cdn.plot.ly/plotly-finance-1.28.0.js | +| CDN URL (tagged minified) | https://cdn.plot.ly/plotly-finance-1.28.0.min.js | | CommonJS | `require('plotly.js/lib/index-finance')` | | Raw size | Minified size | Minified + gzip size | |------|-----------------|------------------------| -| 1.8 MB | 680.7 kB | 219.7 kB | +| 1.8 MB | 691.5 kB | 223.2 kB | ---------------- diff --git a/dist/npm-ls.json b/dist/npm-ls.json index c3ba055c5b9..03e4cf903e1 100644 --- a/dist/npm-ls.json +++ b/dist/npm-ls.json @@ -1,6 +1,6 @@ { "name": "plotly.js", - "version": "1.27.1", + "version": "1.28.0", "dependencies": { "3d-view": { "version": "2.0.0", @@ -49,9 +49,9 @@ "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.3.tgz" }, "d3-interpolate": { - "version": "1.1.4", + "version": "1.1.5", "from": "d3-interpolate@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.1.4.tgz", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.1.5.tgz", "dependencies": { "d3-color": { "version": "1.0.3", @@ -94,152 +94,7 @@ "boundary-cells": { "version": "2.0.1", "from": "boundary-cells@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/boundary-cells/-/boundary-cells-2.0.1.tgz", - "dependencies": { - "tape": { - "version": "4.6.3", - "from": "tape@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/tape/-/tape-4.6.3.tgz", - "dependencies": { - "defined": { - "version": "1.0.0", - "from": "defined@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz" - }, - "for-each": { - "version": "0.3.2", - "from": "for-each@>=0.3.2 <0.4.0", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", - "dependencies": { - "is-function": { - "version": "1.0.1", - "from": "is-function@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz" - } - } - }, - "function-bind": { - "version": "1.1.0", - "from": "function-bind@>=1.1.0 <1.2.0", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz" - }, - "glob": { - "version": "7.1.1", - "from": "glob@>=7.1.1 <7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "dependencies": { - "fs.realpath": { - "version": "1.0.0", - "from": "fs.realpath@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" - }, - "inflight": { - "version": "1.0.6", - "from": "inflight@>=1.0.4 <2.0.0", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" - }, - "minimatch": { - "version": "3.0.3", - "from": "minimatch@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.3.tgz", - "dependencies": { - "brace-expansion": { - "version": "1.1.6", - "from": "brace-expansion@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.6.tgz", - "dependencies": { - "balanced-match": { - "version": "0.4.2", - "from": "balanced-match@>=0.4.1 <0.5.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz" - }, - "concat-map": { - "version": "0.0.1", - "from": "concat-map@0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" - } - } - } - } - }, - "once": { - "version": "1.4.0", - "from": "once@>=1.3.0 <2.0.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" - }, - "path-is-absolute": { - "version": "1.0.1", - "from": "path-is-absolute@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" - } - } - }, - "object-inspect": { - "version": "1.2.2", - "from": "object-inspect@>=1.2.1 <1.3.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.2.2.tgz" - }, - "resumer": { - "version": "0.0.0", - "from": "resumer@>=0.0.0 <0.1.0", - "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz" - }, - "string.prototype.trim": { - "version": "1.1.2", - "from": "string.prototype.trim@>=1.1.2 <1.2.0", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", - "dependencies": { - "define-properties": { - "version": "1.1.2", - "from": "define-properties@>=1.1.2 <2.0.0", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", - "dependencies": { - "object-keys": { - "version": "1.0.11", - "from": "object-keys@>=1.0.8 <2.0.0", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz" - } - } - }, - "es-abstract": { - "version": "1.7.0", - "from": "es-abstract@>=1.5.0 <2.0.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.7.0.tgz", - "dependencies": { - "es-to-primitive": { - "version": "1.1.1", - "from": "es-to-primitive@>=1.1.1 <2.0.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", - "dependencies": { - "is-date-object": { - "version": "1.0.1", - "from": "is-date-object@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz" - }, - "is-symbol": { - "version": "1.0.1", - "from": "is-symbol@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz" - } - } - }, - "is-callable": { - "version": "1.1.3", - "from": "is-callable@>=1.1.3 <2.0.0", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz" - }, - "is-regex": { - "version": "1.0.4", - "from": "is-regex@>=1.0.3 <2.0.0", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz" - } - } - } - } - } - } - } - } + "resolved": "https://registry.npmjs.org/boundary-cells/-/boundary-cells-2.0.1.tgz" }, "reduce-simplicial-complex": { "version": "1.0.0", @@ -403,6 +258,23 @@ "from": "fast-isnumeric@>=1.1.1 <2.0.0", "resolved": "https://registry.npmjs.org/fast-isnumeric/-/fast-isnumeric-1.1.1.tgz" }, + "font-atlas-sdf": { + "version": "1.3.3", + "from": "font-atlas-sdf@1.3.3", + "resolved": "https://registry.npmjs.org/font-atlas-sdf/-/font-atlas-sdf-1.3.3.tgz", + "dependencies": { + "optical-properties": { + "version": "1.0.0", + "from": "optical-properties@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/optical-properties/-/optical-properties-1.0.0.tgz" + }, + "tiny-sdf": { + "version": "1.0.2", + "from": "tiny-sdf@>=1.0.2 <2.0.0", + "resolved": "https://registry.npmjs.org/tiny-sdf/-/tiny-sdf-1.0.2.tgz" + } + } + }, "gl-contour2d": { "version": "1.1.3", "from": "gl-contour2d@>=1.1.2 <2.0.0", @@ -490,23 +362,28 @@ "resolved": "https://registry.npmjs.org/glslify/-/glslify-4.0.0.tgz", "dependencies": { "bl": { - "version": "1.2.0", + "version": "1.2.1", "from": "bl@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.1.tgz", "dependencies": { "readable-stream": { - "version": "2.2.6", + "version": "2.2.9", "from": "readable-stream@>=2.0.5 <3.0.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", "dependencies": { "isarray": { "version": "1.0.0", "from": "isarray@>=1.0.0 <1.1.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" }, + "string_decoder": { + "version": "1.0.1", + "from": "string_decoder@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz" + }, "buffer-shims": { "version": "1.0.0", - "from": "buffer-shims@>=1.0.0 <2.0.0", + "from": "buffer-shims@>=1.0.0 <1.1.0", "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz" }, "core-util-is": { @@ -519,11 +396,6 @@ "from": "process-nextick-args@>=1.0.6 <1.1.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz" }, - "string_decoder": { - "version": "0.10.31", - "from": "string_decoder@>=0.10.0 <0.11.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, "util-deprecate": { "version": "1.0.2", "from": "util-deprecate@>=1.0.1 <1.1.0", @@ -604,11 +476,6 @@ "from": "glsl-token-string@>=1.0.1 <2.0.0", "resolved": "https://registry.npmjs.org/glsl-token-string/-/glsl-token-string-1.0.1.tgz" }, - "glsl-token-whitespace-trim": { - "version": "1.0.0", - "from": "glsl-token-whitespace-trim@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/glsl-token-whitespace-trim/-/glsl-token-whitespace-trim-1.0.0.tgz" - }, "glsl-tokenizer": { "version": "2.1.2", "from": "glsl-tokenizer@>=2.0.2 <3.0.0", @@ -696,10 +563,10 @@ "from": "readable-stream@>=1.0.33-1 <1.1.0-0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "dependencies": { - "isarray": { - "version": "0.0.1", - "from": "isarray@0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + "string_decoder": { + "version": "0.10.31", + "from": "string_decoder@>=0.10.0 <0.11.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" } } } @@ -716,27 +583,10 @@ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz" }, "static-module": { - "version": "1.3.1", + "version": "1.3.2", "from": "static-module@>=1.1.2 <2.0.0", - "resolved": "https://registry.npmjs.org/static-module/-/static-module-1.3.1.tgz", + "resolved": "https://registry.npmjs.org/static-module/-/static-module-1.3.2.tgz", "dependencies": { - "concat-stream": { - "version": "1.4.10", - "from": "concat-stream@>=1.4.5 <1.5.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.4.10.tgz", - "dependencies": { - "readable-stream": { - "version": "1.1.14", - "from": "readable-stream@>=1.1.9 <1.2.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz" - }, - "typedarray": { - "version": "0.0.6", - "from": "typedarray@>=0.0.5 <0.1.0", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" - } - } - }, "duplexer2": { "version": "0.0.2", "from": "duplexer2@>=0.0.2 <0.1.0", @@ -831,11 +681,6 @@ "from": "falafel@>=1.0.0 <2.0.0", "resolved": "https://registry.npmjs.org/falafel/-/falafel-1.2.0.tgz", "dependencies": { - "foreach": { - "version": "2.0.5", - "from": "foreach@>=2.0.5 <3.0.0", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz" - }, "acorn": { "version": "1.2.2", "from": "acorn@>=1.0.3 <2.0.0", @@ -969,35 +814,355 @@ } }, "gl-error3d": { - "version": "1.0.4", - "from": "gl-error3d@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-error3d/-/gl-error3d-1.0.4.tgz", + "version": "1.0.6", + "from": "gl-error3d@>=1.0.6 <2.0.0", + "resolved": "https://registry.npmjs.org/gl-error3d/-/gl-error3d-1.0.6.tgz", "dependencies": { "glslify": { - "version": "2.3.1", - "from": "glslify@>=2.1.2 <3.0.0", - "resolved": "https://registry.npmjs.org/glslify/-/glslify-2.3.1.tgz", + "version": "6.1.0", + "from": "glslify@>=6.0.2 <7.0.0", + "resolved": "https://registry.npmjs.org/glslify/-/glslify-6.1.0.tgz", "dependencies": { - "bl": { - "version": "0.9.5", - "from": "bl@>=0.9.4 <0.10.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-0.9.5.tgz" + "concat-stream": { + "version": "1.6.0", + "from": "concat-stream@>=1.6.0 <1.7.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "dependencies": { + "readable-stream": { + "version": "2.2.9", + "from": "readable-stream@>=2.2.2 <3.0.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "dependencies": { + "isarray": { + "version": "1.0.0", + "from": "isarray@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + }, + "string_decoder": { + "version": "1.0.1", + "from": "string_decoder@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz" + } + } + }, + "typedarray": { + "version": "0.0.6", + "from": "typedarray@>=0.0.6 <0.0.7", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" + } + } + }, + "duplexify": { + "version": "3.5.0", + "from": "duplexify@>=3.4.5 <4.0.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.5.0.tgz", + "dependencies": { + "readable-stream": { + "version": "2.2.9", + "from": "readable-stream@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "dependencies": { + "isarray": { + "version": "1.0.0", + "from": "isarray@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + }, + "string_decoder": { + "version": "1.0.1", + "from": "string_decoder@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz" + } + } + }, + "end-of-stream": { + "version": "1.0.0", + "from": "end-of-stream@1.0.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.0.0.tgz", + "dependencies": { + "once": { + "version": "1.3.3", + "from": "once@>=1.3.0 <1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz" + } + } + }, + "stream-shift": { + "version": "1.0.0", + "from": "stream-shift@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz" + } + } + }, + "falafel": { + "version": "2.1.0", + "from": "falafel@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/falafel/-/falafel-2.1.0.tgz", + "dependencies": { + "acorn": { + "version": "5.0.3", + "from": "acorn@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.0.3.tgz" + }, + "foreach": { + "version": "2.0.5", + "from": "foreach@>=2.0.5 <3.0.0", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz" + }, + "isarray": { + "version": "0.0.1", + "from": "isarray@0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "object-keys": { + "version": "1.0.11", + "from": "object-keys@>=1.0.8 <2.0.0", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz" + } + } + }, + "from2": { + "version": "2.3.0", + "from": "from2@>=2.3.0 <3.0.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "dependencies": { + "readable-stream": { + "version": "2.2.9", + "from": "readable-stream@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "dependencies": { + "isarray": { + "version": "1.0.0", + "from": "isarray@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + }, + "string_decoder": { + "version": "1.0.1", + "from": "string_decoder@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz" + } + } + } + } }, "glslify-bundle": { - "version": "2.0.4", - "from": "glslify-bundle@>=2.0.4 <3.0.0", - "resolved": "https://registry.npmjs.org/glslify-bundle/-/glslify-bundle-2.0.4.tgz" + "version": "5.0.0", + "from": "glslify-bundle@>=5.0.0 <6.0.0", + "resolved": "https://registry.npmjs.org/glslify-bundle/-/glslify-bundle-5.0.0.tgz" + }, + "static-eval": { + "version": "1.1.1", + "from": "static-eval@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/static-eval/-/static-eval-1.1.1.tgz", + "dependencies": { + "escodegen": { + "version": "1.8.1", + "from": "escodegen@>=1.8.1 <2.0.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "dependencies": { + "esprima": { + "version": "2.7.3", + "from": "esprima@>=2.7.1 <3.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz" + }, + "estraverse": { + "version": "1.9.3", + "from": "estraverse@>=1.9.1 <2.0.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz" + }, + "esutils": { + "version": "2.0.2", + "from": "esutils@>=2.0.2 <3.0.0", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz" + }, + "source-map": { + "version": "0.2.0", + "from": "source-map@>=0.2.0 <0.3.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz" + } + } + } + } + }, + "glsl-token-whitespace-trim": { + "version": "1.0.0", + "from": "glsl-token-whitespace-trim@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/glsl-token-whitespace-trim/-/glsl-token-whitespace-trim-1.0.0.tgz" + }, + "stack-trace": { + "version": "0.0.9", + "from": "stack-trace@0.0.9", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz" + }, + "tape": { + "version": "4.6.3", + "from": "tape@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/tape/-/tape-4.6.3.tgz", + "dependencies": { + "deep-equal": { + "version": "1.0.1", + "from": "deep-equal@>=1.0.1 <1.1.0", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz" + }, + "defined": { + "version": "1.0.0", + "from": "defined@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz" + }, + "for-each": { + "version": "0.3.2", + "from": "for-each@>=0.3.2 <0.4.0", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", + "dependencies": { + "is-function": { + "version": "1.0.1", + "from": "is-function@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz" + } + } + }, + "function-bind": { + "version": "1.1.0", + "from": "function-bind@>=1.1.0 <1.2.0", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz" + }, + "glob": { + "version": "7.1.2", + "from": "glob@>=7.1.1 <7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "from": "fs.realpath@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + }, + "inflight": { + "version": "1.0.6", + "from": "inflight@>=1.0.4 <2.0.0", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + }, + "minimatch": { + "version": "3.0.4", + "from": "minimatch@>=3.0.4 <4.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "dependencies": { + "brace-expansion": { + "version": "1.1.7", + "from": "brace-expansion@>=1.1.7 <2.0.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", + "dependencies": { + "balanced-match": { + "version": "0.4.2", + "from": "balanced-match@>=0.4.1 <0.5.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz" + }, + "concat-map": { + "version": "0.0.1", + "from": "concat-map@0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + } + } + } + } + }, + "once": { + "version": "1.4.0", + "from": "once@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + }, + "path-is-absolute": { + "version": "1.0.1", + "from": "path-is-absolute@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + } + } + }, + "object-inspect": { + "version": "1.2.2", + "from": "object-inspect@>=1.2.1 <1.3.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.2.2.tgz" + }, + "resumer": { + "version": "0.0.0", + "from": "resumer@>=0.0.0 <0.1.0", + "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz" + }, + "string.prototype.trim": { + "version": "1.1.2", + "from": "string.prototype.trim@>=1.1.2 <1.2.0", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", + "dependencies": { + "define-properties": { + "version": "1.1.2", + "from": "define-properties@>=1.1.2 <2.0.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz" + }, + "es-abstract": { + "version": "1.7.0", + "from": "es-abstract@>=1.5.0 <2.0.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.7.0.tgz", + "dependencies": { + "es-to-primitive": { + "version": "1.1.1", + "from": "es-to-primitive@>=1.1.1 <2.0.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "dependencies": { + "is-date-object": { + "version": "1.0.1", + "from": "is-date-object@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz" + }, + "is-symbol": { + "version": "1.0.1", + "from": "is-symbol@>=1.0.1 <2.0.0", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz" + } + } + }, + "is-callable": { + "version": "1.1.3", + "from": "is-callable@>=1.1.3 <2.0.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz" + }, + "is-regex": { + "version": "1.0.4", + "from": "is-regex@>=1.0.3 <2.0.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz" + } + } + } + } + } + } }, "through2": { - "version": "0.6.5", - "from": "through2@^0.6.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz" + "version": "2.0.3", + "from": "through2@>=2.0.3 <3.0.0", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "dependencies": { + "readable-stream": { + "version": "2.2.9", + "from": "readable-stream@>=2.1.5 <3.0.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "dependencies": { + "isarray": { + "version": "1.0.0", + "from": "isarray@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + }, + "string_decoder": { + "version": "1.0.1", + "from": "string_decoder@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz" + } + } + } + } } } }, "gl-vao": { "version": "1.3.0", - "from": "gl-vao@>=1.1.3 <2.0.0", + "from": "gl-vao@>=1.3.0 <2.0.0", "resolved": "https://registry.npmjs.org/gl-vao/-/gl-vao-1.3.0.tgz" } } @@ -1098,9 +1263,9 @@ "resolved": "https://registry.npmjs.org/gl-mat4/-/gl-mat4-1.1.4.tgz" }, "gl-mesh3d": { - "version": "1.2.0", - "from": "gl-mesh3d@>=1.2.0 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-mesh3d/-/gl-mesh3d-1.2.0.tgz", + "version": "1.3.0", + "from": "gl-mesh3d@>=1.3.0 <2.0.0", + "resolved": "https://registry.npmjs.org/gl-mesh3d/-/gl-mesh3d-1.3.0.tgz", "dependencies": { "barycentric": { "version": "1.0.1", @@ -1264,20 +1429,13 @@ }, "gl-plot3d": { "version": "1.5.4", - "from": "gl-plot3d@1.5.4", + "from": "gl-plot3d@>=1.5.4 <2.0.0", "resolved": "https://registry.npmjs.org/gl-plot3d/-/gl-plot3d-1.5.4.tgz", "dependencies": { "3d-view-controls": { "version": "2.2.0", "from": "3d-view-controls@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/3d-view-controls/-/3d-view-controls-2.2.0.tgz", - "dependencies": { - "mouse-event-offset": { - "version": "3.0.2", - "from": "mouse-event-offset@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/mouse-event-offset/-/mouse-event-offset-3.0.2.tgz" - } - } + "resolved": "https://registry.npmjs.org/3d-view-controls/-/3d-view-controls-2.2.0.tgz" }, "a-big-triangle": { "version": "1.0.3", @@ -1445,10 +1603,20 @@ } }, "gl-scatter2d": { - "version": "1.2.2", + "version": "1.3.1", "from": "gl-scatter2d@>=1.2.2 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-scatter2d/-/gl-scatter2d-1.2.2.tgz", + "resolved": "https://registry.npmjs.org/gl-scatter2d/-/gl-scatter2d-1.3.1.tgz", "dependencies": { + "array-bounds": { + "version": "1.0.1", + "from": "array-bounds@>=1.0.0 <2.0.0", + "resolved": "https://registry.npmjs.org/array-bounds/-/array-bounds-1.0.1.tgz" + }, + "array-normalize": { + "version": "1.1.2", + "from": "array-normalize@>=1.1.2 <2.0.0", + "resolved": "https://registry.npmjs.org/array-normalize/-/array-normalize-1.1.2.tgz" + }, "binary-search-bounds": { "version": "2.0.3", "from": "binary-search-bounds@>=2.0.3 <3.0.0", @@ -1471,7 +1639,7 @@ }, "through2": { "version": "0.6.5", - "from": "through2@^0.6.3", + "from": "through2@>=0.6.3 <0.7.0", "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz" } } @@ -1484,26 +1652,14 @@ } }, "gl-scatter2d-sdf": { - "version": "1.3.9", - "from": "gl-scatter2d-sdf@>=1.3.9 <2.0.0", - "resolved": "https://registry.npmjs.org/gl-scatter2d-sdf/-/gl-scatter2d-sdf-1.3.9.tgz", + "version": "1.3.11", + "from": "gl-scatter2d-sdf@>=1.3.10 <2.0.0", + "resolved": "https://registry.npmjs.org/gl-scatter2d-sdf/-/gl-scatter2d-sdf-1.3.11.tgz", "dependencies": { "color-id": { - "version": "1.0.3", - "from": "color-id@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/color-id/-/color-id-1.0.3.tgz" - }, - "font-atlas-sdf": { - "version": "1.2.0", - "from": "font-atlas-sdf@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/font-atlas-sdf/-/font-atlas-sdf-1.2.0.tgz", - "dependencies": { - "tiny-sdf": { - "version": "1.0.2", - "from": "tiny-sdf@>=1.0.2 <2.0.0", - "resolved": "https://registry.npmjs.org/tiny-sdf/-/tiny-sdf-1.0.2.tgz" - } - } + "version": "1.1.0", + "from": "color-id@>=1.1.0 <2.0.0", + "resolved": "https://registry.npmjs.org/color-id/-/color-id-1.1.0.tgz" }, "binary-search-bounds": { "version": "2.0.3", @@ -1745,9 +1901,9 @@ } }, "sprintf-js": { - "version": "1.0.3", + "version": "1.1.1", "from": "sprintf-js@>=1.0.3 <2.0.0", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.1.tgz" } } }, @@ -1931,25 +2087,6 @@ "resolved": "https://registry.npmjs.org/buffer-equal/-/buffer-equal-0.0.1.tgz" } } - }, - "through2": { - "version": "2.0.3", - "from": "through2@>=2.0.3 <3.0.0", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "dependencies": { - "readable-stream": { - "version": "2.2.6", - "from": "readable-stream@>=2.1.5 <3.0.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz", - "dependencies": { - "isarray": { - "version": "1.0.0", - "from": "isarray@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" - } - } - } - } } } } @@ -2158,9 +2295,9 @@ } }, "extend": { - "version": "3.0.0", + "version": "3.0.1", "from": "extend@>=3.0.0 <3.1.0", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz" + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz" }, "forever-agent": { "version": "0.6.1", @@ -2168,9 +2305,9 @@ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" }, "form-data": { - "version": "2.1.2", + "version": "2.1.4", "from": "form-data@>=2.1.1 <2.2.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.2.tgz", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", "dependencies": { "asynckit": { "version": "0.4.0", @@ -2185,9 +2322,9 @@ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", "dependencies": { "ajv": { - "version": "4.11.5", + "version": "4.11.8", "from": "ajv@>=4.9.1 <5.0.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.5.tgz", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", "dependencies": { "co": { "version": "4.6.0", @@ -2280,9 +2417,9 @@ } }, "sshpk": { - "version": "1.11.0", + "version": "1.13.0", "from": "sshpk@>=1.7.0 <2.0.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.11.0.tgz", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.0.tgz", "dependencies": { "asn1": { "version": "0.2.3", @@ -2312,9 +2449,9 @@ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz" }, "getpass": { - "version": "0.1.6", + "version": "0.1.7", "from": "getpass@>=0.1.1 <0.2.0", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.6.tgz", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "dependencies": { "assert-plus": { "version": "1.0.0", @@ -2451,9 +2588,9 @@ "resolved": "https://registry.npmjs.org/unassertify/-/unassertify-2.0.4.tgz", "dependencies": { "acorn": { - "version": "4.0.11", + "version": "4.0.13", "from": "acorn@>=4.0.3 <5.0.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.11.tgz" + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz" }, "convert-source-map": { "version": "1.5.0", @@ -2506,11 +2643,6 @@ } } }, - "deep-equal": { - "version": "1.0.1", - "from": "deep-equal@>=1.0.1 <1.1.0", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz" - }, "espurify": { "version": "1.7.0", "from": "espurify@>=1.3.0 <2.0.0", @@ -2523,7 +2655,7 @@ }, "esutils": { "version": "2.0.2", - "from": "esutils@^2.0.2", + "from": "esutils@>=2.0.2 <3.0.0", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz" } } @@ -2553,11 +2685,6 @@ "from": "levn@>=0.3.0 <0.4.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz" }, - "wordwrap": { - "version": "1.0.0", - "from": "wordwrap@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" - }, "prelude-ls": { "version": "1.1.2", "from": "prelude-ls@>=1.1.2 <1.2.0", @@ -2567,6 +2694,11 @@ "version": "0.3.2", "from": "type-check@>=0.3.2 <0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + }, + "wordwrap": { + "version": "1.0.0", + "from": "wordwrap@>=1.0.0 <1.1.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" } } }, @@ -2623,7 +2755,7 @@ }, "matrix-camera-controller": { "version": "2.1.3", - "from": "matrix-camera-controller@latest", + "from": "matrix-camera-controller@>=2.1.3 <3.0.0", "resolved": "https://registry.npmjs.org/matrix-camera-controller/-/matrix-camera-controller-2.1.3.tgz", "dependencies": { "gl-vec3": { @@ -2674,6 +2806,11 @@ } } }, + "mouse-event-offset": { + "version": "3.0.2", + "from": "mouse-event-offset@>=3.0.2 <4.0.0", + "resolved": "https://registry.npmjs.org/mouse-event-offset/-/mouse-event-offset-3.0.2.tgz" + }, "mouse-wheel": { "version": "1.2.0", "from": "mouse-wheel@>=1.0.2 <2.0.0", @@ -2733,9 +2870,9 @@ } }, "uglify-js": { - "version": "2.8.20", + "version": "2.8.27", "from": "uglify-js@>=2.6.0 <3.0.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.20.tgz", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.27.tgz", "dependencies": { "source-map": { "version": "0.5.6", @@ -2773,9 +2910,9 @@ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "dependencies": { "kind-of": { - "version": "3.1.0", + "version": "3.2.2", "from": "kind-of@>=3.0.2 <4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.1.0.tgz" + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" }, "longest": { "version": "1.0.1", @@ -2791,15 +2928,15 @@ } } }, - "right-align": { - "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" + }, + "right-align": { + "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" } } }, @@ -2863,9 +3000,9 @@ "resolved": "https://registry.npmjs.org/ndarray-ops/-/ndarray-ops-1.2.2.tgz", "dependencies": { "cwise-compiler": { - "version": "1.1.2", + "version": "1.1.3", "from": "cwise-compiler@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/cwise-compiler/-/cwise-compiler-1.1.2.tgz" + "resolved": "https://registry.npmjs.org/cwise-compiler/-/cwise-compiler-1.1.3.tgz" } } }, diff --git a/dist/plotly-basic.js b/dist/plotly-basic.js index 03b60d805c2..0e2e2a5ea32 100644 --- a/dist/plotly-basic.js +++ b/dist/plotly-basic.js @@ -1,5 +1,5 @@ /** -* plotly.js (basic) v1.27.1 +* plotly.js (basic) v1.28.0 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -69,7 +69,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":136}],2:[function(require,module,exports){ +},{"../src/lib":143}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -208,7 +208,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":220}],4:[function(require,module,exports){ +},{"../src/traces/bar":228}],4:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -221,7 +221,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/core'); -},{"../src/core":125}],5:[function(require,module,exports){ +},{"../src/core":132}],5:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -254,7 +254,7 @@ module.exports = Plotly; module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":233}],7:[function(require,module,exports){ +},{"../src/traces/pie":241}],7:[function(require,module,exports){ !function() { var d3 = { version: "3.5.17" @@ -11546,6 +11546,10 @@ process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -12767,9 +12771,8 @@ else { 'use strict'; var Lib = require('../../lib'); -var Color = require('../color'); var Axes = require('../../plots/cartesian/axes'); - +var handleAnnotationCommonDefaults = require('./common_defaults'); var attributes = require('./attributes'); @@ -12786,26 +12789,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op if(!(visible || clickToShow)) return annOut; - coerce('opacity'); - var bgColor = coerce('bgcolor'); - - var borderColor = coerce('bordercolor'), - borderOpacity = Color.opacity(borderColor); - - coerce('borderpad'); - - var borderWidth = coerce('borderwidth'); - var showArrow = coerce('showarrow'); - - coerce('text', showArrow ? ' ' : 'new text'); - coerce('textangle'); - Lib.coerceFont(coerce, 'font', fullLayout.font); - - coerce('width'); - coerce('align'); + handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); - var h = coerce('height'); - if(h) coerce('valign'); + var showArrow = annOut.showarrow; // positioning var axLetters = ['x', 'y'], @@ -12847,14 +12833,8 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + // if you have one part of arrow length you should have both if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('standoff'); - - // if you have one part of arrow length you should have both Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); } @@ -12864,34 +12844,18 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // put the actual click data to bind to into private attributes // so we don't have to do this little bit of logic on every hover event - annOut._xclick = (xClick === undefined) ? annOut.x : xClick; - annOut._yclick = (yClick === undefined) ? annOut.y : yClick; + annOut._xclick = (xClick === undefined) ? + annOut.x : + Axes.cleanPosition(xClick, gdMock, annOut.xref); + annOut._yclick = (yClick === undefined) ? + annOut.y : + Axes.cleanPosition(yClick, gdMock, annOut.yref); } - var hoverText = coerce('hovertext'); - var globalHoverLabel = fullLayout.hoverlabel || {}; - - if(hoverText) { - var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || - (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) - ); - - var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || - Color.contrast(hoverBG) - ); - - Lib.coerceFont(coerce, 'hoverlabel.font', { - family: globalHoverLabel.font.family, - size: globalHoverLabel.font.size, - color: globalHoverLabel.font.color || hoverBorder - }); - } - coerce('captureevents', !!hoverText); - return annOut; }; -},{"../../lib":136,"../../plots/cartesian/axes":171,"../color":25,"./attributes":16}],15:[function(require,module,exports){ +},{"../../lib":143,"../../plots/cartesian/axes":178,"./attributes":16,"./common_defaults":19}],15:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -13236,7 +13200,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/cartesian/constants":176,"../../plots/font_attributes":195,"./arrow_paths":15}],17:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/cartesian/constants":183,"../../plots/font_attributes":202,"./arrow_paths":15}],17:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -13339,7 +13303,7 @@ function annAutorange(gd) { }); } -},{"../../lib":136,"../../plots/cartesian/axes":171,"./draw":21}],18:[function(require,module,exports){ +},{"../../lib":143,"../../plots/cartesian/axes":178,"./draw":22}],18:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -13425,18 +13389,22 @@ function getToggleSets(gd, hoverData) { explicitOffSet = [], hoverLen = (hoverData || []).length; - var i, j, anni, showMode, pointj, toggleType; + var i, j, anni, showMode, pointj, xa, ya, toggleType; for(i = 0; i < annotations.length; i++) { anni = annotations[i]; showMode = anni.clicktoshow; + if(showMode) { for(j = 0; j < hoverLen; j++) { pointj = hoverData[j]; - if(pointj.xaxis._id === anni.xref && - pointj.yaxis._id === anni.yref && - pointj.xaxis.d2r(pointj.x) === anni._xclick && - pointj.yaxis.d2r(pointj.y) === anni._yclick + xa = pointj.xaxis; + ya = pointj.yaxis; + + if(xa._id === anni.xref && + ya._id === anni.yref && + xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && + ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) ) { // match! toggle this annotation // regardless of its clicktoshow mode @@ -13464,7 +13432,80 @@ function getToggleSets(gd, hoverData) { return {on: onSet, off: offSet, explicitOff: explicitOffSet}; } -},{"../../plotly":166}],19:[function(require,module,exports){ +// to handle log axes until v2 +function clickData2r(d, ax) { + return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); +} + +},{"../../plotly":173}],19:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Color = require('../color'); + +// defaults common to 'annotations' and 'annotations3d' +module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { + coerce('opacity'); + var bgColor = coerce('bgcolor'); + + var borderColor = coerce('bordercolor'); + var borderOpacity = Color.opacity(borderColor); + + coerce('borderpad'); + + var borderWidth = coerce('borderwidth'); + var showArrow = coerce('showarrow'); + + coerce('text', showArrow ? ' ' : 'new text'); + coerce('textangle'); + Lib.coerceFont(coerce, 'font', fullLayout.font); + + coerce('width'); + coerce('align'); + + var h = coerce('height'); + if(h) coerce('valign'); + + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + coerce('standoff'); + + } + + var hoverText = coerce('hovertext'); + var globalHoverLabel = fullLayout.hoverlabel || {}; + + if(hoverText) { + var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || + (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) + ); + + var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || + Color.contrast(hoverBG) + ); + + Lib.coerceFont(coerce, 'hoverlabel.font', { + family: globalHoverLabel.font.family, + size: globalHoverLabel.font.size, + color: globalHoverLabel.font.color || hoverBorder + }); + } + + coerce('captureevents', !!hoverText); +}; + +},{"../../lib":143,"../color":31}],20:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -13527,7 +13568,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":154,"fast-isnumeric":10}],20:[function(require,module,exports){ +},{"../../lib/to_log_range":161,"fast-isnumeric":10}],21:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -13552,7 +13593,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":168,"./annotation_defaults":14}],21:[function(require,module,exports){ +},{"../../plots/array_container_defaults":175,"./annotation_defaults":14}],22:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -13591,7 +13632,8 @@ var drawArrowHead = require('./draw_arrow_head'); module.exports = { draw: draw, - drawOne: drawOne + drawOne: drawOne, + drawRaw: drawRaw }; /* @@ -13612,37 +13654,61 @@ function draw(gd) { } /* - * drawOne: draw a single annotation, potentially with modifications + * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications * * index (int): the annotation to draw */ function drawOne(gd, index) { - var layout = gd.layout, - fullLayout = gd._fullLayout, - gs = gd._fullLayout._size; + var fullLayout = gd._fullLayout; + var options = fullLayout.annotations[index] || {}; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); - // remove the existing annotation if there is one - fullLayout._infolayer.selectAll('.annotation[data-index="' + index + '"]').remove(); + drawRaw(gd, options, index, false, xa, ya); +} - // remember a few things about what was already there, - var optionsIn = (layout.annotations || [])[index], - options = fullLayout.annotations[index]; +/** + * drawRaw: draw a single annotation, potentially with modifications + * + * @param {DOM element} gd + * @param {object} options : this annotation's fullLayout options + * @param {integer} index : index in 'annotations' container of the annotation to draw + * @param {string} subplotId : id of the annotation's subplot + * - use false for 2d (i.e. cartesian or paper-ref) annotations + * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px + * @param {object | undefined} ya : ... y-axis + */ +function drawRaw(gd, options, index, subplotId, xa, ya) { + var fullLayout = gd._fullLayout; + var gs = gd._fullLayout._size; + var className; + var annbase; + + if(subplotId) { + className = 'annotation-' + subplotId; + annbase = subplotId + '.annotations[' + index + ']'; + } else { + className = 'annotation'; + annbase = 'annotations[' + index + ']'; + } + + // remove the existing annotation if there is one + fullLayout._infolayer + .selectAll('.' + className + '[data-index="' + index + '"]') + .remove(); var annClipID = 'clip' + fullLayout._uid + '_ann' + index; // this annotation is gone - quit now after deleting it // TODO: use d3 idioms instead of deleting and redrawing every time - if(!optionsIn || options.visible === false) { + if(!options._input || options.visible === false) { d3.selectAll('#' + annClipID).remove(); return; } - var xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - - // calculated pixel positions - // x & y each will get text, head, and tail as appropriate - annPosPx = {x: {}, y: {}}, + // calculated pixel positions + // x & y each will get text, head, and tail as appropriate + var annPosPx = {x: {}, y: {}}, textangle = +options.textangle || 0; // create the components @@ -13650,26 +13716,32 @@ function drawOne(gd, index) { // with border/arrow together this could handle a whole bunch of // cleanup at this point, but works for now var annGroup = fullLayout._infolayer.append('g') - .classed('annotation', true) + .classed(className, true) .attr('data-index', String(index)) .style('opacity', options.opacity); // another group for text+background so that they can rotate together var annTextGroup = annGroup.append('g') - .classed('annotation-text-g', true) - .attr('data-index', String(index)); + .classed('annotation-text-g', true); var annTextGroupInner = annTextGroup.append('g') .style('pointer-events', options.captureevents ? 'all' : null) .call(setCursor, 'default') .on('click', function() { gd._dragging = false; - gd.emit('plotly_clickannotation', { + + var eventData = { index: index, - annotation: optionsIn, + annotation: options._input, fullAnnotation: options, event: d3.event - }); + }; + + if(subplotId) { + eventData.subplotId = subplotId; + } + + gd.emit('plotly_clickannotation', eventData); }); if(options.hovertext) { @@ -13692,7 +13764,8 @@ function drawOne(gd, index) { fontColor: hoverFont.color }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); }) .on('mouseout', function() { @@ -13725,8 +13798,7 @@ function drawOne(gd, index) { var font = options.font; var annText = annTextGroupInner.append('text') - .classed('annotation', true) - .attr('data-unformatted', options.text) + .classed('annotation-text', true) .text(options.text); function textLayout(s) { @@ -13738,29 +13810,24 @@ function drawOne(gd, index) { }[options.align] || 'middle' }); - svgTextUtils.convertToTspans(s, drawGraphicalElements); + svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); return s; } function drawGraphicalElements() { // if the text has *only* a link, make the whole box into a link - var anchor = annText.selectAll('a'); - if(anchor.size() === 1 && anchor.text() === annText.text()) { + var anchor3 = annText.selectAll('a'); + if(anchor3.size() === 1 && anchor3.text() === annText.text()) { var wholeLink = annTextGroupInner.insert('a', ':first-child').attr({ - 'xlink:xlink:href': anchor.attr('xlink:href'), - 'xlink:xlink:show': anchor.attr('xlink:show') + 'xlink:xlink:href': anchor3.attr('xlink:href'), + 'xlink:xlink:show': anchor3.attr('xlink:show') }) .style({cursor: 'pointer'}); wholeLink.node().appendChild(annTextBG.node()); } - - // make sure lines are aligned the way they will be - // at the end, even if their position changes - annText.selectAll('tspan.line').attr({y: 0, x: 0}); - - var mathjaxGroup = annTextGroupInner.select('.annotation-math-group'); + var mathjaxGroup = annTextGroupInner.select('.annotation-text-math-group'); var hasMathjax = !mathjaxGroup.empty(); var anntextBB = Drawing.bBox( (hasMathjax ? mathjaxGroup : annText).node()); @@ -13793,10 +13860,13 @@ function drawOne(gd, index) { } var annotationIsOffscreen = false; - ['x', 'y'].forEach(function(axLetter) { - var axRef = options[axLetter + 'ref'] || axLetter, + var letters = ['x', 'y']; + + for(var i = 0; i < letters.length; i++) { + var axLetter = letters[i], + axRef = options[axLetter + 'ref'] || axLetter, tailRef = options['a' + axLetter + 'ref'], - ax = Axes.getFromId(gd, axRef), + ax = {x: xa, y: ya}[axLetter], dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, // note that these two can be either positive or negative annSizeFromWidth = outerWidth * Math.cos(dimAngle), @@ -13836,7 +13906,7 @@ function drawOne(gd, index) { annotationIsOffscreen = true; } - if(annotationIsOffscreen) return; + if(annotationIsOffscreen) continue; } basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; @@ -13918,7 +13988,7 @@ function drawOne(gd, index) { // size/shift are used during dragging options['_' + axLetter + 'size'] = annSize; options['_' + axLetter + 'shift'] = textShift; - }); + } if(annotationIsOffscreen) { annTextGroupInner.remove(); @@ -13943,14 +14013,11 @@ function drawOne(gd, index) { .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } else { - var texty = borderfull + yShift - anntextBB.top, - textx = borderfull + xShift - anntextBB.left; - annText.attr({ - x: textx, - y: texty - }) - .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); - annText.selectAll('tspan.line').attr({y: texty, x: textx}); + var texty = borderfull + yShift - anntextBB.top; + var textx = borderfull + xShift - anntextBB.left; + + annText.call(svgTextUtils.positionText, textx, texty) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } annTextClip.select('rect').call(Drawing.setRect, borderfull, borderfull, @@ -13972,8 +14039,6 @@ function drawOne(gd, index) { annTextGroup.attr({transform: 'rotate(' + textangle + ',' + annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - var annbase = 'annotations[' + index + ']'; - /* * add the arrow * uses options[arrowwidth,arrowcolor,arrowhead] for styling @@ -13981,8 +14046,8 @@ function drawOne(gd, index) { * while the head stays put, dx and dy are the pixel offsets */ var drawArrow = function(dx, dy) { - d3.select(gd) - .selectAll('.annotation-arrow-g[data-index="' + index + '"]') + annGroup + .selectAll('.annotation-arrow-g') .remove(); var headX = annPosPx.x.head, @@ -14039,8 +14104,7 @@ function drawOne(gd, index) { var arrowGroup = annGroup.append('g') .style({opacity: Color.opacity(arrowColor)}) - .classed('annotation-arrow-g', true) - .attr('data-index', String(index)); + .classed('annotation-arrow-g', true); var arrow = arrowGroup.append('path') .attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) @@ -14051,7 +14115,7 @@ function drawOne(gd, index) { // the arrow dragger is a small square right at the head, then a line to the tail, // all expanded by a stroke width of 6px plus the arrow line width - if(gd._context.editable && arrow.node().parentNode) { + if(gd._context.editable && arrow.node().parentNode && !subplotId) { var arrowDragHeadX = headX; var arrowDragHeadY = headY; if(options.standoff) { @@ -14060,10 +14124,9 @@ function drawOne(gd, index) { arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; } var arrowDrag = arrowGroup.append('path') - .classed('annotation', true) + .classed('annotation-arrow', true) .classed('anndrag', true) .attr({ - 'data-index': String(index), d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' }) @@ -14079,6 +14142,7 @@ function drawOne(gd, index) { // (head/tail/text) all together dragElement.init({ element: arrowDrag.node(), + gd: gd, prepFn: function() { var pos = Drawing.getTranslate(annTextGroupInner); @@ -14141,6 +14205,7 @@ function drawOne(gd, index) { // textbox and tail, leave the head untouched dragElement.init({ element: annTextGroupInner.node(), + gd: gd, prepFn: function() { baseTextTransform = annTextGroup.attr('transform'); update = {}; @@ -14162,7 +14227,7 @@ function drawOne(gd, index) { drawArrow(dx, dy); } - else { + else if(!subplotId) { if(xa) update[annbase + '.x'] = options.x + dx / xa._m; else { var widthFraction = options._xsize / gs.w, @@ -14190,6 +14255,7 @@ function drawOne(gd, index) { ); } } + else return; annTextGroup.attr({ transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform @@ -14210,20 +14276,22 @@ function drawOne(gd, index) { } if(gd._context.editable) { - annText.call(svgTextUtils.makeEditable, annTextGroupInner) + annText.call(svgTextUtils.makeEditable, {delegate: annTextGroupInner, gd: gd}) .call(textLayout) .on('edit', function(_text) { options.text = _text; - this.attr({'data-unformatted': options.text}); this.call(textLayout); + var update = {}; - update['annotations[' + index + '].text'] = options.text; + update[annbase + '.text'] = options.text; + if(xa && xa.autorange) { update[xa._name + '.autorange'] = true; } if(ya && ya.autorange) { update[ya._name + '.autorange'] = true; } + Plotly.relayout(gd, update); }); } @@ -14251,7 +14319,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":136,"../../lib/setcursor":151,"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/cartesian/axes":171,"../../plots/plots":199,"../color":25,"../dragelement":46,"../drawing":49,"../fx":66,"./draw_arrow_head":22,"d3":7}],22:[function(require,module,exports){ +},{"../../lib":143,"../../lib/setcursor":158,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/plots":207,"../color":31,"../dragelement":52,"../drawing":55,"../fx":72,"./draw_arrow_head":23,"d3":7}],23:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14365,7 +14433,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { function drawhead(p, rot) { if(!headStyle.path) return; if(style > 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -14385,7 +14453,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":25,"../drawing":49,"./arrow_paths":15,"d3":7,"fast-isnumeric":10}],23:[function(require,module,exports){ +},{"../color":31,"../drawing":55,"./arrow_paths":15,"d3":7,"fast-isnumeric":10}],24:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14410,6 +14478,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -14417,7 +14486,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":16,"./calc_autorange":17,"./click":18,"./convert_coords":19,"./defaults":20,"./draw":21}],24:[function(require,module,exports){ +},{"./attributes":16,"./calc_autorange":17,"./click":18,"./convert_coords":20,"./defaults":21,"./draw":22}],25:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":16}],26:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":143,"../../plots/cartesian/axes":178}],27:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":143,"../../plots/array_container_defaults":175,"../../plots/cartesian/axes":178,"../annotations/common_defaults":19,"./attributes":25}],28:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":204,"../annotations/draw":22}],29:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":25,"./convert":26,"./defaults":27,"./draw":28}],30:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14457,7 +14833,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],25:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14628,7 +15004,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":24,"fast-isnumeric":10,"tinycolor2":13}],26:[function(require,module,exports){ +},{"./attributes":30,"fast-isnumeric":10,"tinycolor2":13}],32:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14784,7 +15160,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/cartesian/layout_attributes":182,"../../plots/font_attributes":195}],27:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/cartesian/layout_attributes":189,"../../plots/font_attributes":202}],33:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14851,7 +15227,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":136,"../../plots/cartesian/tick_label_defaults":189,"../../plots/cartesian/tick_mark_defaults":190,"../../plots/cartesian/tick_value_defaults":191,"./attributes":26}],28:[function(require,module,exports){ +},{"../../lib":143,"../../plots/cartesian/tick_label_defaults":196,"../../plots/cartesian/tick_mark_defaults":197,"../../plots/cartesian/tick_value_defaults":198,"./attributes":32}],34:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14877,6 +15253,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -15150,7 +15528,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -15162,8 +15540,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -15176,8 +15553,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -15410,6 +15786,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -15484,7 +15861,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":136,"../../lib/extend":132,"../../lib/setcursor":151,"../../plotly":166,"../../plots/cartesian/axes":171,"../../plots/cartesian/axis_defaults":173,"../../plots/cartesian/layout_attributes":182,"../../plots/cartesian/position_defaults":185,"../../plots/plots":199,"../../registry":206,"../color":25,"../dragelement":46,"../drawing":49,"../titles":114,"./attributes":26,"d3":7,"tinycolor2":13}],29:[function(require,module,exports){ +},{"../../constants/alignment":127,"../../lib":143,"../../lib/extend":139,"../../lib/setcursor":158,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/cartesian/axis_defaults":180,"../../plots/cartesian/layout_attributes":189,"../../plots/cartesian/position_defaults":192,"../../plots/plots":207,"../../registry":214,"../color":31,"../dragelement":52,"../drawing":55,"../titles":120,"./attributes":32,"d3":7,"tinycolor2":13}],35:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15503,7 +15880,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":136}],30:[function(require,module,exports){ +},{"../../lib":143}],36:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15558,7 +15935,7 @@ module.exports = { } }; -},{}],31:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15637,7 +16014,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":136,"./flip_scale":36,"./scales":43}],32:[function(require,module,exports){ +},{"../../lib":143,"./flip_scale":42,"./scales":49}],38:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15681,7 +16058,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":132,"./attributes":30,"./scales.js":43}],33:[function(require,module,exports){ +},{"../../lib/extend":139,"./attributes":36,"./scales.js":49}],39:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15697,7 +16074,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":43}],34:[function(require,module,exports){ +},{"./scales":49}],40:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15761,7 +16138,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":136,"../colorbar/defaults":27,"../colorbar/has_colorbar":29,"./flip_scale":36,"./is_valid_scale":40,"fast-isnumeric":10}],35:[function(require,module,exports){ +},{"../../lib":143,"../colorbar/defaults":33,"../colorbar/has_colorbar":35,"./flip_scale":42,"./is_valid_scale":46,"fast-isnumeric":10}],41:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15798,7 +16175,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],36:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15823,7 +16200,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],37:[function(require,module,exports){ +},{}],43:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15863,7 +16240,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":33,"./is_valid_scale_array":41,"./scales":43}],38:[function(require,module,exports){ +},{"./default_scale":39,"./is_valid_scale_array":47,"./scales":49}],44:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15909,7 +16286,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":136,"./is_valid_scale":40,"fast-isnumeric":10}],39:[function(require,module,exports){ +},{"../../lib":143,"./is_valid_scale":46,"fast-isnumeric":10}],45:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15943,7 +16320,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./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){ +},{"./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){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15964,7 +16341,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":41,"./scales":43}],41:[function(require,module,exports){ +},{"./is_valid_scale_array":47,"./scales":49}],47:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16001,7 +16378,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":13}],42:[function(require,module,exports){ +},{"tinycolor2":13}],48:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16097,7 +16474,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":25,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],43:[function(require,module,exports){ +},{"../color":31,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],49:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16228,7 +16605,7 @@ module.exports = { ] }; -},{}],44:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16261,7 +16638,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],45:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16299,7 +16676,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":136}],46:[function(require,module,exports){ +},{"../../lib":143}],52:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16328,6 +16705,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -16346,28 +16732,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -16418,10 +16796,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -16468,10 +16842,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -16501,7 +16871,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":121,"../../lib":136,"../../plotly":166,"../../plots/cartesian/constants":176,"./align":44,"./cursor":45,"./unhover":47}],47:[function(require,module,exports){ +},{"../../constants/interactions":128,"../../lib":143,"../../plotly":173,"../../plots/cartesian/constants":183,"./align":50,"./cursor":51,"./unhover":53}],53:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16557,7 +16927,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":131}],48:[function(require,module,exports){ +},{"../../lib/events":138}],54:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16581,7 +16951,7 @@ exports.dash = { }; -},{}],49:[function(require,module,exports){ +},{}],55:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16604,6 +16974,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -16625,13 +16998,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -16640,7 +17019,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -16655,7 +17034,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -16741,6 +17119,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -16967,7 +17355,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -16975,7 +17363,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -16996,9 +17383,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -17029,21 +17415,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -17182,34 +17563,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -17230,18 +17664,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -17396,17 +17841,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":124,"../../lib":136,"../../lib/svg_text_utils":153,"../../registry":206,"../../traces/scatter/make_bubble_size_func":255,"../../traces/scatter/subtypes":260,"../color":25,"../colorscale":39,"./symbol_defs":50,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],50:[function(require,module,exports){ +},{"../../constants/alignment":127,"../../constants/xmlns_namespaces":131,"../../lib":143,"../../lib/svg_text_utils":160,"../../registry":214,"../../traces/scatter/make_bubble_size_func":263,"../../traces/scatter/subtypes":268,"../color":31,"../colorscale":45,"./symbol_defs":56,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],56:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17882,7 +18317,7 @@ module.exports = { } }; -},{"d3":7}],51:[function(require,module,exports){ +},{"d3":7}],57:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17981,7 +18416,7 @@ module.exports = { } }; -},{}],52:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18044,7 +18479,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":171,"../../registry":206,"./compute_error":53,"fast-isnumeric":10}],53:[function(require,module,exports){ +},{"../../plots/cartesian/axes":178,"../../registry":214,"./compute_error":59,"fast-isnumeric":10}],59:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18140,7 +18575,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],54:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18217,7 +18652,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":136,"../../registry":206,"./attributes":51,"fast-isnumeric":10}],55:[function(require,module,exports){ +},{"../../lib":143,"../../registry":214,"./attributes":57,"fast-isnumeric":10}],61:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18276,7 +18711,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":51,"./calc":52,"./defaults":54,"./plot":56,"./style":57}],56:[function(require,module,exports){ +},{"./attributes":57,"./calc":58,"./defaults":60,"./plot":62,"./style":63}],62:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18440,7 +18875,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":260,"d3":7,"fast-isnumeric":10}],57:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":268,"d3":7,"fast-isnumeric":10}],63:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18477,7 +18912,7 @@ module.exports = function style(traces) { }); }; -},{"../color":25,"d3":7}],58:[function(require,module,exports){ +},{"../color":31,"d3":7}],64:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18513,7 +18948,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/font_attributes":195}],59:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/font_attributes":202}],65:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18529,30 +18964,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; + + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + if(!trace.hoverlabel) continue; + + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":136,"../../registry":206}],60:[function(require,module,exports){ +},{"../../lib":143,"../../registry":214}],66:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18564,10 +19015,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -18581,7 +19041,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":206}],61:[function(require,module,exports){ +},{"../../registry":214,"./hover":70}],67:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18613,7 +19073,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],62:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18636,7 +19096,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":136,"./attributes":58,"./hoverlabel_defaults":65}],63:[function(require,module,exports){ +},{"../../lib":143,"./attributes":64,"./hoverlabel_defaults":71}],69:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18647,6 +19107,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -18723,7 +19184,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":61}],64:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":143,"./constants":67}],70:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18792,7 +19279,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -18804,13 +19291,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -18887,15 +19374,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -19080,11 +19567,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -19183,6 +19670,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -19216,7 +19704,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -19230,7 +19718,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -19249,7 +19737,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -19284,7 +19772,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -19321,23 +19809,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -19353,14 +19834,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -19450,7 +19926,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -19466,12 +19944,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -19483,11 +19959,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -19755,17 +20229,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -19782,6 +20251,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -19849,7 +20342,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -19859,29 +20352,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -20033,7 +20503,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":136,"../../lib/events":131,"../../lib/override_cursor":145,"../../lib/svg_text_utils":153,"../../plots/cartesian/axes":171,"../../registry":206,"../color":25,"../dragelement":46,"../drawing":49,"./constants":61,"./helpers":63,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],65:[function(require,module,exports){ +},{"../../lib":143,"../../lib/events":138,"../../lib/override_cursor":152,"../../lib/svg_text_utils":160,"../../plots/cartesian/axes":178,"../../registry":214,"../color":31,"../dragelement":52,"../drawing":55,"./constants":67,"./helpers":69,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],71:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20054,7 +20524,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":136}],66:[function(require,module,exports){ +},{"../../lib":143}],72:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20092,7 +20562,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -20114,23 +20587,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":136,"../dragelement":46,"./attributes":58,"./calc":59,"./click":60,"./constants":61,"./defaults":62,"./helpers":63,"./hover":64,"./layout_attributes":67,"./layout_defaults":68,"./layout_global_defaults":69,"d3":7}],67:[function(require,module,exports){ +},{"../../lib":143,"../dragelement":52,"./attributes":64,"./calc":65,"./click":66,"./constants":67,"./defaults":68,"./helpers":69,"./hover":70,"./layout_attributes":73,"./layout_defaults":74,"./layout_global_defaults":75,"d3":7}],73:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20183,7 +20654,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/font_attributes":195,"./constants":61}],68:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/font_attributes":202,"./constants":67}],74:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20231,7 +20702,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":136,"./layout_attributes":67}],69:[function(require,module,exports){ +},{"../../lib":143,"./layout_attributes":73}],75:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20254,7 +20725,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":136,"./hoverlabel_defaults":65,"./layout_attributes":67}],70:[function(require,module,exports){ +},{"../../lib":143,"./hoverlabel_defaults":71,"./layout_attributes":73}],76:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20376,7 +20847,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":176}],71:[function(require,module,exports){ +},{"../../plots/cartesian/constants":183}],77:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20459,7 +20930,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":154,"fast-isnumeric":10}],72:[function(require,module,exports){ +},{"../../lib/to_log_range":161,"fast-isnumeric":10}],78:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20520,7 +20991,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":136,"../../plots/array_container_defaults":168,"../../plots/cartesian/axes":171,"./attributes":70}],73:[function(require,module,exports){ +},{"../../lib":143,"../../plots/array_container_defaults":175,"../../plots/cartesian/axes":178,"./attributes":76}],79:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20741,7 +21212,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":124,"../../plots/cartesian/axes":171,"../drawing":49,"d3":7}],74:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":131,"../../plots/cartesian/axes":178,"../drawing":55,"d3":7}],80:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20764,7 +21235,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":70,"./convert_coords":71,"./defaults":72,"./draw":73}],75:[function(require,module,exports){ +},{"./attributes":76,"./convert_coords":77,"./defaults":78,"./draw":79}],81:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20813,7 +21284,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],76:[function(require,module,exports){ +},{}],82:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20904,7 +21375,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/font_attributes":195,"../color/attributes":24}],77:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/font_attributes":202,"../color/attributes":30}],83:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20922,7 +21393,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],78:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21015,7 +21486,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":136,"../../plots/layout_attributes":197,"../../registry":206,"./attributes":76,"./helpers":81}],79:[function(require,module,exports){ +},{"../../lib":143,"../../plots/layout_attributes":205,"../../registry":214,"./attributes":82,"./helpers":87}],85:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21040,6 +21511,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -21129,7 +21602,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -21335,6 +21808,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -21386,30 +21860,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -21574,20 +22042,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -21595,18 +22064,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -21841,7 +22311,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":121,"../../lib":136,"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/plots":199,"../../registry":206,"../color":25,"../dragelement":46,"../drawing":49,"./anchor_utils":75,"./constants":77,"./get_legend_data":80,"./helpers":81,"./style":83,"d3":7}],80:[function(require,module,exports){ +},{"../../constants/alignment":127,"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":207,"../../registry":214,"../color":31,"../dragelement":52,"../drawing":55,"./anchor_utils":81,"./constants":83,"./get_legend_data":86,"./helpers":87,"./style":89,"d3":7}],86:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21946,7 +22416,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":206,"./helpers":81}],81:[function(require,module,exports){ +},{"../../registry":214,"./helpers":87}],87:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21977,7 +22447,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":206}],82:[function(require,module,exports){ +},{"../../registry":214}],88:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22001,7 +22471,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":76,"./defaults":78,"./draw":79,"./style":83}],83:[function(require,module,exports){ +},{"./attributes":82,"./defaults":84,"./draw":85,"./style":89}],89:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22024,7 +22494,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -22062,179 +22532,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } + + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; -},{"../../lib":136,"../../registry":206,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":25,"../drawing":49,"d3":7}],84:[function(require,module,exports){ +},{"../../lib":143,"../../registry":214,"../../traces/pie/style_one":246,"../../traces/scatter/subtypes":268,"../color":31,"../drawing":55,"d3":7}],90:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22812,7 +23282,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":136,"../../plotly":166,"../../plots/cartesian/axes":171,"../../plots/plots":199,"../../snapshot/download":208}],85:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":143,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/plots":207,"../../snapshot/download":216}],91:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22826,7 +23296,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":86}],86:[function(require,module,exports){ +},{"./manage":92}],92:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22950,7 +23420,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -23002,7 +23472,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -23054,7 +23524,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":171,"../../traces/scatter/subtypes":260,"./buttons":84,"./modebar":87}],87:[function(require,module,exports){ +},{"../../plots/cartesian/axes":178,"../../traces/scatter/subtypes":268,"./buttons":90,"./modebar":93}],93:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23348,7 +23818,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":136,"d3":7}],88:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":143,"d3":7}],94:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23438,7 +23908,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/font_attributes":195,"../color/attributes":24,"./button_attributes":89}],89:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/font_attributes":202,"../color/attributes":30,"./button_attributes":95}],95:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23479,7 +23949,7 @@ module.exports = { } }; -},{}],90:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23508,7 +23978,7 @@ module.exports = { darkAmount: 10 }; -},{}],91:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23607,7 +24077,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":136,"../color":25,"./attributes":88,"./button_attributes":89,"./constants":90}],92:[function(require,module,exports){ +},{"../../lib":143,"../color":31,"./attributes":94,"./button_attributes":95,"./constants":96}],98:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23629,6 +24099,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -23669,7 +24141,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -23756,11 +24228,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -23792,26 +24262,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -23830,13 +24297,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -23882,7 +24344,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/cartesian/axis_ids":174,"../../plots/plots":199,"../color":25,"../drawing":49,"../legend/anchor_utils":75,"./constants":90,"./get_update_object":93,"d3":7}],93:[function(require,module,exports){ +},{"../../constants/alignment":127,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/cartesian/axis_ids":181,"../../plots/plots":207,"../color":31,"../drawing":55,"../legend/anchor_utils":81,"./constants":96,"./get_update_object":99,"d3":7}],99:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23939,7 +24401,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":7}],94:[function(require,module,exports){ +},{"d3":7}],100:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23966,7 +24428,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":88,"./defaults":91,"./draw":92}],95:[function(require,module,exports){ +},{"./attributes":94,"./defaults":97,"./draw":98}],101:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24030,7 +24492,7 @@ module.exports = { } }; -},{"../color/attributes":24}],96:[function(require,module,exports){ +},{"../color/attributes":30}],102:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24066,7 +24528,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":171,"./constants":97}],97:[function(require,module,exports){ +},{"../../plots/cartesian/axes":178,"./constants":103}],103:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24118,7 +24580,7 @@ module.exports = { extraPad: 15 }; -},{}],98:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24175,7 +24637,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":136,"./attributes":95}],99:[function(require,module,exports){ +},{"../../lib":143,"./attributes":101}],105:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24726,7 +25188,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":136,"../../lib/setcursor":151,"../../plotly":166,"../../plots/cartesian":181,"../../plots/cartesian/axes":171,"../../plots/plots":199,"../color":25,"../dragelement":46,"../drawing":49,"./constants":97,"d3":7}],100:[function(require,module,exports){ +},{"../../lib":143,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian":188,"../../plots/cartesian/axes":178,"../../plots/plots":207,"../color":31,"../dragelement":52,"../drawing":55,"./constants":103,"d3":7}],106:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24753,7 +25215,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":95,"./calc_autorange":96,"./defaults":98,"./draw":99}],101:[function(require,module,exports){ +},{"./attributes":101,"./calc_autorange":102,"./defaults":104,"./draw":105}],107:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24850,7 +25312,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../traces/scatter/attributes":240,"../annotations/attributes":16,"../drawing/attributes":48}],102:[function(require,module,exports){ +},{"../../lib/extend":139,"../../traces/scatter/attributes":248,"../annotations/attributes":16,"../drawing/attributes":54}],108:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24896,7 +25358,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -24927,7 +25389,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":136,"../../plots/cartesian/axes":171,"./constants":103,"./helpers":106}],103:[function(require,module,exports){ +},{"../../lib":143,"../../plots/cartesian/axes":178,"./constants":109,"./helpers":112}],109:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24991,7 +25453,7 @@ module.exports = { } }; -},{}],104:[function(require,module,exports){ +},{}],110:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25016,7 +25478,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":168,"./shape_defaults":108}],105:[function(require,module,exports){ +},{"../../plots/array_container_defaults":175,"./shape_defaults":114}],111:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25149,8 +25611,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -25159,6 +25621,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -25391,7 +25855,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":136,"../../lib/setcursor":151,"../../plotly":166,"../../plots/cartesian/axes":171,"../color":25,"../dragelement":46,"../drawing":49,"./constants":103,"./helpers":106}],106:[function(require,module,exports){ +},{"../../lib":143,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian/axes":178,"../color":31,"../dragelement":52,"../drawing":55,"./constants":109,"./helpers":112}],112:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25472,7 +25936,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],107:[function(require,module,exports){ +},{}],113:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25498,7 +25962,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":101,"./calc_autorange":102,"./defaults":104,"./draw":105}],108:[function(require,module,exports){ +},{"./attributes":107,"./calc_autorange":108,"./defaults":110,"./draw":111}],114:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25597,7 +26061,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":136,"../../plots/cartesian/axes":171,"./attributes":101,"./helpers":106}],109:[function(require,module,exports){ +},{"../../lib":143,"../../plots/cartesian/axes":178,"./attributes":107,"./helpers":112}],115:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25620,7 +26084,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -25645,6 +26109,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -25831,7 +26301,7 @@ module.exports = { }, }; -},{"../../lib/extend":132,"../../plots/animation_attributes":167,"../../plots/font_attributes":195,"../../plots/pad_attributes":198,"./constants":110}],110:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/animation_attributes":174,"../../plots/font_attributes":202,"../../plots/pad_attributes":206,"./constants":116}],116:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25879,9 +26349,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -25928,7 +26395,7 @@ module.exports = { currentValueInset: 0, }; -},{}],111:[function(require,module,exports){ +},{}],117:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26026,14 +26493,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -26041,7 +26510,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":136,"../../plots/array_container_defaults":168,"./attributes":109,"./constants":110}],112:[function(require,module,exports){ +},{"../../lib":143,"../../plots/array_container_defaults":175,"./attributes":115,"./constants":116}],118:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26062,11 +26531,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -26130,24 +26600,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -26175,14 +26639,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -26192,26 +26654,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -26238,6 +26682,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -26329,7 +26798,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -26346,9 +26818,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); + + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + svgTextUtils.positionText(text, x0, y0); return text; } @@ -26380,11 +26857,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -26411,7 +26891,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -26453,7 +26939,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -26643,7 +27131,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":153,"../../plots/plots":199,"../color":25,"../drawing":49,"../legend/anchor_utils":75,"./constants":110,"d3":7}],113:[function(require,module,exports){ +},{"../../constants/alignment":127,"../../lib/svg_text_utils":160,"../../plots/plots":207,"../color":31,"../drawing":55,"../legend/anchor_utils":81,"./constants":116,"d3":7}],119:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26666,7 +27154,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":109,"./constants":110,"./defaults":111,"./draw":112}],114:[function(require,module,exports){ +},{"./attributes":115,"./constants":116,"./defaults":117,"./draw":118}],120:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26689,6 +27177,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -26721,29 +27210,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -26752,7 +27246,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -26761,6 +27255,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -26780,11 +27277,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -26796,33 +27290,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -26853,8 +27347,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -26862,8 +27355,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -26874,11 +27366,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -26888,18 +27380,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":121,"../../lib":136,"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/plots":199,"../color":25,"../drawing":49,"d3":7,"fast-isnumeric":10}],115:[function(require,module,exports){ +},{"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":207,"../color":31,"../drawing":55,"d3":7,"fast-isnumeric":10}],121:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26920,7 +27408,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -26941,6 +27429,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -27046,7 +27540,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../../plots/font_attributes":195,"../../plots/pad_attributes":198,"../color/attributes":24}],116:[function(require,module,exports){ +},{"../../lib/extend":139,"../../plots/font_attributes":202,"../../plots/pad_attributes":206,"../color/attributes":30}],122:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27093,9 +27587,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -27119,10 +27610,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],117:[function(require,module,exports){ +},{}],123:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27201,13 +27700,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -27216,7 +27717,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":136,"../../plots/array_container_defaults":168,"./attributes":115,"./constants":116}],118:[function(require,module,exports){ +},{"../../lib":143,"../../plots/array_container_defaults":175,"./attributes":121,"./constants":122}],124:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27236,6 +27737,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -27421,7 +27924,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -27433,7 +27936,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -27541,7 +28044,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -27550,7 +28053,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -27651,9 +28156,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -27673,18 +28178,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -27735,19 +28243,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -27841,34 +28348,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -27884,8 +28386,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -27896,9 +28398,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":153,"../../plots/plots":199,"../color":25,"../drawing":49,"../legend/anchor_utils":75,"./constants":116,"./scrollbox":120,"d3":7}],119:[function(require,module,exports){ -arguments[4][113][0].apply(exports,arguments) -},{"./attributes":115,"./constants":116,"./defaults":117,"./draw":118,"dup":113}],120:[function(require,module,exports){ +},{"../../constants/alignment":127,"../../lib/svg_text_utils":160,"../../plots/plots":207,"../color":31,"../drawing":55,"../legend/anchor_utils":81,"./constants":122,"./scrollbox":126,"d3":7}],125:[function(require,module,exports){ +arguments[4][119][0].apply(exports,arguments) +},{"./attributes":121,"./constants":122,"./defaults":123,"./draw":124,"dup":119}],126:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28369,7 +28871,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":136,"../color":25,"../drawing":49,"d3":7}],121:[function(require,module,exports){ +},{"../../lib":143,"../color":31,"../drawing":55,"d3":7}],127:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],128:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28393,7 +28931,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],122:[function(require,module,exports){ +},{}],129:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28446,7 +28984,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],123:[function(require,module,exports){ +},{}],130:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28484,7 +29022,7 @@ module.exports = { }; -},{}],124:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28508,7 +29046,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],125:[function(require,module,exports){ +},{}],132:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28526,7 +29064,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -28567,6 +29105,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -28588,7 +29127,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/fx":66,"./components/images":74,"./components/legend":82,"./components/rangeselector":94,"./components/rangeslider":100,"./components/shapes":107,"./components/sliders":113,"./components/updatemenus":119,"./fonts/mathjax_config":126,"./lib/queue":148,"./plot_api/plot_schema":160,"./plot_api/register":161,"./plot_api/set_plot_config":162,"./plot_api/to_image":164,"./plot_api/validate":165,"./plotly":166,"./snapshot":211,"./snapshot/download":208,"./traces/scatter":250,"d3":7,"es6-promise":8}],126:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":24,"./components/annotations3d":29,"./components/fx":72,"./components/images":80,"./components/legend":88,"./components/rangeselector":100,"./components/rangeslider":106,"./components/shapes":113,"./components/sliders":119,"./components/updatemenus":125,"./fonts/mathjax_config":133,"./lib/queue":155,"./plot_api/plot_schema":167,"./plot_api/register":168,"./plot_api/set_plot_config":169,"./plot_api/to_image":171,"./plot_api/validate":172,"./plotly":173,"./snapshot":219,"./snapshot/download":216,"./traces/scatter":258,"d3":7,"es6-promise":8}],133:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28621,7 +29160,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],127:[function(require,module,exports){ +},{}],134:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28654,7 +29193,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":122,"fast-isnumeric":10}],128:[function(require,module,exports){ +},{"../constants/numerical":129,"fast-isnumeric":10}],135:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28669,6 +29208,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -28694,6 +29234,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -28946,6 +29500,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -28965,7 +29548,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":37,"../components/colorscale/scales":43,"./nested_property":142,"fast-isnumeric":10,"tinycolor2":13}],129:[function(require,module,exports){ +},{"../components/colorscale/get_scale":43,"../components/colorscale/scales":49,"../plots/attributes":176,"./nested_property":149,"fast-isnumeric":10,"tinycolor2":13}],136:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29593,7 +30176,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":122,"../registry":206,"./loggers":139,"./mod":141,"d3":7,"fast-isnumeric":10}],130:[function(require,module,exports){ +},{"../constants/numerical":129,"../registry":214,"./loggers":146,"./mod":148,"d3":7,"fast-isnumeric":10}],137:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29622,7 +30205,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],131:[function(require,module,exports){ +},{}],138:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29788,7 +30371,7 @@ var Events = { module.exports = Events; -},{"events":9}],132:[function(require,module,exports){ +},{"events":9}],139:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29902,7 +30485,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":138}],133:[function(require,module,exports){ +},{"./is_plain_object.js":145}],140:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29953,7 +30536,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],134:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29984,7 +30567,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],135:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30000,7 +30583,7 @@ module.exports = function filterVisible(container) { module.exports = function identity(d) { return d; }; -},{}],136:[function(require,module,exports){ +},{}],143:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30013,6 +30596,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -30029,6 +30617,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -30090,6 +30679,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -30340,6 +30936,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -30347,6 +30952,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -30387,7 +31037,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -30417,13 +31067,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -30664,7 +31307,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":127,"./coerce":128,"./dates":129,"./ensure_array":130,"./extend":132,"./filter_unique":133,"./filter_visible":134,"./identity":135,"./is_array":137,"./is_plain_object":138,"./loggers":139,"./matrix":140,"./mod":141,"./nested_property":142,"./noop":143,"./notifier":144,"./push_unique":147,"./relink_private":149,"./search":150,"./stats":152,"./to_log_range":154,"d3":7}],137:[function(require,module,exports){ +},{"../constants/numerical":129,"./clean_number":134,"./coerce":135,"./dates":136,"./ensure_array":137,"./extend":139,"./filter_unique":140,"./filter_visible":141,"./identity":142,"./is_array":144,"./is_plain_object":145,"./loggers":146,"./matrix":147,"./mod":148,"./nested_property":149,"./noop":150,"./notifier":151,"./push_unique":154,"./relink_private":156,"./search":157,"./stats":159,"./to_log_range":161,"d3":7,"fast-isnumeric":10}],144:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30688,7 +31331,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],138:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30717,7 +31360,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],139:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30791,7 +31434,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":159}],140:[function(require,module,exports){ +},{"../plot_api/plot_config":166}],147:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30901,7 +31544,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],141:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30921,7 +31564,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],142:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31225,7 +31868,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":155,"./is_array":137,"./is_plain_object":138,"fast-isnumeric":10}],143:[function(require,module,exports){ +},{"../plot_api/container_array_match":162,"./is_array":144,"./is_plain_object":145,"fast-isnumeric":10}],150:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31241,7 +31884,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],144:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31323,7 +31966,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":7,"fast-isnumeric":10}],145:[function(require,module,exports){ +},{"d3":7,"fast-isnumeric":10}],152:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31372,7 +32015,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":151}],146:[function(require,module,exports){ +},{"./setcursor":158}],153:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31613,7 +32256,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":122,"./matrix":140}],147:[function(require,module,exports){ +},{"../constants/numerical":129,"./matrix":147}],154:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31651,7 +32294,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],148:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31862,7 +32505,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":136,"../plot_api/plot_config":159}],149:[function(require,module,exports){ +},{"../lib":143,"../plot_api/plot_config":166}],156:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31919,7 +32562,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":137,"./is_plain_object":138}],150:[function(require,module,exports){ +},{"./is_array":144,"./is_plain_object":145}],157:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32030,7 +32673,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":139,"fast-isnumeric":10}],151:[function(require,module,exports){ +},{"./loggers":146,"fast-isnumeric":10}],158:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32053,7 +32696,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],152:[function(require,module,exports){ +},{}],159:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32149,7 +32792,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":10}],153:[function(require,module,exports){ +},{"fast-isnumeric":10}],160:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32168,62 +32811,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -32231,42 +32819,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); - - result = _context.appendSVG(converted); + .style('white-space', 'pre'); - if(!result) _context.text(str); + var hasLink = buildSVGText(_context.node(), str); - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -32274,14 +32864,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -32296,7 +32887,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -32313,36 +32908,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -32355,9 +32950,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -32388,23 +32986,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -32415,24 +33025,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -32443,26 +33072,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -32472,122 +33107,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; + + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - var out; + function newLine() { + currentLine++; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + var lineNode = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + d3.select(lineNode).attr({ + class: 'line', + dy: (currentLine * LINE_SPACING) + 'em' + }); + containerNode.appendChild(lineNode); - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -32624,28 +33334,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + context.style({'pointer-events': _delegate ? 'none' : 'all'}); + + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -32660,63 +33383,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -32728,10 +33450,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":123,"../constants/xmlns_namespaces":124,"../lib":136,"d3":7}],154:[function(require,module,exports){ +},{"../constants/alignment":127,"../constants/string_mappings":130,"../constants/xmlns_namespaces":131,"../lib":143,"d3":7}],161:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32759,7 +33481,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":10}],155:[function(require,module,exports){ +},{"fast-isnumeric":10}],162:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32817,7 +33539,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":206}],156:[function(require,module,exports){ +},{"../registry":214}],163:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33035,7 +33757,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -33168,18 +33889,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -33235,7 +33976,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -33338,7 +34079,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":25,"../lib":136,"../plots/cartesian/axes":171,"../plots/plots":199,"../registry":206,"fast-isnumeric":10,"gl-mat4/fromQuat":11}],157:[function(require,module,exports){ +},{"../components/color":31,"../lib":143,"../plots/cartesian/axes":178,"../plots/plots":207,"../registry":214,"fast-isnumeric":10,"gl-mat4/fromQuat":11}],164:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33552,7 +34293,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":138,"../lib/loggers":139,"../lib/nested_property":142,"../lib/noop":143,"../lib/search":150,"../registry":206,"./container_array_match":155}],158:[function(require,module,exports){ +},{"../lib/is_plain_object":145,"../lib/loggers":146,"../lib/nested_property":149,"../lib/noop":150,"../lib/search":157,"../registry":214,"./container_array_match":162}],165:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33587,7 +34328,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -33744,9 +34487,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -33775,19 +34516,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; - - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); + if(JSON.stringify(fullLayout._size) === oldmargins) return; - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -33825,7 +34566,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -33925,6 +34669,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -34022,7 +34767,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -34031,9 +34776,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -34048,11 +34794,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -34938,6 +35683,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -35037,6 +35783,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -35468,10 +36217,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -35493,7 +36244,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -35501,7 +36253,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -35514,11 +36266,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -35598,6 +36364,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -35696,7 +36463,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -35744,7 +36520,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -36578,7 +37354,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":124,"../lib":136,"../lib/events":131,"../lib/queue":148,"../lib/svg_text_utils":153,"../plotly":166,"../plots/cartesian/axis_ids":174,"../plots/cartesian/constants":176,"../plots/cartesian/constraints":178,"../plots/cartesian/graph_interact":180,"../plots/plots":199,"../plots/polar":202,"../registry":206,"./helpers":156,"./manage_arrays":157,"./subroutines":163,"d3":7,"fast-isnumeric":10}],159:[function(require,module,exports){ +},{"../components/drawing":55,"../components/errorbars":61,"../constants/xmlns_namespaces":131,"../lib":143,"../lib/events":138,"../lib/queue":155,"../lib/svg_text_utils":160,"../plotly":173,"../plots/cartesian/axis_ids":181,"../plots/cartesian/constants":183,"../plots/cartesian/constraints":185,"../plots/cartesian/graph_interact":187,"../plots/plots":207,"../plots/polar":210,"../registry":214,"./helpers":163,"./manage_arrays":164,"./subroutines":170,"d3":7,"fast-isnumeric":10}],166:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -36704,7 +37480,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],160:[function(require,module,exports){ +},{}],167:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -36863,7 +37639,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -36883,9 +37662,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -37110,7 +37888,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":136,"../plots/animation_attributes":167,"../plots/attributes":169,"../plots/frame_attributes":196,"../plots/layout_attributes":197,"../plots/polar/area_attributes":200,"../plots/polar/axis_attributes":201,"../registry":206}],161:[function(require,module,exports){ +},{"../lib":143,"../plots/animation_attributes":174,"../plots/attributes":176,"../plots/frame_attributes":203,"../plots/layout_attributes":205,"../plots/polar/area_attributes":208,"../plots/polar/axis_attributes":209,"../registry":214}],168:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37209,7 +37987,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":136,"../registry":206}],162:[function(require,module,exports){ +},{"../lib":143,"../registry":214}],169:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37235,7 +38013,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":136,"../plotly":166}],163:[function(require,module,exports){ +},{"../lib":143,"../plotly":173}],170:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37364,15 +38142,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -37492,27 +38271,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -37613,19 +38394,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -37642,7 +38426,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":25,"../components/drawing":49,"../components/modebar":85,"../components/titles":114,"../lib":136,"../plotly":166,"../plots/cartesian/graph_interact":180,"../plots/plots":199,"../registry":206,"d3":7}],164:[function(require,module,exports){ +},{"../components/color":31,"../components/drawing":55,"../components/modebar":91,"../components/titles":120,"../lib":143,"../plotly":173,"../plots/cartesian/graph_interact":187,"../plots/plots":207,"../registry":214,"d3":7}],171:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37752,7 +38536,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":136,"../plotly":166,"../snapshot/cloneplot":207,"../snapshot/helpers":210,"../snapshot/svgtoimg":212,"../snapshot/tosvg":214,"fast-isnumeric":10}],165:[function(require,module,exports){ +},{"../lib":143,"../plotly":173,"../snapshot/cloneplot":215,"../snapshot/helpers":218,"../snapshot/svgtoimg":220,"../snapshot/tosvg":222,"fast-isnumeric":10}],172:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37974,6 +38758,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -38022,6 +38811,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -38039,7 +38838,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -38056,8 +38855,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -38123,7 +38922,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":136,"../plots/plots":199,"./plot_schema":160}],166:[function(require,module,exports){ +},{"../lib":143,"../plots/plots":207,"./plot_schema":167}],173:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38157,7 +38956,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":85,"./plot_api/plot_api":158,"./plot_api/plot_config":159,"./plots/cartesian/axes":171,"./plots/plots":199}],167:[function(require,module,exports){ +},{"./components/modebar":91,"./plot_api/plot_api":165,"./plot_api/plot_config":166,"./plots/cartesian/axes":178,"./plots/plots":207}],174:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38259,7 +39058,7 @@ module.exports = { } }; -},{}],168:[function(require,module,exports){ +},{}],175:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38340,7 +39139,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":136}],169:[function(require,module,exports){ +},{"../lib":143}],176:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38397,11 +39196,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -38425,7 +39233,7 @@ module.exports = { } }; -},{"../components/fx/attributes":58}],170:[function(require,module,exports){ +},{"../components/fx/attributes":64}],177:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38452,7 +39260,7 @@ module.exports = { } }; -},{}],171:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38482,7 +39290,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -38555,33 +39362,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -38822,6 +39623,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -38917,6 +39721,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -40268,10 +41079,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -40304,17 +41115,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -40780,7 +41584,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":25,"../../components/drawing":49,"../../components/titles":114,"../../constants/numerical":122,"../../lib":136,"../../lib/svg_text_utils":153,"../../registry":206,"./axis_autotype":172,"./axis_ids":174,"./layout_attributes":182,"./layout_defaults":183,"./set_convert":188,"d3":7,"fast-isnumeric":10}],172:[function(require,module,exports){ +},{"../../components/color":31,"../../components/drawing":55,"../../components/titles":120,"../../constants/numerical":129,"../../lib":143,"../../lib/svg_text_utils":160,"../../registry":214,"./axis_autotype":179,"./axis_ids":181,"./layout_attributes":189,"./layout_defaults":190,"./set_convert":195,"d3":7,"fast-isnumeric":10}],179:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -40855,7 +41659,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":122,"../../lib":136,"fast-isnumeric":10}],173:[function(require,module,exports){ +},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":10}],180:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -40978,7 +41782,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":24,"../../lib":136,"../../registry":206,"./category_order_defaults":175,"./layout_attributes":182,"./ordered_categories":184,"./set_convert":188,"./tick_label_defaults":189,"./tick_mark_defaults":190,"./tick_value_defaults":191,"tinycolor2":13}],174:[function(require,module,exports){ +},{"../../components/color/attributes":30,"../../lib":143,"../../registry":214,"./category_order_defaults":182,"./layout_attributes":189,"./ordered_categories":191,"./set_convert":195,"./tick_label_defaults":196,"./tick_mark_defaults":197,"./tick_value_defaults":198,"tinycolor2":13}],181:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41100,7 +41904,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":136,"../../registry":206,"../plots":199,"./constants":176}],175:[function(require,module,exports){ +},{"../../lib":143,"../../registry":214,"../plots":207,"./constants":183}],182:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41134,7 +41938,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],176:[function(require,module,exports){ +},{}],183:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41189,7 +41993,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],177:[function(require,module,exports){ +},{}],184:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41207,10 +42011,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); + + if(containerOut.fixedrange) return; + + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(!containerIn.scaleanchor) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -41229,7 +42048,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -41328,7 +42147,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":136,"./axis_ids":174}],178:[function(require,module,exports){ +},{"../../lib":143,"./axis_ids":181}],185:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41345,12 +42164,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -41366,12 +42187,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -41379,32 +42206,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } + } + } + } +}; + +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; } } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } } }; -},{"../../constants/numerical":122,"./axis_ids":174,"./scale_zoom":186}],179:[function(require,module,exports){ +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":127,"../../constants/numerical":129,"./axis_ids":181,"./scale_zoom":193}],186:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41427,6 +42375,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -41536,7 +42487,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -41590,6 +42540,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -41688,8 +42641,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -41722,7 +42675,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -41741,11 +42695,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -41930,6 +42884,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -41949,8 +42905,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -42047,24 +43008,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -42099,11 +43053,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -42114,7 +43072,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -42123,7 +43081,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -42206,7 +43164,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -42222,13 +43180,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -42405,7 +43365,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":25,"../../components/dragelement":46,"../../components/drawing":49,"../../lib":136,"../../lib/setcursor":151,"../../lib/svg_text_utils":153,"../../plotly":166,"../../registry":206,"./axes":171,"./axis_ids":174,"./constants":176,"./scale_zoom":186,"./select":187,"d3":7,"tinycolor2":13}],180:[function(require,module,exports){ +},{"../../components/color":31,"../../components/dragelement":52,"../../components/drawing":55,"../../constants/alignment":127,"../../lib":143,"../../lib/setcursor":158,"../../lib/svg_text_utils":160,"../../plotly":173,"../../registry":214,"../plots":207,"./axes":178,"./axis_ids":181,"./constants":183,"./scale_zoom":193,"./select":194,"d3":7,"tinycolor2":13}],187:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42428,7 +43388,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -42446,8 +43406,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -42505,7 +43463,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -42566,7 +43524,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":46,"../../components/fx":66,"./constants":176,"./dragbox":179,"fast-isnumeric":10}],181:[function(require,module,exports){ +},{"../../components/dragelement":52,"../../components/fx":72,"./constants":183,"./dragbox":186,"fast-isnumeric":10}],188:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42753,6 +43711,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -42955,7 +43918,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":136,"../plots":199,"./attributes":170,"./axis_ids":174,"./constants":176,"./layout_attributes":182,"./transition_axes":192,"d3":7}],182:[function(require,module,exports){ +},{"../../lib":143,"../plots":207,"./attributes":177,"./axis_ids":181,"./constants":183,"./layout_attributes":189,"./transition_axes":199,"d3":7}],189:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43050,6 +44013,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -43347,7 +44324,7 @@ module.exports = { } }; -},{"../../components/color/attributes":24,"../../components/drawing/attributes":48,"../../lib/extend":132,"../font_attributes":195,"./constants":176}],183:[function(require,module,exports){ +},{"../../components/color/attributes":30,"../../components/drawing/attributes":54,"../../lib/extend":139,"../font_attributes":202,"./constants":183}],190:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43620,7 +44597,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":25,"../../lib":136,"../../registry":206,"../layout_attributes":197,"./axis_defaults":173,"./axis_ids":174,"./constants":176,"./constraint_defaults":177,"./layout_attributes":182,"./position_defaults":185,"./type_defaults":193}],184:[function(require,module,exports){ +},{"../../components/color":31,"../../lib":143,"../../registry":214,"../layout_attributes":205,"./axis_defaults":180,"./axis_ids":181,"./constants":183,"./constraint_defaults":184,"./layout_attributes":189,"./position_defaults":192,"./type_defaults":200}],191:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43699,7 +44676,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":7}],185:[function(require,module,exports){ +},{"d3":7}],192:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43764,7 +44741,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":136,"fast-isnumeric":10}],186:[function(require,module,exports){ +},{"../../lib":143,"fast-isnumeric":10}],193:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43776,20 +44753,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],187:[function(require,module,exports){ +},{"../../constants/alignment":127}],194:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43803,6 +44783,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -43943,7 +44924,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -43989,7 +44972,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":25,"../../lib/polygon":146,"./axes":171,"./constants":176}],188:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":31,"../../components/fx/helpers":69,"../../lib/polygon":153,"./axes":178,"./constants":183}],195:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44008,6 +45008,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -44020,13 +45021,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -44144,7 +45138,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -44157,8 +45151,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -44174,10 +45168,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -44185,16 +45181,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -44212,26 +45210,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; + + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -44432,7 +45442,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":122,"../../lib":136,"./axis_ids":174,"./constants":176,"d3":7,"fast-isnumeric":10}],189:[function(require,module,exports){ +},{"../../constants/numerical":129,"../../lib":143,"./axis_ids":181,"./constants":183,"d3":7,"fast-isnumeric":10}],196:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44516,7 +45526,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":136}],190:[function(require,module,exports){ +},{"../../lib":143}],197:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44549,7 +45559,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":136,"./layout_attributes":182}],191:[function(require,module,exports){ +},{"../../lib":143,"./layout_attributes":189}],198:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44633,7 +45643,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":122,"../../lib":136,"fast-isnumeric":10}],192:[function(require,module,exports){ +},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":10}],199:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44949,7 +45959,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":49,"../../plotly":166,"../../registry":206,"./axes":171,"d3":7}],193:[function(require,module,exports){ +},{"../../components/drawing":55,"../../plotly":173,"../../registry":214,"./axes":178,"d3":7}],200:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45077,7 +46087,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":206,"./axis_autotype":172,"./axis_ids":174}],194:[function(require,module,exports){ +},{"../../registry":214,"./axis_autotype":179,"./axis_ids":181}],201:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45342,6 +46352,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -45502,7 +46514,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":136,"../plotly":166}],195:[function(require,module,exports){ +},{"../lib":143,"../plotly":173}],202:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45533,7 +46545,7 @@ module.exports = { } }; -},{}],196:[function(require,module,exports){ +},{}],203:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45579,7 +46591,41 @@ module.exports = { } }; -},{}],197:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; + + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } + } + + return out; +} + +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} + +module.exports = project; + +},{}],205:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45722,7 +46768,7 @@ module.exports = { } }; -},{"../components/color/attributes":24,"../lib":136,"./font_attributes":195}],198:[function(require,module,exports){ +},{"../components/color/attributes":30,"../lib":143,"./font_attributes":202}],206:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45760,7 +46806,7 @@ module.exports = { } }; -},{}],199:[function(require,module,exports){ +},{}],207:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45776,6 +46822,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -46268,12 +47315,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -46598,12 +47671,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -46616,7 +47689,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -47549,6 +48625,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -47764,7 +48844,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -47785,6 +48871,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -47832,25 +48919,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -47859,11 +48932,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -47936,7 +49005,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":25,"../components/errorbars":55,"../constants/numerical":122,"../lib":136,"../plotly":166,"../registry":206,"./animation_attributes":167,"./attributes":169,"./command":194,"./font_attributes":195,"./frame_attributes":196,"./layout_attributes":197,"d3":7,"fast-isnumeric":10}],200:[function(require,module,exports){ +},{"../components/color":31,"../components/errorbars":61,"../constants/numerical":129,"../lib":143,"../plot_api/plot_schema":167,"../plotly":173,"../registry":214,"./animation_attributes":174,"./attributes":176,"./command":201,"./font_attributes":202,"./frame_attributes":203,"./layout_attributes":205,"d3":7,"fast-isnumeric":10}],208:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47961,7 +49030,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":240}],201:[function(require,module,exports){ +},{"../../traces/scatter/attributes":248}],209:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48076,7 +49145,7 @@ module.exports = { } }; -},{"../../lib/extend":132,"../cartesian/layout_attributes":182}],202:[function(require,module,exports){ +},{"../../lib/extend":139,"../cartesian/layout_attributes":189}],210:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48091,7 +49160,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":203,"./micropolar_manager":204}],203:[function(require,module,exports){ +},{"./micropolar":211,"./micropolar_manager":212}],211:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49510,7 +50579,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":136,"d3":7}],204:[function(require,module,exports){ +},{"../../lib":143,"d3":7}],212:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49596,7 +50665,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":25,"../../lib":136,"./micropolar":203,"./undo_manager":205,"d3":7}],205:[function(require,module,exports){ +},{"../../components/color":31,"../../lib":143,"./micropolar":211,"./undo_manager":213,"d3":7}],213:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49662,7 +50731,7 @@ module.exports = function UndoManager() { }; }; -},{}],206:[function(require,module,exports){ +},{}],214:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49853,7 +50922,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":139,"./lib/noop":143,"./lib/push_unique":147,"./plots/attributes":169}],207:[function(require,module,exports){ +},{"./lib/loggers":146,"./lib/noop":150,"./lib/push_unique":154,"./plots/attributes":176}],215:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50025,7 +51094,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":136,"../plots/plots":199}],208:[function(require,module,exports){ +},{"../lib":143,"../plots/plots":207}],216:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50091,7 +51160,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":136,"../plot_api/to_image":164,"./filesaver":209}],209:[function(require,module,exports){ +},{"../lib":143,"../plot_api/to_image":171,"./filesaver":217}],217:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50159,7 +51228,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],210:[function(require,module,exports){ +},{}],218:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50192,7 +51261,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],211:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50218,7 +51287,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":207,"./download":208,"./helpers":210,"./svgtoimg":212,"./toimage":213,"./tosvg":214}],212:[function(require,module,exports){ +},{"./cloneplot":215,"./download":216,"./helpers":218,"./svgtoimg":220,"./toimage":221,"./tosvg":222}],220:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50256,7 +51325,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -50349,7 +51418,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":136,"events":9}],213:[function(require,module,exports){ +},{"../lib":143,"events":9}],221:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50429,7 +51498,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":136,"../plotly":166,"./cloneplot":207,"./helpers":210,"./svgtoimg":212,"./tosvg":214,"events":9}],214:[function(require,module,exports){ +},{"../lib":143,"../plotly":173,"./cloneplot":215,"./helpers":218,"./svgtoimg":220,"./tosvg":222,"events":9}],222:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50443,12 +51512,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -50501,20 +51587,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -50522,10 +51610,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -50539,16 +51638,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":25,"../components/drawing":49,"../constants/xmlns_namespaces":124,"../lib/svg_text_utils":153,"d3":7}],215:[function(require,module,exports){ +},{"../components/color":31,"../components/drawing":55,"../constants/xmlns_namespaces":131,"d3":7}],223:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50581,7 +51680,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":136}],216:[function(require,module,exports){ +},{"../../lib":143}],224:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50706,7 +51805,7 @@ module.exports = { } }; -},{"../../components/colorbar/attributes":26,"../../components/colorscale/color_attributes":32,"../../components/errorbars/attributes":51,"../../lib/extend":132,"../../plots/font_attributes":195,"../scatter/attributes":240}],217:[function(require,module,exports){ +},{"../../components/colorbar/attributes":32,"../../components/colorscale/color_attributes":38,"../../components/errorbars/attributes":57,"../../lib/extend":139,"../../plots/font_attributes":202,"../scatter/attributes":248}],225:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50799,7 +51898,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":31,"../../components/colorscale/has_colorscale":38,"../../plots/cartesian/axes":171,"./arrays_to_calcdata":215,"fast-isnumeric":10}],218:[function(require,module,exports){ +},{"../../components/colorscale/calc":37,"../../components/colorscale/has_colorscale":44,"../../plots/cartesian/axes":178,"./arrays_to_calcdata":223,"fast-isnumeric":10}],226:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50859,7 +51958,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":25,"../../components/errorbars/defaults":54,"../../lib":136,"../bar/style_defaults":227,"../scatter/xy_defaults":262,"./attributes":216}],219:[function(require,module,exports){ +},{"../../components/color":31,"../../components/errorbars/defaults":60,"../../lib":143,"../bar/style_defaults":235,"../scatter/xy_defaults":270,"./attributes":224}],227:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50971,7 +52070,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":25,"../../components/errorbars":55,"../../components/fx":66}],220:[function(require,module,exports){ +},{"../../components/color":31,"../../components/errorbars":61,"../../components/fx":72}],228:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51007,7 +52106,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":181,"../scatter/colorbar":243,"./arrays_to_calcdata":215,"./attributes":216,"./calc":217,"./defaults":218,"./hover":219,"./layout_attributes":221,"./layout_defaults":222,"./plot":223,"./set_positions":224,"./style":226}],221:[function(require,module,exports){ +},{"../../plots/cartesian":188,"../scatter/colorbar":251,"./arrays_to_calcdata":223,"./attributes":224,"./calc":225,"./defaults":226,"./hover":227,"./layout_attributes":229,"./layout_defaults":230,"./plot":231,"./set_positions":232,"./style":234}],229:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51051,7 +52150,7 @@ module.exports = { } }; -},{}],222:[function(require,module,exports){ +},{}],230:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51109,7 +52208,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":136,"../../plots/cartesian/axes":171,"../../registry":206,"./layout_attributes":221}],223:[function(require,module,exports){ +},{"../../lib":143,"../../plots/cartesian/axes":178,"../../registry":214,"./layout_attributes":229}],231:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51251,22 +52350,17 @@ module.exports = function plot(gd, plotinfo, cdbar) { function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { function appendTextNode(bar, text, textFont) { var textSelection = bar.append('text') - // prohibit tex interpretation until we can handle - // tex and regular text together - .attr('data-notex', 1) .text(text) .attr({ 'class': 'bartext', transform: '', - 'data-bb': '', 'text-anchor': 'middle', - x: 0, - y: 0 + // prohibit tex interpretation until we can handle + // tex and regular text together + 'data-notex': 1 }) - .call(Drawing.font, textFont); - - textSelection.call(svgTextUtils.convertToTspans); - textSelection.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(Drawing.font, textFont) + .call(svgTextUtils.convertToTspans, gd); return textSelection; } @@ -51629,7 +52723,7 @@ function coerceColor(attributeDefinition, value, defaultValue) { attributeDefinition.dflt; } -},{"../../components/color":25,"../../components/drawing":49,"../../components/errorbars":55,"../../lib":136,"../../lib/svg_text_utils":153,"./attributes":216,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],224:[function(require,module,exports){ +},{"../../components/color":31,"../../components/drawing":55,"../../components/errorbars":61,"../../lib":143,"../../lib/svg_text_utils":160,"./attributes":224,"d3":7,"fast-isnumeric":10,"tinycolor2":13}],232:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52229,7 +53323,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../constants/numerical":122,"../../plots/cartesian/axes":171,"../../registry":206,"./sieve.js":225,"fast-isnumeric":10}],225:[function(require,module,exports){ +},{"../../constants/numerical":129,"../../plots/cartesian/axes":178,"../../registry":214,"./sieve.js":233,"fast-isnumeric":10}],233:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52331,7 +53425,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":122,"../../lib":136}],226:[function(require,module,exports){ +},{"../../constants/numerical":129,"../../lib":143}],234:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52401,15 +53495,12 @@ module.exports = function style(gd) { p.call(Color.stroke, lineColor); } }); - // TODO: text markers on bars, either extra text or just bar values - // d3.select(this).selectAll('text') - // .call(Drawing.textPointStyle,d.t||d[0].t); }); s.call(ErrorBars.style); }; -},{"../../components/color":25,"../../components/drawing":49,"../../components/errorbars":55,"d3":7}],227:[function(require,module,exports){ +},{"../../components/color":31,"../../components/drawing":55,"../../components/errorbars":61,"d3":7}],235:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52446,7 +53537,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":25,"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38}],228:[function(require,module,exports){ +},{"../../components/color":31,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],236:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52639,7 +53730,7 @@ module.exports = { } }; -},{"../../components/color/attributes":24,"../../lib/extend":132,"../../plots/attributes":169,"../../plots/font_attributes":195}],229:[function(require,module,exports){ +},{"../../components/color/attributes":30,"../../lib/extend":139,"../../plots/attributes":176,"../../plots/font_attributes":202}],237:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52686,7 +53777,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":206}],230:[function(require,module,exports){ +},{"../../registry":214}],238:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52838,7 +53929,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":25,"./helpers":232,"fast-isnumeric":10,"tinycolor2":13}],231:[function(require,module,exports){ +},{"../../components/color":31,"./helpers":240,"fast-isnumeric":10,"tinycolor2":13}],239:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52888,8 +53979,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); coerce('hovertext'); - coerce('hoverinfo', (layout._dataLength === 1) ? 'label+text+value+percent' : undefined); - if(textInfo && textInfo !== 'none') { var textPosition = coerce('textposition'), hasBoth = Array.isArray(textPosition) || textPosition === 'auto', @@ -52923,7 +54012,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":136,"./attributes":228}],232:[function(require,module,exports){ +},{"../../lib":143,"./attributes":236}],240:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52952,7 +54041,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":136}],233:[function(require,module,exports){ +},{"../../lib":143}],241:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52984,7 +54073,7 @@ Pie.meta = { module.exports = Pie; -},{"./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){ +},{"./attributes":236,"./base_plot":237,"./calc":238,"./defaults":239,"./layout_attributes":242,"./layout_defaults":243,"./plot":244,"./style":245,"./style_one":246}],242:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53004,7 +54093,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],235:[function(require,module,exports){ +},{}],243:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53026,7 +54115,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":136,"./layout_attributes":234}],236:[function(require,module,exports){ +},{"../../lib":143,"./layout_attributes":242}],244:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53118,9 +54207,9 @@ module.exports = function plot(gd, cdpie) { evt.originalEvent = d3.event; // in case fullLayout or fullData has changed without a replot - var fullLayout2 = gd._fullLayout, - trace2 = gd._fullData[trace.index], - hoverinfo = trace2.hoverinfo; + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; + var hoverinfo = Fx.castHoverinfo(trace2, fullLayout2, pt.i); if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; @@ -53153,8 +54242,6 @@ module.exports = function plot(gd, cdpie) { if(hoverinfo.indexOf('value') !== -1) thisText.push(helpers.formatPieValue(pt.v, separators)); if(hoverinfo.indexOf('percent') !== -1) thisText.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators)); - var hoverLabelOpts = trace2.hoverlabel; - Fx.loneHover({ x0: hoverCenterX - rInscribed * cd0.r, x1: hoverCenterX + rInscribed * cd0.r, @@ -53162,14 +54249,15 @@ module.exports = function plot(gd, cdpie) { text: thisText.join('
'), name: hoverinfo.indexOf('name') !== -1 ? trace2.name : undefined, idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', - color: pt.hbg || hoverLabelOpts.bgcolor || pt.color, - borderColor: pt.hbc || hoverLabelOpts.bordercolor, - fontFamily: pt.htf || hoverLabelOpts.font.family, - fontSize: pt.hts || hoverLabelOpts.font.size, - fontColor: pt.htc || hoverLabelOpts.font.color + color: Fx.castHoverOption(trace, pt.i, 'bgcolor') || pt.color, + borderColor: Fx.castHoverOption(trace, pt.i, 'bordercolor'), + fontFamily: Fx.castHoverOption(trace, pt.i, 'font.family'), + fontSize: Fx.castHoverOption(trace, pt.i, 'font.size'), + fontColor: Fx.castHoverOption(trace, pt.i, 'font.color') }, { container: fullLayout2._hoverlayer.node(), - outerContainer: fullLayout2._paper.node() + outerContainer: fullLayout2._paper.node(), + gd: gd }); Fx.hover(gd, evt, 'pie'); @@ -53281,15 +54369,11 @@ module.exports = function plot(gd, cdpie) { .attr({ 'class': 'slicetext', transform: '', - 'data-bb': '', - 'text-anchor': 'middle', - x: 0, - y: 0 + 'text-anchor': 'middle' }) .call(Drawing.font, textPosition === 'outside' ? trace.outsidetextfont : trace.insidetextfont) - .call(svgTextUtils.convertToTspans); - sliceText.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(svgTextUtils.convertToTspans, gd); // position the text relative to the slice // TODO: so far this only accounts for flat @@ -53304,7 +54388,6 @@ module.exports = function plot(gd, cdpie) { sliceText.call(Drawing.font, trace.outsidetextfont); if(trace.outsidetextfont.family !== trace.insidetextfont.family || trace.outsidetextfont.size !== trace.insidetextfont.size) { - sliceText.attr({'data-bb': ''}); textBB = Drawing.bBox(sliceText.node()); } transform = transformOutsideText(textBB, pt); @@ -53740,7 +54823,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":25,"../../components/drawing":49,"../../components/fx":66,"../../lib/svg_text_utils":153,"./helpers":232,"d3":7}],237:[function(require,module,exports){ +},{"../../components/color":31,"../../components/drawing":55,"../../components/fx":72,"../../lib/svg_text_utils":160,"./helpers":240,"d3":7}],245:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53769,7 +54852,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":238,"d3":7}],238:[function(require,module,exports){ +},{"./style_one":246,"d3":7}],246:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53794,7 +54877,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":25}],239:[function(require,module,exports){ +},{"../../components/color":31}],247:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53846,7 +54929,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":136}],240:[function(require,module,exports){ +},{"../../lib":143}],248:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53892,20 +54975,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -54126,7 +55201,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":26,"../../components/colorscale/color_attributes":32,"../../components/drawing":49,"../../components/drawing/attributes":48,"../../components/errorbars/attributes":51,"../../lib/extend":132,"./constants":245}],241:[function(require,module,exports){ +},{"../../components/colorbar/attributes":32,"../../components/colorscale/color_attributes":38,"../../components/drawing":55,"../../components/drawing/attributes":54,"../../components/errorbars/attributes":57,"../../lib/extend":139,"./constants":253}],249:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54257,7 +55332,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":122,"../../plots/cartesian/axes":171,"./arrays_to_calcdata":239,"./colorscale_calc":244,"./subtypes":260,"fast-isnumeric":10}],242:[function(require,module,exports){ +},{"../../constants/numerical":129,"../../plots/cartesian/axes":178,"./arrays_to_calcdata":247,"./colorscale_calc":252,"./subtypes":268,"fast-isnumeric":10}],250:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54296,7 +55371,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],243:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54352,7 +55427,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":28,"../../components/colorscale":39,"../../lib":136,"../../plots/plots":199,"fast-isnumeric":10}],244:[function(require,module,exports){ +},{"../../components/colorbar/draw":34,"../../components/colorscale":45,"../../lib":143,"../../plots/plots":207,"fast-isnumeric":10}],252:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54385,7 +55460,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":31,"../../components/colorscale/has_colorscale":38,"./subtypes":260}],245:[function(require,module,exports){ +},{"../../components/colorscale/calc":37,"../../components/colorscale/has_colorscale":44,"./subtypes":268}],253:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54401,7 +55476,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],246:[function(require,module,exports){ +},{}],254:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54440,11 +55515,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -54483,7 +55556,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":54,"../../lib":136,"./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){ +},{"../../components/errorbars/defaults":60,"../../lib":143,"./attributes":248,"./constants":253,"./fillcolor_defaults":255,"./line_defaults":259,"./line_shape_defaults":261,"./marker_defaults":264,"./subtypes":268,"./text_defaults":269,"./xy_defaults":270}],255:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54521,7 +55594,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":25}],248:[function(require,module,exports){ +},{"../../components/color":31}],256:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54574,7 +55647,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":25,"./subtypes":260}],249:[function(require,module,exports){ +},{"../../components/color":31,"./subtypes":268}],257:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54601,11 +55674,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -54661,7 +55735,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -54745,7 +55819,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":25,"../../components/errorbars":55,"../../components/fx":66,"../../lib":136,"./get_trace_color":248}],250:[function(require,module,exports){ +},{"../../components/color":31,"../../components/errorbars":61,"../../components/fx":72,"../../lib":143,"./get_trace_color":256}],258:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54789,7 +55863,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":181,"./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){ +},{"../../plots/cartesian":188,"./arrays_to_calcdata":247,"./attributes":248,"./calc":249,"./clean_data":250,"./colorbar":251,"./defaults":254,"./hover":257,"./plot":265,"./select":266,"./style":267,"./subtypes":268}],259:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54822,7 +55896,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38}],252:[function(require,module,exports){ +},{"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],260:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54995,7 +56069,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":122}],253:[function(require,module,exports){ +},{"../../constants/numerical":129}],261:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55014,7 +56088,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],254:[function(require,module,exports){ +},{}],262:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55055,7 +56129,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],255:[function(require,module,exports){ +},{}],263:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55097,7 +56171,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":10}],256:[function(require,module,exports){ +},{"fast-isnumeric":10}],264:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55172,7 +56246,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":25,"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38,"./subtypes":260}],257:[function(require,module,exports){ +},{"../../components/color":31,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44,"./subtypes":268}],265:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55515,10 +56589,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -55529,7 +56605,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -55537,7 +56614,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -55594,17 +56672,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -55616,6 +56697,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -55635,6 +56718,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -55643,7 +56728,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -55720,7 +56805,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":49,"../../components/errorbars":55,"../../lib":136,"../../lib/polygon":146,"./line_points":252,"./link_traces":254,"./subtypes":260,"d3":7}],258:[function(require,module,exports){ +},{"../../components/drawing":55,"../../components/errorbars":61,"../../lib":143,"../../lib/polygon":153,"./line_points":260,"./link_traces":262,"./subtypes":268,"d3":7}],266:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55742,7 +56827,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -55766,11 +56850,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -55793,7 +56875,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":260}],259:[function(require,module,exports){ +},{"./subtypes":268}],267:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55824,10 +56906,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -55839,7 +56921,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":49,"../../components/errorbars":55,"d3":7}],260:[function(require,module,exports){ +},{"../../components/drawing":55,"../../components/errorbars":61,"d3":7}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55875,7 +56957,7 @@ module.exports = { } }; -},{"../../lib":136}],261:[function(require,module,exports){ +},{"../../lib":143}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55896,7 +56978,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":136}],262:[function(require,module,exports){ +},{"../../lib":143}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55946,5 +57028,5 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":206}]},{},[5])(5) +},{"../../registry":214}]},{},[5])(5) }); \ No newline at end of file diff --git a/dist/plotly-basic.min.js b/dist/plotly-basic.min.js index 9e8ef8ee6f6..561205e1502 100644 --- a/dist/plotly-basic.min.js +++ b/dist/plotly-basic.min.js @@ -1,27 +1,28 @@ /** -* plotly.js (basic - minified) v1.27.1 +* plotly.js (basic - minified) v1.28.0 * Copyright 2012-2017, 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||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:0/0}function o(t){return null===t?0/0:+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 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,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=$),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 $(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 Q(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?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=vt(a)*Ji,n=vt(n)*Ki,o=vt(o)*tl,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)*Ui,Math.sqrt(e*e+r*r),t):new ft(0/0,0/0,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,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=nl.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=mt((.4124564*t+.3575761*e+.1804375*r)/Ji),a=mt((.2126729*t+.7151522*e+.072175*r)/Ki);return ht(116*a-16,500*(n-a),200*(a-mt((.0193339*t+.119192*e+.9503041*r)/tl)))}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,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 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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Nt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=al,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=ul.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="",v="",m=!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,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=fl.get(h)||Bt;var x=c&&f;return function(t){var r=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),r=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))+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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=S[i in gl?e.charAt(l++):i])||(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,C.c.toString(),e,n)}function s(t,e,n){return r(t,C.x.toString(),e,n)}function c(t,e,n){return r(t,C.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,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{hl=qt;var e=new hl;return e._=t,n(e)}finally{hl=Date}}var n=e(t);return r.parse=function(t){try{hl=qt;var e=n.parse(t);return e&&e._}finally{hl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Gt(g),_=Yt(g),w=Gt(v),k=Yt(v),M=Gt(m),A=Yt(m),T=Gt(y),L=Yt(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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Xt(dl.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"%"}},S={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:Zt,W:$t,x:s,X:c,y:Jt,Y:Qt,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){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){vl.lastIndex=0;var n=vl.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){ml.lastIndex=0;var n=ml.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);kl.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Ml.point=function(i,l){Ml.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Ml.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 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,v=e(o),m=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(m,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=0/0,n=0/0,a=0/0;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 qe(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(kl.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=r^m>=r){var T=xe(me(f),me(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*nt(L[2]);(n>C||n===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 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),v=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 m;v&o||!(m=n(p,r,!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||r&&Me(r,p)||t.point(p[0],p[1]),r=p,s=g,o=v},lineEnd:function(){s&&t.lineEnd(),r=null},clean:function(){return u|(c&&s)<<1}}}function n(t,e,r){var n=me(t),a=me(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);be(p,_e(l,d));var g=h,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-v-x)/m);if(be(b,p),b=ke(b),!r)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)ji^(w<=b[0]&&b[0]<=k)){var S=_e(g,(-v+x)/m);return be(S,p),[b,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;return Ne(e,r,vr(t,6*Vi),i?[0,-t]:[-ji,t-ji])}function Ue(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=v.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(){S.point=p,v&&v.push(m=[]),M=!0,k=!1,_=w=0/0}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(-Fl,Math.min(Fl,t)),e=Math.max(-Fl,Math.min(Fl,e));var r=u(t,e);if(v&&m.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}};C(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,v,m,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Ue(t,e,r,n),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,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=v=m=null}};return S}}function Ge(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 Ye(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 Ze(){function t(t,e){Bl+=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){tVl&&(Vl=t),eUl&&(Ul=e)}function $e(){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=Qe(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=Qe(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function Qe(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){Ll+=t,Cl+=e,++Sl}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);zl+=i*(e+t)/2,Ol+=i*(r+n)/2,Dl+=i,Je(e=t,r=n)}var e,r;Yl.point=function(n,a){Yl.point=t,Je(e=n,r=a)}}function tr(){Yl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);zl+=i*(n+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-n*e,Pl+=i*(n+t),El+=i*(a+e),Nl+=3*i,Je(n=t,a=e)}var e,r,n,a;Yl.point=function(o,i){Yl.point=t,Je(e=n=o,r=a=i)},Yl.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=0/0,M.point=o,e.lineStart()}function o(r,n){var o=me([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=_,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: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,v,m){var y=u-e,x=f-r,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 ar(t){var e=nr(function(e,r){return t([e*Ui,r*Ui])});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[0]*Ui,t[1]*Ui]}function n(){l=ze(i=dr(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=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,v=0,m=0,y=0,x=0,_=Rl,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,Rl):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,v=t[1]%360*Vi,n()):[g*Ui,v*Ui]},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,n()):[m*Ui,y*Ui,x*Ui]},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-Bi:t<-ji?t+Bi:t,e]}function dr(t,e,r){return t?e||r?ze(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-Bi:e<-ji?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 vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=mr(r,a),o=mr(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(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 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 Fr(t){var e=ls.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),as.remove(t),ls.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];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(!((a=o-Vr(l,i))>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(as.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),as.insert(s,r),s.edge=r.edge=Kr(e.site,s.site),Zr(e),void Zr(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,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};en(r.edge,c,p,b),s.edge=Kr(c,t,null,b),r.edge=Kr(t,p,null,b),Zr(e),Zr(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 Ur(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=ns,v=g.length;v--;)if((o=g[v])&&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,v=(s*p-u*h)/d,f=v+l,m=ss.pop()||new Yr;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=is._;x;)if(m.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:v,y:s};r={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)/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=fs.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 Cn(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 zn(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 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 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(Un(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Un(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Un(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Un(r)+"skewX("+e+")")}function Zn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Un(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(Un(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),Gn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Zn(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 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((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(Sa),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 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 Ua(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?$a:Ya,s=n?Qn:$n;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 Qa(t,e,r,n)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Za(t,Wa(to(t,e)[2])),Za(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=ul.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 ks?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=Za(n.map(a),r?Math:As);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 Ms;arguments.length<2?r=Ms:"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,v=d-u,m=h-f,y=v*v+m*m,x=r-n,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*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=Ct(r),p=Ct(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($s,a);return o==$s.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/$s[o-1]<$s[o]/a?o-1:o]:[Ks,to(t,r)[2]]}return n.invert=function(e){return li(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(li)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,li(+r+1),e).length}var o=n.domain(),i=Xa(o),l=null==t?a(i,10):"number"==typeof t&&a(i,t);return l&&(t=l[0],e=l[1]),n.domain(Za(o,e>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,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,r){vi.call(this,t,e,r+"")},mi.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:0/0},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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=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++],v=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)},Ci=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Ci=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,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,r,n,a,o=[];t=z(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}},Si.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))},Si.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},Si.sort=function(t){t=U.apply(this,arguments);for(var e=-1,r=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 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=Q(a);Bs.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 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];m=d*d+h*h}}function n(){var t,e,r,n,i=ui.touches(p);Bs.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,fl=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))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});dl[t+"s"]=r.range,dl[t+"s"].utc=r.utc.range,dl[t+"OfYear"]=function(t){var r=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,ml=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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=me([e*Vi,r*Vi]);if(m){var a=xe(m,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]*Ui*c,v=bi(s)>180;if(v^(c*ph&&(h=y)}else if(g=(g+360)%360-180,v^(c*ph&&(h=r);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,r);m=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=d,_.point=t,m=null}function a(t,r){if(m){var n=t-p;y+=bi(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ml.point(t,r),e(t,r)}function o(){Ml.lineStart()}function i(){a(g,v),Ml.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 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,1/0===u||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Al=Tl=Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,Il);var e=Pl,r=El,n=Nl,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 jl,Bl,ql,Hl,Vl,Ul,Xl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Xl.lineStart=Ze},polygonEnd:function(){Xl.lineStart=Xl.lineEnd=Xl.point=k,jl+=bi(Bl/2)}},Gl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Yl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Yl.lineStart=er},polygonEnd:function(){Yl.point=Je,Yl.lineStart=Ke,Yl.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 jl=0,ui.geo.stream(t,a(Xl)),jl},t.centroid=function(t){return Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,a(Yl)),Nl?[Pl/Nl,El/Nl]:Dl?[zl/Dl,Ol/Dl]:Sl?[Ll/Sl,Cl/Sl]:[0/0,0/0]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Gl)),[[ql,Hl],[Vl,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 $e: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]*=Ui,e[1]*=Ui,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]*=Ui,e[1]*=Ui,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]*=Ui,t[1]*=Ui}}),{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=vr((e=+n)*Vi,a*Vi),t):e},t.precision=function(n){return arguments.length?(r=vr(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/v)*v,a,v).map(d).concat(ui.range(Math.ceil(c/m)*m,s,m).map(h)).concat(ui.range(Math.ceil(n/p)*p,r,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 r,n,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?(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?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(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 Zl=0,ui.geo.stream(t,Wl),Zl};var Zl,Wl={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},$l=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr($l)}).raw=$l;var Ql=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Ql)}).raw=Ql,(ui.geo.conicConformal=function(){return Ge(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Ge(Tr)}).raw=Tr;var Jl=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(Jl)}).raw=Jl,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Cr(Lr)}).raw=Lr;var Kl=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(Kl)}).raw=Kl;var ts=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(ts)}).raw=ts,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Cr(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,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(r),o=Ct(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]]:[]).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=zr,a=Or,o=n,i=a,l=cs;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=r.site,i=r.edges.sort(Gr),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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,v,m,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,v=r,m=n,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=pn();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gn(t,A,g,v,m,y)},A.find=function(t){return vn(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=hs.get(r)||ds,n=ps.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 Bn(r?r.matrix:gs)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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=0/0,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=Ct(e),t):n},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(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,Ca),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,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,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 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,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&&!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=ja(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,v,m,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===zs?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=nt(v/c*Math.sin(m))),t&&(T=nt(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 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=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=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=Go;return t.source=function(r){return arguments.length?(e=Ct(r),t):e},t.target=function(e){return arguments.length?(r=Ct(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=Go,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Ns.get(e.call(this,t,n))||$o)(r.call(this,t,n))}var e=Wo,r=Zo;return t.type=function(r){return arguments.length?(e=Ct(r),t):e},t.size=function(e){return arguments.length?(r=Ct(e),t):r},t};var Ns=ui.map({circle:$o,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*Rs)),r=e*Rs;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/Is),r=e*Is/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),r=e*Is/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Ns.keys();var Is=Math.sqrt(3),Rs=Math.tan(30*Vi);Si.transition=function(t){for(var e,r,n=Fs||++Hs,a=ei(t),o=[],i=js||{time:Date.now(),ease:Cn,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(_),n=!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>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){return 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)}},{}],10:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],11:[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,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=n},{}],12:[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(){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 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=L(t,360),e=L(e,100),r=L(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=L(t,255),e=L(e,255),r=L(r,255);var n,a,o=U(t,e,r),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){z(t)&&(t="100%");var n=O(t);return t=V(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 V(1,U(0,t))}function S(t){return parseInt(t,16)}function z(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function N(t){return S(t)/255}function I(t){return!!Z.CSS_UNIT.exec(t)}function R(t){t=t.replace(j,"").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=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:S(r[1]),g:S(r[2]),b:S(r[3]),a:N(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:N(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.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 j=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=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,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=T(t),this._roundA=H(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=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=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=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 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: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[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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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)&&(r[a]="a"===a?t[a]:P(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:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100;return n({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})},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 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=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(G),Z=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],14:[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),f=c("clicktoshow");if(!u&&!f)return e;c("opacity");var d=c("bgcolor"),h=c("bordercolor"),p=a.opacity(h);c("borderpad");var g=c("borderwidth"),v=c("showarrow");c("text",v?" ":"new text"),c("textangle"),n.coerceFont(c,"font",r.font),c("width"),c("align"),c("height")&&c("valign");for(var m=["x","y"],y=[-10,-30],x={_fullLayout:r},b=0;b<2;b++){var _=m[b],w=o.coerceRef(t,e,x,_,"","paper");if(o.coercePosition(e,x,c,w,_,.5),v){var k="a"+_,M=o.coerceRef(t,e,x,k,"pixel");"pixel"!==M&&M!==w&&(M=e[k]="pixel");var A="pixel"===M?y[b]:.4;o.coercePosition(e,x,c,M,k,A)}c(_+"anchor"),c(_+"shift")}if(n.noneOrAll(t,e,["x","y"]), -v&&(c("arrowcolor",p?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(p&&g||1)),c("standoff"),n.noneOrAll(t,e,["ax","ay"])),f){var T=c("xclick"),L=c("yclick");e._xclick=void 0===T?e.x:T,e._yclick=void 0===L?e.y:L}var C=c("hovertext"),S=r.hoverlabel||{};if(C){var z=c("hoverlabel.bgcolor",S.bgcolor||(a.opacity(d)?a.rgb(d):a.defaultLine)),O=c("hoverlabel.bordercolor",S.bordercolor||a.contrast(z));n.coerceFont(c,"hoverlabel.font",{family:S.font.family,size:S.font.size,color:S.font.color||O})}return c("captureevents",!!C),e}},{"../../lib":136,"../../plots/cartesian/axes":171,"../color":25,"./attributes":16}],15:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],16:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:i({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":132,"../../plots/cartesian/constants":176,"../../plots/font_attributes":195,"./arrow_paths":15}],17:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=o.getFromId(t,e.xref),i=o.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=l+e.xshift,n=l-e.xshift,e.axref===e.xref?(o.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),o.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):o.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),i&&i.autorange&&(r=l-e.yshift,n=l+e.yshift,e.ayref===e.yref?(o.expand(i,[i.r2c(e.y)],{ppadplus:r,ppadminus:n}),o.expand(i,[i.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):o.expand(i,[i.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(o.list(t).filter(function(t){return t.autorange&&l[t._id]}).length)return a.syncOrAsync([i,n],t)}}},{"../../lib":136,"../../plots/cartesian/axes":171,"./draw":21}],18:[function(t,e,r){"use strict";function n(t,e){var r=o(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=o(t,e),a=n.on,l=n.off.concat(n.explicitOff),s={};if(a.length||l.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var n=I.selectAll("a");if(1===n.size()&&n.text()===I.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":n.attr("xlink:href"),"xlink:xlink:show":n.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}I.selectAll("tspan.line").attr({y:0,x:0});var a=C.select(".annotation-math-group"),h=!a.empty(),p=d.bBox((h?a:I).node()),x=p.width,z=p.height,N=b.width||x,R=b.height||z,F=Math.round(N+2*O),j=Math.round(R+2*O);b._w=N,b._h=R;var B=!1;if(["x","y"].forEach(function(e){var n,a,o,i,l,f=b[e+"ref"]||e,d=b["a"+e+"ref"],h=u.getFromId(t,f),p=(A+("x"===e?0:-90))*Math.PI/180,g=F*Math.cos(p),v=j*Math.sin(p),m=Math.abs(g)+Math.abs(v),x=b[e+"anchor"],_=b[e+"shift"]*("x"===e?1:-1),w=M[e];if(h){var k=h.r2fraction(b[e]);if((t._dragging||!h.autorange)&&(k<0||k>1)&&(d===f?((k=h.r2fraction(b["a"+e]))<0||k>1)&&(B=!0):B=!0,B))return;n=h._offset+h.r2p(b[e]),i=.5}else"x"===e?(o=b[e],n=y.l+y.w*o):(o=1-b[e],n=y.t+y.h*o),i=b.showarrow?.5:o;if(b.showarrow){w.head=n;var T=b["a"+e];l=g*r(.5,b.xanchor)-v*r(.5,b.yanchor),d===f?(w.tail=h._offset+h.r2p(T),a=l):(w.tail=n+T,a=l+T),w.text=w.tail+l;var L=s["x"===e?"width":"height"];if("paper"===f&&(w.head=c.constrain(w.head,1,L-1)),"pixel"===d){var C=-Math.max(w.tail-3,w.text),S=Math.min(w.tail+3,w.text)-L;C>0?(w.tail+=C,w.text+=C):S>0&&(w.tail-=S,w.text-=S)}w.tail+=_,w.head+=_}else l=m*r(i,x),a=l,w.text=n+l;w.text+=_,l+=_,a+=_,b["_"+e+"padplus"]=m/2+a,b["_"+e+"padminus"]=m/2-a,b["_"+e+"size"]=m,b["_"+e+"shift"]=l}),B)return void C.remove();var q=0,H=0;if("left"!==b.align&&(q=(N-x)*("center"===b.align?.5:1)),"top"!==b.valign&&(H=(R-z)*("middle"===b.valign?.5:1)),h)a.select("svg").attr({x:O+q-1,y:O+H}).call(d.setClipUrl,P?_:null);else{var V=O+H-p.top,U=O+q-p.left;I.attr({x:U,y:V}).call(d.setClipUrl,P?_:null),I.selectAll("tspan.line").attr({y:V,x:U})}E.select("rect").call(d.setRect,O,O,N,R),D.call(d.setRect,S/2,S/2,F-S,j-S),C.call(d.setTranslate,Math.round(M.x.text-F/2),Math.round(M.y.text-j/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var X="annotations["+e+"]",G=function(r,n){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a=M.x.head,s=M.y.head,u=M.x.tail+r,h=M.y.tail+n,p=M.x.text+r,g=M.y.text+n,x=c.rotationXYMatrix(A,p,g),_=c.apply2DTransform(x),S=c.apply2DTransform2(x),z=+D.attr("width"),O=+D.attr("height"),P=p-.5*z,E=P+z,N=g-.5*O,I=N+O,R=[[P,N,P,I],[P,I,E,I],[E,I,E,N],[E,N,P,N]].map(S);if(!R.reduce(function(t,e){return t^!!o(a,s,a+1e6,s+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=o(u,h,a,s,t[0],t[1],t[2],t[3]);e&&(u=e.x,h=e.y)});var F=b.arrowwidth,j=b.arrowcolor,B=T.append("g").style({opacity:f.opacity(j)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),q=B.append("path").attr("d","M"+u+","+h+"L"+a+","+s).style("stroke-width",F+"px").call(f.stroke,f.rgb(j));if(m(q,b.arrowhead,"end",b.arrowsize,b.standoff),t._context.editable&&q.node().parentNode){var H=a,V=s;if(b.standoff){var U=Math.sqrt(Math.pow(a-u,2)+Math.pow(s-h,2));H+=b.standoff*(u-a)/U,V+=b.standoff*(h-s)/U}var G,Y,Z,W=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(u-H)+","+(h-V),transform:"translate("+H+","+V+")"}).style("stroke-width",F+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");v.init({element:W.node(),prepFn:function(){var t=d.getTranslate(C);Y=t.x,Z=t.y,G={},w&&w.autorange&&(G[w._name+".autorange"]=!0),k&&k.autorange&&(G[k._name+".autorange"]=!0)},moveFn:function(t,e){var r=_(Y,Z),n=r[0]+t,a=r[1]+e;C.call(d.setTranslate,n,a),G[X+".x"]=w?w.p2r(w.r2p(b.x)+t):b.x+t/y.w,G[X+".y"]=k?k.p2r(k.r2p(b.y)+e):b.y-e/y.h,b.axref===b.xref&&(G[X+".ax"]=w.p2r(w.r2p(b.ax)+t)),b.ayref===b.yref&&(G[X+".ay"]=k.p2r(k.r2p(b.ay)+e)),B.attr("transform","translate("+t+","+e+")"),L.attr({transform:"rotate("+A+","+n+","+a+")"})},doneFn:function(e){if(e){l.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(b.showarrow&&G(0,0),t._context.editable){var Y,Z;v.init({element:C.node(),prepFn:function(){Z=L.attr("transform"),Y={}},moveFn:function(t,e){var r="pointer";if(b.showarrow)b.axref===b.xref?Y[X+".ax"]=w.p2r(w.r2p(b.ax)+t):Y[X+".ax"]=b.ax+t,b.ayref===b.yref?Y[X+".ay"]=k.p2r(k.r2p(b.ay)+e):Y[X+".ay"]=b.ay+e,G(t,e);else{if(w)Y[X+".x"]=b.x+t/w._m;else{var n=b._xsize/y.w,a=b.x+(b._xshift-b.xshift)/y.w-n/2;Y[X+".x"]=v.align(a+t/y.w,n,0,1,b.xanchor)}if(k)Y[X+".y"]=b.y+e/k._m;else{var o=b._ysize/y.h,i=b.y-(b._yshift+b.yshift)/y.h-o/2;Y[X+".y"]=v.align(i-e/y.h,o,0,1,b.yanchor)}w&&k||(r=v.getCursor(w?.5:Y[X+".x"],k?.5:Y[X+".y"],b.xanchor,b.yanchor))}L.attr({transform:"translate("+t+","+e+")"+Z}),g(C,r)},doneFn:function(e){if(g(C),e){l.relayout(t,Y);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var a=t.layout,s=t._fullLayout,y=t._fullLayout._size;s._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var x=(a.annotations||[])[e],b=s.annotations[e],_="clip"+s._uid+"_ann"+e;if(!x||b.visible===!1)return void i.selectAll("#"+_).remove();var w=u.getFromId(t,b.xref),k=u.getFromId(t,b.yref),M={x:{},y:{}},A=+b.textangle||0,T=s._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",b.opacity),L=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),C=L.append("g").style("pointer-events",b.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:x,fullAnnotation:b,event:i.event})});b.hovertext&&C.on("mouseover",function(){var e=b.hoverlabel,r=e.font,n=this.getBoundingClientRect(),a=t.getBoundingClientRect();h.loneHover({x0:n.left-a.left,x1:n.right-a.left,y:(n.top+n.bottom)/2-a.top,text:b.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:s._hoverlayer.node(),outerContainer:s._paper.node()})}).on("mouseout",function(){h.loneUnhover(s._hoverlayer.node())});var S=b.borderwidth,z=b.borderpad,O=S+z,D=C.append("rect").attr("class","bg").style("stroke-width",S+"px").call(f.stroke,b.bordercolor).call(f.fill,b.bgcolor),P=b.width||b.height,E=s._defs.select(".clips").selectAll("#"+_).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),E.exit().remove();var N=b.font,I=C.append("text").classed("annotation",!0).attr("data-unformatted",b.text).text(b.text);t._context.editable?I.call(p.makeEditable,C).call(r).on("edit",function(n){b.text=n,this.attr({"data-unformatted":b.text}),this.call(r);var a={};a["annotations["+e+"].text"]=b.text,w&&w.autorange&&(a[w._name+".autorange"]=!0),k&&k.autorange&&(a[k._name+".autorange"]=!0),l.relayout(t,a)}):I.call(r)}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,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("../../plotly"),s=t("../../plots/plots"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":136,"../../lib/setcursor":151,"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/cartesian/axes":171,"../../plots/plots":199,"../color":25,"../dragelement":46,"../drawing":49,"../fx":66,"./draw_arrow_head":22,d3:7}],22:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(r,a){h.path&&(e>5&&(a=0),n.select(d.parentElement).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(v=Math.atan2(A,M),m=v+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(v),L=k*Math.sin(v);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var C=d.getTotalLength(),S="";if(C=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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(i.combine(t,c))),(n.isDark()?e?n.lighten(e):c:r?n.darken(r):s).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(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[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&&(r[1]+=r[1]>r[0]?1:-1);var o=D(t).replace("e-",""),i=a(o).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: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){n.select(this).attr("d","M"+Y+","+(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=Y+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-Y-T.l,r=Math.max(r,n)}var o=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,l=$-Q;ot.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:Q-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:Y,y:Q+_.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=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],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(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+G,W+V-G],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+U)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-G))*T.h+T.t+3+.75*ut:(1-(W+G))*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(Z+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=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":136,"./flip_scale":36,"./scales":43}],32:[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":132,"./attributes":30,"./scales.js":43}],33:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":43}],34:[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,v=p[d+"min"],m=p[d+"max"],y=p.colorscale;c(f+d+"auto",!(n(v)&&n(m)&&v=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],37:[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":33,"./is_valid_scale_array":41,"./scales":43}],38:[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}},{}],45:[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":136}],46:[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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return t.element.onmousemove=g,v._dragged=!1,v._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-v._mouseDownTimey&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(v._dragged,m,e),!v._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(v),v._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g,v=i.getPlotDiv(t.element)||{},m=1,y=s.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),g=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=n},{"../../constants/interactions":121,"../../lib":136,"../../plotly":166,"../../plots/cartesian/constants":176,"./align":44,"./cursor":45,"./unhover":47}],47:[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,a=t._hoverdata;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":131}],48:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],49:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i,l){if(s.traceIs(r,"symbols")){var u=g(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:p.isBubble(r)?u(t.ms):(o.size||6)/2,t.mrc=e;var n=v.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,v.symbolFuncs[a](e)+(n>=200?x:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,m=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?c.defaultLine:i.color,Array.isArray(o.color)&&(f=c.defaultLine,m=!0),f="mc"in t?t.mcc=n(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var y=o.gradient,b=t.mgt;if(b?m=!0:b=y&&y.type,b&&"none"!==b){var _=t.mgc;_?m=!0:_=y.color;var w="g"+l._fullLayout._uid+"-"+r.uid;m&&(w+="-"+t.i),e.call(v.gradient,l,w,b,f,_)}else e.call(c.fill,f);h&&e.call(c.stroke,d)}}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,k/2),u=Math.pow(l*l+s*s,k/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("tinycolor2"),s=t("../../registry"),c=t("../color"),u=t("../colorscale"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.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(c.fill,n)},v.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},v.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},v.setRect=function(t,e,r,n,a){t.call(v.setPosition,e,r).call(v.setSize,n,a)},v.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);return i(a)&&i(o)&&e.node()?("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0):(e.remove(),!1)},v.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);v.translatePoint(t,a,e,r,n)})},v.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},v.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.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||"";c.stroke(e,n||o.color),v.dashLine(e,l,i)},v.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(c.stroke,r||a.color).call(v.dashLine,l,i)})},v.dashLine=function(t,e,r){r=+r||0,e=v.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},v.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),r.remove()}})};var m=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=v.symbolNames.length,x="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";v.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=v.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var b={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};v.gradient=function(t,e,r,n,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+i],f.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(b):"vertical"===n&&t.attr(_),t.attr("id",r);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},v.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},v.singlePointStyle=function(t,e,r,a,o,i){var l=r.marker;n(t,e,r,a,o,l,l.line,i)},v.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=v.tryColorscale(r,""),a=v.tryColorscale(r,"line"),i=f.getPlotDiv(t.node());t.each(function(t){v.singlePointStyle(t,o.select(this),e,n,a,i)})}},v.tryColorscale=function(t,e){var r=e?f.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};v.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(v.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(d.convertToTspans);var f=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=1.3*((h[0].length||1)-1)+1,g=w[s]*u,m=.75*c+w[l]*u+(w[l]-1)*p*c/2;f.attr("transform","translate("+g+","+m+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var k=.5;v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=1e4&&(o.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(s),f.extendFlat({},s)},v.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},v.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||0,y:+n[1]||0}},v.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[n]("transform")||"";return e=e||0,r=r||0,o=o.replace(/(\btranslate\(.*?\);?)/,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},v.getScale=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||1,y:+n[1]||1}},v.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[n]("transform")||"";return e=e||1,r=r||1,o=o.replace(/(\bscale\(.*?\);?)/,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},v.setPointGroupScale=function(t,e,r){var n,a,o;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};v.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),a=n.select("text"),i=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(n.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===r?[]:["translate("+i+","+l+")","scale("+e+","+r+")","translate("+-i+","+-l+")"],s&&t.push(s),n.attr("transform",t.join(" "))})},v.measureText=function(t,e,r){var n=t.append("text").text(e).call(v.font,r),a=v.bBox(n.node());return n.remove(),a}},{"../../constants/xmlns_namespaces":124,"../../lib":136,"../../lib/svg_text_utils":153,"../../registry":206,"../../traces/scatter/make_bubble_size_func":255,"../../traces/scatter/subtypes":260,"../color":25,"../colorscale":39,"./symbol_defs":50,d3:7,"fast-isnumeric":10,tinycolor2:13}],50:[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);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),o=n.round(t*-.309,2);return"M"+e+","+o+"L"+r+","+n.round(.809*t,2)+"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);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+n.round(.382*e,2)+"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:7}],51:[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"}}}},{}],52:[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 v=g.enter().append("g").classed("errorbar",!0);u&&v.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 v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(r.duration).ease(r.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(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":260,d3:7, -"fast-isnumeric":10}],57:[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":25,d3:7}],58:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":132,"../../plots/font_attributes":195}],59:[function(t,e,r){"use strict";function n(t,e,r){Array.isArray(t)&&(e[0][r]=t)}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=0;r=0&&r.indexQ.width||W<0||W>Q.height)return x.unhoverRaw(t,e)}if(P="xval"in e?w.flat(n,e.xval):w.p2c(T,Z),E="yval"in e?w.flat(n,e.yval):w.p2c(L,W),!f(P[0])||!f(E[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var J=1/0;for(I=0;I1||F.hoverinfo.indexOf("name")!==-1?F.name:void 0,index:!1,distance:Math.min(J,k.MAXDIST),color:y.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},d[j]&&(U.subplot=d[j]._subplot),X=G.length,"array"===q){var K=e[I];"pointNumber"in K?(U.index=K.pointNumber,q="closest"):(q="","xval"in K&&(H=K.xval,q="x"),"yval"in K&&(V=K.yval,q=q?"closest":"y"))}else H=P[B],V=E[B];if(F._module&&F._module.hoverPoints){var tt=F._module.hoverPoints(U,H,V,q);if(tt)for(var et,rt=0;rtX&&(G.splice(0,X),J=G[0].distance)}if(0===G.length)return x.unhoverRaw(t,e);G.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,at=[];for(N=0;N1,st=y.combine(d.plot_bgcolor||y.background,d.paper_bgcolor),ct={hovermode:D,rotateLabels:lt,bgColor:st,container:d._hoverlayer,outerContainer:d._paperdiv,commonLabelOpts:d.hoverlabel},ut=a(G,ct);if(o(G,lt?"xa":"ya"),i(ut,lt),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,at);v(u.select(e.target),ft?"pointer":"")}e.target&&c(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:L,xvals:P,yvals:E}))}function a(t,e){var r,n,a=e.hovermode,o=e.rotateLabels,i=e.bgColor,l=e.container,s=e.outerContainer,c=e.commonLabelOpts||{},f=e.fontFamily||k.HOVERFONT,d=e.fontSize||k.HOVERFONTSIZE,h=t[0],p=h.xa,v=h.ya,x="y"===a?"yLabel":"xLabel",b=h[x],_=(String(b)||"").split(" ")[0],w=s.node().getBoundingClientRect(),A=w.top,T=w.width,L=w.height,C=h.distance<=k.MAXDIST&&("x"===a||"y"===a);for(r=0;r15&&(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):C&&t[a+"Label"]===b?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 h=e.select("text.nums").call(m.font,t.fontFamily||f,t.fontSize||d,t.fontColor||c).call(m.setPosition,0,0).text(n).attr("data-notex",1).call(g.convertToTspans);h.selectAll("tspan.line").call(m.setPosition,0,0);var p=e.select("text.name"),v=0;r&&r!==n?(p.call(m.font,t.fontFamily||f,t.fontSize||d,s).text(r).call(m.setPosition,0,0).attr("data-notex",1).call(g.convertToTspans),p.selectAll("tspan.line").call(m.setPosition,0,0),v=p.node().getBoundingClientRect().width+2*z):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var x,_,w=h.node().getBoundingClientRect(),k=t.xa._offset+(t.x0+t.x1)/2,O=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),E=w.width+S+z+v;t.ty0=A-w.top,t.bx=w.width+2*z,t.by=w.height+2*z,t.anchor="start",t.txwidth=w.width,t.tx2width=v,t.offset=0,o?(t.pos=k,x=O+P/2+E<=L,_=O-P/2-E>=0,"top"!==t.idealAlign&&x||!_?x?(O+=P/2,t.anchor="start"):t.anchor="middle":(O-=P/2,t.anchor="end")):(t.pos=O,x=k+D/2+E<=T,_=k-D/2-E>=0,"left"!==t.idealAlign&&x||!_?x?(k+=D/2,t.anchor="start"):t.anchor="middle":(k-=D/2,t.anchor="end")),h.attr("text-anchor",t.anchor),v&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+k+","+O+")"+(o?"rotate("+M+")":""))}),P}function o(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)?T: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 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 i(t,e){t.each(function(t){var r=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+s)+"V"+(c-S)+"Z"),a.call(m.setPosition,i+s,c+t.ty0-t.by/2+z).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(m.setPosition,l+o*z+s,c+t.ty0-t.by/2+z),r.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;r.hover=function(t,e,r){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return n(t,e,r),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l);return i(s,l.rotateLabels),s.node()}},{"../../lib":136,"../../lib/events":131,"../../lib/override_cursor":145,"../../lib/svg_text_utils":153,"../../plots/cartesian/axes":171,"../../registry":206,"../color":25,"../dragelement":46,"../drawing":49,"./constants":61,"./helpers":63,d3:7,"fast-isnumeric":10,tinycolor2:13}],65:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":136}],66:[function(t,e,r){"use strict";function n(t){var e=i.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){var n=t.hoverlabel||{},a=i.nestedProperty(n,r).get();return Array.isArray(a)?Array.isArray(e)&&Array.isArray(a[e[0]])?a[e[0]][e[1]]:a[e]:a}var o=t("d3"),i=t("../../lib"),l=t("../dragelement"),s=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:s.getDistanceFunction,getClosest:s.getClosest,inbox:s.inbox,castHoverOption:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":136,"../dragelement":46,"./attributes":58,"./calc":59,"./click":60,"./constants":61,"./defaults":62,"./helpers":63,"./hover":64,"./layout_attributes":67,"./layout_defaults":68,"./layout_global_defaults":69,d3:7}],67:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":132,"../../plots/font_attributes":195,"./constants":61}],68:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],76:[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":132,"../../plots/font_attributes":195,"../color/attributes":24}],77:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],78:[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,v="normal",m=0;m1)!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":136,"../../plots/layout_attributes":197,"../../registry":206,"./attributes":76,"./helpers":81}],79:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(i,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.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;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeT&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},T):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&A&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),A=!1):A=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?g===-1?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&g===-1&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vtspan"),f=u[0].length||1;r=l*f,n=c.node()&&v.bBox(c.node()).width;var d=l*(.3+(1-f)/2);c.attr("y",d),u.attr("y",d)}r=Math.max(r,16)+3,a.height=r,a.width=n}function l(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=k.isGrouped(a);if(k.isVertical(a))i&&e.each(function(t,e){v.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;v.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];u.select(this).select(".legendtoggle").call(v.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(),c=0,f=s.length;cn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),v.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+r,a.height=Math.max(a.height,e.height),y+=i+r,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center");var a="top";M.isBottomAnchor(r)?a="bottom":M.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),A=!0,T=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),L.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&_(t.calcdata,y),k=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var L=r._topdefs.selectAll("#"+i).data([0]);L.enter().append("clipPath").attr("id",i).append("rect");var C=A.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=A.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var z=A.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 O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==A.enter().size();P&&(l(t,O,D),s(t));var E=r.width,N=r.height;l(t,O,D),y.height>N?c(t):s(t);var I=r._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);M.isRightAnchor(y)?R-=y.width:M.isCenterAnchor(y)&&(R-=y.width/2),M.isBottomAnchor(y)?F-=y.height:M.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var q=y.height,H=I.h;q>H?(F=I.t,q=H):(F+q>N&&(F=N-q),F<0&&(F=0),q=Math.min(N-F,y.height)),v.setTranslate(A,R,F);var V,U,X=q-x.scrollBarHeight-2*x.scrollBarMargin,G=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),L.select("rect").attr({width:j-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),L.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),A.on("wheel",null),A.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/X*G,-G,0),V=x.scrollBarMargin-U/G*X,e(V,U),0!==U&&U!==-G&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var Y=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+X),U=-(V-x.scrollBarMargin)/X*G,e(V,U)});z.call(Y),S.call(Y)}if(t._context.editable){var Z,W,$,Q;A.classed("cursor-move",!0),g.init({element:A.node(),prepFn:function(){var t=v.getTranslate(A);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;v.setTranslate(A,r,n),Z=g.align(r,0,I.l,I.l+I.w,y.xanchor),W=g.align(n,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?A._clickTimeout=setTimeout(function(){o(i,t,n)},T):2===n&&(A._clickTimeout&&clearTimeout(A._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/interactions":121,"../../lib":136,"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/plots":199,"../../registry":206,"../color":25,"../dragelement":46,"../drawing":49,"./anchor_utils":75,"./constants":77,"./get_legend_data":80,"./helpers":81,"./style":83,d3:7}],80:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))s.indexOf(t)===-1?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[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 v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=v.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=s.select(this),a=t[0],o=(a.mlw+1||n.width+1)-1;e.style("stroke-width",o+"px").call(d.fill,a.mc||r.color),o&&e.call(d.stroke,a.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(){var t=e.line.width,r=s.select(this);r.style("stroke-width",t+"px").call(d.fill,e.fillcolor),t&&r.call(d.stroke,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.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var n=r.selectAll("g.legendsymbols").data([t]);n.enter().append("g").classed("legendsymbols",!0),n.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":136,"../../registry":206,"../../traces/pie/style_one":238,"../../traces/scatter/subtypes":260,"../color":25,"../drawing":49,d3:7}],84:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),i(v,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["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&&n(y),!c&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(v,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":136,"../color":25,"./attributes":88,"./button_attributes":89,"./constants":90}],92:[function(t,e,r){"use strict";function n(t){for(var e=m.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;lG&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),X=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),q=m.getDataToPixel(t,j),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,j),U=m.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(v=q(r.x0),y=H(r.y0),x=q(r.x1),b=H(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vY&&(h[S]=r[P]=U(c),h[z]=r[E]=U(u)),d-f>G&&(h[O]=r[N]=V(f),h[D]=r[I]=V(d))}e.attr("d",i(t,r))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,D,P,E,N,I,R,F,j,B,q,H,V,U,X,G=10,Y=10,Z={setCursor:a,element:e.node(),prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z)}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=m.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=m.decodeDate(n)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":136,"../../lib/setcursor":151,"../../plotly":166,"../../plots/cartesian/axes":171,"../color":25,"../dragelement":46,"../drawing":49,"./constants":103,"./helpers":106}],106:[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}},{}],107:[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":101,"./calc_autorange":102,"./defaults":104,"./draw":105}],108:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":136,"../../plots/cartesian/axes":171,"./attributes":101,"./helpers":106}],109:[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":132,"../../plots/animation_attributes":167,"../../plots/font_attributes":195,"../../plots/pad_attributes":198,"./constants":110}],110:[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}},{}],111:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",a);var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}return e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans),A.setTranslate(o,n,e.currentValueHeight),o}}function s(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]);n.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans),n}function u(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,m(e,t.fraction),C.tickOffset+e.ticklen+e.labelHeight+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(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(M.fill,r.bgcolor).attr("opacity",0),A.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(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.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 g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r] -}[x.side];e.attr("transform","translate("+g+")")}}}var g=r.propContainer,v=r.propName,m=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,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(d);var O="Click to enter "+y+" title";t._context.editable?(S?z.on(".opacity",null):function(){L=0,C=!0,S=O,z.attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),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(d)}).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)}},{"../../constants/interactions":121,"../../lib":136,"../../lib/svg_text_utils":153,"../../plotly":166,"../../plots/plots":199,"../color":25,"../drawing":49,d3:7,"fast-isnumeric":10}],115:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":132,"../../plots/font_attributes":195,"../../plots/pad_attributes":198,"../color/attributes":24}],116:[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"}},{}],117:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+C.headerGroupClassName).data(r,a);u.enter().append("g").classed(C.headerGroupClassName,!0);var f=o.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":136,"../color":25,"../drawing":49,d3:7}],121:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],122:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],123:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],124:[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}},{}],125:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.27.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/fx"),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=t("./components/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":23,"./components/fx":66,"./components/images":74,"./components/legend":82,"./components/rangeselector":94,"./components/rangeslider":100,"./components/shapes":107,"./components/sliders":113,"./components/updatemenus":119,"./fonts/mathjax_config":126,"./lib/queue":148,"./plot_api/plot_schema":160,"./plot_api/register":161,"./plot_api/set_plot_config":162,"./plot_api/to_image":164,"./plot_api/validate":165,"./plotly":166,"./snapshot":211,"./snapshot/download":208,"./traces/scatter":250,d3:7,"es6-promise":8}],126:[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},{}],127:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),n(t)?Number(t):a}},{"../constants/numerical":122,"fast-isnumeric":10}],128:[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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);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;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,L;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=T&&t<=L?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-A)%100+A:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},T=r.MIN_MS=r.dateTime2ms("-9999"),L=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var C=90*y,S=3*x,z=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=T&&t<=L))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=T+y&&t<=L-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=M("%Y"),E=M("%b %Y"),N=M("%b %-d"),I=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=P(g):"m"===r?d=E(g):"d"===r?(o=P(g),d=N(g)):(o=I(g),d=l(t,r))}return d+(o?"\n"+o:"")};var R=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+R);return s.setUTCMonth(s.getUTCMonth()+e)+a-R},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;ur?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.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||1/0!==u&&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)<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.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":127,"./coerce":128,"./dates":129,"./ensure_array":130,"./extend":132,"./filter_unique":133,"./filter_visible":134,"./identity":135,"./is_array":137,"./is_plain_object":138,"./loggers":139,"./matrix":140,"./mod":141,"./nested_property":142,"./noop":143,"./notifier":144,"./push_unique":147,"./relink_private":149,"./search":150,"./stats":152,"./to_log_range":154,d3:7}],137:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],138:[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}},{}],139:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":122,"./matrix":140}],147:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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":10}],153:[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-"+h.randstr([],64),o=d.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=d.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.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":"")+(m[n]||"");if("br"===n)return"
";var o,i=e[4];if("a"===n){var l=i&&i.match(T),c=l&&(l[3]||l[4]);if(o="':o+">"}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,d=t("d3"),h=t("../lib"),p=t("../constants/xmlns_namespaces"),g=t("../constants/string_mappings");r.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},d.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=r.getDOMParser(),a=n.parseFromString(e,"application/xml"),o=a.documentElement.firstChild;o;)this.node().appendChild(this.node().ownerDocument.importNode(o,!0)),o=o.nextSibling;return a.querySelector("parsererror")?(h.log(a.querySelector("parsererror div").textContent),null):d.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=d.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=l.attr("class")+"-math",f.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,f=d.select(l.node().parentNode);if(!f.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=h.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){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=f.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 d=n(s,"width"),h=n(s,"height"),g=+l.attr("x")-d*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||n(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-d/2,m-h/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-h/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-h/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},m={sup:'',sub:''},y=["http:","https:","mailto:"],x=new RegExp("]*)?/?>","g"),b=Object.keys(g.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:g.entityToUnicode[t]}}),_=Object.keys(g.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+g.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,k=/(<[^<>]*>)/,M=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,L=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(x," ")},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]")&&d.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=h.getPlotDiv(i.node()),e=d.select(t),n=e.select(".svg-container"),o=n.append("div");o.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,n,r)).on("blur",function(){t._editing=!1,i.text(this.textContent).style({opacity:1});var e,r=d.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&d.select(i.node().parentNode).select(e).style({opacity:0});var n=this.textContent;d.select(this).transition().duration(0).remove(),d.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var e=this;t._editing=!0,d.select(document).on("mouseup",function(){if(d.event.target===e)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===d.event.which?(t._editing=!1,i.style({opacity:1}),d.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),d.select(this).call(u(i,n,r)))}).on("keydown",function(){13===d.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=d.dispatch("edit","input","cancel"),s=d.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),d.rebind(this,l,"on")}},{"../constants/string_mappings":123,"../constants/xmlns_namespaces":124,"../lib":136,d3:7}],154:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":10}],155:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),C=L||[],S=n(m,f).get(),z=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),O===-1&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(O===-1)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sj.range[0]?[1,2]:[2,1]);else{var H=j.range[0],V=j.range[1];B?(H<=0&&V<=0&&r(I+".autorange",!0),H<=0?H=V/1e6:V<=0&&(V=H/1e6),r(I+".range[0]",Math.log(H)/Math.LN10),r(I+".range[1]",Math.log(V)/Math.LN10)):(r(I+".range[0]",Math.pow(10,H)),r(I+".range[1]",Math.pow(10,V)))}else r(I+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,F,T,r),w.getComponentMethod("images","convertCoords")(t,F,T,r)}else r(I+".autorange",!0)}else if(D.match(P.AX_NAME_PATTERN)){var U=x.nestedProperty(c,M).get(),X=(T||{}).type;X&&"-"!==X||(X="linear"),w.getComponentMethod("annotations","convertCoords")(t,U,X,r),w.getComponentMethod("images","convertCoords")(t,U,X,r)}var G=z.containerArrayMatch(M);if(G){o=G.array,i=G.index;var Y=G.property,Z=x.nestedProperty(s,o),W=(Z||[])[i]||{};if(""===i)M.indexOf("updatemenus")===-1&&(v.docalc=!0);else if(""===Y){var $=T;z.isAddVal(T)?b[M]=null:z.isRemoveVal(T)?(b[M]=W,$=W):x.warn("unrecognized full object value",e),(n($,"x")||n($,"y")&&M.indexOf("updatemenus")===-1)&&(v.docalc=!0)}else!n(W,"x")&&!n(W,"y")||x.containsAny(M,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);d[o]||(d[o]={});var Q=d[o][i];Q||(Q=d[o][i]={}),Q[Y]=T,delete e[M]}else if("reverse"===D)R.range?R.range.reverse():(r(I+".autorange",!0),R.range=[1,0]),F.autorange?v.docalc=!0:v.doplot=!0;else{var J=String(A.parts[1]||"");0===S.indexOf("scene")?"camera"===A.parts[1]?v.docamera=!0:v.doplot=!0:0===S.indexOf("geo")?v.doplot=!0:0===S.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===M?v.doplot=!0:"margin"===S||"autorange"===J||"rangemode"===J||"type"===J||"domain"===J||"fixedrange"===J||"scaleanchor"===J||"scaleratio"===J||M.indexOf("calendar")!==-1||M.match(/^(bar|box|font)/)?v.docalc=!0:!c._has("gl2d")||M.indexOf("axis")===-1&&"plot_bgcolor"!==M?"hiddenlabels"===M?v.docalc=!0:S.indexOf("legend")!==-1?v.dolegend=!0:M.indexOf("title")!==-1?v.doticks=!0:S.indexOf("bgcolor")!==-1?v.dolayoutstyle=!0:L>1&&x.containsAny(J,["tick","exponent","grid","zeroline"])?v.doticks=!0:M.indexOf(".linewidth")!==-1&&M.indexOf("axis")!==-1?v.doticks=v.dolayoutstyle=!0:L>1&&J.indexOf("line")!==-1?v.dolayoutstyle=!0:L>1&&"mirror"===J?v.doticks=v.dolayoutstyle=!0:"margin.pad"===M?v.doticks=v.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(M)!==-1||M.indexOf("spike")!==-1?v.domodebar=!0:["height","width","autosize"].indexOf(M)===-1&&(v.doplot=!0):v.doplot=!0,A.set(T)}}}for(o in d){z.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],v)||(v.doplot=!0)}var K=c._axisConstraintGroups;for(var tt in _)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&MM)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":49,"../components/errorbars":55,"../constants/xmlns_namespaces":124,"../lib":136,"../lib/events":131,"../lib/queue":148,"../lib/svg_text_utils":153,"../plotly":166,"../plots/cartesian/axis_ids":174,"../plots/cartesian/constants":176,"../plots/cartesian/constraints":178,"../plots/cartesian/graph_interact":180,"../plots/plots":199,"../plots/polar":202,"../registry":206,"./helpers":156,"./manage_arrays":157,"./subroutines":163,d3:7,"fast-isnumeric":10}],159:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],160:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[k]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=A,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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},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)||p.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){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||e.arrayOk===!0)){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}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;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":136,"../plotly":166,"../snapshot/cloneplot":207,"../snapshot/helpers":210,"../snapshot/svgtoimg":212,"../snapshot/tosvg":214,"fast-isnumeric":10}],165:[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,v=r.length,m=0;m.3*f||o(n)||o(a))){var d=r.dtick/2;t+=t+d.8){var i=Number(r.substr(1));o.exactYears>.8&&i%12==0?t=N.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=N.tickIncrement(t,r);if(l<=n)return l}return t}function o(t){var e,r,n=t.tickvals,a=t.ticktext,o=new Array(n.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;ru&&e10||"01-01"!==n.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>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=t.l2r(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 s(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function c(t,e,r,n){var a=t._tickround,o=r&&t.hoverformat||t.tickformat;n&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");s!==-1&&(i=l.substr(s+1),l=l.substr(0,s)),n&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(r?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function d(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,n)}function h(t,e,r,n){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=U[s/3+5])}return a?"\u2212"+t:t}function p(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,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 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(),_.simpleMap(r,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._input;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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(r)c=(s-l)/r;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},N.setConvert(h),N.autoTicks(h,c);var p,g=N.tickIncrement(N.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=n(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=N.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},N.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),N.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=N.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=N.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fC?(e/=C,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,F)):n>S?(e/=S,t.dtick="M"+i(e,1,j)):n>z?(t.dtick=i(e,z,q),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=i(e,O,j):n>D?t.dtick=i(e,D,B):n>P?t.dtick=i(e,P,B):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,F))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,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,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,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,F));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,n){var a=r?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,n);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?V:H,s=t+.01*a,c=_.roundUp(_.mod(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=_.simpleMap(t.range,e),n=r[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":122,"../../lib":136,"fast-isnumeric":10}],173:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,r,p,g){function v(r,n){return o.coerce2(t,e,l,r,n)}var m=p.letter,y=p.font||{},x="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",b=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?h(m,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=r("color"),k=w===t.color?w:y.color;r("title",x),o.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,r,_),u(t,e,r,_,p),c(t,e,r,p);var M=v("linecolor",w),A=v("linewidth"),T=r("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var L=v("gridcolor",n(w,p.bgColor,i).toRgbString()),C=v("gridwidth");r("showgrid",p.showGrid||!!L||!!C)||(delete e.gridcolor,delete e.gridwidth);var S=v("zerolinecolor",w),z=v("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!z)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":24,"../../lib":136,"../../registry":206,"./category_order_defaults":175,"./layout_attributes":182,"./ordered_categories":184,"./set_convert":188,"./tick_label_defaults":189,"./tick_mark_defaults":190,"./tick_value_defaults":191,tinycolor2:13}],174:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],176:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],177:[function(t,e,r){"use strict";function n(t,e,r,n){var a,o,l,s,c=n[i(e)].type,u=[];for(o=0;oo*p))for(r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,r,n,a,o){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return["lasso","select"].indexOf(t)!==-1}function v(t,e){return"M"+(t.l-.5)+","+(e-I-.5)+"h-3v"+(2*I+1)+"h3ZM"+(t.r+.5)+","+(e-I-.5)+"h3v"+(2*I+1)+"h-3Z"}function m(t,e){return"M"+(e-I-.5)+","+(t.t-.5)+"v-3h"+(2*I+1)+"v3ZM"+(e-I-.5)+","+(t.b+.5)+"v3h"+(2*I+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,I)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,r){var n,a,o,i,l,s,c=!1,u={},f={};for(n=0;nI||l>I?(wt="xy",i/nt>l/at?(l=i*at/nt,mt>o?yt.t=mt-l:yt.b=mt+l):(i=l*nt/at,vt>a?yt.l=vt-i:yt.r=vt+i),Mt.attr("d",y(yt))):n():!it||lzoom back out","long"),R=!1)}function X(e,r){var n=1===(j+B).length;if(e)$();else if(2!==r||n){if(1===r&&n){var a=j?tt[0]:K[0],i="s"===j||"w"===B?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;j?(u="n"===j?"top":"bottom","right"===a.side&&(c="right")):"e"===B&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(pt).call(A.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,l,r)})}}else W()}function G(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var n=t.querySelector(".plotly");if(q(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Tt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ct.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(B||st){for(B||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":136,"fast-isnumeric":10}],186:[function(t,e,r){"use strict";e.exports=function(t,e,r){void 0===r&&(r=.5);var n=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=n[0]+(n[1]-n[0])*r,o=(a-n[0])*e;t.range=t._input.range=[t.l2r(a-o),t.l2r(a+o)]}},{}],187:[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,v=a.element.getBoundingClientRect(),m=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-v.left,b=r-v.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),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,D,P,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,F=[];for(z=0;zd?h:i(t)?Number(t):h):h}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../lib"),s=l.cleanNumber,c=l.ms2DateTime,u=l.dateTime2ms,f=t("../../constants/numerical"),d=f.FP_SAFE,h=f.BADNUM,p=t("./constants"),g=t("./axis_ids");e.exports=function(t,e){function r(e,r){if(e>0)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*w*Math.abs(n-a))}return h}function f(e,r,n){var a=u(e,n||t.calendar);if(a===h){if(!i(e))return h;a=u(new Date(+e))}return a}function v(e,r,n){return c(e,r,n||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if("number"==typeof e)return e}function b(e){return i(e)?o.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:a,t.l2c="log"===t.type?n:a,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,t.p2c="log"===t.type?function(t){return n(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=a,t.d2p=t.r2p=function(t){return b(s(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=a,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return b(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(t){return b(s(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=l.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(t,e,r){return b(f(t,0,r))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2l_noadd=x,t.r2l=t.l2r=t.r2c=t.c2r=a,t.d2p=function(t){return b(x(t))},t.p2d=function(t){return m(_(t))},t.r2p=b,t.p2r=_),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=l.nestedProperty(t,e).get(),o=(t._id||"x").charAt(0);if(n="date"===t.type?l.dfltRange(t.calendar):"y"===o?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void l.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=l.cleanDate(a[0],h,t.calendar),a[1]=l.cleanDate(a[1],h,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!l.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=l.constrain(t.r2l(a[0]),l.MIN_MS+1e3,l.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!i(a[r])){if(!i(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-d?a[r]=-d:a[r]>d&&(a[r]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var i=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(i);var c=t.r2l(t[i][0],s),u=t.r2l(t[i][1],s);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw l.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,o,i="date"===t.type&&e[r+"calendar"];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?a.dateTick0(e.calendar):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":122,"../../lib":136,"fast-isnumeric":10}],192:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(e,r){function n(e,r){for(a=0;ar.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(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}(v,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":49,"../../plotly":166,"../../registry":206,"./axes":171,d3:7}],193:[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 c=a(e,r,n);if(c){if("histogram"===c.type&&n==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=n+"calendar",f=c[u];if(i(c,n)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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"),s=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),s.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=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).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||[],i=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var s=r.width,u=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=s),a.height||(n.height=u)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,h=t._context&&t._context.autosizable;f&&(d||h)?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,i,a,n),n._has=p._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var u=o(t._boundingBoxMargins),d=u.left+u.right,h=u.bottom+u.top,g=1-2*l,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-d)),a=Math.round(g*(v.height-h))}else{var m=c?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,a=parseFloat(m.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;c.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];n._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),u=e._pushmargin;if(e.margin.autoexpand!==!1){u.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(u),d=0;dv){var M=(m*w+(k-e.width)*v)/(w-v),A=(k*(1-v)+(m-e.width)*(1-w))/(w-v);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(s(x)&&u[_].t){var T=u[_].t.val,L=u[_].t.size;if(T>y){var C=(x*T+(L-e.height)*y)/(T-y),S=(L*(1-y)+(x-e.height)*(1-T))/(T-y);C>=0&&S>=0&&C+S>l+i&&(l=C,i=S)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(f.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):f.isJSDate(t)?f.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===n?c:JSON.stringify(c)},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 c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,u=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=L?f.angularAxis.domain:n.extent(k),S=Math.abs(k[1]-k[0]);A&&!M&&(S=0);var z=C.slice();T&&M&&(z[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(z[1]-z[0])/O);var D=f.angularAxis.ticksStep||(z[1]-z[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),z[2]||(z[2]=D);var P=n.range.apply(this,z);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(z.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?S:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),N=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(N)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},j={"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 B=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=void 0===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:I,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=I.node().getBBox();x=Math.min(f.width-q.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}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(j).text(f.title),U=V.node().getBBox();V.attr({x:_[0]-U.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(F),G.attr("r",a),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(F);var Y=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Z=n.svg.axis().scale(a).ticks(5).tickSize(5);X.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(F),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),$=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),$.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(F),$.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var Q=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(j);f.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(Y).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(Y).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(Y).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},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(void 0===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;return[t*Math.cos(r),t*Math.sin(r)]},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 v.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,a,o)},"stroke-width":function(t,e){return v["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,a,o)},opacity:function(t,e){return v.opacity(r,a,o)},display:function(t,e){return v.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 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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.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=[i.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),o(e[r],i.PolyChart.defaultConfig()),o(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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),v=n.scale[u?"linear":"ordinal"]().domain(g).range(s),m=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,m(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=n.svg.axis().scale(m).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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){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);if([[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"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":136,d3:7}],204:[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":25,"../../lib":136,"./micropolar":203,"./undo_manager":205,d3:7}],205:[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-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)),d=t._context||{};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&&A>0,j=k<=I&&A<=R,B=k<=R&&A<=I,q="h"===m?I>=k*(R/A):R>=A*(I/k);F&&(j||B||q)?x="inside":(x="outside",b.remove(),b=null)}else x="inside";if(!b&&(b=g(e,y,"outside"===x?C:L),_=M.bBox(b.node()),k=_.width,A=_.height,k<=0||A<=0))return void b.remove();var H;H="outside"===x?o(i,d,h,p,_,m):a(i,d,h,p,_,m),b.attr("transform",H)}}}function a(t,e,r,n,a,o){var l,s,c,u,f,d=a.width,h=a.height,p=(a.left+a.right)/2,g=(a.top+a.bottom)/2,v=Math.abs(e-t),m=Math.abs(n-r);v>2*D&&m>2*D?(f=D,v-=2*f,m-=2*f):f=0;var y,x;return d<=v&&h<=m?(y=!1,x=1):d<=m&&h<=v?(y=!0,x=1):dr?(c=(t+e)/2,u=n-f-s/2):(c=(t+e)/2,u=n+f+s/2),i(p,g,c,u,x,y)}function o(t,e,r,n,a,o){var l,s="h"===o?Math.abs(n-r):Math.abs(e-t);s>2*D&&(l=D,s-=2*l);var c,u,f,d,h="h"===o?Math.min(1,s/a.height):Math.min(1,s/a.width),p=(a.left+a.right)/2,g=(a.top+a.bottom)/2;return c=h*a.width,u=h*a.height,"h"===o?er?(f=(t+e)/2,d=n+l+u/2):(f=(t+e)/2,d=n-l-u/2),i(p,g,f,d,h,!1)}function i(t,e,r,n,a,o){var i,l;return a<1?i="scale("+a+") ":(a=1,i=""),l=o?"rotate("+o+" "+t+" "+e+") ":"","translate("+(r-a*t)+" "+(n-a*e)+")"+i+l}function l(t,e){var r=h(t.text,e);return p(L,r)}function s(t,e){var r=h(t.textposition,e);return g(C,r)}function c(t,e,r){return d(S,t.textfont,e,r)}function u(t,e,r){return d(z,t.insidetextfont,e,r)}function f(t,e,r){return d(O,t.outsidetextfont,e,r)}function d(t,e,r,n){e=e||{};var a=h(e.family,r),o=h(e.size,r),i=h(e.color,r);return{family:p(t.family,a,n.family),size:v(t.size,o,n.size),color:m(t.color,i,n.color)}}function h(t,e){var r;return Array.isArray(t)?ea))return e}return void 0!==r?r:t.dflt}function m(t,e,r){return b(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),x=t("fast-isnumeric"),b=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),k=t("../../components/color"),M=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),L=T.text,C=T.textposition,S=T.textfont,z=T.insidetextfont,O=T.outsidetextfont,D=3;e.exports=function(t,e,r){var a=e.xaxis,o=e.yaxis,i=t._fullLayout,l=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);l.enter().append("g").attr("class","trace bars"),l.append("g").attr("class","points").each(function(e){var r=e[0].t,l=e[0].trace,s=r.poffset,c=Array.isArray(s);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,u){function f(t){return 0===i.bargap&&0===i.bargroupgap?y.round(Math.round(t)-A,2):t}function d(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)}var h,p,g,v,m=r.p+(c?s[u]:s),b=m+r.w,_=r.b,w=_+r.s;if("h"===l.orientation?(g=o.c2p(m,!0),v=o.c2p(b,!0),h=a.c2p(_,!0),p=a.c2p(w,!0)):(h=a.c2p(m,!0),p=a.c2p(b,!0),g=o.c2p(_,!0),v=o.c2p(w,!0)),!(x(h)&&x(p)&&x(g)&&x(v)&&h!==p&&g!==v))return void y.select(this).remove();var M=(r.mlw+1||l.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(M/2%1,2);if(!t._context.staticPlot){var T=k.opacity(r.mc||l.marker.color),L=T<1||M>.01?f:d;h=L(h,p),p=L(p,h),g=L(g,v),v=L(v,g)}var C=y.select(this);C.append("path").attr("d","M"+h+","+g+"V"+v+"H"+p+"V"+g+"Z"),n(t,C,e,u,h,p,g,v)})}),l.call(A.plot,e)}},{"../../components/color":25,"../../components/drawing":49,"../../components/errorbars":55,"../../lib":136,"../../lib/svg_text_utils":153,"./attributes":216,d3:7,"fast-isnumeric":10,tinycolor2:13}],224:[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;cc+l||!y(s))&&(f=!0,d(u,t))}for(var a=r.traces,o=m(e),i="fraction"===t._fullLayout.barnorm?1:100,l=i/1e9,s=e.l2c(e.c2l(0)),c="stack"===t._fullLayout.barmode?i:s,u=[s,c],f=!1,h=0;h1||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":25,"../../components/drawing":49,"../../components/errorbars":55,d3:7}],227:[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":25,"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38}],228:[function(t,e,r){"use strict";var n=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:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},hovertext:{valType:"string",dflt:"",arrayOk:!0},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:i({},o.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:i({},a,{}),insidetextfont:i({},a,{}),outsidetextfont:i({},a,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},hole:{valType:"number",min:0,max:1,dflt:0},sort:{valType:"boolean",dflt:!0},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise"},rotation:{valType:"number",min:-360,max:360,dflt:0},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0}}},{"../../components/color/attributes":24,"../../lib/extend":132,"../../plots/attributes":169,"../../plots/font_attributes":195}],229:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n")}return g};var s},{"../../components/color":25,"./helpers":232,"fast-isnumeric":10,tinycolor2:13}],231:[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")),i("marker.line.width")&&i("marker.line.color");var u=i("marker.colors");Array.isArray(u)||(e.marker.colors=[]),i("scalegroup");var f=i("text"),d=i("textinfo",Array.isArray(f)?"text+percent":"percent");if(i("hovertext"),i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var h=i("textposition"),p=Array.isArray(h)||"auto"===h,g=p||"inside"===h,v=p||"outside"===h;if(g||v){var m=l(i,"textfont",o.font);g&&l(i,"insidetextfont",m),v&&l(i,"outsidetextfont",m)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":136,"./attributes":228}],232:[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":136}],233:[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":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,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],235:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){!function(r,o){n.coerce(t,e,a,r,o)}("hiddenlabels")}},{"../../lib":136,"./layout_attributes":234}],236:[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)),v={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>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 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]}var a,o,i,l,s,c,u,f,d,h,p,g,v;for(o=0;o<2;o++)for(i=o?r:n,s=o?Math.max:Math.min,u=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(i),d=t[1-o][a],h=d.concat(f),g=[],p=0;p0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[i.i]||((t.pxmid[1]-i.pxmid[1])*u>0?(f=i.cyFinal+s(i.px0[1],i.px1[1]),(x=f-v-t.labelExtraY)*u>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*u>0&&(n=3*c*Math.abs(a-h.indexOf(t)),d=i.cxFinal+l(i.px0[0],i.px1[0]),(p=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*c>0&&(t.labelExtraX+=p)))}(g[p],m)}}}function l(t,e){var r,n,a,o,i,l,s,u,f,d,h=[];for(a=0;au&&(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("../../components/fx"),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],v=c.trace,m=(v.depth||0)*c.r*Math.sin(0)/2,y=v.tiltaxis||0,x=y*Math.PI/180,b=[m*Math.sin(x),m*Math.cos(x)],_=c.r*Math.cos(0),w=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function i(n){n.originalEvent=u.event;var o=t._fullLayout,i=t._fullData[v.index],l=i.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),t._dragging||o.hovermode===!1||"none"===l||"skip"===l||!l)return void f.hover(t,n,"pie");var s=a(e,c),d=w+e.pxmid[0]*(1-s),h=k+e.pxmid[1]*(1-s),p=r.separators,m=[];l.indexOf("label")!==-1&&m.push(e.label),l.indexOf("text")!==-1&&(i.hovertext?m.push(Array.isArray(i.hovertext)?i.hovertext[e.i]:i.hovertext):i.text&&i.text[e.i]&&m.push(i.text[e.i])),l.indexOf("value")!==-1&&m.push(g.formatPieValue(e.v,p)),l.indexOf("percent")!==-1&&m.push(g.formatPiePercent(e.v/c.vTotal,p));var y=i.hoverlabel;f.loneHover({x0:d-s*c.r,x1:d+s*c.r,y:h,text:m.join("
"),name:l.indexOf("name")!==-1?i.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:e.hbg||y.bgcolor||e.color,borderColor:e.hbc||y.bordercolor,fontFamily:e.htf||y.font.family,fontSize:e.hts||y.font.size,fontColor:e.htc||y.font.color},{container:o._hoverlayer.node(),outerContainer:o._paper.node()}),f.hover(t,n,"pie"),T=!0}function l(e){e.originalEvent=u.event,t.emit("plotly_unhover",{event:u.event,points:[e]}),T&&(f.loneUnhover(r._hoverlayer.node()),T=!1)}function d(){t._hoverdata=[e],t._hoverdata.trace=c.trace,f.click(t,u.event)}function x(t,r,n,a){return"a"+a*c.r+","+a*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-t[0])+","+a*(r[1]-t[1])}if(e.hidden)return void u.select(this).selectAll("path,g").remove();s[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=c.cx+b[0],k=c.cy+b[1],M=u.select(this),A=M.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),M.select("path.textline").remove(),M.on("mouseover",i).on("mouseout",l).on("click",d),v.pull){var L=+(Array.isArray(v.pull)?v.pull[e.i]:v.pull)||0;L>0&&(w+=L*e.pxmid[0],k+=L*e.pxmid[1])}e.cxFinal=w,e.cyFinal=k;var C=v.hole;if(e.v===c.vTotal){var S="M"+(w+e.px0[0])+","+(k+e.px0[1])+x(e.px0,e.pxmid,!0,1)+x(e.pxmid,e.px0,!0,1)+"Z";C?A.attr("d","M"+(w+C*e.px0[0])+","+(k+C*e.px0[1])+x(e.px0,e.pxmid,!1,C)+x(e.pxmid,e.px0,!1,C)+"Z"+S):A.attr("d",S)}else{var z=x(e.px0,e.px1,!0,1);if(C){var O=1-C;A.attr("d","M"+(w+C*e.px1[0])+","+(k+C*e.px1[1])+x(e.px1,e.px0,!1,C)+"l"+O*e.px0[0]+","+O*e.px0[1]+z+"Z")}else A.attr("d","M"+w+","+k+"l"+e.px0[0]+","+e.px0[1]+z+"Z")}var D=Array.isArray(v.textposition)?v.textposition[e.i]:v.textposition,P=M.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]);P.enter().append("g").classed("slicetext",!0),P.exit().remove(),P.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(e.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 r,a=h.bBox(t.node());"outside"===D?r=o(a,e):(r=n(a,e,c),"auto"===D&&r.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),a=h.bBox(t.node())),r=o(a,e)));var i=w+e.pxmid[0]*r.rCenter+(r.x||0),l=k+e.pxmid[1]*r.rCenter+(r.y||0);r.outside&&(e.yLabelMin=l-a.height/2,e.yLabelMid=l,e.yLabelMax=l+a.height/2,e.labelExtraX=0,e.labelExtraY=0,m=!0),t.attr("transform","translate("+i+","+l+")"+(r.scale<1?"scale("+r.scale+")":"")+(r.rotate?"rotate("+r.rotate+")":"")+"translate("+-(a.left+a.right)/2+","+-(a.top+a.bottom)/2+")")})}),m&&i(s,v),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]);Math.abs(l)>Math.abs(s)?o+="l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):o+="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":25,"../../components/drawing":49,"../../components/fx":66,"../../lib/svg_text_utils":153,"./helpers":232,d3:7}],237:[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":238,d3:7}],238:[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}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":25}],239:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,c=r.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(f,h,v),a.expand(d,p,m);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],243:[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":28,"../../components/colorscale":39,"../../lib":136,"../../plots/plots":199,"fast-isnumeric":10}],244:[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":31,"../../components/colorscale/has_colorscale":38,"./subtypes":260}],245:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],246:[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 v=l(t,e,p,g),m=vq!=P>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-D)/(P-D),R=Math.min(R,S),F=Math.max(F,S));R=Math.max(R,0),F=Math.min(F,d._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:s+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":25,"../../components/errorbars":55,"../../components/fx":66,"../../lib":136,"./get_trace_color":248}],250:[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":181,"./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,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,i,l){var s=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||r)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38}],252:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var o,i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],C=.2,S=new Array(t.length),z=0;for(k||(A=C=-1),o=0;oa(u))break;l=u,m=p[0]*h[0]+p[1]*h[1],m>g?(g=m,s=u,d=!1):m=t.length||!u)break;S[z++]=u,i=u}}else S[z++]=s}L.push(S.slice(0,z))}return L}},{"../../constants/numerical":122}],253:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],254:[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":10}],256:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(r=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?n.background:n.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":25,"../../components/colorscale/defaults":34,"../../components/colorscale/has_colorscale":38,"./subtypes":260}],257:[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,d,p){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function x(){return!1}function b(e){var r,n,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,m=x;f&&(p=o.marker.maxdisplayed||o._needsCull?v:l.identity),d&&(m=o.marker.maxdisplayed||o._needsCull?v:l.identity),n=c.selectAll("path.point"),r=n.data(p,h);var b=r.enter().append("path").classed("point",!0);b.call(s.pointStyle,o).call(s.translatePoints,M,A,o),k&&b.style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");r.each(function(e){var r=i.select(this),n=g(r);(a=s.translatePoint(e,n,M,A))&&(s.singlePointStyle(e,n,o,_,w,t),o.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),k?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=c.selectAll("g"),r=n.data(m,h),r.enter().append("g").classed("textpoint",!0).append("text"),r.each(function(t){var e=i.select(this),r=g(e.select("text"));(a=s.translatePoint(t,r,M,A))||e.remove()}),r.selectAll("text").call(s.textPointStyle,o).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;o(t,e,r,n,a);var k=!!p&&p.duration>0,M=r.xaxis,A=r.yaxis,T=n[0].trace,L=T.line,C=i.select(d);if(C.call(c.plot,r,p),T.visible===!0){g(C).style("opacity",T.opacity);var S,z,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=C;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",z=E._nextFill,P=E._polygons);var N,I,R,F,j,B,q,H,V,U="",X="",G=[],Y=[],Z=l.noop;if(S=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(z&&z.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(R=s.steps(L.shape),F=s.steps(L.shape.split("").reverse().join(""))):R=F="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return F(t.reverse())},G=f(n,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(G.length),w=0;w1}),Z=function(t){return function(e){if(N=R(e),I=j(e),U?O?(U+="L"+N.substr(1),X=I+"L"+X.substr(1)):(U+="Z"+N,X=I+"Z"+X):(U=N,X=I),u.hasLines(T)&&e.length>1){var r=i.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",N).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",N),s.singleLineStyle(n,a)}}}}}var W=C.selectAll(".js-line").data(Y);g(W.exit()).style("opacity",0).remove(),W.each(Z(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),G.length&&(S?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(S).attr("d","M"+H+"L"+B+"L"+U.substr(1))):g(S).attr("d",U+"Z")):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(z).attr("d",U+"Z"+D+"Z"):g(z).attr("d",U+"L"+D.substr(1)+"Z"),T._polygons=T._polygons.concat(P)),T._prevRevpath=X,T._prevPolygons=V);var $=C.selectAll(".points");_=$.data([n]),$.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,s=r.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=n[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=n.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),v=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),d(t,e,r),n(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),v){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":49,"../../components/errorbars":55,"../../lib":136,"../../lib/polygon":146,"./line_points":252,"./link_traces":254,"./subtypes":260,d3:7}],258:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.index,h=f.marker,p=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!p){var g=Array.isArray(h.opacity)?1:h.opacity;if(e===!1)for(r=0;re?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 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,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=$),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 $(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 Q(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?ji:Math.acos(t)}function nt(t){return t>1?qi:t<-1?-qi: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=vt(a)*Ji,n=vt(n)*Ki,o=vt(o)*tl,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)*Ui,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 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=nl.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=mt((.4124564*t+.3575761*e+.1804375*r)/Ji),a=mt((.2126729*t+.7151522*e+.072175*r)/Ki);return ht(116*a-16,500*(n-a),200*(a-mt((.0193339*t+.119192*e+.9503041*r)/tl)))}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,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 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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Nt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=al,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=ul.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="",v="",m=!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,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=fl.get(h)||Bt;var x=c&&f;return function(t){var r=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),r=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))+r}}}function Bt(t){return t+""}function Ht(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function qt(t,e,r){function n(e){var r=t(e),n=o(r,1);return e-r1)for(;i=c)return-1;if(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=S[i in gl?e.charAt(l++):i])||(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,C.c.toString(),e,n)}function s(t,e,n){return r(t,C.x.toString(),e,n)}function c(t,e,n){return r(t,C.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,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{hl=Ht;var e=new hl;return e._=t,n(e)}finally{hl=Date}}var n=e(t);return r.parse=function(t){try{hl=Ht;var e=n.parse(t);return e&&e._}finally{hl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Xt(g),_=Yt(g),w=Xt(v),k=Yt(v),M=Xt(m),A=Yt(m),T=Xt(y),L=Yt(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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(dl.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: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:Zt,W:$t,x:s,X:c,y:Jt,Y:Qt,Z:Kt,"%":ce};return e}function Gt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o68?1900:2e3)}function ee(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){vl.lastIndex=0;var n=vl.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+Gt(n,"0",2)+Gt(a,"0",2)}function ce(t,e,r){ml.lastIndex=0;var n=ml.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);kl.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Ml.point=function(i,l){Ml.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Ml.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 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,v=e(o),m=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=qe(m,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]-qi-Ri:qi-t[1])-((e=e.x)[0]<0?e[1]-qi-Ri:qi-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?qi:-qi),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 He(t,e,r,n){var a;if(null==t)a=r*qi,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(kl.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=r^m>=r){var T=xe(me(f),me(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*nt(L[2]);(n>C||n===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 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),v=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 m;v&o||!(m=n(p,r,!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||r&&Me(r,p)||t.point(p[0],p[1]),r=p,s=g,o=v},lineEnd:function(){s&&t.lineEnd(),r=null},clean:function(){return u|(c&&s)<<1}}}function n(t,e,r){var n=me(t),a=me(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);be(p,_e(l,d));var g=h,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-v-x)/m);if(be(b,p),b=ke(b),!r)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)ji^(w<=b[0]&&b[0]<=k)){var S=_e(g,(-v+x)/m);return be(S,p),[b,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;return Ne(e,r,vr(t,6*Vi),i?[0,-t]:[-ji,t-ji])}function Ue(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 Ge(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=v.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(){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(-Fl,Math.min(Fl,t)),e=Math.max(-Fl,Math.min(Fl,e));var r=u(t,e);if(v&&m.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}};C(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,v,m,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Ue(t,e,r,n),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,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=v=m=null}};return S}}function Xe(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 Ye(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 Ze(){function t(t,e){Bl+=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){tVl&&(Vl=t),eUl&&(Ul=e)}function $e(){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=Qe(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=Qe(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function Qe(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){Ll+=t,Cl+=e,++Sl}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);zl+=i*(e+t)/2,Ol+=i*(r+n)/2,Dl+=i,Je(e=t,r=n)}var e,r;Yl.point=function(n,a){Yl.point=t,Je(e=n,r=a)}}function tr(){Yl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);zl+=i*(n+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-n*e,Pl+=i*(n+t),El+=i*(a+e),Nl+=3*i,Je(n=t,a=e)}var e,r,n,a;Yl.point=function(o,i){Yl.point=t,Je(e=n=o,r=a=i)},Yl.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=me([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=_,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: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,v,m){var y=u-e,x=f-r,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 ar(t){var e=nr(function(e,r){return t([e*Ui,r*Ui])});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[0]*Ui,t[1]*Ui]}function n(){l=ze(i=dr(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=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,v=0,m=0,y=0,x=0,_=Rl,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,Rl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ge(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,v=t[1]%360*Vi,n()):[g*Ui,v*Ui]},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,n()):[m*Ui,y*Ui,x*Ui]},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-Bi:t<-ji?t+Bi:t,e]}function dr(t,e,r){return t?e||r?ze(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-Bi:e<-ji?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 vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=mr(r,a),o=mr(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<-qi+Ri&&(e=-qi+Ri):e>qi-Ri&&(e=qi-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))-qi]},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 Fr(t){var e=ls.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),as.remove(t),ls.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];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(!((a=o-Vr(l,i))>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(as.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),as.insert(s,r),s.edge=r.edge=Kr(e.site,s.site),Zr(e),void Zr(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,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};en(r.edge,c,p,b),s.edge=Kr(c,t,null,b),r.edge=Kr(t,p,null,b),Zr(e),Zr(r)}}function qr(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 qr(r,e);var n=t.site;return n.y===e?n.x:1/0}function Ur(t){this.site=t,this.edges=[]}function Gr(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=ns,v=g.length;v--;)if((o=g[v])&&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,v=(s*p-u*h)/d,f=v+l,m=ss.pop()||new Yr;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=is._;x;)if(m.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:v,y:s};r={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)/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=fs.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 Cn(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 zn(t){return 1-Math.cos(t*qi)}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 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 Bn(t){var e=[t.a,t.b],r=[t.c,t.d],n=qn(e),a=Hn(e,r),o=qn(Vn(r,e,-a))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Un(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Un(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Un(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Un(r)+"skewX("+e+")")}function Zn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Un(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(Un(r)+"scale("+e+")")}function Wn(t,e){var r=[],n=[];return t=ui.transform(t),e=ui.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Zn(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 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((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(Sa),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 Ba(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ha(t){var e=t.children;return e&&e.length?Ha(e[0]):t}function qa(t){var e,r=t.children;return r&&(e=r.length)?qa(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ua(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 Ga(t){var e=t[0],r=t[t.length-1];return e2?$a:Ya,s=n?Qn:$n;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 Qa(t,e,r,n)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Za(t,Wa(to(t,e)[2])),Za(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Ga(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=ul.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 ks?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=Za(n.map(a),r?Math:As);return t.domain(e),n=e.map(o),i},i.ticks=function(){var t=Ga(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 Ms;arguments.length<2?r=Ms:"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,v=d-u,m=h-f,y=v*v+m*m,x=r-n,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*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=Ct(r),p=Ct(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 qo(t){return t.length<3?ko(t):t[0]+Oo(t,Ho(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($s,a);return o==$s.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/$s[o-1]<$s[o]/a?o-1:o]:[Ks,to(t,r)[2]]}return n.invert=function(e){return li(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(li)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,li(+r+1),e).length}var o=n.domain(),i=Ga(o),l=null==t?a(i,10):"number"==typeof t&&a(i,t);return l&&(t=l[0],e=l[1]),n.domain(Za(o,e>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=Ga(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,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,r){vi.call(this,t,e,r+"")},mi.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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=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++],v=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)},Ci=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Ci=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,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,r,n,a,o=[];t=z(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}},Si.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))},Si.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},Si.sort=function(t){t=U.apply(this,arguments);for(var e=-1,r=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 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=Q(a);Bs.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 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];m=d*d+h*h}}function n(){var t,e,r,n,i=ui.touches(p);Bs.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,fl=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))))}}),dl=ui.time={},hl=Date;Ht.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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=qt(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=qt(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=qt(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});dl[t+"s"]=r.range,dl[t+"s"].utc=r.utc.range,dl[t+"OfYear"]=function(t){var r=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,ml=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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=me([e*Vi,r*Vi]);if(m){var a=xe(m,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]*Ui*c,v=bi(s)>180;if(v^(c*ph&&(h=y)}else if(g=(g+360)%360-180,v^(c*ph&&(h=r);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,r);m=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=d,_.point=t,m=null}function a(t,r){if(m){var n=t-p;y+=bi(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ml.point(t,r),e(t,r)}function o(){Ml.lineStart()}function i(){a(g,v),Ml.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 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){Al=Tl=Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,Il);var e=Pl,r=El,n=Nl,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 jl,Bl,Hl,ql,Vl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Gl.lineStart=Ze},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,jl+=bi(Bl/2)}},Xl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Yl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Yl.lineStart=er},polygonEnd:function(){Yl.point=Je,Yl.lineStart=Ke,Yl.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 jl=0,ui.geo.stream(t,a(Gl)),jl},t.centroid=function(t){return Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,a(Yl)),Nl?[Pl/Nl,El/Nl]:Dl?[zl/Dl,Ol/Dl]:Sl?[Ll/Sl,Cl/Sl]:[NaN,NaN]},t.bounds=function(t){return Vl=Ul=-(Hl=ql=1/0),ui.geo.stream(t,a(Xl)),[[Hl,ql],[Vl,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 $e: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]*=Ui,e[1]*=Ui,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]*=Ui,e[1]*=Ui,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]*=Ui,t[1]*=Ui}}),{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=vr((e=+n)*Vi,a*Vi),t):e},t.precision=function(n){return arguments.length?(r=vr(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/v)*v,a,v).map(d).concat(ui.range(Math.ceil(c/m)*m,s,m).map(h)).concat(ui.range(Math.ceil(n/p)*p,r,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 r,n,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?(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?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(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 Zl=0,ui.geo.stream(t,Wl),Zl};var Zl,Wl={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},$l=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr($l)}).raw=$l;var Ql=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Ql)}).raw=Ql,(ui.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Jl=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(Jl)}).raw=Jl,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-qi]},(ui.geo.mercator=function(){return Cr(Lr)}).raw=Lr;var Kl=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(Kl)}).raw=Kl;var ts=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(ts)}).raw=ts,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-qi]},(ui.geo.transverseMercator=function(){var t=Cr(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,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(r),o=Ct(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]]:[]).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=zr,a=Or,o=n,i=a,l=cs;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=r.site,i=r.edges.sort(Xr),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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,v,m,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,v=r,m=n,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=pn();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gn(t,A,g,v,m,y)},A.find=function(t){return vn(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=hs.get(r)||ds,n=ps.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 Bn(r?r.matrix:gs)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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=Ct(e),t):n},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(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,Ca),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,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,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 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,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&&!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=ja(e)):(t.x=i?c+=r(t,i):0,t.y=0,i=t)});var u=Ha(s),f=qa(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=Hi)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===zs?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=nt(v/c*Math.sin(m))),t&&(T=nt(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 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=Go,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=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=Xo;return t.source=function(r){return arguments.length?(e=Ct(r),t):e},t.target=function(e){return arguments.length?(r=Ct(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=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Ns.get(e.call(this,t,n))||$o)(r.call(this,t,n))}var e=Wo,r=Zo;return t.type=function(r){return arguments.length?(e=Ct(r),t):e},t.size=function(e){return arguments.length?(r=Ct(e),t):r},t};var Ns=ui.map({circle:$o,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*Rs)),r=e*Rs;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/Is),r=e*Is/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),r=e*Is/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Ns.keys();var Is=Math.sqrt(3),Rs=Math.tan(30*Vi);Si.transition=function(t){for(var e,r,n=Fs||++qs,a=ei(t),o=[],i=js||{time:Date.now(),ease:Cn,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(_),n=!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>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){return 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)}},{}],10:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],11:[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,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=n},{}],12:[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(){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 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=L(t,360),e=L(e,100),r=L(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=L(t,255),e=L(e,255),r=L(r,255);var n,a,o=U(t,e,r),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){z(t)&&(t="100%");var n=O(t);return t=V(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 V(1,U(0,t))}function S(t){return parseInt(t,16)}function z(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function N(t){return S(t)/255}function I(t){return!!Z.CSS_UNIT.exec(t)}function R(t){t=t.replace(j,"").replace(B,"").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=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:S(r[1]),g:S(r[2]),b:S(r[3]),a:N(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:N(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.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 j=/^\s+/,B=/\s+$/,H=0,q=e.round,V=e.min,U=e.max,G=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=T(t),this._roundA=q(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=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=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=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 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: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*L(this._r,255))+"%",g:q(100*L(this._g,255))+"%",b:q(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*L(this._r,255))+"%, "+q(100*L(this._g,255))+"%, "+q(100*L(this._b,255))+"%)":"rgba("+q(100*L(this._r,255))+"%, "+q(100*L(this._g,255))+"%, "+q(100*L(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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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)&&(r[a]="a"===a?t[a]:P(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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100;return n({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})},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"},Y=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),Z=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],14:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./common_defaults"),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),f=c("clicktoshow");if(!u&&!f)return e;o(t,e,r,c);for(var d=e.showarrow,h=["x","y"],p=[-10,-30],g={_fullLayout:r},v=0;v<2;v++){var m=h[v],y=a.coerceRef(t,e,g,m,"","paper");if(a.coercePosition(e,g,c,y,m,.5),d){var x="a"+m,b=a.coerceRef(t,e,g,x,"pixel");"pixel"!==b&&b!==y&&(b=e[x]="pixel");var _="pixel"===b?p[v]:.4;a.coercePosition(e,g,c,b,x,_)}c(m+"anchor"),c(m+"shift")}if(n.noneOrAll(t,e,["x","y"]),d&&n.noneOrAll(t,e,["ax","ay"]),f){var w=c("xclick"),k=c("yclick");e._xclick=void 0===w?e.x:a.cleanPosition(w,g,e.xref), +e._yclick=void 0===k?e.y:a.cleanPosition(k,g,e.yref)}return e}},{"../../lib":143,"../../plots/cartesian/axes":178,"./attributes":16,"./common_defaults":19}],15:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],16:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:i({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":139,"../../plots/cartesian/constants":183,"../../plots/font_attributes":202,"./arrow_paths":15}],17:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=o.getFromId(t,e.xref),i=o.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=l+e.xshift,n=l-e.xshift,e.axref===e.xref?(o.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),o.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):o.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),i&&i.autorange&&(r=l-e.yshift,n=l+e.yshift,e.ayref===e.yref?(o.expand(i,[i.r2c(e.y)],{ppadplus:r,ppadminus:n}),o.expand(i,[i.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):o.expand(i,[i.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(o.list(t).filter(function(t){return t.autorange&&l[t._id]}).length)return a.syncOrAsync([i,n],t)}}},{"../../lib":143,"../../plots/cartesian/axes":178,"./draw":22}],18:[function(t,e,r){"use strict";function n(t,e){var r=o(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=o(t,e),a=n.on,i=n.off.concat(n.explicitOff),s={};if(a.length||i.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var l=I.selectAll("a");if(1===l.size()&&l.text()===I.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":l.attr("xlink:href"),"xlink:xlink:show":l.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}var c=C.select(".annotation-text-math-group"),f=!c.empty(),p=h.bBox((f?c:I).node()),x=p.width,z=p.height,N=e.width||x,R=e.height||z,F=Math.round(N+2*O),j=Math.round(R+2*O);e._w=N,e._h=R;for(var B=!1,H=["x","y"],q=0;q1)&&($===W?((ot=Q.r2fraction(e["a"+Z]))<0||ot>1)&&(B=!0):B=!0,B))continue;V=Q._offset+Q.r2p(e[Z]),X=.5}else"x"===Z?(G=e[Z],V=w.l+w.w*G):(G=1-e[Z],V=w.t+w.h*G),X=e.showarrow?.5:G;if(e.showarrow){at.head=V;var it=e["a"+Z];Y=K*r(.5,e.xanchor)-tt*r(.5,e.yanchor),$===W?(at.tail=Q._offset+Q.r2p(it),U=Y):(at.tail=V+it,U=Y+it),at.text=at.tail+Y;var lt=_["x"===Z?"width":"height"];if("paper"===W&&(at.head=u.constrain(at.head,1,lt-1)),"pixel"===$){var st=-Math.max(at.tail-3,at.text),ct=Math.min(at.tail+3,at.text)-lt;st>0?(at.tail+=st,at.text+=st):ct>0&&(at.tail-=ct,at.text-=ct)}at.tail+=nt,at.head+=nt}else Y=et*r(X,rt),U=Y,at.text=V+Y;at.text+=nt,Y+=nt,U+=nt,e["_"+Z+"padplus"]=et/2+U,e["_"+Z+"padminus"]=et/2-U,e["_"+Z+"size"]=et,e["_"+Z+"shift"]=Y}if(B)return void C.remove();var ut=0,ft=0;if("left"!==e.align&&(ut=(N-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(R-z)*("middle"===e.valign?.5:1)),f)c.select("svg").attr({x:O+ut-1,y:O+ft}).call(h.setClipUrl,P?k:null);else{var dt=O+ft-p.top,ht=O+ut-p.left;I.call(g.positionText,ht,dt).call(h.setClipUrl,P?k:null)}E.select("rect").call(h.setRect,O,O,N,R),D.call(h.setRect,S/2,S/2,F-S,j-S),C.call(h.setTranslate,Math.round(M.x.text-F/2),Math.round(M.y.text-j/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var pt=function(r,l){T.selectAll(".annotation-arrow-g").remove();var c=M.x.head,f=M.y.head,p=M.x.tail+r,g=M.y.tail+l,v=M.x.text+r,x=M.y.text+l,_=u.rotationXYMatrix(A,v,x),k=u.apply2DTransform(_),S=u.apply2DTransform2(_),z=+D.attr("width"),O=+D.attr("height"),P=v-.5*z,E=P+z,N=x-.5*O,I=N+O,R=[[P,N,P,I],[P,I,E,I],[E,I,E,N],[E,N,P,N]].map(S);if(!R.reduce(function(t,e){return t^!!i(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=i(p,g,c,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,g=e.y)});var F=e.arrowwidth,j=e.arrowcolor,B=T.append("g").style({opacity:d.opacity(j)}).classed("annotation-arrow-g",!0),H=B.append("path").attr("d","M"+p+","+g+"L"+c+","+f).style("stroke-width",F+"px").call(d.stroke,d.rgb(j));if(y(H,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&H.node().parentNode&&!n){var q=c,V=f;if(e.standoff){var U=Math.sqrt(Math.pow(c-p,2)+Math.pow(f-g,2));q+=e.standoff*(p-c)/U,V+=e.standoff*(g-f)/U}var G,X,Y,Z=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-q)+","+(g-V),transform:"translate("+q+","+V+")"}).style("stroke-width",F+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");m.init({element:Z.node(),gd:t,prepFn:function(){var t=h.getTranslate(C);X=t.x,Y=t.y,G={},a&&a.autorange&&(G[a._name+".autorange"]=!0),o&&o.autorange&&(G[o._name+".autorange"]=!0)},moveFn:function(t,r){var n=k(X,Y),i=n[0]+t,l=n[1]+r;C.call(h.setTranslate,i,l),G[b+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/w.w,G[b+".y"]=o?o.p2r(o.r2p(e.y)+r):e.y-r/w.h,e.axref===e.xref&&(G[b+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(G[b+".ay"]=o.p2r(o.r2p(e.ay)+r)),B.attr("transform","translate("+t+","+r+")"),L.attr({transform:"rotate("+A+","+i+","+l+")"})},doneFn:function(e){if(e){s.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var gt,vt;m.init({element:C.node(),gd:t,prepFn:function(){vt=L.attr("transform"),gt={}},moveFn:function(t,r){var i="pointer";if(e.showarrow)e.axref===e.xref?gt[b+".ax"]=a.p2r(a.r2p(e.ax)+t):gt[b+".ax"]=e.ax+t,e.ayref===e.yref?gt[b+".ay"]=o.p2r(o.r2p(e.ay)+r):gt[b+".ay"]=e.ay+r,pt(t,r);else{if(n)return;if(a)gt[b+".x"]=e.x+t/a._m;else{var l=e._xsize/w.w,s=e.x+(e._xshift-e.xshift)/w.w-l/2;gt[b+".x"]=m.align(s+t/w.w,l,0,1,e.xanchor)}if(o)gt[b+".y"]=e.y+r/o._m;else{var c=e._ysize/w.h,u=e.y-(e._yshift+e.yshift)/w.h-c/2;gt[b+".y"]=m.align(u-r/w.h,c,0,1,e.yanchor)}a&&o||(i=m.getCursor(a?.5:gt[b+".x"],o?.5:gt[b+".y"],e.xanchor,e.yanchor))}L.attr({transform:"translate("+t+","+r+")"+vt}),v(C,i)},doneFn:function(e){if(v(C),e){s.relayout(t,gt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var x,b,_=t._fullLayout,w=t._fullLayout._size;n?(x="annotation-"+n,b=n+".annotations["+r+"]"):(x="annotation",b="annotations["+r+"]"),_._infolayer.selectAll("."+x+'[data-index="'+r+'"]').remove();var k="clip"+_._uid+"_ann"+r;if(!e._input||!1===e.visible)return void l.selectAll("#"+k).remove();var M={x:{},y:{}},A=+e.textangle||0,T=_._infolayer.append("g").classed(x,!0).attr("data-index",String(r)).style("opacity",e.opacity),L=T.append("g").classed("annotation-text-g",!0),C=L.append("g").style("pointer-events",e.captureevents?"all":null).call(v,"default").on("click",function(){t._dragging=!1;var a={index:r,annotation:e._input,fullAnnotation:e,event:l.event};n&&(a.subplotId=n),t.emit("plotly_clickannotation",a)});e.hovertext&&C.on("mouseover",function(){var r=e.hoverlabel,n=r.font,a=this.getBoundingClientRect(),o=t.getBoundingClientRect();p.loneHover({x0:a.left-o.left,x1:a.right-o.left,y:(a.top+a.bottom)/2-o.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var S=e.borderwidth,z=e.borderpad,O=S+z,D=C.append("rect").attr("class","bg").style("stroke-width",S+"px").call(d.stroke,e.bordercolor).call(d.fill,e.bgcolor),P=e.width||e.height,E=_._defs.select(".clips").selectAll("#"+k).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",k).append("rect"),E.exit().remove();var N=e.font,I=C.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?I.call(g.makeEditable,{delegate:C,gd:t}).call(c).on("edit",function(r){e.text=r,this.call(c);var n={};n[b+".text"]=e.text,a&&a.autorange&&(n[a._name+".autorange"]=!0),o&&o.autorange&&(n[o._name+".autorange"]=!0),s.relayout(t,n)}):I.call(c)}function i(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,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 l=t("d3"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../fx"),g=t("../../lib/svg_text_utils"),v=t("../../lib/setcursor"),m=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:n,drawOne:a,drawRaw:o}},{"../../lib":143,"../../lib/setcursor":158,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/plots":207,"../color":31,"../dragelement":52,"../drawing":55,"../fx":72,"./draw_arrow_head":23,d3:7}],23:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(r,a){h.path&&(e>5&&(a=0),n.select(d.parentNode).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(v=Math.atan2(A,M),m=v+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(v),L=k*Math.sin(v);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var C=d.getTotalLength(),S="";if(C1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+l+'"]').remove():(s.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(s.x)*r[0],e.yaxis.r2l(s.y)*r[1],e.zaxis.r2l(s.z)*r[2]]),n(t.graphDiv,s,l,t.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":204,"../annotations/draw":22}],29:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":25,"./convert":26,"./defaults":27,"./draw":28}],30:[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},{}],31:[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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(i.combine(t,c))),(n.isDark()?e?n.lighten(e):c:r?n.darken(r):s).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]-=(ct-l)/2):r.node()&&!r.classed("js-placeholder")&&(ct=h.bBox(r.node()).height),ct){if(ct+=5,"top"===k.titleside)et.domain[1]-=ct/C.h,o[1]*=-1;else{et.domain[0]+=ct/C.h;var c=v.lineCount(r);o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),et.setScale()}}lt.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(C.h*(1-et.domain[1]))+")");var f=lt.select(".cbfills").selectAll("rect.cbfill").data(D);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?z[0]:(D[e]+D[e-1])/2,e===D.length-1?z[1]:(D[e]+D[e+1])/2].map(et.c2p).map(Math.round);e!==D.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();n.select(this).attr({x:W,width:Math.max(q,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:i})});var d=lt.select(".cblines").selectAll("path.cbline").data(k.line.color&&k.line.width?O:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(et.c2p(t))+k.line.width/2%1)+"h"+q).call(h.lineGroupStyle,k.line.width,P(t),k.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=W+q+(k.outlinewidth||0)/2-("outside"===k.ticks?1:0),et.side="right",u.syncOrAsync([function(){return s.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(k.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,a=C.l+(et.position||0)*C.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));A("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:k.titleside,offsetLeft:C.l,offsetTop:C.t,maxShift:L.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,a=w();n=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:et,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:lt.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;lt.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,r||{}))}function T(){var r=q+k.outlinewidth/2+h.bBox(et._axislayer.node()).width;if(j=st.select("text"),j.node()&&!j.classed("js-placeholder")){var n,a=st.select(".h"+et._id+"title-math-group").node();n=a&&-1!==["top","bottom"].indexOf(k.titleside)?h.bBox(a).width:h.bBox(st.node()).right-W-C.l,r=Math.max(r,n)}var o=2*k.xpad+r+k.borderwidth+k.outlinewidth/2,l=J-K;lt.select(".cbbg").attr({x:W-k.xpad-(k.borderwidth+k.outlinewidth)/2,y:K-Y,width:Math.max(o,2),height:Math.max(l+2*Y,2)}).call(p.fill,k.bgcolor).call(p.stroke,k.bordercolor).style({"stroke-width":k.borderwidth}),lt.selectAll(".cboutline").attr({x:W,y:K+k.ypad+("top"===k.titleside?ct:0),width:Math.max(q,2),height:Math.max(l-2*k.ypad-ct,2)}).call(p.stroke,k.outlinecolor).style({fill:"None","stroke-width":k.outlinewidth});var s=({center:.5,right:1}[k.xanchor]||0)*o;lt.attr("transform","translate("+(C.l-s)+","+C.t+")"),i.autoMargin(t,e,{x:k.x,y:k.y,l:o*({right:1,center:.5}[k.xanchor]||0),r:o*({left:1,center:.5}[k.xanchor]||0),t:l*({bottom:1,middle:.5}[k.yanchor]||0),b:l*({top:1,middle:.5}[k.yanchor]||0)})}var L=t._fullLayout,C=L._size;if("function"!=typeof k.fillcolor&&"function"!=typeof k.line.color)return void L._infolayer.selectAll("g."+e).remove();var S,z=n.extent(("function"==typeof k.fillcolor?k.fillcolor:k.line.color).domain()),O=[],D=[],P="function"==typeof k.line.color?k.line.color:function(){return k.line.color},E="function"==typeof k.fillcolor?k.fillcolor:function(){return k.fillcolor},N=k.levels.end+k.levels.size/100,I=k.levels.size,R=1.001*z[0]-.001*z[1],F=1.001*z[1]-.001*z[0];for(S=k.levels.start;(S-N)*I<0;S+=I)S>R&&Sz[0]&&S1){var it=Math.pow(10,Math.floor(Math.log(ot)/Math.LN10));nt*=it*u.roundUp(ot/it,[2,5,10]),(Math.abs(k.levels.start)/k.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[Q+Z,Q+G-Z],et.setScale();var lt=L._infolayer.selectAll("g."+e).data([0]);lt.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)}),lt.attr("transform","translate("+Math.round(C.l)+","+Math.round(C.t)+")") +;var st=lt.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(C.l)+",-"+Math.round(C.t)+")");et._axislayer=lt.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(k.titleside)){var ut,ft=C.l+(k.x+X)*C.w,dt=et.titlefont.size;ut="top"===k.titleside?(1-(Q+G-Z))*C.h+C.t+3+.75*dt:(1-(Q+Z))*C.h+C.t-3-.25*dt,A(et._id+"title",{attributes:{x:ft,y:ut,"text-anchor":"start"}})}var ht=u.syncOrAsync([i.previousPromises,M,i.previousPromises,T],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var pt,gt,vt;c.init({element:lt.node(),gd:t,prepFn:function(){pt=lt.attr("transform"),d(lt)},moveFn:function(t,e){lt.attr("transform",pt+" translate("+t+","+e+")"),gt=c.align($+t/C.w,V,0,1,k.xanchor),vt=c.align(Q-e/C.h,G,0,1,k.yanchor);var r=c.getCursor(gt,vt,k.xanchor,k.yanchor);d(lt,r)},doneFn:function(e){d(lt),e&&void 0!==gt&&void 0!==vt&&o.restyle(t,{"colorbar.x":gt,"colorbar.y":vt},w().index)}})}return ht}function w(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,s.colorscale=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":143,"./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":139,"./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,v=p[d+"min"],m=p[d+"max"],y=p.colorscale;c(f+d+"auto",!(n(v)&&n(m)&&v=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":143}],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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return g._dragged=!1,g._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v,e),!g._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g=t.gd,v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=n},{"../../constants/interactions":128,"../../lib":143,"../../plotly":173,"../../plots/cartesian/constants":183,"./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,a=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":138}],54:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],55:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i,l){if(c.traceIs(r,"symbols")){var s=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:m.isBubble(r)?s(t.ms):(o.size||6)/2,t.mrc=e;var n=x.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,x.symbolFuncs[a](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,p=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?u.defaultLine:i.color,Array.isArray(o.color)&&(f=u.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var g=o.gradient,v=t.mgt;if(v?p=!0:v=g&&g.type,v&&"none"!==v){var b=t.mgc;b?p=!0:b=g.color;var _="g"+l._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(x.gradient,l,_,v,f,b)}else e.call(u.fill,f);h&&e.call(u.stroke,d)}}function a(t,e,r,n){var a=t[0]-e[0],o=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+o*o,T/2),u=Math.pow(l*l+s*s,T/2),f=(u*u*a-c*c*l)*n,d=(u*u*o-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[i.round(e[0]+(h&&f/h),2),i.round(e[1]+(h&&d/h),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&d/p),2)]]}function o(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var i=t("d3"),l=t("fast-isnumeric"),s=t("tinycolor2"),c=t("../../registry"),u=t("../color"),f=t("../colorscale"),d=t("../../lib"),h=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),v=g.LINE_SPACING,m=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),x=e.exports={};x.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(u.fill,n)},x.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},x.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},x.setRect=function(t,e,r,n,a){t.call(x.setPosition,e,r).call(x.setSize,n,a)},x.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);return!!(l(a)&&l(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},x.translatePoints=function(t,e,r,n){t.each(function(t){var a=i.select(this);x.translatePoint(t,a,e,r,n)})},x.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},x.crispRound=function(t,e,r){return e&&l(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},x.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||"";u.stroke(e,n||o.color),x.dashLine(e,l,i)},x.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=n||a.dash||"";i.select(this).call(u.stroke,r||a.color).call(x.dashLine,l,o)})},x.dashLine=function(t,e,r){r=+r||0,e=x.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},x.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},x.singleFillStyle=function(t){var e=i.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(u.fill,n)},x.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(u.fill,e[0].trace.fillcolor)}catch(e){d.error(e,t),r.remove()}})};var b=t("./symbol_defs");x.symbolNames=[],x.symbolFuncs=[],x.symbolNeedLines={},x.symbolNoDot={},x.symbolList=[],Object.keys(b).forEach(function(t){var e=b[t];x.symbolList=x.symbolList.concat([e.n,t,e.n+100,t+"-open"]),x.symbolNames[e.n]=t,x.symbolFuncs[e.n]=e.f,e.needLine&&(x.symbolNeedLines[e.n]=!0),e.noDot?x.symbolNoDot[e.n]=!0:x.symbolList=x.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=x.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";x.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=x.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var k={x1:1,x2:0,y1:0,y2:0},M={x1:0,x2:0,y1:1,y2:0};x.gradient=function(t,e,r,n,a,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+o],d.identity);l.exit().remove(),l.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=i.select(this);"horizontal"===n?t.attr(k):"vertical"===n&&t.attr(M),t.attr("id",r);var e=s(a),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},x.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},x.singlePointStyle=function(t,e,r,a,o,i){var l=r.marker;n(t,e,r,a,o,l,l.line,i)},x.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,a=x.tryColorscale(n,""),o=x.tryColorscale(n,"line");t.each(function(t){x.singlePointStyle(t,i.select(this),e,a,o,r)})}},x.tryColorscale=function(t,e){var r=e?d.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):d.identity};var A={start:1,end:-1,middle:0,bottom:1,top:-1};x.textPointStyle=function(t,e,r){t.each(function(t){var n=i.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void n.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",c=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=l(u)&&u>0?u:0,n.call(x.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",c).text(a).call(h.convertToTspans,r);var d=i.select(this.parentNode),p=(h.lineCount(n)-1)*v+1,g=A[c]*f,m=.75*u+A[s]*f+(A[s]-1)*p*u/2;d.attr("transform","translate("+g+","+m+")")})};var T=.5;x.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=1e4&&(x.savedBBoxes={},S=0),e&&(x.savedBBoxes[e]=v),S++,d.extendFlat({},v)},x.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")},x.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},x.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||0,r=r||0,i=i.replace(n,"").trim(),i+=" translate("+e+", "+r+")",i=i.trim(),t[o]("transform",i),i},x.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},x.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||1,r=r||1,i=i.replace(n,"").trim(),i+=" scale("+e+", "+r+")",i=i.trim(),t[o]("transform",i),i},x.setPointGroupScale=function(t,e,r){var n,a,o;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};var z=/translate\([^)]*\)\s*$/;x.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=i.select(this),a=n.select("text"),o=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(n.attr("transform")||"").match(z);t=1===e&&1===r?[]:["translate("+o+","+l+")","scale("+e+","+r+")","translate("+-o+","+-l+")"],s&&t.push(s),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":127,"../../constants/xmlns_namespaces":131,"../../lib":143,"../../lib/svg_text_utils":160,"../../registry":214,"../../traces/scatter/make_bubble_size_func":263,"../../traces/scatter/subtypes":268,"../color":31,"../colorscale":45,"./symbol_defs":56,d3:7,"fast-isnumeric":10,tinycolor2:13}],56:[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);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),o=n.round(-.309*t,2);return"M"+e+","+o+"L"+r+","+n.round(.809*t,2)+"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(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+n.round(.382*e,2)+"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:7}],57:[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"}}}},{}],58:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&-1!==["linear","log"].indexOf(r.type),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(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 v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(r.duration).ease(r.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(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":268,d3:7,"fast-isnumeric":10}],63:[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":31,d3:7}],64:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":139,"../../plots/font_attributes":202}],65:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,i=0;i=0&&r.indexJ.width||$<0||$>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(C,$),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RX&&(Y.splice(0,X),K=Y[0].distance)}if(0===Y.length)return x.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(I=0;I1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:P,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ut,t);if(o(Y,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);v(u.select(e.target),dt?"pointer":"")}e.target&&!n&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:C,xvals:E,yvals:N}))}function a(t,e,r){var n,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],v=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,O=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(n=0;n15&&(n=n.substr(0,12)+"...")),void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var p=e.select("text.nums").call(m.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),v=e.select("text.name"),x=0;n&&n!==a?(v.call(m.font,t.fontFamily||d,t.fontSize||h,c).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),x=v.node().getBoundingClientRect().width+2*z):(v.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var b,w,k=p.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,P=Math.abs(t.x1-t.x0),E=Math.abs(t.y1-t.y0),N=k.width+S+z+x;t.ty0=T-k.top,t.bx=k.width+2*z,t.by=k.height+2*z,t.anchor="start",t.txwidth=k.width,t.tx2width=x,t.offset=0,i?(t.pos=A,b=D+E/2+N<=C,w=D-E/2-N>=0,"top"!==t.idealAlign&&b||!w?b?(D+=E/2,t.anchor="start"):t.anchor="middle":(D-=E/2,t.anchor="end")):(t.pos=D,b=A+P/2+N<=L,w=A-P/2-N>=0,"left"!==t.idealAlign&&b||!w?b?(A+=P/2,t.anchor="start"):t.anchor="middle":(A-=P/2,t.anchor="end")),p.attr("text-anchor",t.anchor),x&&v.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+D+")"+(i?"rotate("+M+")":""))}),E}function o(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)?T: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 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 i(t,e){t.each(function(t){var r=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+s)+"V"+(c-S)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+z),t.tx2width&&(r.select("text.name").call(g.positionText,l+o*z+s,c+t.ty0-t.by/2+z),r.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":143,"../../lib/events":138,"../../lib/override_cursor":152,"../../lib/svg_text_utils":160,"../../plots/cartesian/axes":178,"../../registry":214,"../color":31,"../dragelement":52,"../drawing":55,"./constants":67,"./helpers":69,d3:7,"fast-isnumeric":10,tinycolor2:13}],71:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":143}],72:[function(t,e,r){"use strict";function n(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return l.castOption(t,e,"hoverlabel."+r)}function o(t,e,r){function n(r){return l.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return l.castOption(t,r,"hoverinfo",n)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":143,"../dragelement":52,"./attributes":64,"./calc":65,"./click":66,"./constants":67,"./defaults":68,"./helpers":69,"./hover":70,"./layout_attributes":73,"./layout_defaults":74,"./layout_global_defaults":75,d3:7}],73:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":139,"../../plots/font_attributes":202,"./constants":67}],74:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],82:[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":139,"../../plots/font_attributes":202,"../color/attributes":30}],83:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],84:[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,v="normal",m=0;m1)){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":143,"../../plots/layout_attributes":205,"../../registry":214,"./attributes":82,"./helpers":87}],85:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){i(t,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=n.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeL&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},L):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?-1===g?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),v.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+r,a.height=Math.max(a.height,e.height),y+=i+r,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var a="top";A.isBottomAnchor(r)?a="bottom":A.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).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 T=r._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.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 O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==M.enter().size();P&&(l(t,O,D),s(t));var E=r.width,N=r.height;l(t,O,D),y.height>N?c(t):s(t);var I=r._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?F-=y.height:A.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var H=y.height,q=I.h;H>q?(F=I.t,H=q):(F+H>N&&(F=N-H),F<0&&(F=0),H=Math.min(N-F,y.height)),v.setTranslate(M,R,F);var V,U,G=H-x.scrollBarHeight-2*x.scrollBarMargin,X=y.height-H;if(y.height<=H||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),T.select("rect").attr({width:j-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*X,-X,0),V=x.scrollBarMargin-U/X*G,e(V,U),0!==U&&U!==-X&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var Y=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*X,e(V,U)});z.call(Y),S.call(Y)}if(t._context.editable){var Z,W,$,Q;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=v.getTranslate(M);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;v.setTranslate(M,r,n),Z=g.align(r,0,I.l,I.l+I.w,y.xanchor),W=g.align(n,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?M._clickTimeout=setTimeout(function(){o(i,t,n)},L):2===n&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/alignment":127,"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":207,"../../registry":214,"../color":31,"../dragelement":52,"../drawing":55,"./anchor_utils":81,"./constants":83,"./get_legend_data":86,"./helpers":87,"./style":89,d3:7}],86:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[1])return r[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},v={};d&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",o.mean,[.2,1]),g.ms=r("marker.size",o.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",o.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:r("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,v)}var m=n.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=m.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,r=e.marker||{},o=r.line||{},i=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=n.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||r.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&r.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(c,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(r).each(u)}},{"../../lib":143,"../../registry":214,"../../traces/pie/style_one":246,"../../traces/scatter/subtypes":268,"../color":31,"../drawing":55,d3:7}],90:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),i(v,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g||p)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(v,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":143,"../color":31,"./attributes":94,"./button_attributes":95,"./constants":96}],98:[function(t,e,r){"use strict";function n(t){for(var e=m.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;lX&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),G=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),H=m.getDataToPixel(t,j),q=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,j),U=m.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(v=H(r.x0),y=q(r.y0),x=H(r.x1),b=q(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vY&&(h[S]=r[P]=U(c),h[z]=r[E]=U(u)),d-f>X&&(h[O]=r[N]=V(f),h[D]=r[I]=V(d))}e.attr("d",i(t,r))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,D,P,E,N,I,R,F,j,B,H,q,V,U,G,X=10,Y=10,Z={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z),e.node().onmousemove=a}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=m.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=m.decodeDate(n)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":143,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian/axes":178,"../color":31,"../dragelement":52,"../drawing":55,"./constants":109,"./helpers":112}],112:[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}},{}],113:[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":107,"./calc_autorange":108,"./defaults":110,"./draw":111}],114:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":143,"../../plots/cartesian/axes":178,"./attributes":107,"./helpers":112}],115:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":139,"../../plots/animation_attributes":174,"../../plots/font_attributes":202,"../../plots/pad_attributes":206,"./constants":116}],116:[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,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}},{}],117:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*S;return T.positionText(o,n,s),o}}function s(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]);n.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function u(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,m(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*S+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){ +var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(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(M.fill,r.bgcolor).attr("opacity",0),A.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(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.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 g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+g+")")}}}var v=r.propContainer,m=r.propName,y=r.traceIndex,x=r.dfltName,b=r.avoid||{},_=r.attributes,w=r.transform,k=r.containerGroup,M=t._fullLayout,A=v.titlefont.family,T=v.titlefont.size,L=v.titlefont.color,C=1,S=!1,z=v.title.trim(),O=t._context.editable;""===z&&(C=0),z.match(d)&&(C=.2,S=!0,O||(z=""));var D=z||O;k||(k=M._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var P=k.selectAll("text").data(D?[0]:[]);if(P.enter().append("text"),P.text(z).attr("class",e),P.exit().remove(),D){P.call(h);var E="Click to enter "+x+" title";O&&(z?P.on(".opacity",null):function(){C=0,S=!0,z=E,P.text(z).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),P.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?o.restyle(t,m,e,y):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,_.x,_.y)})),P.classed("js-placeholder",S)}}},{"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":207,"../color":31,"../drawing":55,d3:7,"fast-isnumeric":10}],121:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":139,"../../plots/font_attributes":202,"../../plots/pad_attributes":206,"../color/attributes":30}],122:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],123:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+S.headerGroupClassName).data(r,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,H=A?h+L+.5:h+.5,q=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=q.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(H)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":143,"../color":31,"../drawing":55,d3:7}],127:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],128:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],129:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],130:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],131:[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}},{}],132:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":24,"./components/annotations3d":29,"./components/fx":72,"./components/images":80,"./components/legend":88,"./components/rangeselector":100,"./components/rangeslider":106,"./components/shapes":113,"./components/sliders":119,"./components/updatemenus":125,"./fonts/mathjax_config":133,"./lib/queue":155,"./plot_api/plot_schema":167,"./plot_api/register":168,"./plot_api/set_plot_config":169,"./plot_api/to_image":171,"./plot_api/validate":172,"./plotly":173,"./snapshot":219,"./snapshot/download":216,"./traces/scatter":258,d3:7,"es6-promise":8}],133:[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},{}],134:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),n(t)?Number(t):a}},{"../constants/numerical":129,"fast-isnumeric":10}],135:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(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),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.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;!0!==n.strict&&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(i(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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);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(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u) +}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=r.MIN_MS=r.dateTime2ms("-9999"),S=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var z=90*y,O=3*x,D=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),I=M("%b %Y"),R=M("%b %-d"),F=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=N(g):"m"===r?d=I(g):"d"===r?(o=N(g),d=R(g)):(o=F(g),d=l(t,r))}return d+(o?"\n"+o:"")};var j=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;ui?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var a=0;ar?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},s.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},s.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<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},s.syncOrAsync=function(t,e,r){function n(){return s.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(n).then(void 0,s.promiseError);return r&&r(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.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}},{"../constants/numerical":129,"./clean_number":134,"./coerce":135,"./dates":136,"./ensure_array":137,"./extend":139,"./filter_unique":140,"./filter_visible":141,"./identity":142,"./is_array":144,"./is_plain_object":145,"./loggers":146,"./matrix":147,"./mod":148,"./nested_property":149,"./noop":150,"./notifier":151,"./push_unique":154,"./relink_private":156,"./search":157,"./stats":159,"./to_log_range":161,d3:7,"fast-isnumeric":10}],144:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],145:[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}},{}],146:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":129,"./matrix":147}],154:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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":10}],160:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function l(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],I={type:M},R=i(N,z);if(R?(R=R.replace(E,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(I.style=R),"a"===M){l=!0;var F=i(N,O);if(F){var j=document.createElement("a");j.href=F,-1!==k.indexOf(j.protocol)&&(I.href=F,I.target=i(N,D)||"_blank",I.popup=i(N,P))}}n(I)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(v),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};o(s[2],r,function(r,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=r&&r.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=n(c,"width"),g=n(c,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||n(t,"height"),y=-m/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,z=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,E=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(M," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),o=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=s.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(o),a=r.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial", +"font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,n)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():s.on("click",r),f.rebind(t,l,"on")}},{"../constants/alignment":127,"../constants/string_mappings":130,"../constants/xmlns_namespaces":131,"../lib":143,d3:7}],161:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":10}],162:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),C=L||[],S=n(m,f).get(),z=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(-1===O)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sq.range[0]?[1,2]:[2,1]);else{var G=q.range[0],X=q.range[1];V?(G<=0&&X<=0&&r(I+".autorange",!0),G<=0?G=X/1e6:X<=0&&(X=G/1e6),r(I+".range[0]",Math.log(G)/Math.LN10),r(I+".range[1]",Math.log(X)/Math.LN10)):(r(I+".range[0]",Math.pow(10,G)),r(I+".range[1]",Math.pow(10,X)))}else r(I+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,j,L,r),w.getComponentMethod("images","convertCoords")(t,j,L,r)}else r(I+".autorange",!0);x.nestedProperty(c,I+"._inputRange").set(null)}else if(E.match(P.AX_NAME_PATTERN)){var Y=x.nestedProperty(c,A).get(),Z=(L||{}).type;Z&&"-"!==Z||(Z="linear"),w.getComponentMethod("annotations","convertCoords")(t,Y,Z,r),w.getComponentMethod("images","convertCoords")(t,Y,Z,r)}var W=z.containerArrayMatch(A);if(W){o=W.array,i=W.index;var $=W.property,Q=x.nestedProperty(s,o),J=(Q||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(m.docalc=!0);else if(""===$){var K=L;z.isAddVal(L)?_[A]=null:z.isRemoveVal(L)?(_[A]=J,K=J):x.warn("unrecognized full object value",e),(n(K,"x")||n(K,"y")&&-1===A.indexOf("updatemenus"))&&(m.docalc=!0)}else!n(J,"x")&&!n(J,"y")||x.containsAny(A,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var tt=d[o][i];tt||(tt=d[o][i]={}),tt[$]=L,delete e[A]}else if("reverse"===E)F.range?F.range.reverse():(r(I+".autorange",!0),F.range=[1,0]),j.autorange?m.docalc=!0:m.doplot=!0;else{var et=String(T.parts[1]||"");0===D.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===D.indexOf("geo")?m.doplot=!0:0===D.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===A?m.doplot=!0:"margin"===D||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===B||"select"===B?"hiddenlabels"===A?m.docalc=!0:-1!==D.indexOf("legend")?m.dolegend=!0:-1!==A.indexOf("title")?m.doticks=!0:-1!==D.indexOf("bgcolor")?m.dolayoutstyle=!0:C>1&&x.containsAny(et,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:C>1&&-1!==et.indexOf("line")?m.dolayoutstyle=!0:C>1&&"mirror"===et?m.doticks=m.dolayoutstyle=!0:"margin.pad"===A?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(L)}}}for(o in d){z.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var rt=c._axisConstraintGroups;for(v in M)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":55,"../components/errorbars":61,"../constants/xmlns_namespaces":131,"../lib":143,"../lib/events":138,"../lib/queue":155,"../lib/svg_text_utils":160,"../plotly":173,"../plots/cartesian/axis_ids":181,"../plots/cartesian/constants":183,"../plots/cartesian/constraints":185,"../plots/cartesian/graph_interact":187,"../plots/plots":207,"../plots/polar":210,"../registry":214,"./helpers":163,"./manage_arrays":164,"./subroutines":170,d3:7,"fast-isnumeric":10}],166:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],167:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[k]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=A,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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];-1===A.indexOf(n)&&(e(o,n,t,a),r.isValObject(o)||p.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){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":143,"../plotly":173,"../snapshot/cloneplot":215,"../snapshot/helpers":218,"../snapshot/svgtoimg":220,"../snapshot/tosvg":222,"fast-isnumeric":10}],172:[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,v=r.length,m=0;m.3*f||o(n)||o(a))){var d=r.dtick/2;t+=t+d.8){var i=Number(r.substr(1));o.exactYears>.8&&i%12==0?t=E.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=E.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=E.tickIncrement(t,r);if(l<=n)return l}return t}function o(t){var e,r,n=t.tickvals,a=t.ticktext,o=new Array(n.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;ru&&e10||"01-01"!==n.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>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=t.l2r(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 s(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function c(t,e,r,n){var a=t._tickround,o=r&&t.hoverformat||t.tickformat;n&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");-1!==s&&(i=l.substr(s+1),l=l.substr(0,s)),n&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(r?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function d(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,n)}function h(t,e,r,n){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=V[s/3+5])}return a?"\u2212"+t:t}function p(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},E.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,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 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(),_.simpleMap(r,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},E.saveRangeInitial=function(t,e){for(var r=E.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type);m&&"domain"===t.constrain&&t._inputDomain&&(m*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},E.autoBin=function(t,e,r,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(r)c=(s-l)/r;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},E.setConvert(h),E.autoTicks(h,c);var p,g=E.tickIncrement(E.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=n(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=E.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},E.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),E.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=E.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=E.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fC?(e/=C,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>S?(e/=S,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,B),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=i(e,O,F):n>D?t.dtick=i(e,D,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=_.simpleMap(t.range,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 l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},E.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,n);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?q:H,s=t+.01*a,c=_.roundUp(_.mod(s,1),l,r);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,r=_.simpleMap(t.range,e),n=r[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":10}],180:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,r,p,g){function v(r,n){return o.coerce2(t,e,l,r,n)}var m=p.letter,y=p.font||{},x="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",b=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?h(m,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=r("color"),k=w===t.color?w:y.color;r("title",x),o.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,r,_),u(t,e,r,_,p),c(t,e,r,p);var M=v("linecolor",w),A=v("linewidth"),T=r("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var L=v("gridcolor",n(w,p.bgColor,i).toRgbString()),C=v("gridwidth");r("showgrid",p.showGrid||!!L||!!C)||(delete e.gridcolor,delete e.gridwidth);var S=v("zerolinecolor",w),z=v("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!z)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":30,"../../lib":143,"../../registry":214,"./category_order_defaults":182,"./layout_attributes":189,"./ordered_categories":191,"./set_convert":195,"./tick_label_defaults":196,"./tick_mark_defaults":197,"./tick_value_defaults":198,tinycolor2:13}],181:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],183:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],184:[function(t,e,r){"use strict";function n(t,e,r,n){var a,o,l,s,c=n[i(e)].type,u=[];for(o=0;oi*m)||_)for(r=0;rO&&PS&&(S=P);var I=(S-C)/(2*z);f/=I,C=s.l2r(C),S=s.l2r(S),s.range=s._input.range=A=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,r,n,a,o){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function v(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function m(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,r){var n,a,o,i,l,s,c=!1,u={},f={};for(n=0;nF||l>F?(Mt="xy",i/ot>l/it?(l=i*it/ot,xt>o?bt.t=xt-l:bt.b=xt+l):(i=l*ot/it,yt>a?bt.l=yt-i:bt.r=yt+i),Tt.attr("d",y(bt))):n():!st||lzoom back out","long"),j=!1)}function Y(e,r){var n=1===(H+q).length;if(e)J();else if(2!==r||n){if(1===r&&n){var a=H?rt[0]:et[0],i="s"===H||"w"===q?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;H?(u="n"===H?"top":"bottom","right"===a.side&&(c="right")):"e"===q&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(vt).call(A.makeEditable,{gd:t,immediate:!0,background:ht.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,l,r)})}}else Q()}function Z(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ht._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var n=t.querySelector(".plotly");if(V(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(St);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(q||ut){for(q||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":143,"fast-isnumeric":10}],193:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],o=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(o+(a[0]-o)*e),t.l2r(o+(a[1]-o)*e)]}},{"../../constants/alignment":127}],194:[function(t,e,r){"use strict";function n(t){return t._id}function a(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)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*w*Math.abs(n-a))}return h}function f(e,r,n){var a=c(e,n||t.calendar);if(a===h){if(!o(e))return h;a=c(new Date(+e))}return a}function v(e,r,n){return s(e,r,n||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(o(e))return+e}function b(e){return o(e)?a.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:u,t.l2c="log"===t.type?n:u,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(l(e))},t.p2d=t.p2r=_,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(l(t),e)},t.r2d=t.r2c=function(t){return n(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=u,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(l(e))},t.p2r=_,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=i.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)},t.cleanPos=function(e){return i.cleanDate(e,h,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2r=t.d2l_noadd=x,t.r2c=function(e){var r=x(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return m(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=i.nestedProperty(t,e).get(),l=(t._id||"x").charAt(0);if(n="date"===t.type?i.dfltRange(t.calendar):"y"===l?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void i.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=i.cleanDate(a[0],h,t.calendar),a[1]=i.cleanDate(a[1],h,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!i.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=i.constrain(t.r2l(a[0]),i.MIN_MS+1e3,i.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!o(a[r])){if(!o(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-d?a[r]=-d:a[r]>d&&(a[r]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var l=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(l);var c=t.r2l(t[l][0],s),u=t.r2l(t[l][1],s);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw i.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,o,i="date"===t.type&&e[r+"calendar"];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?a.dateTick0(e.calendar):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":129,"../../lib":143,"fast-isnumeric":10}],199:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(e,r){function n(e,r){for(a=0;ar.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(-1===l.indexOf(s)){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]||-1===e.indexOf(c)&&-1===e.indexOf(u)||l.push(s)}}return l}(v,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":55,"../../plotly":173,"../../registry":214,"./axes":178,d3:7}],200:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var c=a(e,r,n);if(c){if("histogram"===c.type&&n==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=n+"calendar",f=c[u];if(i(c,n)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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()?" - ":"")}},v.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=v.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},v.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||v.createTransitionData(t),r._initialAutoSizeIsDone){var c=r.width,f=r.height;v.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{v.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,p=t._context&&t._context.autosizable;d&&(h||p)?v.plotAutoSize(t,o,n):d&&v.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,v.supplyDataDefaults(s,l,o,n),n._has=v._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var u=i(t._boundingBoxMargins),f=u.left+u.right,d=u.bottom+u.top,p=1-2*l,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-d))}else{var m=s?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,a=parseFloat(m.height)||r.height}var y=v.layoutAttributes.width.min,x=v.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}),v.sanitizeMargins(r)},v.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];n._replotting||v.doAutoMargin(t)}},v.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(!1!==e.margin.autoexpand){s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(s),d=0;dv){var M=(m*w+(k-e.width)*v)/(w-v),A=(k*(1-v)+(m-e.width)*(1-w))/(w-v);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(c(x)&&s[_].t){var T=s[_].t.val,L=s[_].t.size;if(T>y){var C=(x*T+(L-e.height)*y)/(T-y),S=(L*(1-y)+(x-e.height)*(1-T))/(T-y);C>=0&&S>=0&&C+S>l+i&&(l=C,i=S)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},v.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):h.isJSDate(t)?h.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&v.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===n?c:JSON.stringify(c)},v.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(){b=!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,d=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=L?f.angularAxis.domain:n.extent(k),S=Math.abs(k[1]-k[0]);A&&!M&&(S=0);var z=C.slice();T&&M&&(z[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(z[1]-z[0])/O);var D=f.angularAxis.ticksStep||(z[1]-z[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),z[2]||(z[2]=D);var P=n.range.apply(this,z);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(z.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?S:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),N=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(N)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},j={"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 B=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=void 0===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:I,elements:B,reverseOrder:f.legend.reverseOrder})})();var H=I.node().getBBox();x=Math.min(f.width-H.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}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var q=[(f.width-(f.margin.left+f.margin.right+2*x+(H?H.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/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 V=e.select("g.title-group text").style(j).text(f.title),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=G.selectAll("circle.grid-circle").data(a.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(F),X.attr("r",a),X.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(F);var Y=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Z=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(F),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),$=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),$.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(F),$.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var Q=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(j);f.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(Y).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(Y).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(Y).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-q[0]-d.left,f.top+f.height/2-q[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},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(void 0===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-2===r},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;return[t*Math.cos(r),t*Math.sin(r)]},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 v.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,a,o)},"stroke-width":function(t,e){return v["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,a,o)},opacity:function(t,e){return v.opacity(r,a,o)},display:function(t,e){return v.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 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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.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=[i.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),o(e[r],i.PolyChart.defaultConfig()),o(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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),v=n.scale[u?"linear":"ordinal"]().domain(g).range(s),m=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":-1!=n.svg.symbolTypes.indexOf(t)?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,m(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=n.svg.axis().scale(m).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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var l=o({},t.layout);if([[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"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":143,d3:7}],212:[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":31,"../../lib":143,"./micropolar":211,"./undo_manager":213,d3:7}],213:[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-1!==n},hasRedo:function(){return n-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)),d=t._context||{};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;r")?"":e.html(t).text()});return e.remove(),r}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var o=t("d3"),i=t("../components/drawing"),l=t("../components/color"),s=t("../constants/xmlns_namespaces"),c=/"/g,u=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,d=f._paper,h=f._toppaper;d.insert("rect",":first-child").call(i.setRect,0,0,f.width,f.height).call(l.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(r=0;r0&&A>0,j=k<=I&&A<=R,B=k<=R&&A<=I,H="h"===m?I>=k*(R/A):R>=A*(I/k);F&&(j||B||H)?x="inside":(x="outside",b.remove(),b=null)}else x="inside";if(!b&&(b=g(e,y,"outside"===x?C:L),_=M.bBox(b.node()),k=_.width,A=_.height,k<=0||A<=0))return void b.remove();var q;q="outside"===x?o(i,d,h,p,_,m):a(i,d,h,p,_,m),b.attr("transform",q)}}}function a(t,e,r,n,a,o){var l,s,c,u,f,d=a.width,h=a.height,p=(a.left+a.right)/2,g=(a.top+a.bottom)/2,v=Math.abs(e-t),m=Math.abs(n-r);v>2*D&&m>2*D?(f=D,v-=2*f,m-=2*f):f=0;var y,x;return d<=v&&h<=m?(y=!1,x=1):d<=m&&h<=v?(y=!0,x=1):dr?(c=(t+e)/2,u=n-f-s/2):(c=(t+e)/2,u=n+f+s/2),i(p,g,c,u,x,y)}function o(t,e,r,n,a,o){var l,s="h"===o?Math.abs(n-r):Math.abs(e-t);s>2*D&&(l=D,s-=2*l);var c,u,f,d,h="h"===o?Math.min(1,s/a.height):Math.min(1,s/a.width),p=(a.left+a.right)/2,g=(a.top+a.bottom)/2;return c=h*a.width,u=h*a.height,"h"===o?er?(f=(t+e)/2,d=n+l+u/2):(f=(t+e)/2,d=n-l-u/2),i(p,g,f,d,h,!1)}function i(t,e,r,n,a,o){var i,l;return a<1?i="scale("+a+") ":(a=1,i=""),l=o?"rotate("+o+" "+t+" "+e+") ":"","translate("+(r-a*t)+" "+(n-a*e)+")"+i+l}function l(t,e){var r=h(t.text,e);return p(L,r)}function s(t,e){var r=h(t.textposition,e);return g(C,r)}function c(t,e,r){return d(S,t.textfont,e,r)}function u(t,e,r){return d(z,t.insidetextfont,e,r)}function f(t,e,r){return d(O,t.outsidetextfont,e,r)}function d(t,e,r,n){e=e||{};var a=h(e.family,r),o=h(e.size,r),i=h(e.color,r);return{family:p(t.family,a,n.family),size:v(t.size,o,n.size),color:m(t.color,i,n.color)}}function h(t,e){var r;return Array.isArray(t)?ea))return e}return void 0!==r?r:t.dflt}function m(t,e,r){return b(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),x=t("fast-isnumeric"),b=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),k=t("../../components/color"),M=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),L=T.text,C=T.textposition,S=T.textfont,z=T.insidetextfont,O=T.outsidetextfont,D=3;e.exports=function(t,e,r){var a=e.xaxis,o=e.yaxis,i=t._fullLayout,l=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);l.enter().append("g").attr("class","trace bars"),l.append("g").attr("class","points").each(function(e){var r=e[0].t,l=e[0].trace,s=r.poffset,c=Array.isArray(s);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,u){function f(t){return 0===i.bargap&&0===i.bargroupgap?y.round(Math.round(t)-A,2):t}function d(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)}var h,p,g,v,m=r.p+(c?s[u]:s),b=m+r.w,_=r.b,w=_+r.s;if("h"===l.orientation?(g=o.c2p(m,!0),v=o.c2p(b,!0),h=a.c2p(_,!0),p=a.c2p(w,!0)):(h=a.c2p(m,!0),p=a.c2p(b,!0),g=o.c2p(_,!0),v=o.c2p(w,!0)),!(x(h)&&x(p)&&x(g)&&x(v)&&h!==p&&g!==v))return void y.select(this).remove();var M=(r.mlw+1||l.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(M/2%1,2);if(!t._context.staticPlot){var T=k.opacity(r.mc||l.marker.color),L=T<1||M>.01?f:d;h=L(h,p),p=L(p,h),g=L(g,v),v=L(v,g)}var C=y.select(this);C.append("path").attr("d","M"+h+","+g+"V"+v+"H"+p+"V"+g+"Z"),n(t,C,e,u,h,p,g,v)})}),l.call(A.plot,e)}},{"../../components/color":31,"../../components/drawing":55,"../../components/errorbars":61,"../../lib":143,"../../lib/svg_text_utils":160,"./attributes":224,d3:7,"fast-isnumeric":10,tinycolor2:13}],232:[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;cc+l||!y(s))&&(f=!0,d(u,t))} +for(var a=r.traces,o=m(e),i="fraction"===t._fullLayout.barnorm?1:100,l=i/1e9,s=e.l2c(e.c2l(0)),c="stack"===t._fullLayout.barmode?i:s,u=[s,c],f=!1,h=0;h1||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":31,"../../components/drawing":55,"../../components/errorbars":61,d3:7}],235:[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":31,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],236:[function(t,e,r){"use strict";var n=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:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},hovertext:{valType:"string",dflt:"",arrayOk:!0},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":30,"../../lib/extend":139,"../../plots/attributes":176,"../../plots/font_attributes":202}],237:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n")}return g};var s},{"../../components/color":31,"./helpers":240,"fast-isnumeric":10,tinycolor2:13}],239:[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")),i("marker.line.width")&&i("marker.line.color");var u=i("marker.colors");Array.isArray(u)||(e.marker.colors=[]),i("scalegroup");var f=i("text"),d=i("textinfo",Array.isArray(f)?"text+percent":"percent");if(i("hovertext"),d&&"none"!==d){var h=i("textposition"),p=Array.isArray(h)||"auto"===h,g=p||"inside"===h,v=p||"outside"===h;if(g||v){var m=l(i,"textfont",o.font);g&&l(i,"insidetextfont",m),v&&l(i,"outsidetextfont",m)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":143,"./attributes":236}],240:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":143}],241:[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":236,"./base_plot":237,"./calc":238,"./defaults":239,"./layout_attributes":242,"./layout_defaults":243,"./plot":244,"./style":245,"./style_one":246}],242:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],243:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){!function(r,o){n.coerce(t,e,a,r,o)}("hiddenlabels")}},{"../../lib":143,"./layout_attributes":242}],244:[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)),v={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>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 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]}var a,o,i,l,s,c,u,f,d,h,p,g,v;for(o=0;o<2;o++)for(i=o?r:n,s=o?Math.max:Math.min,u=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(i),d=t[1-o][a],h=d.concat(f),g=[],p=0;p0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[i.i]||((t.pxmid[1]-i.pxmid[1])*u>0?(f=i.cyFinal+s(i.px0[1],i.px1[1]),(x=f-v-t.labelExtraY)*u>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*u>0&&(n=3*c*Math.abs(a-h.indexOf(t)),d=i.cxFinal+l(i.px0[0],i.px1[0]),(p=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*c>0&&(t.labelExtraX+=p)))}(g[p],m)}}}function l(t,e){var r,n,a,o,i,l,s,u,f,d,h=[];for(a=0;au&&(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&&-1===h.indexOf(l.scalegroup)&&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("../../components/fx"),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],v=c.trace,m=(v.depth||0)*c.r*Math.sin(0)/2,y=v.tiltaxis||0,x=y*Math.PI/180,b=[m*Math.sin(x),m*Math.cos(x)],_=c.r*Math.cos(0),w=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function i(n){n.originalEvent=u.event;var o=t._fullLayout,i=t._fullData[v.index],l=f.castHoverinfo(i,o,e.i);if("all"===l&&(l="label+text+value+percent+name"),t._dragging||!1===o.hovermode||"none"===l||"skip"===l||!l)return void f.hover(t,n,"pie");var s=a(e,c),d=w+e.pxmid[0]*(1-s),h=k+e.pxmid[1]*(1-s),p=r.separators,m=[];-1!==l.indexOf("label")&&m.push(e.label),-1!==l.indexOf("text")&&(i.hovertext?m.push(Array.isArray(i.hovertext)?i.hovertext[e.i]:i.hovertext):i.text&&i.text[e.i]&&m.push(i.text[e.i])),-1!==l.indexOf("value")&&m.push(g.formatPieValue(e.v,p)),-1!==l.indexOf("percent")&&m.push(g.formatPiePercent(e.v/c.vTotal,p)),f.loneHover({x0:d-s*c.r,x1:d+s*c.r,y:h,text:m.join("
"),name:-1!==l.indexOf("name")?i.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:f.castHoverOption(v,e.i,"bgcolor")||e.color,borderColor:f.castHoverOption(v,e.i,"bordercolor"),fontFamily:f.castHoverOption(v,e.i,"font.family"),fontSize:f.castHoverOption(v,e.i,"font.size"),fontColor:f.castHoverOption(v,e.i,"font.color")},{container:o._hoverlayer.node(),outerContainer:o._paper.node(),gd:t}),f.hover(t,n,"pie"),T=!0}function l(e){e.originalEvent=u.event,t.emit("plotly_unhover",{event:u.event,points:[e]}),T&&(f.loneUnhover(r._hoverlayer.node()),T=!1)}function d(){t._hoverdata=[e],t._hoverdata.trace=c.trace,f.click(t,u.event)}function x(t,r,n,a){return"a"+a*c.r+","+a*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-t[0])+","+a*(r[1]-t[1])}if(e.hidden)return void u.select(this).selectAll("path,g").remove();s[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=c.cx+b[0],k=c.cy+b[1],M=u.select(this),A=M.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),M.select("path.textline").remove(),M.on("mouseover",i).on("mouseout",l).on("click",d),v.pull){var L=+(Array.isArray(v.pull)?v.pull[e.i]:v.pull)||0;L>0&&(w+=L*e.pxmid[0],k+=L*e.pxmid[1])}e.cxFinal=w,e.cyFinal=k;var C=v.hole;if(e.v===c.vTotal){var S="M"+(w+e.px0[0])+","+(k+e.px0[1])+x(e.px0,e.pxmid,!0,1)+x(e.pxmid,e.px0,!0,1)+"Z";C?A.attr("d","M"+(w+C*e.px0[0])+","+(k+C*e.px0[1])+x(e.px0,e.pxmid,!1,C)+x(e.pxmid,e.px0,!1,C)+"Z"+S):A.attr("d",S)}else{var z=x(e.px0,e.px1,!0,1);if(C){var O=1-C;A.attr("d","M"+(w+C*e.px1[0])+","+(k+C*e.px1[1])+x(e.px1,e.px0,!1,C)+"l"+O*e.px0[0]+","+O*e.px0[1]+z+"Z")}else A.attr("d","M"+w+","+k+"l"+e.px0[0]+","+e.px0[1]+z+"Z")}var D=Array.isArray(v.textposition)?v.textposition[e.i]:v.textposition,P=M.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]);P.enter().append("g").classed("slicetext",!0),P.exit().remove(),P.each(function(){var r=u.select(this).selectAll("text").data([0]);r.enter().append("text").attr("data-notex",1),r.exit().remove(),r.text(e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(h.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans,t);var a,i=h.bBox(r.node());"outside"===D?a=o(i,e):(a=n(i,e,c),"auto"===D&&a.scale<1&&(r.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(i=h.bBox(r.node())),a=o(i,e)));var l=w+e.pxmid[0]*a.rCenter+(a.x||0),s=k+e.pxmid[1]*a.rCenter+(a.y||0);a.outside&&(e.yLabelMin=s-i.height/2,e.yLabelMid=s,e.yLabelMax=s+i.height/2,e.labelExtraX=0,e.labelExtraY=0,m=!0),r.attr("transform","translate("+l+","+s+")"+(a.scale<1?"scale("+a.scale+")":"")+(a.rotate?"rotate("+a.rotate+")":"")+"translate("+-(i.left+i.right)/2+","+-(i.top+i.bottom)/2+")")})}),m&&i(s,v),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]);Math.abs(l)>Math.abs(s)?o+="l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):o+="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":31,"../../components/drawing":55,"../../components/fx":72,"../../lib/svg_text_utils":160,"./helpers":240,d3:7}],245:[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":246,d3:7}],246:[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}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":31}],247:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,c=r.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(f,h,v),a.expand(d,p,m);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],251:[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":34,"../../components/colorscale":45,"../../lib":143,"../../plots/plots":207,"fast-isnumeric":10}],252:[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":268}],253:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],254:[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 v=l(t,e,p,g),m=vq!=E>=q&&(O=S[L-1][0],D=S[L][0],z=O+(D-O)*(q-P)/(E-P),F=Math.min(F,z),j=Math.max(j,z));F=Math.max(F,0),j=Math.min(j,d._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:s+10,x0:F,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":31,"../../components/errorbars":61,"../../components/fx":72,"../../lib":143,"./get_trace_color":256}],258:[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":188,"./arrays_to_calcdata":247,"./attributes":248,"./calc":249,"./clean_data":250,"./colorbar":251,"./defaults":254,"./hover":257,"./plot":265,"./select":266,"./style":267,"./subtypes":268}],259:[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,l){var s=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||r)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44}],260:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var o,i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],C=.2,S=new Array(t.length),z=0;for(k||(A=C=-1),o=0;oa(u))break;l=u,m=p[0]*h[0]+p[1]*h[1],m>g?(g=m,s=u,d=!1):m=t.length||!u)break;S[z++]=u,i=u}}else S[z++]=s}L.push(S.slice(0,z))}return L}},{"../../constants/numerical":129}],261:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],262:[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":10}],264:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(r=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?n.background:n.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":31,"../../components/colorscale/defaults":40,"../../components/colorscale/has_colorscale":44,"./subtypes":268}],265:[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,d,p){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function x(){return!1}function b(e){var r,n,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,m=x;f&&(p=o.marker.maxdisplayed||o._needsCull?v:l.identity),d&&(m=o.marker.maxdisplayed||o._needsCull?v:l.identity),n=c.selectAll("path.point"),r=n.data(p,h);var b=r.enter().append("path").classed("point",!0);k&&b.call(s.pointStyle,o,t).call(s.translatePoints,M,A,o).style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");r.order(),r.each(function(e){var r=i.select(this),n=g(r);a=s.translatePoint(e,n,M,A),a?(s.singlePointStyle(e,n,o,_,w,t),o.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):n.remove()}),k?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=c.selectAll("g"),r=n.data(m,h),r.enter().append("g").classed("textpoint",!0).append("text"),r.order(),r.each(function(t){var e=i.select(this),r=g(e.select("text"));(a=s.translatePoint(t,r,M,A))||e.remove()}),r.selectAll("text").call(s.textPointStyle,o,t).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;o(t,e,r,n,a);var k=!!p&&p.duration>0,M=r.xaxis,A=r.yaxis,T=n[0].trace,L=T.line,C=i.select(d);if(C.call(c.plot,r,p),!0===T.visible){g(C).style("opacity",T.opacity);var S,z,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=C;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",z=E._nextFill,P=E._polygons);var N,I,R,F,j,B,H,q,V,U="",G="",X=[],Y=[],Z=l.noop;if(S=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(z&&z.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(L.shape)?(R=s.steps(L.shape),F=s.steps(L.shape.split("").reverse().join(""))):R=F="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return F(t.reverse())},X=f(n,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),Z=function(t){return function(e){if(N=R(e),I=j(e),U?O?(U+="L"+N.substr(1),G=I+"L"+G.substr(1)):(U+="Z"+N,G=I+"Z"+G):(U=N,G=I),u.hasLines(T)&&e.length>1){var r=i.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",N).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",N),s.singleLineStyle(n,a)}}}}}var W=C.selectAll(".js-line").data(Y);g(W.exit()).style("opacity",0).remove(),W.each(Z(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),X.length&&(S?B&&q&&(O?("y"===O?B[1]=q[1]=A.c2p(0,!0):"x"===O&&(B[0]=q[0]=M.c2p(0,!0)),g(S).attr("d","M"+q+"L"+B+"L"+U.substr(1)).call(s.singleFillStyle)):g(S).attr("d",U+"Z").call(s.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(z).attr("d",U+"Z"+D+"Z").call(s.singleFillStyle):g(z).attr("d",U+"L"+D.substr(1)+"Z").call(s.singleFillStyle),T._polygons=T._polygons.concat(P)),T._prevRevpath=G,T._prevPolygons=V);var $=C.selectAll(".points");_=$.data([n]),$.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,s=r.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=n[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=n.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),v=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),d(t,e,r),n(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),v){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":55,"../../components/errorbars":61,"../../lib":143,"../../lib/polygon":153,"./line_points":260,"./link_traces":262,"./subtypes":268,d3:7}],266:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.marker,h=!n.hasMarkers(f)&&!n.hasText(f);if(!0===f.visible&&!h){var p=Array.isArray(d.opacity)?1:d.opacity;if(!1===e)for(r=0;r 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -14483,7 +14551,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":32,"../drawing":56,"./arrow_paths":22,"d3":14,"fast-isnumeric":17}],30:[function(require,module,exports){ +},{"../color":38,"../drawing":62,"./arrow_paths":22,"d3":14,"fast-isnumeric":17}],31:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14508,6 +14576,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -14515,7 +14584,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":23,"./calc_autorange":24,"./click":25,"./convert_coords":26,"./defaults":27,"./draw":28}],31:[function(require,module,exports){ +},{"./attributes":23,"./calc_autorange":24,"./click":25,"./convert_coords":27,"./defaults":28,"./draw":29}],32:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":23}],33:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":150,"../../plots/cartesian/axes":185}],34:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":150,"../../plots/array_container_defaults":182,"../../plots/cartesian/axes":185,"../annotations/common_defaults":26,"./attributes":32}],35:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":211,"../annotations/draw":29}],36:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":32,"./convert":33,"./defaults":34,"./draw":35}],37:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14555,7 +14931,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],32:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14726,7 +15102,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":31,"fast-isnumeric":17,"tinycolor2":20}],33:[function(require,module,exports){ +},{"./attributes":37,"fast-isnumeric":17,"tinycolor2":20}],39:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14882,7 +15258,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../plots/cartesian/layout_attributes":189,"../../plots/font_attributes":202}],34:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/cartesian/layout_attributes":196,"../../plots/font_attributes":209}],40:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14949,7 +15325,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":143,"../../plots/cartesian/tick_label_defaults":196,"../../plots/cartesian/tick_mark_defaults":197,"../../plots/cartesian/tick_value_defaults":198,"./attributes":33}],35:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/tick_label_defaults":203,"../../plots/cartesian/tick_mark_defaults":204,"../../plots/cartesian/tick_value_defaults":205,"./attributes":39}],41:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14975,6 +15351,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -15248,7 +15626,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -15260,8 +15638,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -15274,8 +15651,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -15508,6 +15884,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -15582,7 +15959,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":143,"../../lib/extend":139,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/cartesian/axis_defaults":180,"../../plots/cartesian/layout_attributes":189,"../../plots/cartesian/position_defaults":192,"../../plots/plots":206,"../../registry":221,"../color":32,"../dragelement":53,"../drawing":56,"../titles":121,"./attributes":33,"d3":14,"tinycolor2":20}],36:[function(require,module,exports){ +},{"../../constants/alignment":134,"../../lib":150,"../../lib/extend":146,"../../lib/setcursor":165,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/cartesian/axes":185,"../../plots/cartesian/axis_defaults":187,"../../plots/cartesian/layout_attributes":196,"../../plots/cartesian/position_defaults":199,"../../plots/plots":214,"../../registry":229,"../color":38,"../dragelement":59,"../drawing":62,"../titles":127,"./attributes":39,"d3":14,"tinycolor2":20}],42:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15601,7 +15978,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":143}],37:[function(require,module,exports){ +},{"../../lib":150}],43:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15656,7 +16033,7 @@ module.exports = { } }; -},{}],38:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15735,7 +16112,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":143,"./flip_scale":43,"./scales":50}],39:[function(require,module,exports){ +},{"../../lib":150,"./flip_scale":49,"./scales":56}],45:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15779,7 +16156,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":139,"./attributes":37,"./scales.js":50}],40:[function(require,module,exports){ +},{"../../lib/extend":146,"./attributes":43,"./scales.js":56}],46:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15795,7 +16172,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":50}],41:[function(require,module,exports){ +},{"./scales":56}],47:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15859,7 +16236,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":143,"../colorbar/defaults":34,"../colorbar/has_colorbar":36,"./flip_scale":43,"./is_valid_scale":47,"fast-isnumeric":17}],42:[function(require,module,exports){ +},{"../../lib":150,"../colorbar/defaults":40,"../colorbar/has_colorbar":42,"./flip_scale":49,"./is_valid_scale":53,"fast-isnumeric":17}],48:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15896,7 +16273,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],43:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15921,7 +16298,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],44:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15961,7 +16338,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":40,"./is_valid_scale_array":48,"./scales":50}],45:[function(require,module,exports){ +},{"./default_scale":46,"./is_valid_scale_array":54,"./scales":56}],51:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16007,7 +16384,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":143,"./is_valid_scale":47,"fast-isnumeric":17}],46:[function(require,module,exports){ +},{"../../lib":150,"./is_valid_scale":53,"fast-isnumeric":17}],52:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16041,7 +16418,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":37,"./calc":38,"./default_scale":40,"./defaults":41,"./extract_scale":42,"./flip_scale":43,"./get_scale":44,"./has_colorscale":45,"./is_valid_scale":47,"./make_color_scale_func":49,"./scales":50}],47:[function(require,module,exports){ +},{"./attributes":43,"./calc":44,"./default_scale":46,"./defaults":47,"./extract_scale":48,"./flip_scale":49,"./get_scale":50,"./has_colorscale":51,"./is_valid_scale":53,"./make_color_scale_func":55,"./scales":56}],53:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16062,7 +16439,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":48,"./scales":50}],48:[function(require,module,exports){ +},{"./is_valid_scale_array":54,"./scales":56}],54:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16099,7 +16476,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":20}],49:[function(require,module,exports){ +},{"tinycolor2":20}],55:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16195,7 +16572,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":32,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],50:[function(require,module,exports){ +},{"../color":38,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],56:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16326,7 +16703,7 @@ module.exports = { ] }; -},{}],51:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16359,7 +16736,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],52:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16397,7 +16774,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":143}],53:[function(require,module,exports){ +},{"../../lib":150}],59:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16426,6 +16803,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -16444,28 +16830,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -16516,10 +16894,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -16566,10 +16940,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -16599,7 +16969,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":128,"../../lib":143,"../../plotly":173,"../../plots/cartesian/constants":183,"./align":51,"./cursor":52,"./unhover":54}],54:[function(require,module,exports){ +},{"../../constants/interactions":135,"../../lib":150,"../../plotly":180,"../../plots/cartesian/constants":190,"./align":57,"./cursor":58,"./unhover":60}],60:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16655,7 +17025,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":138}],55:[function(require,module,exports){ +},{"../../lib/events":145}],61:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16679,7 +17049,7 @@ exports.dash = { }; -},{}],56:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16702,6 +17072,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -16723,13 +17096,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -16738,7 +17117,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -16753,7 +17132,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -16839,6 +17217,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -17065,7 +17453,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -17073,7 +17461,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -17094,9 +17481,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -17127,21 +17513,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -17280,34 +17661,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -17328,18 +17762,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -17494,17 +17939,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":131,"../../lib":143,"../../lib/svg_text_utils":160,"../../registry":221,"../../traces/scatter/make_bubble_size_func":328,"../../traces/scatter/subtypes":333,"../color":32,"../colorscale":46,"./symbol_defs":57,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],57:[function(require,module,exports){ +},{"../../constants/alignment":134,"../../constants/xmlns_namespaces":138,"../../lib":150,"../../lib/svg_text_utils":167,"../../registry":229,"../../traces/scatter/make_bubble_size_func":336,"../../traces/scatter/subtypes":341,"../color":38,"../colorscale":52,"./symbol_defs":63,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],63:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17980,7 +18415,7 @@ module.exports = { } }; -},{"d3":14}],58:[function(require,module,exports){ +},{"d3":14}],64:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18079,7 +18514,7 @@ module.exports = { } }; -},{}],59:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18142,7 +18577,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":178,"../../registry":221,"./compute_error":60,"fast-isnumeric":17}],60:[function(require,module,exports){ +},{"../../plots/cartesian/axes":185,"../../registry":229,"./compute_error":66,"fast-isnumeric":17}],66:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18238,7 +18673,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],61:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18315,7 +18750,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":143,"../../registry":221,"./attributes":58,"fast-isnumeric":17}],62:[function(require,module,exports){ +},{"../../lib":150,"../../registry":229,"./attributes":64,"fast-isnumeric":17}],68:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18374,7 +18809,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":58,"./calc":59,"./defaults":61,"./plot":63,"./style":64}],63:[function(require,module,exports){ +},{"./attributes":64,"./calc":65,"./defaults":67,"./plot":69,"./style":70}],69:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18538,7 +18973,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":333,"d3":14,"fast-isnumeric":17}],64:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":341,"d3":14,"fast-isnumeric":17}],70:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18575,7 +19010,7 @@ module.exports = function style(traces) { }); }; -},{"../color":32,"d3":14}],65:[function(require,module,exports){ +},{"../color":38,"d3":14}],71:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18611,7 +19046,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../plots/font_attributes":202}],66:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/font_attributes":209}],72:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18627,30 +19062,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; + + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":143,"../../registry":221}],67:[function(require,module,exports){ +},{"../../lib":150,"../../registry":229}],73:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18662,10 +19113,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -18679,7 +19139,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":221}],68:[function(require,module,exports){ +},{"../../registry":229,"./hover":77}],74:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18711,7 +19171,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],69:[function(require,module,exports){ +},{}],75:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18734,7 +19194,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":143,"./attributes":65,"./hoverlabel_defaults":72}],70:[function(require,module,exports){ +},{"../../lib":150,"./attributes":71,"./hoverlabel_defaults":78}],76:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18745,6 +19205,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -18821,7 +19282,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":68}],71:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":150,"./constants":74}],77:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18890,7 +19377,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -18902,13 +19389,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -18985,15 +19472,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -19178,11 +19665,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -19281,6 +19768,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -19314,7 +19802,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -19328,7 +19816,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -19347,7 +19835,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -19382,7 +19870,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -19419,23 +19907,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -19451,14 +19932,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -19548,7 +20024,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -19564,12 +20042,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -19581,11 +20057,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -19853,17 +20327,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -19880,6 +20349,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -19947,7 +20440,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -19957,29 +20450,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -20131,7 +20601,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":143,"../../lib/events":138,"../../lib/override_cursor":152,"../../lib/svg_text_utils":160,"../../plots/cartesian/axes":178,"../../registry":221,"../color":32,"../dragelement":53,"../drawing":56,"./constants":68,"./helpers":70,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],72:[function(require,module,exports){ +},{"../../lib":150,"../../lib/events":145,"../../lib/override_cursor":159,"../../lib/svg_text_utils":167,"../../plots/cartesian/axes":185,"../../registry":229,"../color":38,"../dragelement":59,"../drawing":62,"./constants":74,"./helpers":76,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],78:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20152,7 +20622,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":143}],73:[function(require,module,exports){ +},{"../../lib":150}],79:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20190,7 +20660,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -20212,23 +20685,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":143,"../dragelement":53,"./attributes":65,"./calc":66,"./click":67,"./constants":68,"./defaults":69,"./helpers":70,"./hover":71,"./layout_attributes":74,"./layout_defaults":75,"./layout_global_defaults":76,"d3":14}],74:[function(require,module,exports){ +},{"../../lib":150,"../dragelement":59,"./attributes":71,"./calc":72,"./click":73,"./constants":74,"./defaults":75,"./helpers":76,"./hover":77,"./layout_attributes":80,"./layout_defaults":81,"./layout_global_defaults":82,"d3":14}],80:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20281,7 +20752,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../plots/font_attributes":202,"./constants":68}],75:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/font_attributes":209,"./constants":74}],81:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20329,7 +20800,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":143,"./layout_attributes":74}],76:[function(require,module,exports){ +},{"../../lib":150,"./layout_attributes":80}],82:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20352,7 +20823,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":143,"./hoverlabel_defaults":72,"./layout_attributes":74}],77:[function(require,module,exports){ +},{"../../lib":150,"./hoverlabel_defaults":78,"./layout_attributes":80}],83:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20474,7 +20945,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":183}],78:[function(require,module,exports){ +},{"../../plots/cartesian/constants":190}],84:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20557,7 +21028,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":161,"fast-isnumeric":17}],79:[function(require,module,exports){ +},{"../../lib/to_log_range":168,"fast-isnumeric":17}],85:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20618,7 +21089,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":143,"../../plots/array_container_defaults":175,"../../plots/cartesian/axes":178,"./attributes":77}],80:[function(require,module,exports){ +},{"../../lib":150,"../../plots/array_container_defaults":182,"../../plots/cartesian/axes":185,"./attributes":83}],86:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20839,7 +21310,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":131,"../../plots/cartesian/axes":178,"../drawing":56,"d3":14}],81:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":138,"../../plots/cartesian/axes":185,"../drawing":62,"d3":14}],87:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20862,7 +21333,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":77,"./convert_coords":78,"./defaults":79,"./draw":80}],82:[function(require,module,exports){ +},{"./attributes":83,"./convert_coords":84,"./defaults":85,"./draw":86}],88:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20911,7 +21382,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],83:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21002,7 +21473,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../plots/font_attributes":202,"../color/attributes":31}],84:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/font_attributes":209,"../color/attributes":37}],90:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21020,7 +21491,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],85:[function(require,module,exports){ +},{}],91:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21113,7 +21584,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":143,"../../plots/layout_attributes":204,"../../registry":221,"./attributes":83,"./helpers":88}],86:[function(require,module,exports){ +},{"../../lib":150,"../../plots/layout_attributes":212,"../../registry":229,"./attributes":89,"./helpers":94}],92:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21138,6 +21609,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -21227,7 +21700,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -21433,6 +21906,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -21484,30 +21958,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -21672,20 +22140,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -21693,18 +22162,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -21939,7 +22409,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":206,"../../registry":221,"../color":32,"../dragelement":53,"../drawing":56,"./anchor_utils":82,"./constants":84,"./get_legend_data":87,"./helpers":88,"./style":90,"d3":14}],87:[function(require,module,exports){ +},{"../../constants/alignment":134,"../../constants/interactions":135,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/plots":214,"../../registry":229,"../color":38,"../dragelement":59,"../drawing":62,"./anchor_utils":88,"./constants":90,"./get_legend_data":93,"./helpers":94,"./style":96,"d3":14}],93:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22044,7 +22514,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":221,"./helpers":88}],88:[function(require,module,exports){ +},{"../../registry":229,"./helpers":94}],94:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22075,7 +22545,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":221}],89:[function(require,module,exports){ +},{"../../registry":229}],95:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22099,7 +22569,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":83,"./defaults":85,"./draw":86,"./style":90}],90:[function(require,module,exports){ +},{"./attributes":89,"./defaults":91,"./draw":92,"./style":96}],96:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22122,7 +22592,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -22160,179 +22630,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; + + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } - if(pts.size()) pts.call(stylePie, d[0], trace); -} + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; -},{"../../lib":143,"../../registry":221,"../../traces/pie/style_one":311,"../../traces/scatter/subtypes":333,"../color":32,"../drawing":56,"d3":14}],91:[function(require,module,exports){ +},{"../../lib":150,"../../registry":229,"../../traces/pie/style_one":319,"../../traces/scatter/subtypes":341,"../color":38,"../drawing":62,"d3":14}],97:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22910,7 +23380,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":143,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/plots":206,"../../snapshot/download":223}],92:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":150,"../../plotly":180,"../../plots/cartesian/axes":185,"../../plots/plots":214,"../../snapshot/download":231}],98:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22924,7 +23394,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":93}],93:[function(require,module,exports){ +},{"./manage":99}],99:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23048,7 +23518,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -23100,7 +23570,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -23152,7 +23622,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":178,"../../traces/scatter/subtypes":333,"./buttons":91,"./modebar":94}],94:[function(require,module,exports){ +},{"../../plots/cartesian/axes":185,"../../traces/scatter/subtypes":341,"./buttons":97,"./modebar":100}],100:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23446,7 +23916,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":143,"d3":14}],95:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":150,"d3":14}],101:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23536,7 +24006,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../plots/font_attributes":202,"../color/attributes":31,"./button_attributes":96}],96:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/font_attributes":209,"../color/attributes":37,"./button_attributes":102}],102:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23577,7 +24047,7 @@ module.exports = { } }; -},{}],97:[function(require,module,exports){ +},{}],103:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23606,7 +24076,7 @@ module.exports = { darkAmount: 10 }; -},{}],98:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23705,7 +24175,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":143,"../color":32,"./attributes":95,"./button_attributes":96,"./constants":97}],99:[function(require,module,exports){ +},{"../../lib":150,"../color":38,"./attributes":101,"./button_attributes":102,"./constants":103}],105:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23727,6 +24197,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -23767,7 +24239,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -23854,11 +24326,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -23890,26 +24360,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -23928,13 +24395,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -23980,7 +24442,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/cartesian/axis_ids":181,"../../plots/plots":206,"../color":32,"../drawing":56,"../legend/anchor_utils":82,"./constants":97,"./get_update_object":100,"d3":14}],100:[function(require,module,exports){ +},{"../../constants/alignment":134,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/cartesian/axis_ids":188,"../../plots/plots":214,"../color":38,"../drawing":62,"../legend/anchor_utils":88,"./constants":103,"./get_update_object":106,"d3":14}],106:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24037,7 +24499,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":14}],101:[function(require,module,exports){ +},{"d3":14}],107:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24064,7 +24526,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":95,"./defaults":98,"./draw":99}],102:[function(require,module,exports){ +},{"./attributes":101,"./defaults":104,"./draw":105}],108:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24128,7 +24590,7 @@ module.exports = { } }; -},{"../color/attributes":31}],103:[function(require,module,exports){ +},{"../color/attributes":37}],109:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24164,7 +24626,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":178,"./constants":104}],104:[function(require,module,exports){ +},{"../../plots/cartesian/axes":185,"./constants":110}],110:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24216,7 +24678,7 @@ module.exports = { extraPad: 15 }; -},{}],105:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24273,7 +24735,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":143,"./attributes":102}],106:[function(require,module,exports){ +},{"../../lib":150,"./attributes":108}],112:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24824,7 +25286,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":143,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian":188,"../../plots/cartesian/axes":178,"../../plots/plots":206,"../color":32,"../dragelement":53,"../drawing":56,"./constants":104,"d3":14}],107:[function(require,module,exports){ +},{"../../lib":150,"../../lib/setcursor":165,"../../plotly":180,"../../plots/cartesian":195,"../../plots/cartesian/axes":185,"../../plots/plots":214,"../color":38,"../dragelement":59,"../drawing":62,"./constants":110,"d3":14}],113:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24851,7 +25313,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":102,"./calc_autorange":103,"./defaults":105,"./draw":106}],108:[function(require,module,exports){ +},{"./attributes":108,"./calc_autorange":109,"./defaults":111,"./draw":112}],114:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24948,7 +25410,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../traces/scatter/attributes":313,"../annotations/attributes":23,"../drawing/attributes":55}],109:[function(require,module,exports){ +},{"../../lib/extend":146,"../../traces/scatter/attributes":321,"../annotations/attributes":23,"../drawing/attributes":61}],115:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24994,7 +25456,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -25025,7 +25487,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":143,"../../plots/cartesian/axes":178,"./constants":110,"./helpers":113}],110:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"./constants":116,"./helpers":119}],116:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25089,7 +25551,7 @@ module.exports = { } }; -},{}],111:[function(require,module,exports){ +},{}],117:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25114,7 +25576,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":175,"./shape_defaults":115}],112:[function(require,module,exports){ +},{"../../plots/array_container_defaults":182,"./shape_defaults":121}],118:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25247,8 +25709,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -25257,6 +25719,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -25489,7 +25953,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":143,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian/axes":178,"../color":32,"../dragelement":53,"../drawing":56,"./constants":110,"./helpers":113}],113:[function(require,module,exports){ +},{"../../lib":150,"../../lib/setcursor":165,"../../plotly":180,"../../plots/cartesian/axes":185,"../color":38,"../dragelement":59,"../drawing":62,"./constants":116,"./helpers":119}],119:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25570,7 +26034,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],114:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25596,7 +26060,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":108,"./calc_autorange":109,"./defaults":111,"./draw":112}],115:[function(require,module,exports){ +},{"./attributes":114,"./calc_autorange":115,"./defaults":117,"./draw":118}],121:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25695,7 +26159,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":143,"../../plots/cartesian/axes":178,"./attributes":108,"./helpers":113}],116:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"./attributes":114,"./helpers":119}],122:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25718,7 +26182,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -25743,6 +26207,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -25929,7 +26399,7 @@ module.exports = { }, }; -},{"../../lib/extend":139,"../../plots/animation_attributes":174,"../../plots/font_attributes":202,"../../plots/pad_attributes":205,"./constants":117}],117:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/animation_attributes":181,"../../plots/font_attributes":209,"../../plots/pad_attributes":213,"./constants":123}],123:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25977,9 +26447,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -26026,7 +26493,7 @@ module.exports = { currentValueInset: 0, }; -},{}],118:[function(require,module,exports){ +},{}],124:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26124,14 +26591,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -26139,7 +26608,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":143,"../../plots/array_container_defaults":175,"./attributes":116,"./constants":117}],119:[function(require,module,exports){ +},{"../../lib":150,"../../plots/array_container_defaults":182,"./attributes":122,"./constants":123}],125:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26160,11 +26629,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -26228,24 +26698,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -26273,14 +26737,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -26290,26 +26752,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -26336,6 +26780,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -26427,7 +26896,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -26444,9 +26916,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; + + svgTextUtils.positionText(text, x0, y0); return text; } @@ -26478,11 +26955,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -26509,7 +26989,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -26551,7 +27037,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -26741,7 +27229,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":160,"../../plots/plots":206,"../color":32,"../drawing":56,"../legend/anchor_utils":82,"./constants":117,"d3":14}],120:[function(require,module,exports){ +},{"../../constants/alignment":134,"../../lib/svg_text_utils":167,"../../plots/plots":214,"../color":38,"../drawing":62,"../legend/anchor_utils":88,"./constants":123,"d3":14}],126:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26764,7 +27252,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":116,"./constants":117,"./defaults":118,"./draw":119}],121:[function(require,module,exports){ +},{"./attributes":122,"./constants":123,"./defaults":124,"./draw":125}],127:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26787,6 +27275,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -26819,29 +27308,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -26850,7 +27344,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -26859,6 +27353,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -26878,11 +27375,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -26894,33 +27388,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -26951,8 +27445,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -26960,8 +27453,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -26972,11 +27464,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -26986,18 +27478,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":206,"../color":32,"../drawing":56,"d3":14,"fast-isnumeric":17}],122:[function(require,module,exports){ +},{"../../constants/interactions":135,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/plots":214,"../color":38,"../drawing":62,"d3":14,"fast-isnumeric":17}],128:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27018,7 +27506,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -27039,6 +27527,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -27144,7 +27638,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../../plots/font_attributes":202,"../../plots/pad_attributes":205,"../color/attributes":31}],123:[function(require,module,exports){ +},{"../../lib/extend":146,"../../plots/font_attributes":209,"../../plots/pad_attributes":213,"../color/attributes":37}],129:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27191,9 +27685,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -27217,10 +27708,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],124:[function(require,module,exports){ +},{}],130:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27299,13 +27798,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -27314,7 +27815,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":143,"../../plots/array_container_defaults":175,"./attributes":122,"./constants":123}],125:[function(require,module,exports){ +},{"../../lib":150,"../../plots/array_container_defaults":182,"./attributes":128,"./constants":129}],131:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27334,6 +27835,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -27519,7 +28022,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -27531,7 +28034,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -27639,7 +28142,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -27648,7 +28151,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -27749,9 +28254,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -27771,18 +28276,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -27833,19 +28341,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -27939,34 +28446,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -27982,8 +28484,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -27994,9 +28496,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":160,"../../plots/plots":206,"../color":32,"../drawing":56,"../legend/anchor_utils":82,"./constants":123,"./scrollbox":127,"d3":14}],126:[function(require,module,exports){ -arguments[4][120][0].apply(exports,arguments) -},{"./attributes":122,"./constants":123,"./defaults":124,"./draw":125,"dup":120}],127:[function(require,module,exports){ +},{"../../constants/alignment":134,"../../lib/svg_text_utils":167,"../../plots/plots":214,"../color":38,"../drawing":62,"../legend/anchor_utils":88,"./constants":129,"./scrollbox":133,"d3":14}],132:[function(require,module,exports){ +arguments[4][126][0].apply(exports,arguments) +},{"./attributes":128,"./constants":129,"./defaults":130,"./draw":131,"dup":126}],133:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28467,7 +28969,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":143,"../color":32,"../drawing":56,"d3":14}],128:[function(require,module,exports){ +},{"../../lib":150,"../color":38,"../drawing":62,"d3":14}],134:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],135:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28491,7 +29029,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],129:[function(require,module,exports){ +},{}],136:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28544,7 +29082,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],130:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28582,7 +29120,7 @@ module.exports = { }; -},{}],131:[function(require,module,exports){ +},{}],138:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28606,7 +29144,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],132:[function(require,module,exports){ +},{}],139:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28624,7 +29162,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -28665,6 +29203,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -28686,7 +29225,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":30,"./components/fx":73,"./components/images":81,"./components/legend":89,"./components/rangeselector":101,"./components/rangeslider":107,"./components/shapes":114,"./components/sliders":120,"./components/updatemenus":126,"./fonts/mathjax_config":133,"./lib/queue":155,"./plot_api/plot_schema":167,"./plot_api/register":168,"./plot_api/set_plot_config":169,"./plot_api/to_image":171,"./plot_api/validate":172,"./plotly":173,"./snapshot":226,"./snapshot/download":223,"./traces/scatter":323,"d3":14,"es6-promise":15}],133:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":31,"./components/annotations3d":36,"./components/fx":79,"./components/images":87,"./components/legend":95,"./components/rangeselector":107,"./components/rangeslider":113,"./components/shapes":120,"./components/sliders":126,"./components/updatemenus":132,"./fonts/mathjax_config":140,"./lib/queue":162,"./plot_api/plot_schema":174,"./plot_api/register":175,"./plot_api/set_plot_config":176,"./plot_api/to_image":178,"./plot_api/validate":179,"./plotly":180,"./snapshot":234,"./snapshot/download":231,"./traces/scatter":331,"d3":14,"es6-promise":15}],140:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28719,7 +29258,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],134:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28752,7 +29291,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":129,"fast-isnumeric":17}],135:[function(require,module,exports){ +},{"../constants/numerical":136,"fast-isnumeric":17}],142:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28767,6 +29306,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -28792,6 +29332,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -29044,6 +29598,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -29063,7 +29646,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":44,"../components/colorscale/scales":50,"./nested_property":149,"fast-isnumeric":17,"tinycolor2":20}],136:[function(require,module,exports){ +},{"../components/colorscale/get_scale":50,"../components/colorscale/scales":56,"../plots/attributes":183,"./nested_property":156,"fast-isnumeric":17,"tinycolor2":20}],143:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29691,7 +30274,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":129,"../registry":221,"./loggers":146,"./mod":148,"d3":14,"fast-isnumeric":17}],137:[function(require,module,exports){ +},{"../constants/numerical":136,"../registry":229,"./loggers":153,"./mod":155,"d3":14,"fast-isnumeric":17}],144:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29720,7 +30303,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],138:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29886,7 +30469,7 @@ var Events = { module.exports = Events; -},{"events":16}],139:[function(require,module,exports){ +},{"events":16}],146:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30000,7 +30583,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":145}],140:[function(require,module,exports){ +},{"./is_plain_object.js":152}],147:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30051,7 +30634,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],141:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30082,7 +30665,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],142:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30098,7 +30681,7 @@ module.exports = function filterVisible(container) { module.exports = function identity(d) { return d; }; -},{}],143:[function(require,module,exports){ +},{}],150:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30111,6 +30694,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -30127,6 +30715,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -30188,6 +30777,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -30438,6 +31034,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -30445,6 +31050,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -30485,7 +31135,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -30515,13 +31165,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -30762,7 +31405,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":134,"./coerce":135,"./dates":136,"./ensure_array":137,"./extend":139,"./filter_unique":140,"./filter_visible":141,"./identity":142,"./is_array":144,"./is_plain_object":145,"./loggers":146,"./matrix":147,"./mod":148,"./nested_property":149,"./noop":150,"./notifier":151,"./push_unique":154,"./relink_private":156,"./search":157,"./stats":159,"./to_log_range":161,"d3":14}],144:[function(require,module,exports){ +},{"../constants/numerical":136,"./clean_number":141,"./coerce":142,"./dates":143,"./ensure_array":144,"./extend":146,"./filter_unique":147,"./filter_visible":148,"./identity":149,"./is_array":151,"./is_plain_object":152,"./loggers":153,"./matrix":154,"./mod":155,"./nested_property":156,"./noop":157,"./notifier":158,"./push_unique":161,"./relink_private":163,"./search":164,"./stats":166,"./to_log_range":168,"d3":14,"fast-isnumeric":17}],151:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30786,7 +31429,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],145:[function(require,module,exports){ +},{}],152:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30815,7 +31458,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],146:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30889,7 +31532,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":166}],147:[function(require,module,exports){ +},{"../plot_api/plot_config":173}],154:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30999,7 +31642,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],148:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31019,7 +31662,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],149:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31323,7 +31966,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":162,"./is_array":144,"./is_plain_object":145,"fast-isnumeric":17}],150:[function(require,module,exports){ +},{"../plot_api/container_array_match":169,"./is_array":151,"./is_plain_object":152,"fast-isnumeric":17}],157:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31339,7 +31982,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],151:[function(require,module,exports){ +},{}],158:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31421,7 +32064,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":14,"fast-isnumeric":17}],152:[function(require,module,exports){ +},{"d3":14,"fast-isnumeric":17}],159:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31470,7 +32113,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":158}],153:[function(require,module,exports){ +},{"./setcursor":165}],160:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31711,7 +32354,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":129,"./matrix":147}],154:[function(require,module,exports){ +},{"../constants/numerical":136,"./matrix":154}],161:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31749,7 +32392,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],155:[function(require,module,exports){ +},{}],162:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31960,7 +32603,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":143,"../plot_api/plot_config":166}],156:[function(require,module,exports){ +},{"../lib":150,"../plot_api/plot_config":173}],163:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32017,7 +32660,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":144,"./is_plain_object":145}],157:[function(require,module,exports){ +},{"./is_array":151,"./is_plain_object":152}],164:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32128,7 +32771,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":146,"fast-isnumeric":17}],158:[function(require,module,exports){ +},{"./loggers":153,"fast-isnumeric":17}],165:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32151,7 +32794,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],159:[function(require,module,exports){ +},{}],166:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32247,7 +32890,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":17}],160:[function(require,module,exports){ +},{"fast-isnumeric":17}],167:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32266,62 +32909,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -32329,42 +32917,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); + .style('white-space', 'pre'); - result = _context.appendSVG(converted); + var hasLink = buildSVGText(_context.node(), str); - if(!result) _context.text(str); - - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -32372,14 +32962,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -32394,7 +32985,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -32411,36 +33006,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -32453,9 +33048,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -32486,23 +33084,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' +}; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' }; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -32513,24 +33123,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -32541,26 +33170,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -32570,122 +33205,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -32722,28 +33432,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + context.style({'pointer-events': _delegate ? 'none' : 'all'}); + + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -32758,63 +33481,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -32826,10 +33548,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":130,"../constants/xmlns_namespaces":131,"../lib":143,"d3":14}],161:[function(require,module,exports){ +},{"../constants/alignment":134,"../constants/string_mappings":137,"../constants/xmlns_namespaces":138,"../lib":150,"d3":14}],168:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32857,7 +33579,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":17}],162:[function(require,module,exports){ +},{"fast-isnumeric":17}],169:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32915,7 +33637,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":221}],163:[function(require,module,exports){ +},{"../registry":229}],170:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33133,7 +33855,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -33266,18 +33987,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -33333,7 +34074,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -33436,7 +34177,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":32,"../lib":143,"../plots/cartesian/axes":178,"../plots/plots":206,"../registry":221,"fast-isnumeric":17,"gl-mat4/fromQuat":18}],164:[function(require,module,exports){ +},{"../components/color":38,"../lib":150,"../plots/cartesian/axes":185,"../plots/plots":214,"../registry":229,"fast-isnumeric":17,"gl-mat4/fromQuat":18}],171:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33650,7 +34391,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":145,"../lib/loggers":146,"../lib/nested_property":149,"../lib/noop":150,"../lib/search":157,"../registry":221,"./container_array_match":162}],165:[function(require,module,exports){ +},{"../lib/is_plain_object":152,"../lib/loggers":153,"../lib/nested_property":156,"../lib/noop":157,"../lib/search":164,"../registry":229,"./container_array_match":169}],172:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33685,7 +34426,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -33842,9 +34585,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -33873,19 +34614,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; + if(JSON.stringify(fullLayout._size) === oldmargins) return; - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); - - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -33923,7 +34664,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -34023,6 +34767,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -34120,7 +34865,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -34129,9 +34874,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -34146,11 +34892,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -35036,6 +35781,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -35135,6 +35881,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -35566,10 +36315,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -35591,7 +36342,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -35599,7 +36351,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -35612,11 +36364,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -35696,6 +36462,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -35794,7 +36561,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -35842,7 +36618,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -36676,7 +37452,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":56,"../components/errorbars":62,"../constants/xmlns_namespaces":131,"../lib":143,"../lib/events":138,"../lib/queue":155,"../lib/svg_text_utils":160,"../plotly":173,"../plots/cartesian/axis_ids":181,"../plots/cartesian/constants":183,"../plots/cartesian/constraints":185,"../plots/cartesian/graph_interact":187,"../plots/plots":206,"../plots/polar":209,"../registry":221,"./helpers":163,"./manage_arrays":164,"./subroutines":170,"d3":14,"fast-isnumeric":17}],166:[function(require,module,exports){ +},{"../components/drawing":62,"../components/errorbars":68,"../constants/xmlns_namespaces":138,"../lib":150,"../lib/events":145,"../lib/queue":162,"../lib/svg_text_utils":167,"../plotly":180,"../plots/cartesian/axis_ids":188,"../plots/cartesian/constants":190,"../plots/cartesian/constraints":192,"../plots/cartesian/graph_interact":194,"../plots/plots":214,"../plots/polar":217,"../registry":229,"./helpers":170,"./manage_arrays":171,"./subroutines":177,"d3":14,"fast-isnumeric":17}],173:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -36802,7 +37578,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],167:[function(require,module,exports){ +},{}],174:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -36961,7 +37737,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -36981,9 +37760,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -37208,7 +37986,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":143,"../plots/animation_attributes":174,"../plots/attributes":176,"../plots/frame_attributes":203,"../plots/layout_attributes":204,"../plots/polar/area_attributes":207,"../plots/polar/axis_attributes":208,"../registry":221}],168:[function(require,module,exports){ +},{"../lib":150,"../plots/animation_attributes":181,"../plots/attributes":183,"../plots/frame_attributes":210,"../plots/layout_attributes":212,"../plots/polar/area_attributes":215,"../plots/polar/axis_attributes":216,"../registry":229}],175:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37307,7 +38085,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":143,"../registry":221}],169:[function(require,module,exports){ +},{"../lib":150,"../registry":229}],176:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37333,7 +38111,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":143,"../plotly":173}],170:[function(require,module,exports){ +},{"../lib":150,"../plotly":180}],177:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37462,15 +38240,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -37590,27 +38369,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -37711,19 +38492,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -37740,7 +38524,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":32,"../components/drawing":56,"../components/modebar":92,"../components/titles":121,"../lib":143,"../plotly":173,"../plots/cartesian/graph_interact":187,"../plots/plots":206,"../registry":221,"d3":14}],171:[function(require,module,exports){ +},{"../components/color":38,"../components/drawing":62,"../components/modebar":98,"../components/titles":127,"../lib":150,"../plotly":180,"../plots/cartesian/graph_interact":194,"../plots/plots":214,"../registry":229,"d3":14}],178:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37850,7 +38634,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":143,"../plotly":173,"../snapshot/cloneplot":222,"../snapshot/helpers":225,"../snapshot/svgtoimg":227,"../snapshot/tosvg":229,"fast-isnumeric":17}],172:[function(require,module,exports){ +},{"../lib":150,"../plotly":180,"../snapshot/cloneplot":230,"../snapshot/helpers":233,"../snapshot/svgtoimg":235,"../snapshot/tosvg":237,"fast-isnumeric":17}],179:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38072,6 +38856,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -38120,6 +38909,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -38137,7 +38936,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -38154,8 +38953,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -38221,7 +39020,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":143,"../plots/plots":206,"./plot_schema":167}],173:[function(require,module,exports){ +},{"../lib":150,"../plots/plots":214,"./plot_schema":174}],180:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38255,7 +39054,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":92,"./plot_api/plot_api":165,"./plot_api/plot_config":166,"./plots/cartesian/axes":178,"./plots/plots":206}],174:[function(require,module,exports){ +},{"./components/modebar":98,"./plot_api/plot_api":172,"./plot_api/plot_config":173,"./plots/cartesian/axes":185,"./plots/plots":214}],181:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38357,7 +39156,7 @@ module.exports = { } }; -},{}],175:[function(require,module,exports){ +},{}],182:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38438,7 +39237,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":143}],176:[function(require,module,exports){ +},{"../lib":150}],183:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38495,11 +39294,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -38523,7 +39331,7 @@ module.exports = { } }; -},{"../components/fx/attributes":65}],177:[function(require,module,exports){ +},{"../components/fx/attributes":71}],184:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38550,7 +39358,7 @@ module.exports = { } }; -},{}],178:[function(require,module,exports){ +},{}],185:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38580,7 +39388,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -38653,33 +39460,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -38920,6 +39721,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -39015,6 +39819,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -40366,10 +41177,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -40402,17 +41213,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -40878,7 +41682,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":32,"../../components/drawing":56,"../../components/titles":121,"../../constants/numerical":129,"../../lib":143,"../../lib/svg_text_utils":160,"../../registry":221,"./axis_autotype":179,"./axis_ids":181,"./layout_attributes":189,"./layout_defaults":190,"./set_convert":195,"d3":14,"fast-isnumeric":17}],179:[function(require,module,exports){ +},{"../../components/color":38,"../../components/drawing":62,"../../components/titles":127,"../../constants/numerical":136,"../../lib":150,"../../lib/svg_text_utils":167,"../../registry":229,"./axis_autotype":186,"./axis_ids":188,"./layout_attributes":196,"./layout_defaults":197,"./set_convert":202,"d3":14,"fast-isnumeric":17}],186:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -40953,7 +41757,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":17}],180:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../lib":150,"fast-isnumeric":17}],187:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41076,7 +41880,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":31,"../../lib":143,"../../registry":221,"./category_order_defaults":182,"./layout_attributes":189,"./ordered_categories":191,"./set_convert":195,"./tick_label_defaults":196,"./tick_mark_defaults":197,"./tick_value_defaults":198,"tinycolor2":20}],181:[function(require,module,exports){ +},{"../../components/color/attributes":37,"../../lib":150,"../../registry":229,"./category_order_defaults":189,"./layout_attributes":196,"./ordered_categories":198,"./set_convert":202,"./tick_label_defaults":203,"./tick_mark_defaults":204,"./tick_value_defaults":205,"tinycolor2":20}],188:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41198,7 +42002,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":143,"../../registry":221,"../plots":206,"./constants":183}],182:[function(require,module,exports){ +},{"../../lib":150,"../../registry":229,"../plots":214,"./constants":190}],189:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41232,7 +42036,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],183:[function(require,module,exports){ +},{}],190:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41287,7 +42091,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],184:[function(require,module,exports){ +},{}],191:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41305,10 +42109,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(containerOut.fixedrange) return; + + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + if(!containerIn.scaleanchor) return; + + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -41327,7 +42146,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -41426,7 +42245,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":143,"./axis_ids":181}],185:[function(require,module,exports){ +},{"../../lib":150,"./axis_ids":188}],192:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41443,12 +42262,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -41464,12 +42285,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -41477,32 +42304,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; + + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } + } + } + } +}; + +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; } } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } } }; -},{"../../constants/numerical":129,"./axis_ids":181,"./scale_zoom":193}],186:[function(require,module,exports){ +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":134,"../../constants/numerical":136,"./axis_ids":188,"./scale_zoom":200}],193:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41525,6 +42473,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -41634,7 +42585,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -41688,6 +42638,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -41786,8 +42739,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -41820,7 +42773,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -41839,11 +42793,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -42028,6 +42982,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -42047,8 +43003,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -42145,24 +43106,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -42197,11 +43151,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -42212,7 +43170,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -42221,7 +43179,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -42304,7 +43262,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -42320,13 +43278,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -42503,7 +43463,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":32,"../../components/dragelement":53,"../../components/drawing":56,"../../lib":143,"../../lib/setcursor":158,"../../lib/svg_text_utils":160,"../../plotly":173,"../../registry":221,"./axes":178,"./axis_ids":181,"./constants":183,"./scale_zoom":193,"./select":194,"d3":14,"tinycolor2":20}],187:[function(require,module,exports){ +},{"../../components/color":38,"../../components/dragelement":59,"../../components/drawing":62,"../../constants/alignment":134,"../../lib":150,"../../lib/setcursor":165,"../../lib/svg_text_utils":167,"../../plotly":180,"../../registry":229,"../plots":214,"./axes":185,"./axis_ids":188,"./constants":190,"./scale_zoom":200,"./select":201,"d3":14,"tinycolor2":20}],194:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42526,7 +43486,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -42544,8 +43504,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -42603,7 +43561,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -42664,7 +43622,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":53,"../../components/fx":73,"./constants":183,"./dragbox":186,"fast-isnumeric":17}],188:[function(require,module,exports){ +},{"../../components/dragelement":59,"../../components/fx":79,"./constants":190,"./dragbox":193,"fast-isnumeric":17}],195:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42851,6 +43809,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -43053,7 +44016,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":143,"../plots":206,"./attributes":177,"./axis_ids":181,"./constants":183,"./layout_attributes":189,"./transition_axes":199,"d3":14}],189:[function(require,module,exports){ +},{"../../lib":150,"../plots":214,"./attributes":184,"./axis_ids":188,"./constants":190,"./layout_attributes":196,"./transition_axes":206,"d3":14}],196:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43148,6 +44111,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -43445,7 +44422,7 @@ module.exports = { } }; -},{"../../components/color/attributes":31,"../../components/drawing/attributes":55,"../../lib/extend":139,"../font_attributes":202,"./constants":183}],190:[function(require,module,exports){ +},{"../../components/color/attributes":37,"../../components/drawing/attributes":61,"../../lib/extend":146,"../font_attributes":209,"./constants":190}],197:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43718,7 +44695,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":32,"../../lib":143,"../../registry":221,"../layout_attributes":204,"./axis_defaults":180,"./axis_ids":181,"./constants":183,"./constraint_defaults":184,"./layout_attributes":189,"./position_defaults":192,"./type_defaults":200}],191:[function(require,module,exports){ +},{"../../components/color":38,"../../lib":150,"../../registry":229,"../layout_attributes":212,"./axis_defaults":187,"./axis_ids":188,"./constants":190,"./constraint_defaults":191,"./layout_attributes":196,"./position_defaults":199,"./type_defaults":207}],198:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43797,7 +44774,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":14}],192:[function(require,module,exports){ +},{"d3":14}],199:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43862,7 +44839,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":143,"fast-isnumeric":17}],193:[function(require,module,exports){ +},{"../../lib":150,"fast-isnumeric":17}],200:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43874,20 +44851,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],194:[function(require,module,exports){ +},{"../../constants/alignment":134}],201:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43901,6 +44881,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -44041,7 +45022,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -44087,7 +45070,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":32,"../../lib/polygon":153,"./axes":178,"./constants":183}],195:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":38,"../../components/fx/helpers":76,"../../lib/polygon":160,"./axes":185,"./constants":190}],202:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44106,6 +45106,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -44118,13 +45119,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -44242,7 +45236,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -44255,8 +45249,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -44272,10 +45266,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -44283,16 +45279,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -44310,26 +45308,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; + + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -44530,7 +45540,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":129,"../../lib":143,"./axis_ids":181,"./constants":183,"d3":14,"fast-isnumeric":17}],196:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../lib":150,"./axis_ids":188,"./constants":190,"d3":14,"fast-isnumeric":17}],203:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44614,7 +45624,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":143}],197:[function(require,module,exports){ +},{"../../lib":150}],204:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44647,7 +45657,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":143,"./layout_attributes":189}],198:[function(require,module,exports){ +},{"../../lib":150,"./layout_attributes":196}],205:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44731,7 +45741,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":17}],199:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../lib":150,"fast-isnumeric":17}],206:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45047,7 +46057,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":56,"../../plotly":173,"../../registry":221,"./axes":178,"d3":14}],200:[function(require,module,exports){ +},{"../../components/drawing":62,"../../plotly":180,"../../registry":229,"./axes":185,"d3":14}],207:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45175,7 +46185,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":221,"./axis_autotype":179,"./axis_ids":181}],201:[function(require,module,exports){ +},{"../../registry":229,"./axis_autotype":186,"./axis_ids":188}],208:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45440,6 +46450,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -45600,7 +46612,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":143,"../plotly":173}],202:[function(require,module,exports){ +},{"../lib":150,"../plotly":180}],209:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45631,7 +46643,7 @@ module.exports = { } }; -},{}],203:[function(require,module,exports){ +},{}],210:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45677,7 +46689,41 @@ module.exports = { } }; -},{}],204:[function(require,module,exports){ +},{}],211:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; + + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } + } + + return out; +} + +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} + +module.exports = project; + +},{}],212:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45820,7 +46866,7 @@ module.exports = { } }; -},{"../components/color/attributes":31,"../lib":143,"./font_attributes":202}],205:[function(require,module,exports){ +},{"../components/color/attributes":37,"../lib":150,"./font_attributes":209}],213:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45858,7 +46904,7 @@ module.exports = { } }; -},{}],206:[function(require,module,exports){ +},{}],214:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45874,6 +46920,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -46366,12 +47413,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -46696,12 +47769,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -46714,7 +47787,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -47647,6 +48723,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -47862,7 +48942,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -47883,6 +48969,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -47930,25 +49017,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -47957,11 +49030,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -48034,7 +49103,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":32,"../components/errorbars":62,"../constants/numerical":129,"../lib":143,"../plotly":173,"../registry":221,"./animation_attributes":174,"./attributes":176,"./command":201,"./font_attributes":202,"./frame_attributes":203,"./layout_attributes":204,"d3":14,"fast-isnumeric":17}],207:[function(require,module,exports){ +},{"../components/color":38,"../components/errorbars":68,"../constants/numerical":136,"../lib":150,"../plot_api/plot_schema":174,"../plotly":180,"../registry":229,"./animation_attributes":181,"./attributes":183,"./command":208,"./font_attributes":209,"./frame_attributes":210,"./layout_attributes":212,"d3":14,"fast-isnumeric":17}],215:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48059,7 +49128,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":313}],208:[function(require,module,exports){ +},{"../../traces/scatter/attributes":321}],216:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48174,7 +49243,7 @@ module.exports = { } }; -},{"../../lib/extend":139,"../cartesian/layout_attributes":189}],209:[function(require,module,exports){ +},{"../../lib/extend":146,"../cartesian/layout_attributes":196}],217:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48189,7 +49258,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":210,"./micropolar_manager":211}],210:[function(require,module,exports){ +},{"./micropolar":218,"./micropolar_manager":219}],218:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49608,7 +50677,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":143,"d3":14}],211:[function(require,module,exports){ +},{"../../lib":150,"d3":14}],219:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49694,7 +50763,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":32,"../../lib":143,"./micropolar":210,"./undo_manager":212,"d3":14}],212:[function(require,module,exports){ +},{"../../components/color":38,"../../lib":150,"./micropolar":218,"./undo_manager":220,"d3":14}],220:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49760,7 +50829,7 @@ module.exports = function UndoManager() { }; }; -},{}],213:[function(require,module,exports){ +},{}],221:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49835,7 +50904,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":143,"./plots":206}],214:[function(require,module,exports){ +},{"../lib":150,"./plots":214}],222:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49909,7 +50978,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":206,"./layout/attributes":215,"./layout/defaults":218,"./layout/layout_attributes":219,"./ternary":220}],215:[function(require,module,exports){ +},{"../../plots/plots":214,"./layout/attributes":223,"./layout/defaults":226,"./layout/layout_attributes":227,"./ternary":228}],223:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49930,7 +50999,7 @@ module.exports = { } }; -},{}],216:[function(require,module,exports){ +},{}],224:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49990,7 +51059,7 @@ module.exports = { } }; -},{"../../../lib/extend":139,"../../cartesian/layout_attributes":189}],217:[function(require,module,exports){ +},{"../../../lib/extend":146,"../../cartesian/layout_attributes":196}],225:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50074,7 +51143,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":143,"../../cartesian/tick_label_defaults":196,"../../cartesian/tick_mark_defaults":197,"../../cartesian/tick_value_defaults":198,"./axis_attributes":216,"tinycolor2":20}],218:[function(require,module,exports){ +},{"../../../lib":150,"../../cartesian/tick_label_defaults":203,"../../cartesian/tick_mark_defaults":204,"../../cartesian/tick_value_defaults":205,"./axis_attributes":224,"tinycolor2":20}],226:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50137,7 +51206,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":32,"../../subplot_defaults":213,"./axis_defaults":217,"./layout_attributes":219}],219:[function(require,module,exports){ +},{"../../../components/color":38,"../../subplot_defaults":221,"./axis_defaults":225,"./layout_attributes":227}],227:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50193,7 +51262,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":31,"./axis_attributes":216}],220:[function(require,module,exports){ +},{"../../../components/color/attributes":37,"./axis_attributes":224}],228:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50827,7 +51896,7 @@ proto.initInteractions = function() { }; dragger.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, _this.id); }; dragElement.init(dragOptions); @@ -50839,7 +51908,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":32,"../../components/dragelement":53,"../../components/drawing":56,"../../components/fx":73,"../../components/titles":121,"../../lib":143,"../../lib/extend":139,"../../plotly":173,"../cartesian/axes":178,"../cartesian/constants":183,"../cartesian/select":194,"../cartesian/set_convert":195,"../plots":206,"d3":14,"tinycolor2":20}],221:[function(require,module,exports){ +},{"../../components/color":38,"../../components/dragelement":59,"../../components/drawing":62,"../../components/fx":79,"../../components/titles":127,"../../lib":150,"../../lib/extend":146,"../../plotly":180,"../cartesian/axes":185,"../cartesian/constants":190,"../cartesian/select":201,"../cartesian/set_convert":202,"../plots":214,"d3":14,"tinycolor2":20}],229:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51030,7 +52099,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":146,"./lib/noop":150,"./lib/push_unique":154,"./plots/attributes":176}],222:[function(require,module,exports){ +},{"./lib/loggers":153,"./lib/noop":157,"./lib/push_unique":161,"./plots/attributes":183}],230:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51202,7 +52271,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":143,"../plots/plots":206}],223:[function(require,module,exports){ +},{"../lib":150,"../plots/plots":214}],231:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51268,7 +52337,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":143,"../plot_api/to_image":171,"./filesaver":224}],224:[function(require,module,exports){ +},{"../lib":150,"../plot_api/to_image":178,"./filesaver":232}],232:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51336,7 +52405,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],225:[function(require,module,exports){ +},{}],233:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51369,7 +52438,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],226:[function(require,module,exports){ +},{}],234:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51395,7 +52464,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":222,"./download":223,"./helpers":225,"./svgtoimg":227,"./toimage":228,"./tosvg":229}],227:[function(require,module,exports){ +},{"./cloneplot":230,"./download":231,"./helpers":233,"./svgtoimg":235,"./toimage":236,"./tosvg":237}],235:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51433,7 +52502,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -51526,7 +52595,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":143,"events":16}],228:[function(require,module,exports){ +},{"../lib":150,"events":16}],236:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51606,7 +52675,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":143,"../plotly":173,"./cloneplot":222,"./helpers":225,"./svgtoimg":227,"./tosvg":229,"events":16}],229:[function(require,module,exports){ +},{"../lib":150,"../plotly":180,"./cloneplot":230,"./helpers":233,"./svgtoimg":235,"./tosvg":237,"events":16}],237:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51620,12 +52689,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -51678,20 +52764,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -51699,10 +52787,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -51716,16 +52815,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":32,"../components/drawing":56,"../constants/xmlns_namespaces":131,"../lib/svg_text_utils":160,"d3":14}],230:[function(require,module,exports){ +},{"../components/color":38,"../components/drawing":62,"../constants/xmlns_namespaces":138,"d3":14}],238:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51758,7 +52857,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":143}],231:[function(require,module,exports){ +},{"../../lib":150}],239:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51883,7 +52982,7 @@ module.exports = { } }; -},{"../../components/colorbar/attributes":33,"../../components/colorscale/color_attributes":39,"../../components/errorbars/attributes":58,"../../lib/extend":139,"../../plots/font_attributes":202,"../scatter/attributes":313}],232:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/color_attributes":45,"../../components/errorbars/attributes":64,"../../lib/extend":146,"../../plots/font_attributes":209,"../scatter/attributes":321}],240:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51976,7 +53075,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":38,"../../components/colorscale/has_colorscale":45,"../../plots/cartesian/axes":178,"./arrays_to_calcdata":230,"fast-isnumeric":17}],233:[function(require,module,exports){ +},{"../../components/colorscale/calc":44,"../../components/colorscale/has_colorscale":51,"../../plots/cartesian/axes":185,"./arrays_to_calcdata":238,"fast-isnumeric":17}],241:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52036,7 +53135,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":32,"../../components/errorbars/defaults":61,"../../lib":143,"../bar/style_defaults":242,"../scatter/xy_defaults":335,"./attributes":231}],234:[function(require,module,exports){ +},{"../../components/color":38,"../../components/errorbars/defaults":67,"../../lib":150,"../bar/style_defaults":250,"../scatter/xy_defaults":343,"./attributes":239}],242:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52148,7 +53247,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":32,"../../components/errorbars":62,"../../components/fx":73}],235:[function(require,module,exports){ +},{"../../components/color":38,"../../components/errorbars":68,"../../components/fx":79}],243:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52184,7 +53283,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":188,"../scatter/colorbar":316,"./arrays_to_calcdata":230,"./attributes":231,"./calc":232,"./defaults":233,"./hover":234,"./layout_attributes":236,"./layout_defaults":237,"./plot":238,"./set_positions":239,"./style":241}],236:[function(require,module,exports){ +},{"../../plots/cartesian":195,"../scatter/colorbar":324,"./arrays_to_calcdata":238,"./attributes":239,"./calc":240,"./defaults":241,"./hover":242,"./layout_attributes":244,"./layout_defaults":245,"./plot":246,"./set_positions":247,"./style":249}],244:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52228,7 +53327,7 @@ module.exports = { } }; -},{}],237:[function(require,module,exports){ +},{}],245:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52286,7 +53385,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":143,"../../plots/cartesian/axes":178,"../../registry":221,"./layout_attributes":236}],238:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"../../registry":229,"./layout_attributes":244}],246:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52428,22 +53527,17 @@ module.exports = function plot(gd, plotinfo, cdbar) { function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { function appendTextNode(bar, text, textFont) { var textSelection = bar.append('text') - // prohibit tex interpretation until we can handle - // tex and regular text together - .attr('data-notex', 1) .text(text) .attr({ 'class': 'bartext', transform: '', - 'data-bb': '', 'text-anchor': 'middle', - x: 0, - y: 0 + // prohibit tex interpretation until we can handle + // tex and regular text together + 'data-notex': 1 }) - .call(Drawing.font, textFont); - - textSelection.call(svgTextUtils.convertToTspans); - textSelection.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(Drawing.font, textFont) + .call(svgTextUtils.convertToTspans, gd); return textSelection; } @@ -52806,7 +53900,7 @@ function coerceColor(attributeDefinition, value, defaultValue) { attributeDefinition.dflt; } -},{"../../components/color":32,"../../components/drawing":56,"../../components/errorbars":62,"../../lib":143,"../../lib/svg_text_utils":160,"./attributes":231,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],239:[function(require,module,exports){ +},{"../../components/color":38,"../../components/drawing":62,"../../components/errorbars":68,"../../lib":150,"../../lib/svg_text_utils":167,"./attributes":239,"d3":14,"fast-isnumeric":17,"tinycolor2":20}],247:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53406,7 +54500,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../constants/numerical":129,"../../plots/cartesian/axes":178,"../../registry":221,"./sieve.js":240,"fast-isnumeric":17}],240:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../plots/cartesian/axes":185,"../../registry":229,"./sieve.js":248,"fast-isnumeric":17}],248:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53508,7 +54602,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":129,"../../lib":143}],241:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../lib":150}],249:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53578,15 +54672,12 @@ module.exports = function style(gd) { p.call(Color.stroke, lineColor); } }); - // TODO: text markers on bars, either extra text or just bar values - // d3.select(this).selectAll('text') - // .call(Drawing.textPointStyle,d.t||d[0].t); }); s.call(ErrorBars.style); }; -},{"../../components/color":32,"../../components/drawing":56,"../../components/errorbars":62,"d3":14}],242:[function(require,module,exports){ +},{"../../components/color":38,"../../components/drawing":62,"../../components/errorbars":68,"d3":14}],250:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53623,7 +54714,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":32,"../../components/colorscale/defaults":41,"../../components/colorscale/has_colorscale":45}],243:[function(require,module,exports){ +},{"../../components/color":38,"../../components/colorscale/defaults":47,"../../components/colorscale/has_colorscale":51}],251:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53756,7 +54847,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":31,"../../lib/extend":139,"../scatter/attributes":313}],244:[function(require,module,exports){ +},{"../../components/color/attributes":37,"../../lib/extend":146,"../scatter/attributes":321}],252:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53905,7 +54996,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":143,"../../plots/cartesian/axes":178,"fast-isnumeric":17}],245:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"fast-isnumeric":17}],253:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53978,7 +55069,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":32,"../../lib":143,"../../registry":221,"./attributes":243}],246:[function(require,module,exports){ +},{"../../components/color":38,"../../lib":150,"../../registry":229,"./attributes":251}],254:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54087,7 +55178,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":32,"../../components/fx":73,"../../lib":143,"../../plots/cartesian/axes":178}],247:[function(require,module,exports){ +},{"../../components/color":38,"../../components/fx":79,"../../lib":150,"../../plots/cartesian/axes":185}],255:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54120,7 +55211,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":188,"./attributes":243,"./calc":244,"./defaults":245,"./hover":246,"./layout_attributes":248,"./layout_defaults":249,"./plot":250,"./set_positions":251,"./style":252}],248:[function(require,module,exports){ +},{"../../plots/cartesian":195,"./attributes":251,"./calc":252,"./defaults":253,"./hover":254,"./layout_attributes":256,"./layout_defaults":257,"./plot":258,"./set_positions":259,"./style":260}],256:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54158,7 +55249,7 @@ module.exports = { } }; -},{}],249:[function(require,module,exports){ +},{}],257:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54192,7 +55283,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":143,"../../registry":221,"./layout_attributes":248}],250:[function(require,module,exports){ +},{"../../lib":150,"../../registry":229,"./layout_attributes":256}],258:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54432,7 +55523,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":56,"../../lib":143,"d3":14}],251:[function(require,module,exports){ +},{"../../components/drawing":62,"../../lib":150,"d3":14}],259:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54526,7 +55617,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":143,"../../plots/cartesian/axes":178,"../../registry":221}],252:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"../../registry":229}],260:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54561,11 +55652,11 @@ module.exports = function style(gd) { }) .call(Color.stroke, trace.line.color); d3.select(this).selectAll('g.points path') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, gd); }); }; -},{"../../components/color":32,"../../components/drawing":56,"d3":14}],253:[function(require,module,exports){ +},{"../../components/color":38,"../../components/drawing":62,"d3":14}],261:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54668,7 +55759,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":33,"../../components/colorscale/attributes":37,"../../components/drawing/attributes":55,"../../lib/extend":139,"../heatmap/attributes":268,"../scatter/attributes":313}],254:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/attributes":43,"../../components/drawing/attributes":61,"../../lib/extend":146,"../heatmap/attributes":276,"../scatter/attributes":321}],262:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54772,7 +55863,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":143,"../../plots/cartesian/axes":178,"../heatmap/calc":269}],255:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"../heatmap/calc":277}],263:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54834,7 +55925,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":35,"../../plots/plots":206,"./end_plus":259,"./make_color_map":263}],256:[function(require,module,exports){ +},{"../../components/colorbar/draw":41,"../../plots/plots":214,"./end_plus":267,"./make_color_map":271}],264:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54874,7 +55965,7 @@ module.exports.CHOOSESADDLE = { // substitute to be used up later? module.exports.SADDLEREMAINDER = {1: 4, 2: 8, 4: 1, 7: 13, 8: 2, 11: 14, 13: 7, 14: 11}; -},{}],257:[function(require,module,exports){ +},{}],265:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54906,7 +55997,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce) { if(autoContour || !contourSize) coerce('ncontours'); }; -},{"../../lib":143,"./attributes":253}],258:[function(require,module,exports){ +},{"../../lib":150,"./attributes":261}],266:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54945,7 +56036,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":143,"../heatmap/has_columns":275,"../heatmap/xyz_defaults":283,"./attributes":253,"./contours_defaults":257,"./style_defaults":267}],259:[function(require,module,exports){ +},{"../../lib":150,"../heatmap/has_columns":283,"../heatmap/xyz_defaults":291,"./attributes":261,"./contours_defaults":265,"./style_defaults":275}],267:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54965,7 +56056,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],260:[function(require,module,exports){ +},{}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55240,7 +56331,7 @@ function getInterpPx(pi, loc, step) { } } -},{"../../lib":143,"./constants":256}],261:[function(require,module,exports){ +},{"../../lib":150,"./constants":264}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55259,7 +56350,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":276}],262:[function(require,module,exports){ +},{"../heatmap/hover":284}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55291,7 +56382,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":188,"./attributes":253,"./calc":254,"./colorbar":255,"./defaults":258,"./hover":261,"./plot":265,"./style":266}],263:[function(require,module,exports){ +},{"../../plots/cartesian":195,"./attributes":261,"./calc":262,"./colorbar":263,"./defaults":266,"./hover":269,"./plot":273,"./style":274}],271:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55375,7 +56466,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":46,"./end_plus":259,"d3":14}],264:[function(require,module,exports){ +},{"../../components/colorscale":52,"./end_plus":267,"d3":14}],272:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55467,7 +56558,7 @@ function getMarchingIndex(val, corners) { return (mi === 15) ? 0 : mi; } -},{"./constants":256}],265:[function(require,module,exports){ +},{"./constants":264}],273:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55831,7 +56922,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":56,"../../lib":143,"../heatmap/plot":281,"./end_plus":259,"./find_all_paths":260,"./make_crossings":264,"d3":14}],266:[function(require,module,exports){ +},{"../../components/drawing":62,"../../lib":150,"../heatmap/plot":289,"./end_plus":267,"./find_all_paths":268,"./make_crossings":272,"d3":14}],274:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55893,7 +56984,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":56,"../heatmap/style":282,"./make_color_map":263,"d3":14}],267:[function(require,module,exports){ +},{"../../components/drawing":62,"../heatmap/style":290,"./make_color_map":271,"d3":14}],275:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55929,7 +57020,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, } }; -},{"../../components/colorscale/defaults":41}],268:[function(require,module,exports){ +},{"../../components/colorscale/defaults":47}],276:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56013,7 +57104,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":33,"../../components/colorscale/attributes":37,"../../lib/extend":139,"../scatter/attributes":313}],269:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/attributes":43,"../../lib/extend":146,"../scatter/attributes":321}],277:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56073,10 +57164,15 @@ module.exports = function calc(gd, trace) { z = binned.z; } else { - if(hasColumns(trace)) convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + if(hasColumns(trace)) { + convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + x = trace.x; + y = trace.y; + } else { + x = trace.x ? xa.makeCalcdata(trace, 'x') : []; + y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + } - x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace.y ? ya.makeCalcdata(trace, 'y') : []; x0 = trace.x0 || 0; dx = trace.dx || 1; y0 = trace.y0 || 0; @@ -56155,7 +57251,7 @@ module.exports = function calc(gd, trace) { return [cd0]; }; -},{"../../components/colorscale/calc":38,"../../lib":143,"../../plots/cartesian/axes":178,"../../registry":221,"../histogram2d/calc":294,"./clean_2d_array":270,"./convert_column_xyz":272,"./find_empties":274,"./has_columns":275,"./interp2d":278,"./make_bound_array":279,"./max_row_length":280}],270:[function(require,module,exports){ +},{"../../components/colorscale/calc":44,"../../lib":150,"../../plots/cartesian/axes":185,"../../registry":229,"../histogram2d/calc":302,"./clean_2d_array":278,"./convert_column_xyz":280,"./find_empties":282,"./has_columns":283,"./interp2d":286,"./make_bound_array":287,"./max_row_length":288}],278:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56200,7 +57296,7 @@ module.exports = function clean2dArray(zOld, transpose) { return zNew; }; -},{"fast-isnumeric":17}],271:[function(require,module,exports){ +},{"fast-isnumeric":17}],279:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56251,7 +57347,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":35,"../../components/colorscale":46,"../../lib":143,"../../plots/plots":206,"fast-isnumeric":17}],272:[function(require,module,exports){ +},{"../../components/colorbar/draw":41,"../../components/colorscale":52,"../../lib":150,"../../plots/plots":214,"fast-isnumeric":17}],280:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56332,7 +57428,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, if(hasColumnText) trace.text = text; }; -},{"../../constants/numerical":129,"../../lib":143}],273:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../lib":150}],281:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56377,7 +57473,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":41,"../../lib":143,"./attributes":268,"./has_columns":275,"./xyz_defaults":283}],274:[function(require,module,exports){ +},{"../../components/colorscale/defaults":47,"../../lib":150,"./attributes":276,"./has_columns":283,"./xyz_defaults":291}],282:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56483,7 +57579,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"./max_row_length":280}],275:[function(require,module,exports){ +},{"./max_row_length":288}],283:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56499,7 +57595,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],276:[function(require,module,exports){ +},{}],284:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56616,7 +57712,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../components/fx":73,"../../lib":143}],277:[function(require,module,exports){ +},{"../../components/fx":79,"../../lib":150}],285:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56648,7 +57744,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":188,"./attributes":268,"./calc":269,"./colorbar":271,"./defaults":273,"./hover":276,"./plot":281,"./style":282}],278:[function(require,module,exports){ +},{"../../plots/cartesian":195,"./attributes":276,"./calc":277,"./colorbar":279,"./defaults":281,"./hover":284,"./plot":289,"./style":290}],286:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56780,7 +57876,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":143}],279:[function(require,module,exports){ +},{"../../lib":150}],287:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56862,7 +57958,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../registry":221}],280:[function(require,module,exports){ +},{"../../registry":229}],288:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56884,7 +57980,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],281:[function(require,module,exports){ +},{}],289:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57353,7 +58449,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale":46,"../../constants/xmlns_namespaces":131,"../../lib":143,"../../registry":221,"./max_row_length":280,"tinycolor2":20}],282:[function(require,module,exports){ +},{"../../components/colorscale":52,"../../constants/xmlns_namespaces":138,"../../lib":150,"../../registry":229,"./max_row_length":288,"tinycolor2":20}],290:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57374,7 +58470,7 @@ module.exports = function style(gd) { }); }; -},{"d3":14}],283:[function(require,module,exports){ +},{"d3":14}],291:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57469,7 +58565,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../registry":221,"./has_columns":275,"fast-isnumeric":17}],284:[function(require,module,exports){ +},{"../../registry":229,"./has_columns":283,"fast-isnumeric":17}],292:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57599,7 +58695,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":231}],285:[function(require,module,exports){ +},{"../bar/attributes":239}],293:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57625,7 +58721,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],286:[function(require,module,exports){ +},{}],294:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57658,7 +58754,7 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect return traceOut; }; -},{}],287:[function(require,module,exports){ +},{}],295:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57734,7 +58830,7 @@ module.exports = { } }; -},{"fast-isnumeric":17}],288:[function(require,module,exports){ +},{"fast-isnumeric":17}],296:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57965,7 +59061,7 @@ function cdf(size, direction, currentbin) { } } -},{"../../lib":143,"../../plots/cartesian/axes":178,"../bar/arrays_to_calcdata":230,"./average":285,"./bin_functions":287,"./clean_bins":289,"./norm_functions":292,"fast-isnumeric":17}],289:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"../bar/arrays_to_calcdata":238,"./average":293,"./bin_functions":295,"./clean_bins":297,"./norm_functions":300,"fast-isnumeric":17}],297:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58042,7 +59138,7 @@ module.exports = function cleanBins(trace, ax, binDirection) { if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; }; -},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":17}],290:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../lib":150,"fast-isnumeric":17}],298:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58104,7 +59200,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":32,"../../components/errorbars/defaults":61,"../../lib":143,"../../registry":221,"../bar/style_defaults":242,"./attributes":284,"./bin_defaults":286}],291:[function(require,module,exports){ +},{"../../components/color":38,"../../components/errorbars/defaults":67,"../../lib":150,"../../registry":229,"../bar/style_defaults":250,"./attributes":292,"./bin_defaults":294}],299:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58153,7 +59249,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":188,"../bar/hover":234,"../bar/layout_attributes":236,"../bar/layout_defaults":237,"../bar/plot":238,"../bar/set_positions":239,"../bar/style":241,"../scatter/colorbar":316,"./attributes":284,"./calc":288,"./defaults":290}],292:[function(require,module,exports){ +},{"../../plots/cartesian":195,"../bar/hover":242,"../bar/layout_attributes":244,"../bar/layout_defaults":245,"../bar/plot":246,"../bar/set_positions":247,"../bar/style":249,"../scatter/colorbar":324,"./attributes":292,"./calc":296,"./defaults":298}],300:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58188,7 +59284,7 @@ module.exports = { } }; -},{}],293:[function(require,module,exports){ +},{}],301:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58240,7 +59336,7 @@ module.exports = extendFlat({}, { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":33,"../../components/colorscale/attributes":37,"../../lib/extend":139,"../heatmap/attributes":268,"../histogram/attributes":284}],294:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/attributes":43,"../../lib/extend":146,"../heatmap/attributes":276,"../histogram/attributes":292}],302:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58443,7 +59539,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":143,"../../plots/cartesian/axes":178,"../histogram/average":285,"../histogram/bin_functions":287,"../histogram/clean_bins":289,"../histogram/norm_functions":292}],295:[function(require,module,exports){ +},{"../../lib":150,"../../plots/cartesian/axes":185,"../histogram/average":293,"../histogram/bin_functions":295,"../histogram/clean_bins":297,"../histogram/norm_functions":300}],303:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58481,7 +59577,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout ); }; -},{"../../components/colorscale/defaults":41,"../../lib":143,"./attributes":293,"./sample_defaults":297}],296:[function(require,module,exports){ +},{"../../components/colorscale/defaults":47,"../../lib":150,"./attributes":301,"./sample_defaults":305}],304:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58514,7 +59610,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":188,"../heatmap/calc":269,"../heatmap/colorbar":271,"../heatmap/hover":276,"../heatmap/plot":281,"../heatmap/style":282,"./attributes":293,"./defaults":295}],297:[function(require,module,exports){ +},{"../../plots/cartesian":195,"../heatmap/calc":277,"../heatmap/colorbar":279,"../heatmap/hover":284,"../heatmap/plot":289,"../heatmap/style":290,"./attributes":301,"./defaults":303}],305:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58554,7 +59650,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../../registry":221,"../histogram/bin_defaults":286}],298:[function(require,module,exports){ +},{"../../registry":229,"../histogram/bin_defaults":294}],306:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58599,7 +59695,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":33,"../../components/colorscale/attributes":37,"../../lib/extend":139,"../contour/attributes":253,"../histogram2d/attributes":293}],299:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/attributes":43,"../../lib/extend":146,"../contour/attributes":261,"../histogram2d/attributes":301}],307:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58629,7 +59725,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":143,"../contour/contours_defaults":257,"../contour/style_defaults":267,"../histogram2d/sample_defaults":297,"./attributes":298}],300:[function(require,module,exports){ +},{"../../lib":150,"../contour/contours_defaults":265,"../contour/style_defaults":275,"../histogram2d/sample_defaults":305,"./attributes":306}],308:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58662,7 +59758,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":188,"../contour/calc":254,"../contour/colorbar":255,"../contour/hover":261,"../contour/plot":265,"../contour/style":266,"./attributes":298,"./defaults":299}],301:[function(require,module,exports){ +},{"../../plots/cartesian":195,"../contour/calc":262,"../contour/colorbar":263,"../contour/hover":269,"../contour/plot":273,"../contour/style":274,"./attributes":306,"./defaults":307}],309:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58855,7 +59951,7 @@ module.exports = { } }; -},{"../../components/color/attributes":31,"../../lib/extend":139,"../../plots/attributes":176,"../../plots/font_attributes":202}],302:[function(require,module,exports){ +},{"../../components/color/attributes":37,"../../lib/extend":146,"../../plots/attributes":183,"../../plots/font_attributes":209}],310:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58902,7 +59998,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":221}],303:[function(require,module,exports){ +},{"../../registry":229}],311:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59054,7 +60150,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":32,"./helpers":305,"fast-isnumeric":17,"tinycolor2":20}],304:[function(require,module,exports){ +},{"../../components/color":38,"./helpers":313,"fast-isnumeric":17,"tinycolor2":20}],312:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59104,8 +60200,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); coerce('hovertext'); - coerce('hoverinfo', (layout._dataLength === 1) ? 'label+text+value+percent' : undefined); - if(textInfo && textInfo !== 'none') { var textPosition = coerce('textposition'), hasBoth = Array.isArray(textPosition) || textPosition === 'auto', @@ -59139,7 +60233,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":143,"./attributes":301}],305:[function(require,module,exports){ +},{"../../lib":150,"./attributes":309}],313:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59168,7 +60262,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":143}],306:[function(require,module,exports){ +},{"../../lib":150}],314:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59200,7 +60294,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":301,"./base_plot":302,"./calc":303,"./defaults":304,"./layout_attributes":307,"./layout_defaults":308,"./plot":309,"./style":310,"./style_one":311}],307:[function(require,module,exports){ +},{"./attributes":309,"./base_plot":310,"./calc":311,"./defaults":312,"./layout_attributes":315,"./layout_defaults":316,"./plot":317,"./style":318,"./style_one":319}],315:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59220,7 +60314,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],308:[function(require,module,exports){ +},{}],316:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59242,7 +60336,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":143,"./layout_attributes":307}],309:[function(require,module,exports){ +},{"../../lib":150,"./layout_attributes":315}],317:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59334,9 +60428,9 @@ module.exports = function plot(gd, cdpie) { evt.originalEvent = d3.event; // in case fullLayout or fullData has changed without a replot - var fullLayout2 = gd._fullLayout, - trace2 = gd._fullData[trace.index], - hoverinfo = trace2.hoverinfo; + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; + var hoverinfo = Fx.castHoverinfo(trace2, fullLayout2, pt.i); if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; @@ -59369,8 +60463,6 @@ module.exports = function plot(gd, cdpie) { if(hoverinfo.indexOf('value') !== -1) thisText.push(helpers.formatPieValue(pt.v, separators)); if(hoverinfo.indexOf('percent') !== -1) thisText.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators)); - var hoverLabelOpts = trace2.hoverlabel; - Fx.loneHover({ x0: hoverCenterX - rInscribed * cd0.r, x1: hoverCenterX + rInscribed * cd0.r, @@ -59378,14 +60470,15 @@ module.exports = function plot(gd, cdpie) { text: thisText.join('
'), name: hoverinfo.indexOf('name') !== -1 ? trace2.name : undefined, idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', - color: pt.hbg || hoverLabelOpts.bgcolor || pt.color, - borderColor: pt.hbc || hoverLabelOpts.bordercolor, - fontFamily: pt.htf || hoverLabelOpts.font.family, - fontSize: pt.hts || hoverLabelOpts.font.size, - fontColor: pt.htc || hoverLabelOpts.font.color + color: Fx.castHoverOption(trace, pt.i, 'bgcolor') || pt.color, + borderColor: Fx.castHoverOption(trace, pt.i, 'bordercolor'), + fontFamily: Fx.castHoverOption(trace, pt.i, 'font.family'), + fontSize: Fx.castHoverOption(trace, pt.i, 'font.size'), + fontColor: Fx.castHoverOption(trace, pt.i, 'font.color') }, { container: fullLayout2._hoverlayer.node(), - outerContainer: fullLayout2._paper.node() + outerContainer: fullLayout2._paper.node(), + gd: gd }); Fx.hover(gd, evt, 'pie'); @@ -59497,15 +60590,11 @@ module.exports = function plot(gd, cdpie) { .attr({ 'class': 'slicetext', transform: '', - 'data-bb': '', - 'text-anchor': 'middle', - x: 0, - y: 0 + 'text-anchor': 'middle' }) .call(Drawing.font, textPosition === 'outside' ? trace.outsidetextfont : trace.insidetextfont) - .call(svgTextUtils.convertToTspans); - sliceText.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(svgTextUtils.convertToTspans, gd); // position the text relative to the slice // TODO: so far this only accounts for flat @@ -59520,7 +60609,6 @@ module.exports = function plot(gd, cdpie) { sliceText.call(Drawing.font, trace.outsidetextfont); if(trace.outsidetextfont.family !== trace.insidetextfont.family || trace.outsidetextfont.size !== trace.insidetextfont.size) { - sliceText.attr({'data-bb': ''}); textBB = Drawing.bBox(sliceText.node()); } transform = transformOutsideText(textBB, pt); @@ -59956,7 +61044,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":32,"../../components/drawing":56,"../../components/fx":73,"../../lib/svg_text_utils":160,"./helpers":305,"d3":14}],310:[function(require,module,exports){ +},{"../../components/color":38,"../../components/drawing":62,"../../components/fx":79,"../../lib/svg_text_utils":167,"./helpers":313,"d3":14}],318:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59985,7 +61073,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":311,"d3":14}],311:[function(require,module,exports){ +},{"./style_one":319,"d3":14}],319:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60010,7 +61098,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":32}],312:[function(require,module,exports){ +},{"../../components/color":38}],320:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60062,7 +61150,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":143}],313:[function(require,module,exports){ +},{"../../lib":150}],321:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60108,20 +61196,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -60342,7 +61422,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":33,"../../components/colorscale/color_attributes":39,"../../components/drawing":56,"../../components/drawing/attributes":55,"../../components/errorbars/attributes":58,"../../lib/extend":139,"./constants":318}],314:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/color_attributes":45,"../../components/drawing":62,"../../components/drawing/attributes":61,"../../components/errorbars/attributes":64,"../../lib/extend":146,"./constants":326}],322:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60473,7 +61553,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":129,"../../plots/cartesian/axes":178,"./arrays_to_calcdata":312,"./colorscale_calc":317,"./subtypes":333,"fast-isnumeric":17}],315:[function(require,module,exports){ +},{"../../constants/numerical":136,"../../plots/cartesian/axes":185,"./arrays_to_calcdata":320,"./colorscale_calc":325,"./subtypes":341,"fast-isnumeric":17}],323:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60512,7 +61592,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],316:[function(require,module,exports){ +},{}],324:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60568,7 +61648,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":35,"../../components/colorscale":46,"../../lib":143,"../../plots/plots":206,"fast-isnumeric":17}],317:[function(require,module,exports){ +},{"../../components/colorbar/draw":41,"../../components/colorscale":52,"../../lib":150,"../../plots/plots":214,"fast-isnumeric":17}],325:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60601,7 +61681,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":38,"../../components/colorscale/has_colorscale":45,"./subtypes":333}],318:[function(require,module,exports){ +},{"../../components/colorscale/calc":44,"../../components/colorscale/has_colorscale":51,"./subtypes":341}],326:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60617,7 +61697,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],319:[function(require,module,exports){ +},{}],327:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60656,11 +61736,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -60699,7 +61777,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":61,"../../lib":143,"./attributes":313,"./constants":318,"./fillcolor_defaults":320,"./line_defaults":324,"./line_shape_defaults":326,"./marker_defaults":329,"./subtypes":333,"./text_defaults":334,"./xy_defaults":335}],320:[function(require,module,exports){ +},{"../../components/errorbars/defaults":67,"../../lib":150,"./attributes":321,"./constants":326,"./fillcolor_defaults":328,"./line_defaults":332,"./line_shape_defaults":334,"./marker_defaults":337,"./subtypes":341,"./text_defaults":342,"./xy_defaults":343}],328:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60737,7 +61815,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":32}],321:[function(require,module,exports){ +},{"../../components/color":38}],329:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60790,7 +61868,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":32,"./subtypes":333}],322:[function(require,module,exports){ +},{"../../components/color":38,"./subtypes":341}],330:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60817,11 +61895,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -60877,7 +61956,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -60961,7 +62040,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":32,"../../components/errorbars":62,"../../components/fx":73,"../../lib":143,"./get_trace_color":321}],323:[function(require,module,exports){ +},{"../../components/color":38,"../../components/errorbars":68,"../../components/fx":79,"../../lib":150,"./get_trace_color":329}],331:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61005,7 +62084,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":188,"./arrays_to_calcdata":312,"./attributes":313,"./calc":314,"./clean_data":315,"./colorbar":316,"./defaults":319,"./hover":322,"./plot":330,"./select":331,"./style":332,"./subtypes":333}],324:[function(require,module,exports){ +},{"../../plots/cartesian":195,"./arrays_to_calcdata":320,"./attributes":321,"./calc":322,"./clean_data":323,"./colorbar":324,"./defaults":327,"./hover":330,"./plot":338,"./select":339,"./style":340,"./subtypes":341}],332:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61038,7 +62117,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":41,"../../components/colorscale/has_colorscale":45}],325:[function(require,module,exports){ +},{"../../components/colorscale/defaults":47,"../../components/colorscale/has_colorscale":51}],333:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61211,7 +62290,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":129}],326:[function(require,module,exports){ +},{"../../constants/numerical":136}],334:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61230,7 +62309,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],327:[function(require,module,exports){ +},{}],335:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61271,7 +62350,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],328:[function(require,module,exports){ +},{}],336:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61313,7 +62392,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":17}],329:[function(require,module,exports){ +},{"fast-isnumeric":17}],337:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61388,7 +62467,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":32,"../../components/colorscale/defaults":41,"../../components/colorscale/has_colorscale":45,"./subtypes":333}],330:[function(require,module,exports){ +},{"../../components/color":38,"../../components/colorscale/defaults":47,"../../components/colorscale/has_colorscale":51,"./subtypes":341}],338:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61731,10 +62810,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -61745,7 +62826,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -61753,7 +62835,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -61810,17 +62893,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -61832,6 +62918,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -61851,6 +62939,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -61859,7 +62949,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -61936,7 +63026,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":56,"../../components/errorbars":62,"../../lib":143,"../../lib/polygon":153,"./line_points":325,"./link_traces":327,"./subtypes":333,"d3":14}],331:[function(require,module,exports){ +},{"../../components/drawing":62,"../../components/errorbars":68,"../../lib":150,"../../lib/polygon":160,"./line_points":333,"./link_traces":335,"./subtypes":341,"d3":14}],339:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61958,7 +63048,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -61982,11 +63071,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -62009,7 +63096,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":333}],332:[function(require,module,exports){ +},{"./subtypes":341}],340:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62040,10 +63127,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -62055,7 +63142,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":56,"../../components/errorbars":62,"d3":14}],333:[function(require,module,exports){ +},{"../../components/drawing":62,"../../components/errorbars":68,"d3":14}],341:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62091,7 +63178,7 @@ module.exports = { } }; -},{"../../lib":143}],334:[function(require,module,exports){ +},{"../../lib":150}],342:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62112,7 +63199,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":143}],335:[function(require,module,exports){ +},{"../../lib":150}],343:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62162,7 +63249,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":221}],336:[function(require,module,exports){ +},{"../../registry":229}],344:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62252,7 +63339,7 @@ module.exports = { hoveron: scatterAttrs.hoveron, }; -},{"../../components/colorbar/attributes":33,"../../components/colorscale/color_attributes":39,"../../components/drawing/attributes":55,"../../lib/extend":139,"../../plots/attributes":176,"../scatter/attributes":313}],337:[function(require,module,exports){ +},{"../../components/colorbar/attributes":39,"../../components/colorscale/color_attributes":45,"../../components/drawing/attributes":61,"../../lib/extend":146,"../../plots/attributes":183,"../scatter/attributes":321}],345:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62349,7 +63436,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":178,"../scatter/arrays_to_calcdata":312,"../scatter/colorscale_calc":317,"../scatter/subtypes":333,"fast-isnumeric":17}],338:[function(require,module,exports){ +},{"../../plots/cartesian/axes":185,"../scatter/arrays_to_calcdata":320,"../scatter/colorscale_calc":325,"../scatter/subtypes":341,"fast-isnumeric":17}],346:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62447,15 +63534,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } - coerce('hoverinfo', (layout._dataLength === 1) ? 'a+b+c+text' : undefined); - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { dfltHoverOn.push('fills'); } coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":143,"../scatter/constants":318,"../scatter/fillcolor_defaults":320,"../scatter/line_defaults":324,"../scatter/line_shape_defaults":326,"../scatter/marker_defaults":329,"../scatter/subtypes":333,"../scatter/text_defaults":334,"./attributes":336}],339:[function(require,module,exports){ +},{"../../lib":150,"../scatter/constants":326,"../scatter/fillcolor_defaults":328,"../scatter/line_defaults":332,"../scatter/line_shape_defaults":334,"../scatter/marker_defaults":337,"../scatter/subtypes":341,"../scatter/text_defaults":342,"./attributes":344}],347:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62526,7 +63611,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":178,"../scatter/hover":322}],340:[function(require,module,exports){ +},{"../../plots/cartesian/axes":185,"../scatter/hover":330}],348:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62559,7 +63644,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":214,"../scatter/colorbar":316,"./attributes":336,"./calc":337,"./defaults":338,"./hover":339,"./plot":341,"./select":342,"./style":343}],341:[function(require,module,exports){ +},{"../../plots/ternary":222,"../scatter/colorbar":324,"./attributes":344,"./calc":345,"./defaults":346,"./hover":347,"./plot":349,"./select":350,"./style":351}],349:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62595,7 +63680,7 @@ module.exports = function plot(ternary, moduleCalcData) { scatterPlot(ternary.graphDiv, plotinfo, moduleCalcData); }; -},{"../scatter/plot":330}],342:[function(require,module,exports){ +},{"../scatter/plot":338}],350:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62630,7 +63715,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":331}],343:[function(require,module,exports){ +},{"../scatter/select":339}],351:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62659,5 +63744,5 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":332}]},{},[11])(11) +},{"../scatter/style":340}]},{},[11])(11) }); \ No newline at end of file diff --git a/dist/plotly-cartesian.min.js b/dist/plotly-cartesian.min.js index 4fb5368be09..d94edc80870 100644 --- a/dist/plotly-cartesian.min.js +++ b/dist/plotly-cartesian.min.js @@ -1,30 +1,30 @@ /** -* plotly.js (cartesian - minified) v1.27.1 +* plotly.js (cartesian - minified) v1.28.0 * Copyright 2012-2017, 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||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:0/0}function o(t){return null===t?0/0:+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=$),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 $(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 Q(t){var r=".dragsuppress-"+ ++Ii,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(Ni<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();Ni=!(i.f||i.e),r.remove()}}return Ni?(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)*Ji,n=mt(n)*Ki,o=mt(o)*tl,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)*Ui,Math.sqrt(e*e+r*r),t):new ft(0/0,0/0,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=nl.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)/Ji),a=vt((.2126729*t+.7151522*e+.072175*r)/Ki);return ht(116*a-16,500*(n-a),200*(a-vt((.0193339*t+.119192*e+.9503041*r)/tl)))}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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=It(),e=Nt()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function It(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Nt(){for(var t,e=al,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=ul.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=fl.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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=C[i in gl?e.charAt(l++):i])||(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{hl=qt;var e=new hl;return e._=t,n(e)}finally{hl=Date}}var n=e(t);return r.parse=function(t){try{hl=qt;var e=n.parse(t);return e&&e._}finally{hl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Zt(g),_=Gt(g),w=Zt(m),k=Gt(m),M=Zt(v),A=Gt(v),T=Zt(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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Xt(dl.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:$t,x:s,X:c,y:Jt,Y:Qt,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){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){ml.lastIndex=0;var n=ml.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){vl.lastIndex=0;var n=vl.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);kl.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Ml.point=function(i,l){Ml.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Ml.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(Ne))}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 Ne(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=0/0,n=0/0,a=0/0;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 qe(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(kl.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?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);be(p,_e(l,d));var g=h,m=ye(p,g),v=ye(g,g),y=m*m-v*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-m-x)/v);if(be(b,p),b=ke(b),!r)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)ji^(w<=b[0]&&b[0]<=k)){var C=_e(g,(-m+x)/v);return be(C,p),[b,ke(C)]}}}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;return Ie(e,r,mr(t,6*Vi),i?[0,-t]:[-ji,t-ji])}function Ue(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=0/0}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(-Fl,Math.min(Fl,t)),e=Math.max(-Fl,Math.min(Fl,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=Ue(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 Ze(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){Bl+=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){tVl&&(Vl=t),eUl&&(Ul=e)}function $e(){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=Qe(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=Qe(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function Qe(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){Ll+=t,zl+=e,++Cl}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);Sl+=i*(e+t)/2,Ol+=i*(r+n)/2,Dl+=i,Je(e=t,r=n)}var e,r;Gl.point=function(n,a){Gl.point=t,Je(e=n,r=a)}}function tr(){Gl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);Sl+=i*(n+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-n*e,Pl+=i*(n+t),El+=i*(a+e),Il+=3*i,Je(n=t,a=e)}var e,r,n,a;Gl.point=function(o,i){Gl.point=t,Je(e=n=o,r=a=i)},Gl.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=0/0,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*Ui,r*Ui])});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[0]*Ui,t[1]*Ui]}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,_=Rl,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,Rl):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*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,n()):[v*Ui,y*Ui,x*Ui]},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-Bi:t<-ji?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>ji?e-Bi:e<-ji?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(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 Er(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 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 Nr(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=ls.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),as.remove(t),ls.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];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(!((a=o-Vr(l,i))>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(as.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),as.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 Ur(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=ns,m=g.length;m--;)if((o=g[m])&&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=ss.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=is._;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=fs.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 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 Nn(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 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(Un(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Un(r)+"rotate("+e+")")}function Gn(t,e,r,n){t!==e?n.push({i:r.push(Un(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Un(r)+"skewX("+e+")")}function Yn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Un(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(Un(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),Zn(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 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 Ua(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?$a:Ga,s=n?Qn:$n;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 Qa(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=ul.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 ks?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:As);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 Ms;arguments.length<2?r=Ms:"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($s,a);return o==$s.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/$s[o-1]<$s[o]/a?o-1:o]:[Ks,to(t,r)[2]]}return n.invert=function(e){return li(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(li)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,li(+r+1),e).length}var o=n.domain(),i=Xa(o),l=null==t?a(i,10):"number"==typeof t&&a(i,t);return l&&(t=l[0],e=l[1]),n.domain(Ya(o,e>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:0/0},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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=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=I(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=U.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=I.of(a,arguments),l=0,f=ui.select(n(a)).on(D,t).on(P,r),d=e(ui.mouse(a)),h=Q(a);Bs.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);Bs.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,fl=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))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});dl[t+"s"]=r.range,dl[t+"s"].utc=r.utc.range,dl[t+"OfYear"]=function(t){var r=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},ml=/^\s*\d+/,vl=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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]*Ui*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;Ml.point(t,r),e(t,r)}function o(){Ml.lineStart()}function i(){a(g,m),Ml.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,1/0===u||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Al=Tl=Ll=zl=Cl=Sl=Ol=Dl=Pl=El=Il=0,ui.geo.stream(t,Nl);var e=Pl,r=El,n=Il,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 jl,Bl,ql,Hl,Vl,Ul,Xl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Xl.lineStart=Ye},polygonEnd:function(){Xl.lineStart=Xl.lineEnd=Xl.point=k,jl+=bi(Bl/2)}},Zl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Gl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Gl.lineStart=er},polygonEnd:function(){Gl.point=Je,Gl.lineStart=Ke,Gl.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 jl=0,ui.geo.stream(t,a(Xl)),jl},t.centroid=function(t){return Ll=zl=Cl=Sl=Ol=Dl=Pl=El=Il=0,ui.geo.stream(t,a(Gl)),Il?[Pl/Il,El/Il]:Dl?[Sl/Dl,Ol/Dl]:Cl?[Ll/Cl,zl/Cl]:[0/0,0/0]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Zl)),[[ql,Hl],[Vl,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 $e: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]*=Ui,e[1]*=Ui,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]*=Ui,e[1]*=Ui,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]*=Ui,t[1]*=Ui}}),{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 Yl=0,ui.geo.stream(t,Wl),Yl};var Yl,Wl={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},$l=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr($l)}).raw=$l;var Ql=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Ql)}).raw=Ql,(ui.geo.conicConformal=function(){return Ze(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Ze(Tr)}).raw=Tr;var Jl=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(Jl)}).raw=Jl,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return zr(Lr)}).raw=Lr;var Kl=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(Kl)}).raw=Kl;var ts=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(ts)}).raw=ts,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]]:[]).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=cs;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=r.site,i=r.edges.sort(Zr),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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=hs.get(r)||ds,n=ps.get(n)||b,kn(n(r.apply(null,fi.call(arguments,1)))) -},ui.interpolateHcl=Nn,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 Bn(r?r.matrix:gs)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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=0/0,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&&(Na(Fa(i,t,r),t,n),c+=n,u+=n),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Ia(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=ja(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===Ss?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=Zo;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=Zo,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(Is.get(e.call(this,t,n))||$o)(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 Is=ui.map({circle:$o,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*Rs)),r=e*Rs;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/Ns),r=e*Ns/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Ns),r=e*Ns/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Is.keys();var Ns=Math.sqrt(3),Rs=Math.tan(30*Vi);Ci.transition=function(t){for(var e,r,n=Fs||++Hs,a=ei(t),o=[],i=js||{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){return 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(0===(t=+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=L(t,360),e=L(e,100),r=L(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=L(t,255),e=L(e,255),r=L(r,255);var n,a,o=U(t,e,r),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){S(t)&&(t="100%");var n=O(t);return t=V(r,U(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function z(t){return V(1,U(0,t))}function C(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return C(t)/255}function N(t){return!!Y.CSS_UNIT.exec(t)}function R(t){t=t.replace(j,"").replace(B,"").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 r;return(r=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:I(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Y.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Y.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 j=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=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,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=T(t),this._roundA=H(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=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=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=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 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: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)&&(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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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)&&(r[a]="a"===a?t[a]:P(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:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100;return n({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})},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 Z=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=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(Z),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==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),f=c("clicktoshow");if(!u&&!f)return e;c("opacity");var d=c("bgcolor"),h=c("bordercolor"),p=a.opacity(h);c("borderpad");var g=c("borderwidth"),m=c("showarrow");c("text",m?" ":"new text"),c("textangle"),n.coerceFont(c,"font",r.font),c("width"),c("align"),c("height")&&c("valign");for(var v=["x","y"],y=[-10,-30],x={_fullLayout:r},b=0;b<2;b++){var _=v[b],w=o.coerceRef(t,e,x,_,"","paper");if(o.coercePosition(e,x,c,w,_,.5),m){var k="a"+_,M=o.coerceRef(t,e,x,k,"pixel");"pixel"!==M&&M!==w&&(M=e[k]="pixel");var A="pixel"===M?y[b]:.4;o.coercePosition(e,x,c,M,k,A)}c(_+"anchor"),c(_+"shift")}if(n.noneOrAll(t,e,["x","y"]),m&&(c("arrowcolor",p?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(p&&g||1)),c("standoff"),n.noneOrAll(t,e,["ax","ay"])),f){var T=c("xclick"),L=c("yclick");e._xclick=void 0===T?e.x:T,e._yclick=void 0===L?e.y:L}var z=c("hovertext"),C=r.hoverlabel||{};if(z){var S=c("hoverlabel.bgcolor",C.bgcolor||(a.opacity(d)?a.rgb(d):a.defaultLine)),O=c("hoverlabel.bordercolor",C.bordercolor||a.contrast(S));n.coerceFont(c,"hoverlabel.font",{family:C.font.family,size:C.font.size,color:C.font.color||O})}return c("captureevents",!!z),e}},{"../../lib":143,"../../plots/cartesian/axes":178,"../color":32,"./attributes":23}],22:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:i({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":139,"../../plots/cartesian/constants":183,"../../plots/font_attributes":202,"./arrow_paths":22}],24:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=o.getFromId(t,e.xref),i=o.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=l+e.xshift,n=l-e.xshift,e.axref===e.xref?(o.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),o.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):o.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),i&&i.autorange&&(r=l-e.yshift,n=l+e.yshift,e.ayref===e.yref?(o.expand(i,[i.r2c(e.y)],{ppadplus:r,ppadminus:n}),o.expand(i,[i.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):o.expand(i,[i.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(o.list(t).filter(function(t){return t.autorange&&l[t._id]}).length)return a.syncOrAsync([i,n],t)}}},{"../../lib":143,"../../plots/cartesian/axes":178,"./draw":28}],25:[function(t,e,r){"use strict";function n(t,e){var r=o(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=o(t,e),a=n.on,l=n.off.concat(n.explicitOff),s={};if(a.length||l.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var n=N.selectAll("a");if(1===n.size()&&n.text()===N.text()){z.insert("a",":first-child").attr({"xlink:xlink:href":n.attr("xlink:href"),"xlink:xlink:show":n.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}N.selectAll("tspan.line").attr({y:0,x:0});var a=z.select(".annotation-math-group"),h=!a.empty(),p=d.bBox((h?a:N).node()),x=p.width,S=p.height,I=b.width||x,R=b.height||S,F=Math.round(I+2*O),j=Math.round(R+2*O);b._w=I,b._h=R;var B=!1;if(["x","y"].forEach(function(e){var n,a,o,i,l,f=b[e+"ref"]||e,d=b["a"+e+"ref"],h=u.getFromId(t,f),p=(A+("x"===e?0:-90))*Math.PI/180,g=F*Math.cos(p),m=j*Math.sin(p),v=Math.abs(g)+Math.abs(m),x=b[e+"anchor"],_=b[e+"shift"]*("x"===e?1:-1),w=M[e];if(h){var k=h.r2fraction(b[e]);if((t._dragging||!h.autorange)&&(k<0||k>1)&&(d===f?((k=h.r2fraction(b["a"+e]))<0||k>1)&&(B=!0):B=!0,B))return;n=h._offset+h.r2p(b[e]),i=.5}else"x"===e?(o=b[e],n=y.l+y.w*o):(o=1-b[e],n=y.t+y.h*o),i=b.showarrow?.5:o;if(b.showarrow){w.head=n;var T=b["a"+e];l=g*r(.5,b.xanchor)-m*r(.5,b.yanchor),d===f?(w.tail=h._offset+h.r2p(T),a=l):(w.tail=n+T,a=l+T),w.text=w.tail+l;var L=s["x"===e?"width":"height"];if("paper"===f&&(w.head=c.constrain(w.head,1,L-1)),"pixel"===d){var z=-Math.max(w.tail-3,w.text),C=Math.min(w.tail+3,w.text)-L;z>0?(w.tail+=z,w.text+=z):C>0&&(w.tail-=C,w.text-=C)}w.tail+=_,w.head+=_}else l=v*r(i,x),a=l,w.text=n+l;w.text+=_,l+=_,a+=_,b["_"+e+"padplus"]=v/2+a,b["_"+e+"padminus"]=v/2-a,b["_"+e+"size"]=v,b["_"+e+"shift"]=l}),B)return void z.remove();var q=0,H=0;if("left"!==b.align&&(q=(I-x)*("center"===b.align?.5:1)),"top"!==b.valign&&(H=(R-S)*("middle"===b.valign?.5:1)),h)a.select("svg").attr({x:O+q-1,y:O+H}).call(d.setClipUrl,P?_:null);else{var V=O+H-p.top,U=O+q-p.left;N.attr({x:U,y:V}).call(d.setClipUrl,P?_:null),N.selectAll("tspan.line").attr({y:V,x:U})}E.select("rect").call(d.setRect,O,O,I,R),D.call(d.setRect,C/2,C/2,F-C,j-C),z.call(d.setTranslate,Math.round(M.x.text-F/2),Math.round(M.y.text-j/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var X="annotations["+e+"]",Z=function(r,n){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a=M.x.head,s=M.y.head,u=M.x.tail+r,h=M.y.tail+n,p=M.x.text+r,g=M.y.text+n,x=c.rotationXYMatrix(A,p,g),_=c.apply2DTransform(x),C=c.apply2DTransform2(x),S=+D.attr("width"),O=+D.attr("height"),P=p-.5*S,E=P+S,I=g-.5*O,N=I+O,R=[[P,I,P,N],[P,N,E,N],[E,N,E,I],[E,I,P,I]].map(C);if(!R.reduce(function(t,e){return t^!!o(a,s,a+1e6,s+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=o(u,h,a,s,t[0],t[1],t[2],t[3]);e&&(u=e.x,h=e.y)});var F=b.arrowwidth,j=b.arrowcolor,B=T.append("g").style({opacity:f.opacity(j)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),q=B.append("path").attr("d","M"+u+","+h+"L"+a+","+s).style("stroke-width",F+"px").call(f.stroke,f.rgb(j));if(v(q,b.arrowhead,"end",b.arrowsize,b.standoff),t._context.editable&&q.node().parentNode){var H=a,V=s;if(b.standoff){var U=Math.sqrt(Math.pow(a-u,2)+Math.pow(s-h,2));H+=b.standoff*(u-a)/U,V+=b.standoff*(h-s)/U}var Z,G,Y,W=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(u-H)+","+(h-V),transform:"translate("+H+","+V+")"}).style("stroke-width",F+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");m.init({element:W.node(),prepFn:function(){var t=d.getTranslate(z);G=t.x,Y=t.y,Z={},w&&w.autorange&&(Z[w._name+".autorange"]=!0),k&&k.autorange&&(Z[k._name+".autorange"]=!0)},moveFn:function(t,e){var r=_(G,Y),n=r[0]+t,a=r[1]+e;z.call(d.setTranslate,n,a),Z[X+".x"]=w?w.p2r(w.r2p(b.x)+t):b.x+t/y.w,Z[X+".y"]=k?k.p2r(k.r2p(b.y)+e):b.y-e/y.h,b.axref===b.xref&&(Z[X+".ax"]=w.p2r(w.r2p(b.ax)+t)),b.ayref===b.yref&&(Z[X+".ay"]=k.p2r(k.r2p(b.ay)+e)),B.attr("transform","translate("+t+","+e+")"),L.attr({transform:"rotate("+A+","+n+","+a+")"})},doneFn:function(e){if(e){l.relayout(t,Z);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(b.showarrow&&Z(0,0),t._context.editable){var G,Y;m.init({element:z.node(),prepFn:function(){Y=L.attr("transform"),G={}},moveFn:function(t,e){var r="pointer";if(b.showarrow)b.axref===b.xref?G[X+".ax"]=w.p2r(w.r2p(b.ax)+t):G[X+".ax"]=b.ax+t,b.ayref===b.yref?G[X+".ay"]=k.p2r(k.r2p(b.ay)+e):G[X+".ay"]=b.ay+e,Z(t,e);else{if(w)G[X+".x"]=b.x+t/w._m;else{var n=b._xsize/y.w,a=b.x+(b._xshift-b.xshift)/y.w-n/2;G[X+".x"]=m.align(a+t/y.w,n,0,1,b.xanchor)}if(k)G[X+".y"]=b.y+e/k._m;else{var o=b._ysize/y.h,i=b.y-(b._yshift+b.yshift)/y.h-o/2;G[X+".y"]=m.align(i-e/y.h,o,0,1,b.yanchor)}w&&k||(r=m.getCursor(w?.5:G[X+".x"],k?.5:G[X+".y"],b.xanchor,b.yanchor))}L.attr({transform:"translate("+t+","+e+")"+Y}),g(z,r)},doneFn:function(e){if(g(z),e){l.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var a=t.layout,s=t._fullLayout,y=t._fullLayout._size;s._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var x=(a.annotations||[])[e],b=s.annotations[e],_="clip"+s._uid+"_ann"+e;if(!x||b.visible===!1)return void i.selectAll("#"+_).remove();var w=u.getFromId(t,b.xref),k=u.getFromId(t,b.yref),M={x:{},y:{}},A=+b.textangle||0,T=s._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",b.opacity),L=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),z=L.append("g").style("pointer-events",b.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:x,fullAnnotation:b,event:i.event})});b.hovertext&&z.on("mouseover",function(){var e=b.hoverlabel,r=e.font,n=this.getBoundingClientRect(),a=t.getBoundingClientRect();h.loneHover({x0:n.left-a.left,x1:n.right-a.left,y:(n.top+n.bottom)/2-a.top,text:b.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:s._hoverlayer.node(),outerContainer:s._paper.node()})}).on("mouseout",function(){h.loneUnhover(s._hoverlayer.node())});var C=b.borderwidth,S=b.borderpad,O=C+S,D=z.append("rect").attr("class","bg").style("stroke-width",C+"px").call(f.stroke,b.bordercolor).call(f.fill,b.bgcolor),P=b.width||b.height,E=s._defs.select(".clips").selectAll("#"+_).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),E.exit().remove();var I=b.font,N=z.append("text").classed("annotation",!0).attr("data-unformatted",b.text).text(b.text);t._context.editable?N.call(p.makeEditable,z).call(r).on("edit",function(n){b.text=n,this.attr({"data-unformatted":b.text}),this.call(r);var a={};a["annotations["+e+"].text"]=b.text,w&&w.autorange&&(a[w._name+".autorange"]=!0),k&&k.autorange&&(a[k._name+".autorange"]=!0),l.relayout(t,a)}):N.call(r)}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("../../plotly"),s=t("../../plots/plots"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":143,"../../lib/setcursor":158,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/cartesian/axes":178,"../../plots/plots":206,"../color":32,"../dragelement":53,"../drawing":56,"../fx":73,"./draw_arrow_head":29,d3:14}],29:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(r,a){h.path&&(e>5&&(a=0),n.select(d.parentElement).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof r&&r||(r="end");var p,g,m,v,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(m=Math.atan2(A,M),v=m+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(m),L=k*Math.sin(m);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var z=d.getTotalLength(),C="";if(z=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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(i.combine(t,c))),(n.isDark()?e?n.lighten(e):c:r?n.darken(r):s).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(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"+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,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-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:Q-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:Q+_.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,I=1.001*z[0]-.001*z[1],N=1.001*z[1]-.001*z[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>I&&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+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=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+U)*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 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=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":143,"./flip_scale":43,"./scales":50}],39:[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":139,"./attributes":37,"./scales.js":50}],40:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":50}],41:[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;c(f+d+"auto",!(n(m)&&n(v)&&m=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],44:[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":40,"./is_valid_scale_array":48,"./scales":50}],45:[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}},{}],52:[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":143}],53:[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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return t.element.onmousemove=g,m._dragged=!1,m._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-m._mouseDownTimey&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(m._dragged,v,e),!m._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(m),m._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g,m=i.getPlotDiv(t.element)||{},v=1,y=s.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),g=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=n},{"../../constants/interactions":128,"../../lib":143,"../../plotly":173,"../../plots/cartesian/constants":183,"./align":51,"./cursor":52,"./unhover":54}],54:[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,a=t._hoverdata;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":138}],55:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],56:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i,l){if(s.traceIs(r,"symbols")){var u=g(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:p.isBubble(r)?u(t.ms):(o.size||6)/2,t.mrc=e;var n=m.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,m.symbolFuncs[a](e)+(n>=200?x:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,v=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?c.defaultLine:i.color,Array.isArray(o.color)&&(f=c.defaultLine,v=!0),f="mc"in t?t.mcc=n(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var y=o.gradient,b=t.mgt;if(b?v=!0:b=y&&y.type,b&&"none"!==b){var _=t.mgc;_?v=!0:_=y.color;var w="g"+l._fullLayout._uid+"-"+r.uid;v&&(w+="-"+t.i),e.call(m.gradient,l,w,b,f,_)}else e.call(c.fill,f);h&&e.call(c.stroke,d)}}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,k/2),u=Math.pow(l*l+s*s,k/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("tinycolor2"),s=t("../../registry"),c=t("../color"),u=t("../colorscale"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.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(c.fill,n)},m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},m.setRect=function(t,e,r,n,a){t.call(m.setPosition,e,r).call(m.setSize,n,a)},m.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);return i(a)&&i(o)&&e.node()?("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0):(e.remove(),!1)},m.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);m.translatePoint(t,a,e,r,n)})},m.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},m.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},m.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var o=(((t||[])[0]||{}).trace||{}).line||{},i=r||o.width||0,l=a||o.dash||"";c.stroke(e,n||o.color),m.dashLine(e,l,i)},m.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(c.stroke,r||a.color).call(m.dashLine,l,i)})},m.dashLine=function(t,e,r){r=+r||0,e=m.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},m.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),r.remove()}})};var v=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];m.symbolList=m.symbolList.concat([e.n,t,e.n+100,t+"-open"]),m.symbolNames[e.n]=t,m.symbolFuncs[e.n]=e.f,e.needLine&&(m.symbolNeedLines[e.n]=!0),e.noDot?m.symbolNoDot[e.n]=!0:m.symbolList=m.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=m.symbolNames.length,x="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>=y||t>=400?0:Math.floor(Math.max(t,0))};var b={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};m.gradient=function(t,e,r,n,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+i],f.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(b):"vertical"===n&&t.attr(_),t.attr("id",r);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},m.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},m.singlePointStyle=function(t,e,r,a,o,i){var l=r.marker;n(t,e,r,a,o,l,l.line,i)},m.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=m.tryColorscale(r,""),a=m.tryColorscale(r,"line"),i=f.getPlotDiv(t.node());t.each(function(t){m.singlePointStyle(t,o.select(this),e,n,a,i)})}},m.tryColorscale=function(t,e){var r=e?f.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};m.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(m.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(d.convertToTspans);var f=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=1.3*((h[0].length||1)-1)+1,g=w[s]*u,v=.75*c+w[l]*u+(w[l]-1)*p*c/2;f.attr("transform","translate("+g+","+v+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var k=.5;m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=1e4&&(o.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(s),f.extendFlat({},s)},m.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},m.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||0,y:+n[1]||0}},m.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[n]("transform")||"";return e=e||0,r=r||0,o=o.replace(/(\btranslate\(.*?\);?)/,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},m.getScale=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||1,y:+n[1]||1}},m.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[n]("transform")||"";return e=e||1,r=r||1,o=o.replace(/(\bscale\(.*?\);?)/,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},m.setPointGroupScale=function(t,e,r){var n,a,o;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};m.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),a=n.select("text"),i=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(n.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===r?[]:["translate("+i+","+l+")","scale("+e+","+r+")","translate("+-i+","+-l+")"],s&&t.push(s),n.attr("transform",t.join(" "))})},m.measureText=function(t,e,r){var n=t.append("text").text(e).call(m.font,r),a=m.bBox(n.node());return n.remove(),a}},{"../../constants/xmlns_namespaces":131,"../../lib":143,"../../lib/svg_text_utils":160,"../../registry":221,"../../traces/scatter/make_bubble_size_func":328,"../../traces/scatter/subtypes":333,"../color":32,"../colorscale":46,"./symbol_defs":57,d3:14,"fast-isnumeric":17,tinycolor2:20}],57:[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);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),o=n.round(t*-.309,2);return"M"+e+","+o+"L"+r+","+n.round(.809*t,2)+"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);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+n.round(.382*e,2)+"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}],58:[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"}}}},{}],59:[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":333,d3:14,"fast-isnumeric":17}],64:[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":32,d3:14}],65:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":139,"../../plots/font_attributes":202}],66:[function(t,e,r){"use strict";function n(t,e,r){Array.isArray(t)&&(e[0][r]=t)}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=0;r=0&&r.indexQ.width||W<0||W>Q.height)return x.unhoverRaw(t,e)}if(P="xval"in e?w.flat(n,e.xval):w.p2c(T,Y),E="yval"in e?w.flat(n,e.yval):w.p2c(L,W),!f(P[0])||!f(E[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var J=1/0;for(N=0;N1||F.hoverinfo.indexOf("name")!==-1?F.name:void 0,index:!1,distance:Math.min(J,k.MAXDIST),color:y.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},d[j]&&(U.subplot=d[j]._subplot),X=Z.length,"array"===q){var K=e[N];"pointNumber"in K?(U.index=K.pointNumber,q="closest"):(q="","xval"in K&&(H=K.xval,q="x"),"yval"in K&&(V=K.yval,q=q?"closest":"y"))}else H=P[B],V=E[B];if(F._module&&F._module.hoverPoints){var tt=F._module.hoverPoints(U,H,V,q);if(tt)for(var et,rt=0;rtX&&(Z.splice(0,X),J=Z[0].distance)}if(0===Z.length)return x.unhoverRaw(t,e);Z.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,at=[];for(I=0;I1,st=y.combine(d.plot_bgcolor||y.background,d.paper_bgcolor),ct={hovermode:D,rotateLabels:lt,bgColor:st,container:d._hoverlayer,outerContainer:d._paperdiv,commonLabelOpts:d.hoverlabel},ut=a(Z,ct);if(o(Z,lt?"xa":"ya"),i(ut,lt),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,at);m(u.select(e.target),ft?"pointer":"")}e.target&&c(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:L,xvals:P,yvals:E}))}function a(t,e){var r,n,a=e.hovermode,o=e.rotateLabels,i=e.bgColor,l=e.container,s=e.outerContainer,c=e.commonLabelOpts||{},f=e.fontFamily||k.HOVERFONT,d=e.fontSize||k.HOVERFONTSIZE,h=t[0],p=h.xa,m=h.ya,x="y"===a?"yLabel":"xLabel",b=h[x],_=(String(b)||"").split(" ")[0],w=s.node().getBoundingClientRect(),A=w.top,T=w.width,L=w.height,z=h.distance<=k.MAXDIST&&("x"===a||"y"===a);for(r=0;r15&&(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):z&&t[a+"Label"]===b?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 h=e.select("text.nums").call(v.font,t.fontFamily||f,t.fontSize||d,t.fontColor||c).call(v.setPosition,0,0).text(n).attr("data-notex",1).call(g.convertToTspans);h.selectAll("tspan.line").call(v.setPosition,0,0);var p=e.select("text.name"),m=0;r&&r!==n?(p.call(v.font,t.fontFamily||f,t.fontSize||d,s).text(r).call(v.setPosition,0,0).attr("data-notex",1).call(g.convertToTspans),p.selectAll("tspan.line").call(v.setPosition,0,0),m=p.node().getBoundingClientRect().width+2*S):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var x,_,w=h.node().getBoundingClientRect(),k=t.xa._offset+(t.x0+t.x1)/2,O=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),E=w.width+C+S+m;t.ty0=A-w.top,t.bx=w.width+2*S,t.by=w.height+2*S,t.anchor="start",t.txwidth=w.width,t.tx2width=m,t.offset=0,o?(t.pos=k,x=O+P/2+E<=L,_=O-P/2-E>=0,"top"!==t.idealAlign&&x||!_?x?(O+=P/2,t.anchor="start"):t.anchor="middle":(O-=P/2,t.anchor="end")):(t.pos=O,x=k+D/2+E<=T,_=k-D/2-E>=0,"left"!==t.idealAlign&&x||!_?x?(k+=D/2,t.anchor="start"):t.anchor="middle":(k-=D/2,t.anchor="end")),h.attr("text-anchor",t.anchor),m&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+k+","+O+")"+(o?"rotate("+M+")":""))}),P}function o(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)?T: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 i(t,e){t.each(function(t){var r=u.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*(C+S),l=i+o*(t.txwidth+S),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-z,s=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+s)+","+(C+c)+"v"+(t.by/2-C)+"h"+n*t.bx+"v-"+t.by+"H"+(n*C+s)+"V"+(c-C)+"Z"),a.call(v.setPosition,i+s,c+t.ty0-t.by/2+S).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(v.setPosition,l+o*S+s,c+t.ty0-t.by/2+S),r.select("rect").call(v.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,m=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),z=Math.sin(A),C=k.HOVERARROWSIZE,S=k.HOVERTEXTPAD;r.hover=function(t,e,r){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return n(t,e,r),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l);return i(s,l.rotateLabels),s.node()}},{"../../lib":143,"../../lib/events":138,"../../lib/override_cursor":152,"../../lib/svg_text_utils":160,"../../plots/cartesian/axes":178,"../../registry":221,"../color":32,"../dragelement":53,"../drawing":56,"./constants":68,"./helpers":70,d3:14,"fast-isnumeric":17,tinycolor2:20}],72:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":143}],73:[function(t,e,r){"use strict";function n(t){var e=i.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){var n=t.hoverlabel||{},a=i.nestedProperty(n,r).get();return Array.isArray(a)?Array.isArray(e)&&Array.isArray(a[e[0]])?a[e[0]][e[1]]:a[e]:a}var o=t("d3"),i=t("../../lib"),l=t("../dragelement"),s=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:s.getDistanceFunction,getClosest:s.getClosest,inbox:s.inbox,castHoverOption:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":143,"../dragelement":53,"./attributes":65,"./calc":66,"./click":67,"./constants":68,"./defaults":69,"./helpers":70,"./hover":71,"./layout_attributes":74,"./layout_defaults":75,"./layout_global_defaults":76,d3:14}],74:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":139,"../../plots/font_attributes":202,"./constants":68}],75:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],83:[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":139,"../../plots/font_attributes":202,"../color/attributes":31}],84:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],85:[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)!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":143,"../../plots/layout_attributes":204,"../../registry":221,"./attributes":83,"./helpers":88}],86:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(i,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.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;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeT&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},T):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&A&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),A=!1):A=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?g===-1?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&g===-1&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var m,v=[],y=[];for(m=0;mtspan"),f=u[0].length||1;r=l*f,n=c.node()&&m.bBox(c.node()).width;var d=l*(.3+(1-f)/2);c.attr("y",d),u.attr("y",d)}r=Math.max(r,16)+3,a.height=r,a.width=n}function l(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=k.isGrouped(a);if(k.isVertical(a))i&&e.each(function(t,e){m.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;m.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];u.select(this).select(".legendtoggle").call(m.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(),c=0,f=s.length;cn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),m.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+r,a.height=Math.max(a.height,e.height),y+=i+r,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(m.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center");var a="top";M.isBottomAnchor(r)?a="bottom":M.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),A=!0,T=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){C.attr("data-scroll",e).call(m.setTranslate,0,e),S.call(m.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),L.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&_(t.calcdata,y),k=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var L=r._topdefs.selectAll("#"+i).data([0]);L.enter().append("clipPath").attr("id",i).append("rect");var z=A.selectAll("rect.bg").data([0]);z.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),z.call(v.stroke,y.bordercolor),z.call(v.fill,y.bgcolor),z.style("stroke-width",y.borderwidth+"px");var C=A.selectAll("g.scrollbox").data([0]);C.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(v.fill,"#808BA4");var O=C.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==A.enter().size();P&&(l(t,O,D),s(t));var E=r.width,I=r.height;l(t,O,D),y.height>I?c(t):s(t);var N=r._size,R=N.l+N.w*y.x,F=N.t+N.h*(1-y.y);M.isRightAnchor(y)?R-=y.width:M.isCenterAnchor(y)&&(R-=y.width/2),M.isBottomAnchor(y)?F-=y.height:M.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=N.w;j>B?(R=N.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var q=y.height,H=N.h;q>H?(F=N.t,q=H):(F+q>I&&(F=I-q),F<0&&(F=0),q=Math.min(I-F,y.height)),m.setTranslate(A,R,F);var V,U,X=q-x.scrollBarHeight-2*x.scrollBarMargin,Z=y.height-q;if(y.height<=q||t._context.staticPlot)z.attr({width:j-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(C,0,0),L.select("rect").attr({width:j-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),C.call(m.setClipUrl,i);else{V=x.scrollBarMargin,U=C.attr("data-scroll")||0,z.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),L.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),C.call(m.setClipUrl,i),P&&e(V,U),A.on("wheel",null),A.on("wheel",function(){U=d.constrain(C.attr("data-scroll")-u.event.deltaY/X*Z,-Z,0),V=x.scrollBarMargin-U/Z*X,e(V,U),0!==U&&U!==-Z&&u.event.preventDefault()}),S.on(".drag",null),C.on(".drag",null);var G=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+X),U=-(V-x.scrollBarMargin)/X*Z,e(V,U)});S.call(G),C.call(G)}if(t._context.editable){var Y,W,$,Q;A.classed("cursor-move",!0),g.init({element:A.node(),prepFn:function(){var t=m.getTranslate(A);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;m.setTranslate(A,r,n),Y=g.align(r,0,N.l,N.l+N.w,y.xanchor),W=g.align(n,0,N.t+N.h,N.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Y&&void 0!==W)f.relayout(t,{"legend.x":Y,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?A._clickTimeout=setTimeout(function(){o(i,t,n)},T):2===n&&(A._clickTimeout&&clearTimeout(A._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":206,"../../registry":221,"../color":32,"../dragelement":53,"../drawing":56,"./anchor_utils":82,"./constants":84,"./get_legend_data":87,"./helpers":88,"./style":90,d3:14}],87:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))s.indexOf(t)===-1?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[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=s.select(this),a=t[0],o=(a.mlw+1||n.width+1)-1;e.style("stroke-width",o+"px").call(d.fill,a.mc||r.color),o&&e.call(d.stroke,a.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(){var t=e.line.width,r=s.select(this);r.style("stroke-width",t+"px").call(d.fill,e.fillcolor),t&&r.call(d.stroke,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.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var n=r.selectAll("g.legendsymbols").data([t]);n.enter().append("g").classed("legendsymbols",!0),n.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":143,"../../registry":221,"../../traces/pie/style_one":311,"../../traces/scatter/subtypes":333,"../color":32,"../drawing":56,d3:14}],91:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)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(["toggleSpikelines","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)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":143,"../color":32,"./attributes":95,"./button_attributes":96,"./constants":97}],99:[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;lZ&&n>G&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),X=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),q=v.getDataToPixel(t,j),H=v.getDataToPixel(t,B,!0),V=v.getPixelToData(t,j),U=v.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(m=q(r.x0),y=H(r.y0),x=q(r.x1),b=H(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),mG&&(h[C]=r[P]=U(c),h[S]=r[E]=U(u)),d-f>Z&&(h[O]=r[I]=V(f),h[D]=r[N]=V(d))}e.attr("d",i(t,r))}var h,m,y,x,b,_,w,k,M,A,T,L,z,C,S,O,D,P,E,I,N,R,F,j,B,q,H,V,U,X,Z=10,G=10,Y={setCursor:a,element:e.node(),prepFn:o,doneFn:l},W=Y.element.getBoundingClientRect();p.init(Y)}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=v.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=v.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=v.decodeDate(n)),c&&"date"===c.type&&(o=v.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var m=(d+h)/2,y=(p+g)/2,x=Math.abs(m-d),b=Math.abs(y-p),_="A"+x+","+b,w=m+x+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),o=m.paramIsX[a],i=m.paramIsY[a],l=m.numParams[a],s=t.substr(1).replace(m.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),o=m.paramIsX[a],i=m.paramIsY[a],l=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":143,"../../lib/setcursor":158,"../../plotly":173,"../../plots/cartesian/axes":178,"../color":32,"../dragelement":53,"../drawing":56,"./constants":110,"./helpers":113}],113:[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}},{}],114:[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":108,"./calc_autorange":109,"./defaults":111,"./draw":112}],115:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,x;"paper"!==m?(v=a.getFromId(g,m),x=i.rangeToShapePosition(v),y=i.shapePositionToRange(v)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,m,b,.25),a.coercePosition(e,g,c,m,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":143,"../../plots/cartesian/axes":178,"./attributes":108,"./helpers":113}],116:[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":139,"../../plots/animation_attributes":174,"../../plots/font_attributes":202,"../../plots/pad_attributes":205,"./constants":117}],117:[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}},{}],118:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-z.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=z.currentValueInset,a="left"}o.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",a);var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}return e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans),A.setTranslate(o,n,e.currentValueHeight),o}}function s(t,e,r){var n=t.selectAll("rect."+z.gripRectClass).data([0]);n.enter().append("rect").classed(z.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:z.gripWidth,height:z.gripHeight,rx:z.gripRadius,ry:z.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans),n}function u(t,e){var r=t.selectAll("g."+z.labelsClass).data([0]);r.enter().append("g").classed(z.labelsClass,!0);var n=r.selectAll("g."+z.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(z.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,v(e,t.fraction),z.tickOffset+e.ticklen+e.labelHeight+z.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+z.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+z.tickRectClass).data(e.steps);r.enter().append("rect").classed(z.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?z.tickOffset:z.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(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,r){var n=t.selectAll("rect."+z.railTouchRectClass).data([0]);n.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,z.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+z.railRectClass).data([0]);r.enter().append("rect").classed(z.railRectClass,!0);var n=e.inputAreaLength-2*z.railInset;r.attr({width:n,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,z.railInset,.5*(e.inputAreaWidth-z.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(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+z.groupClassName).data(r,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 g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+g+")")}}}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(d);var O="Click to enter "+y+" title";t._context.editable?(C?S.on(".opacity",null):function(){L=0,z=!0,C=O,S.attr({"data-unformatted":C}).text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),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(d)}).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)}},{"../../constants/interactions":128,"../../lib":143,"../../lib/svg_text_utils":160,"../../plotly":173,"../../plots/plots":206,"../color":32,"../drawing":56,d3:14,"fast-isnumeric":17}],122:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":139,"../../plots/font_attributes":202,"../../plots/pad_attributes":205,"../color/attributes":31}],123:[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"}},{}],124:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(z.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+z.headerGroupClassName).data(r,a);u.enter().append("g").classed(z.headerGroupClassName,!0);var f=o.selectAll("g."+z.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(z.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,z=p,C=m+v;C+L>c&&(C=c-L);var S=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:z,y:C,width:T,height:L}),this._hbarXMin=z+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,I=m;E+D>s&&(E=s-D);var N=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);N.exit().on(".drag",null).remove(),N.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=N.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:I,width:D,height:P}),this._vbarYMin=I+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":143,"../color":32,"../drawing":56,d3:14}],128:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],129:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],130:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],131:[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}},{}],132:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.27.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/fx"),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=t("./components/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":30,"./components/fx":73,"./components/images":81,"./components/legend":89,"./components/rangeselector":101,"./components/rangeslider":107,"./components/shapes":114,"./components/sliders":120,"./components/updatemenus":126,"./fonts/mathjax_config":133,"./lib/queue":155,"./plot_api/plot_schema":167,"./plot_api/register":168,"./plot_api/set_plot_config":169,"./plot_api/to_image":171,"./plot_api/validate":172,"./plotly":173,"./snapshot":226,"./snapshot/download":223,"./traces/scatter":323,d3:14,"es6-promise":15}],133:[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},{}],134:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),n(t)?Number(t):a}},{"../constants/numerical":129,"fast-isnumeric":17}],135:[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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);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;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,x=m.ONEHOUR,b=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,L;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=T&&t<=L?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!l)return v;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return v;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var m="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,m),u)}else p=g.newDate(s,Number(c),u)}catch(t){return v}return p?(p.toJD()-w)*y+f*x+d*b+h*_:v}s=2===s.length?(Number(s)+2e3-A)%100+A:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?v:M.getUTCDate()!==u?v:M.getTime()+h*_},T=r.MIN_MS=r.dateTime2ms("-9999"),L=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var z=90*y,C=3*x,S=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=T&&t<=L))return v;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=T+y&&t<=L-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=M("%Y"),E=M("%b %Y"),I=M("%b %-d"),N=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=P(g):"m"===r?d=E(g):"d"===r?(o=P(g),d=I(g)):(o=N(g),d=l(t,r))}return d+(o?"\n"+o:"")};var R=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+R);return s.setUTCMonth(s.getUTCMonth()+e)+a-R},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;ur?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.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||1/0!==u&&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)<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.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":134,"./coerce":135,"./dates":136,"./ensure_array":137,"./extend":139,"./filter_unique":140,"./filter_visible":141,"./identity":142,"./is_array":144,"./is_plain_object":145,"./loggers":146,"./matrix":147,"./mod":148,"./nested_property":149,"./noop":150,"./notifier":151,"./push_unique":154,"./relink_private":156,"./search":157,"./stats":159,"./to_log_range":161,d3:14}],144:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],145:[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}},{}],146:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(u=1;uMath.max(f,m)||c>Math.max(d,v)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":129,"./matrix":147}],154:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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}],160:[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-"+h.randstr([],64),o=d.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=d.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.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":"")+(v[n]||"");if("br"===n)return"
";var o,i=e[4];if("a"===n){var l=i&&i.match(T),c=l&&(l[3]||l[4]);if(o="':o+">"}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,d=t("d3"),h=t("../lib"),p=t("../constants/xmlns_namespaces"),g=t("../constants/string_mappings");r.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},d.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=r.getDOMParser(),a=n.parseFromString(e,"application/xml"),o=a.documentElement.firstChild;o;)this.node().appendChild(this.node().ownerDocument.importNode(o,!0)),o=o.nextSibling;return a.querySelector("parsererror")?(h.log(a.querySelector("parsererror div").textContent),null):d.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=d.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=l.attr("class")+"-math",f.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,f=d.select(l.node().parentNode);if(!f.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=h.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){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=f.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 d=n(s,"width"),h=n(s,"height"),g=+l.attr("x")-d*{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("+[-d/2,v-h/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:v-h/2}):"a"===p[0]?s.attr({x:0,y:v}):s.attr({x:g,y:+l.attr("y")+v-h/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},v={sup:'',sub:''},y=["http:","https:","mailto:"],x=new RegExp("]*)?/?>","g"),b=Object.keys(g.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:g.entityToUnicode[t]}}),_=Object.keys(g.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+g.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,k=/(<[^<>]*>)/,M=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,L=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(x," ")},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]")&&d.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=h.getPlotDiv(i.node()),e=d.select(t),n=e.select(".svg-container"),o=n.append("div");o.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,n,r)).on("blur",function(){t._editing=!1,i.text(this.textContent).style({opacity:1});var e,r=d.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&d.select(i.node().parentNode).select(e).style({opacity:0});var n=this.textContent;d.select(this).transition().duration(0).remove(),d.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var e=this;t._editing=!0,d.select(document).on("mouseup",function(){if(d.event.target===e)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===d.event.which?(t._editing=!1,i.style({opacity:1}),d.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),d.select(this).call(u(i,n,r)))}).on("keydown",function(){13===d.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=d.dispatch("edit","input","cancel"),s=d.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),d.rebind(this,l,"on")}},{"../constants/string_mappings":130,"../constants/xmlns_namespaces":131,"../lib":143,d3:14}],161:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":17}],162:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(m,v),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),z=L||[],C=n(v,f).get(),S=[],O=-1,D=z.length;for(x=0;xz.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?S.push(_):A?("add"===M&&(M={}),z.splice(_,0,M),C&&C.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),O===-1&&(O=_);else for(b=0;b=0;x--)z.splice(S[x],1),C&&C.splice(S[x],1);if(z.length?L||e.set(z):e.set(null),g)return!1;if(d(m,v),p!==o){var P;if(O===-1)P=T;else{for(D=Math.max(z.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sj.range[0]?[1,2]:[2,1]);else{var H=j.range[0],V=j.range[1];B?(H<=0&&V<=0&&r(N+".autorange",!0),H<=0?H=V/1e6:V<=0&&(V=H/1e6),r(N+".range[0]",Math.log(H)/Math.LN10),r(N+".range[1]",Math.log(V)/Math.LN10)):(r(N+".range[0]",Math.pow(10,H)),r(N+".range[1]",Math.pow(10,V)))}else r(N+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,F,T,r),w.getComponentMethod("images","convertCoords")(t,F,T,r)}else r(N+".autorange",!0)}else if(D.match(P.AX_NAME_PATTERN)){var U=x.nestedProperty(c,M).get(),X=(T||{}).type;X&&"-"!==X||(X="linear"),w.getComponentMethod("annotations","convertCoords")(t,U,X,r),w.getComponentMethod("images","convertCoords")(t,U,X,r)}var Z=S.containerArrayMatch(M);if(Z){o=Z.array,i=Z.index;var G=Z.property,Y=x.nestedProperty(s,o),W=(Y||[])[i]||{};if(""===i)M.indexOf("updatemenus")===-1&&(m.docalc=!0);else if(""===G){var $=T;S.isAddVal(T)?b[M]=null:S.isRemoveVal(T)?(b[M]=W,$=W):x.warn("unrecognized full object value",e),(n($,"x")||n($,"y")&&M.indexOf("updatemenus")===-1)&&(m.docalc=!0)}else!n(W,"x")&&!n(W,"y")||x.containsAny(M,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var Q=d[o][i];Q||(Q=d[o][i]={}),Q[G]=T,delete e[M]}else if("reverse"===D)R.range?R.range.reverse():(r(N+".autorange",!0),R.range=[1,0]),F.autorange?m.docalc=!0:m.doplot=!0;else{var J=String(A.parts[1]||"");0===C.indexOf("scene")?"camera"===A.parts[1]?m.docamera=!0:m.doplot=!0:0===C.indexOf("geo")?m.doplot=!0:0===C.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===M?m.doplot=!0:"margin"===C||"autorange"===J||"rangemode"===J||"type"===J||"domain"===J||"fixedrange"===J||"scaleanchor"===J||"scaleratio"===J||M.indexOf("calendar")!==-1||M.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||M.indexOf("axis")===-1&&"plot_bgcolor"!==M?"hiddenlabels"===M?m.docalc=!0:C.indexOf("legend")!==-1?m.dolegend=!0:M.indexOf("title")!==-1?m.doticks=!0:C.indexOf("bgcolor")!==-1?m.dolayoutstyle=!0:L>1&&x.containsAny(J,["tick","exponent","grid","zeroline"])?m.doticks=!0:M.indexOf(".linewidth")!==-1&&M.indexOf("axis")!==-1?m.doticks=m.dolayoutstyle=!0:L>1&&J.indexOf("line")!==-1?m.dolayoutstyle=!0:L>1&&"mirror"===J?m.doticks=m.dolayoutstyle=!0:"margin.pad"===M?m.doticks=m.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(M)!==-1||M.indexOf("spike")!==-1?m.domodebar=!0:["height","width","autosize"].indexOf(M)===-1&&(m.doplot=!0):m.doplot=!0,A.set(T)}}}for(o in d){S.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var K=c._axisConstraintGroups;for(var tt in _)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?m>=l.length?t.transitionOpts=l[m]:t.transitionOpts=l[0]:t.transitionOpts=l,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&MM)&&A.push(g);v=A}}v.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":56,"../components/errorbars":62,"../constants/xmlns_namespaces":131,"../lib":143,"../lib/events":138,"../lib/queue":155,"../lib/svg_text_utils":160,"../plotly":173,"../plots/cartesian/axis_ids":181,"../plots/cartesian/constants":183,"../plots/cartesian/constraints":185,"../plots/cartesian/graph_interact":187,"../plots/plots":206,"../plots/polar":209,"../registry":221,"./helpers":163,"./manage_arrays":164,"./subroutines":170,d3:14,"fast-isnumeric":17}],166:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],167:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,m),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},v)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[k]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=A,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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},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)||p.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){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||e.arrayOk===!0)){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}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;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":143,"../plotly":173,"../snapshot/cloneplot":222,"../snapshot/helpers":225,"../snapshot/svgtoimg":227,"../snapshot/tosvg":229,"fast-isnumeric":17}],172:[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;v.3*f||o(n)||o(a))){var d=r.dtick/2;t+=t+d.8){var i=Number(r.substr(1));o.exactYears>.8&&i%12==0?t=I.tickIncrement(t,"M6","reverse")+1.5*S:o.exactMonths>.8?t=I.tickIncrement(t,"M1","reverse")+15.5*S:t-=S/2;var l=I.tickIncrement(t,r);if(l<=n)return l}return t}function o(t){var e,r,n=t.tickvals,a=t.ticktext,o=new Array(n.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;ru&&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=t.l2r(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 s(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function c(t,e,r,n){var a=t._tickround,o=r&&t.hoverformat||t.tickformat;n&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");s!==-1&&(i=l.substr(s+1),l=l.substr(0,s)),n&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(r?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function d(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,n)}function h(t,e,r,n){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=U[s/3+5])}return a?"\u2212"+t:t}function p(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},I.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(),_.simpleMap(r,t.l2r||Number)},I.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=I.getAutoRange(t);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},I.saveRangeInitial=function(t,e){for(var r=I.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},I.autoBin=function(t,e,r,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(r)c=(s-l)/r;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},I.setConvert(h),I.autoTicks(h,c);var p,g=I.tickIncrement(I.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=n(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=I.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},I.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),I.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=I.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=I.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,F)):n>C?(e/=C,t.dtick="M"+i(e,1,j)):n>S?(t.dtick=i(e,S,q),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=i(e,O,j):n>D?t.dtick=i(e,D,B):n>P?t.dtick=i(e,P,B):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,F))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,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,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,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,F));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)}},I.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,n);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?V:H,s=t+.01*a,c=_.roundUp(_.mod(s,1),l,r);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},I.tickFirst=function(t){var e=t.r2l||Number,r=_.simpleMap(t.range,e),n=r[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":17}],180:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,r,p,g){function m(r,n){return o.coerce2(t,e,l,r,n)}var v=p.letter,y=p.font||{},x="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",b=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?h(v,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=r("color"),k=w===t.color?w:y.color;r("title",x),o.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,r,_),u(t,e,r,_,p),c(t,e,r,p);var M=m("linecolor",w),A=m("linewidth"),T=r("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var L=m("gridcolor",n(w,p.bgColor,i).toRgbString()),z=m("gridwidth");r("showgrid",p.showGrid||!!L||!!z)||(delete e.gridcolor,delete e.gridwidth);var C=m("zerolinecolor",w),S=m("zerolinewidth");return r("zeroline",p.showGrid||!!C||!!S)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":31,"../../lib":143,"../../registry":221,"./category_order_defaults":182,"./layout_attributes":189,"./ordered_categories":191,"./set_convert":195,"./tick_label_defaults":196,"./tick_mark_defaults":197,"./tick_value_defaults":198,tinycolor2:20}],181:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],183:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],184:[function(t,e,r){"use strict";function n(t,e,r,n){var a,o,l,s,c=n[i(e)].type,u=[];for(o=0;oo*p))for(r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,r,n,a,o){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return["lasso","select"].indexOf(t)!==-1}function m(t,e){return"M"+(t.l-.5)+","+(e-N-.5)+"h-3v"+(2*N+1)+"h3ZM"+(t.r+.5)+","+(e-N-.5)+"h3v"+(2*N+1)+"h-3Z"}function v(t,e){return"M"+(e-N-.5)+","+(t.t-.5)+"v-3h"+(2*N+1)+"v3ZM"+(e-N-.5)+","+(t.b+.5)+"v3h"+(2*N+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,N)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,r){var n,a,o,i,l,s,c=!1,u={},f={};for(n=0;nN||l>N?(wt="xy",i/nt>l/at?(l=i*at/nt,vt>o?yt.t=vt-l:yt.b=vt+l):(i=l*nt/at,mt>a?yt.l=mt-i:yt.r=mt+i),Mt.attr("d",y(yt))):n():!it||lzoom back out","long"),R=!1)}function X(e,r){var n=1===(j+B).length;if(e)$();else if(2!==r||n){if(1===r&&n){var a=j?tt[0]:K[0],i="s"===j||"w"===B?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;j?(u="n"===j?"top":"bottom","right"===a.side&&(c="right")):"e"===B&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(pt).call(A.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,l,r)})}}else W()}function Z(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var n=t.querySelector(".plotly");if(q(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Tt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=zt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(B||st){for(B||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":143,"fast-isnumeric":17}],193:[function(t,e,r){"use strict";e.exports=function(t,e,r){void 0===r&&(r=.5);var n=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=n[0]+(n[1]-n[0])*r,o=(a-n[0])*e;t.range=t._input.range=[t.l2r(a-o),t.l2r(a+o)]}},{}],194:[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,I=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"),N=[],R=a.gd,F=[];for(S=0;Sd?h:i(t)?Number(t):h):h}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../lib"),s=l.cleanNumber,c=l.ms2DateTime,u=l.dateTime2ms,f=t("../../constants/numerical"),d=f.FP_SAFE,h=f.BADNUM,p=t("./constants"),g=t("./axis_ids");e.exports=function(t,e){function r(e,r){if(e>0)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*w*Math.abs(n-a))}return h}function f(e,r,n){var a=u(e,n||t.calendar);if(a===h){if(!i(e))return h;a=u(new Date(+e))}return a}function m(e,r,n){return c(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if("number"==typeof e)return e}function b(e){return i(e)?o.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:a,t.l2c="log"===t.type?n:a,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,t.p2c="log"===t.type?function(t){return n(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=a,t.d2p=t.r2p=function(t){return b(s(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=a,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return b(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(t){return b(s(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=l.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=m,t.d2p=t.r2p=function(t,e,r){return b(f(t,0,r))},t.p2d=t.p2r=function(t,e,r){return m(_(t),e,r)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2l_noadd=x,t.r2l=t.l2r=t.r2c=t.c2r=a,t.d2p=function(t){return b(x(t))},t.p2d=function(t){return v(_(t))},t.r2p=b,t.p2r=_),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=l.nestedProperty(t,e).get(),o=(t._id||"x").charAt(0);if(n="date"===t.type?l.dfltRange(t.calendar):"y"===o?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void l.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=l.cleanDate(a[0],h,t.calendar),a[1]=l.cleanDate(a[1],h,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!l.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=l.constrain(t.r2l(a[0]),l.MIN_MS+1e3,l.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!i(a[r])){if(!i(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-d?a[r]=-d:a[r]>d&&(a[r]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var i=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(i);var c=t.r2l(t[i][0],s),u=t.r2l(t[i][1],s);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw l.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,o,i="date"===t.type&&e[r+"calendar"];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?a.dateTick0(e.calendar):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":129,"../../lib":143,"fast-isnumeric":17}],199:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(e,r){function n(e,r){for(a=0;ar.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var m=t._fullLayout,v=[],y=function(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=m[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,v.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(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}(m,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":56,"../../plotly":173,"../../registry":221,"./axes":178,d3:14}],200:[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 c=a(e,r,n);if(c){if("histogram"===c.type&&n==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=n+"calendar",f=c[u];if(i(c,n)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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"),s=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),s.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=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).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||[],i=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var s=r.width,u=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=s),a.height||(n.height=u)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,h=t._context&&t._context.autosizable;f&&(d||h)?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,i,a,n),n._has=p._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var u=o(t._boundingBoxMargins),d=u.left+u.right,h=u.bottom+u.top,g=1-2*l,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-d)),a=Math.round(g*(m.height-h))}else{var v=c?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;c.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];n._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),u=e._pushmargin;if(e.margin.autoexpand!==!1){u.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(u),d=0;dm){var M=(v*w+(k-e.width)*m)/(w-m),A=(k*(1-m)+(v-e.width)*(1-w))/(w-m);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(s(x)&&u[_].t){var T=u[_].t.val,L=u[_].t.size;if(T>y){var z=(x*T+(L-e.height)*y)/(T-y),C=(L*(1-y)+(x-e.height)*(1-T))/(T-y);z>=0&&C>=0&&z+C>l+i&&(l=z,i=C)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(f.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):f.isJSDate(t)?f.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===n?c:JSON.stringify(c)},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 c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,u=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,z=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);A&&!M&&(C=0);var S=z.slice();T&&M&&(S[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(S[1]-S[0])/O);var D=f.angularAxis.ticksStep||(S[1]-S[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),S[2]||(S[2]=D);var P=n.range.apply(this,S);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(S.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?C:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),I=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(I)}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 N,R=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},j={"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){N=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:N,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=N.node().getBBox();x=Math.min(f.width-q.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(),N.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else N=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(j).text(f.title),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var X=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Z=X.selectAll("circle.grid-circle").data(a.ticks(5));Z.enter().append("circle").attr({class:"grid-circle"}).style(F),Z.attr("r",a),Z.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(F);var G=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Y=n.svg.axis().scale(a).ticks(5).tickSize(5);X.call(Y).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(F),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),$=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),$.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(F),$.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var Q=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(j);f.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(G).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(G).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(G).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},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(void 0===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;return[t*Math.cos(r),t*Math.sin(r)]},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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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=[i.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),o(e[r],i.PolyChart.defaultConfig()),o(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){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);if([[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"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":143,d3:14}],211:[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":32,"../../lib":143,"./micropolar":210,"./undo_manager":212,d3:14}],212:[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":32,"../../subplot_defaults":213,"./axis_defaults":217,"./layout_attributes":219}],219:[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":31,"./axis_attributes":216}],220:[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("../plots"),p=t("../cartesian/axes"),g=t("../../components/dragelement"),m=t("../../components/fx"),v=t("../../components/titles"),y=t("../cartesian/select"),x=t("../cartesian/constants");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=this,n=e[r.id],a=e._size;r.adjustLayout(n,a),h.generalUpdatePerTraceModule(r,t,n),r.layers.plotbg.select("path").call(c.fill,n.bgcolor)},b.makeFramework=function(){var t=this,e=t.defs.selectAll("g.clips").data([0]);e.enter().append("g").classed("clips",!0);var r="clip"+t.layoutId+t.id;t.clipDef=e.selectAll("#"+r).data([0]),t.clipDef.enter().append("clipPath").attr("id",r).append("path").attr("d","M0,0Z"),t.plotContainer=t.container.selectAll("g."+t.id).data([0]),t.plotContainer.enter().append("g").classed(t.id,!0),t.layers={};var n=["draglayer","plotbg","backplot","grids","frontplot","zoom","aaxis","baxis","caxis","axlines"];t.plotContainer.selectAll("g.toplevel").data(n).enter().append("g").attr("class",function(t){return"toplevel "+t}).each(function(e){var r=o.select(this);t.layers[e]=r,"frontplot"===e?r.append("g").classed("scatterlayer",!0):"backplot"===e?r.append("g").classed("maplayer",!0):"plotbg"===e?r.append("path").attr("d","M0,0Z"):"axlines"===e&&r.selectAll("path").data(["aline","bline","cline"]).enter().append("path").each(function(t){o.select(this).classed(t,!0)})}),t.plotContainer.select(".grids").selectAll("g.grid").data(["agrid","bgrid","cgrid"]).enter().append("g").attr("class",function(t){return"grid "+t}).each(function(e){t.layers[e]=o.select(this)}),t.plotContainer.selectAll(".backplot,.frontplot,.grids").call(u.setClipUrl,r),t.graphDiv._context.staticPlot||t.initInteractions()};var _=Math.sqrt(4/3);b.adjustLayout=function(t,e){var r,n,a,o,i,l,s=this,u=t.domain,h=(u.x[0]+u.x[1])/2,p=(u.y[0]+u.y[1])/2,g=u.x[1]-u.x[0],m=u.y[1]-u.y[0],v=g*e.w,y=m*e.h,x=t.sum,b=t.aaxis.min,w=t.baxis.min,k=t.caxis.min;v>_*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"},f(s.xaxis,s.graphDiv._fullLayout),s.xaxis.setScale(),s.yaxis={type:"linear",range:[b,x-w-k],domain:[p-l/2,p+l/2],_id:"y"},f(s.yaxis,s.graphDiv._fullLayout),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{visible:!0,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,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A,s.graphDiv._fullLayout),A.setScale();var T=s.baxis=d({},t.baxis,{visible:!0,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,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T,s.graphDiv._fullLayout),T.setScale(),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{visible:!0,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,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L,s.graphDiv._fullLayout),L.setScale();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(p.doTicks(r,a,!0),p.doTicks(r,o,!0),p.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));v.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;v.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"}}),v.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=x.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=!0;b.initInteractions=function(){function t(t,e,r){var n=N.getBoundingClientRect();b=e-n.left,w=r-n.top,L={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=L,z=I.aaxis.range[1]-L.a,S=i(I.graphDiv._fullLayout[I.id].bgcolor).getLuminance(),O="M0,"+I.h+"L"+I.w/2+", 0L"+I.w+","+I.h+"Z",D=!1,P=F.append("path").attr("class","zoombox").style({fill:S>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",O),E=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),E.transition().style("opacity",1).duration(200),D=!0)}function u(t,e){if(C===L)return 2===e&&v(),a(R);a(R);var r={};r[I.id+".aaxis.min"]=C.a,r[I.id+".baxis.min"]=C.b,r[I.id+".caxis.min"]=C.c,l.relayout(R,r),T&&R.data&&R._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),T=!1)}function f(){L={a:I.aaxis.range[0],b:I.baxis.range[1],c:I.caxis.range[1]},C=L}function d(t,e){var r=t/I.xaxis._m,n=e/I.yaxis._m;C={a:L.a-n,b:L.b+(r+n)/2,c:L.c-(r-n)/2};var a=[C.a,C.b,C.c].sort(),o={a:a.indexOf(C.a),b:a.indexOf(C.b),c:a.indexOf(C.c)};a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),C={a:a[o.a],b:a[o.b],c:a[o.c]},e=(L.a-C.a)*I.yaxis._m,t=(L.c-C.c-L.b+C.b)*I.xaxis._m);var i="translate("+(I.x0+t)+","+(I.y0+e)+")";I.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),I.aaxis.range=[C.a,I.sum-C.b-C.c],I.baxis.range=[I.sum-C.a-C.c,C.b],I.caxis.range=[I.sum-C.a-C.b,C.c],I.drawAxes(!1),I.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var r={};r[I.id+".aaxis.min"]=C.a,r[I.id+".baxis.min"]=C.b,r[I.id+".caxis.min"]=C.c,l.relayout(R,r)}else 2===e&&v()}function p(){I.plotContainer.selectAll(".select-outline").remove()}function v(){var t={};t[I.id+".aaxis.min"]=0,t[I.id+".baxis.min"]=0,t[I.id+".caxis.min"]=0,R.emit("plotly_doubleclick",null),l.relayout(R,t)}var b,w,L,z,C,S,O,D,P,E,I=this,N=I.layers.plotbg.select("path").node(),R=I.graphDiv,F=I.layers.zoom,j={element:N,gd:R,plotinfo:{plot:F},doubleclick:v,subplot:I.id,prepFn:function(e,r,n){j.xaxes=[I.xaxis],j.yaxes=[I.yaxis];var a=R._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),j.minDrag="lasso"===a?1:void 0,"zoom"===a?(j.moveFn=o,j.doneFn=u,t(e,r,n)):"pan"===a?(j.moveFn=d,j.doneFn=h,f(),p()):"select"!==a&&"lasso"!==a||y(e,r,n,j,a)}};N.onmousemove=function(t){m.hover(R,t,I.id),R._fullLayout._lasthover=N,R._fullLayout._hoversubplot=I.id},N.onmouseout=function(t){R._dragging||g.unhover(R,t)},N.onclick=function(t){m.click(R,t)},g.init(j)}},{"../../components/color":32,"../../components/dragelement":53,"../../components/drawing":56,"../../components/fx":73,"../../components/titles":121,"../../lib":143,"../../lib/extend":139,"../../plotly":173,"../cartesian/axes":178,"../cartesian/constants":183,"../cartesian/select":194,"../cartesian/set_convert":195,"../plots":206,d3:14,tinycolor2:20}],221:[function(t,e,r){"use strict";function n(t){if(t.layoutAttributes){var e=t.layoutAttributes._arrayAttrRegexps;if(e)for(var n=0;n-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)),d=t._context||{};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&&A>0,j=k<=N&&A<=R,B=k<=R&&A<=N,q="h"===v?N>=k*(R/A):R>=A*(N/k);F&&(j||B||q)?x="inside":(x="outside",b.remove(),b=null)}else x="inside";if(!b&&(b=g(e,y,"outside"===x?z:L),_=M.bBox(b.node()),k=_.width,A=_.height,k<=0||A<=0))return void b.remove();var H;H="outside"===x?o(i,d,h,p,_,v):a(i,d,h,p,_,v),b.attr("transform",H)}}}function a(t,e,r,n,a,o){var l,s,c,u,f,d=a.width,h=a.height,p=(a.left+a.right)/2,g=(a.top+a.bottom)/2,m=Math.abs(e-t),v=Math.abs(n-r);m>2*D&&v>2*D?(f=D,m-=2*f,v-=2*f):f=0;var y,x;return d<=m&&h<=v?(y=!1,x=1):d<=v&&h<=m?(y=!0,x=1):dr?(c=(t+e)/2,u=n-f-s/2):(c=(t+e)/2,u=n+f+s/2),i(p,g,c,u,x,y)}function o(t,e,r,n,a,o){var l,s="h"===o?Math.abs(n-r):Math.abs(e-t);s>2*D&&(l=D,s-=2*l);var c,u,f,d,h="h"===o?Math.min(1,s/a.height):Math.min(1,s/a.width),p=(a.left+a.right)/2,g=(a.top+a.bottom)/2;return c=h*a.width,u=h*a.height,"h"===o?er?(f=(t+e)/2,d=n+l+u/2):(f=(t+e)/2,d=n-l-u/2),i(p,g,f,d,h,!1)}function i(t,e,r,n,a,o){var i,l;return a<1?i="scale("+a+") ":(a=1,i=""),l=o?"rotate("+o+" "+t+" "+e+") ":"","translate("+(r-a*t)+" "+(n-a*e)+")"+i+l}function l(t,e){var r=h(t.text,e);return p(L,r)}function s(t,e){var r=h(t.textposition,e);return g(z,r)}function c(t,e,r){return d(C,t.textfont,e,r)}function u(t,e,r){return d(S,t.insidetextfont,e,r)}function f(t,e,r){return d(O,t.outsidetextfont,e,r)}function d(t,e,r,n){e=e||{};var a=h(e.family,r),o=h(e.size,r),i=h(e.color,r);return{family:p(t.family,a,n.family),size:m(t.size,o,n.size),color:v(t.color,i,n.color)}}function h(t,e){var r;return Array.isArray(t)?ea))return e}return void 0!==r?r:t.dflt}function v(t,e,r){return b(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),x=t("fast-isnumeric"),b=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),k=t("../../components/color"),M=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),L=T.text,z=T.textposition,C=T.textfont,S=T.insidetextfont,O=T.outsidetextfont,D=3;e.exports=function(t,e,r){var a=e.xaxis,o=e.yaxis,i=t._fullLayout,l=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);l.enter().append("g").attr("class","trace bars"),l.append("g").attr("class","points").each(function(e){var r=e[0].t,l=e[0].trace,s=r.poffset,c=Array.isArray(s);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,u){function f(t){return 0===i.bargap&&0===i.bargroupgap?y.round(Math.round(t)-A,2):t}function d(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)}var h,p,g,m,v=r.p+(c?s[u]:s),b=v+r.w,_=r.b,w=_+r.s;if("h"===l.orientation?(g=o.c2p(v,!0),m=o.c2p(b,!0),h=a.c2p(_,!0),p=a.c2p(w,!0)):(h=a.c2p(v,!0),p=a.c2p(b,!0),g=o.c2p(_,!0),m=o.c2p(w,!0)), -!(x(h)&&x(p)&&x(g)&&x(m)&&h!==p&&g!==m))return void y.select(this).remove();var M=(r.mlw+1||l.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(M/2%1,2);if(!t._context.staticPlot){var T=k.opacity(r.mc||l.marker.color),L=T<1||M>.01?f:d;h=L(h,p),p=L(p,h),g=L(g,m),m=L(m,g)}var z=y.select(this);z.append("path").attr("d","M"+h+","+g+"V"+m+"H"+p+"V"+g+"Z"),n(t,z,e,u,h,p,g,m)})}),l.call(A.plot,e)}},{"../../components/color":32,"../../components/drawing":56,"../../components/errorbars":62,"../../lib":143,"../../lib/svg_text_utils":160,"./attributes":231,d3:14,"fast-isnumeric":17,tinycolor2:20}],239:[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;cc+l||!y(s))&&(f=!0,d(u,t))}for(var a=r.traces,o=v(e),i="fraction"===t._fullLayout.barnorm?1:100,l=i/1e9,s=e.l2c(e.c2l(0)),c="stack"===t._fullLayout.barmode?i:s,u=[s,c],f=!1,h=0;h1||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":32,"../../components/drawing":56,"../../components/errorbars":62,d3:14}],242:[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":32,"../../components/colorscale/defaults":41,"../../components/colorscale/has_colorscale":45}],243:[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"},xcalendar:n.xcalendar,ycalendar:n.ycalendar,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":31,"../../lib/extend":139,"../scatter/attributes":313}],244:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,i,l,s,c,u,f,d,h,p=o.getFromId(t,e.xaxis||"x"),g=o.getFromId(t,e.yaxis||"y"),m=e.orientation,v=[];"h"===m?(r=p,i="x",c=g,u="y"):(r=g,i="y",c=p,u="x"),l=r.makeCalcdata(e,i),o.expand(r,l,{padded:!0}),f=function(t,e,r,o,i){var l;return r in e?f=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,0,e[r+"calendar"]),f=i.map(function(){return l})),f}(t,e,u,c,l);var y=a.distinctVals(f);return d=y.vals,h=y.minDiff/2,s=function(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,g=r.dPos*(1-u.boxgap)*(1-u.boxgroupgap)/(p?t.numboxes:1),m=p?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-u.boxgap):0,v=g*h.whiskerwidth;if(h.visible!==!0||r.emptybox)return void o.select(this).remove();"h"===h.orientation?(s=d,c=f):(s=f,c=d),r.bPos=m,r.bdPos=g,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+m,!0),r=s.c2p(t.pos+m-g,!0),n=s.c2p(t.pos+m+g,!0),a=s.c2p(t.pos+m-v,!0),l=s.c2p(t.pos+m+v,!0),u=c.c2p(t.q1,!0),f=c.c2p(t.q3,!0),d=i.constrain(c.c2p(t.med,!0),Math.min(u,f)+1,Math.max(u,f)-1),p=c.c2p(h.boxpoints===!1?t.min:t.lf,!0),y=c.c2p(h.boxpoints===!1?t.max:t.uf,!0);"h"===h.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+f+"V"+r+"ZM"+u+","+e+"H"+p+"M"+f+","+e+"H"+y+(0===h.whiskerwidth?"":"M"+p+","+a+"V"+l+"M"+y+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+u+"H"+n+"V"+f+"H"+r+"ZM"+e+","+u+"V"+p+"M"+e+","+f+"V"+y+(0===h.whiskerwidth?"":"M"+a+","+p+"H"+l+"M"+a+","+y+"H"+l))}),h.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=h}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,c,u="all"===h.boxpoints?t.val:t.val.filter(function(e){return et.uf}),f=Math.max((t.max-t.min)/10,t.q3-t.q1),d=1e-9*f,p=.01*f,v=[],y=0;if(h.jitter){if(0===f)for(y=1,v=new Array(u.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,f,d),h.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+m,!0),r=s.c2p(t.pos+m-g,!0),n=s.c2p(t.pos+m+g,!0),a=c.c2p(t.mean,!0),i=c.c2p(t.mean-t.sd,!0),l=c.c2p(t.mean+t.sd,!0);"h"===h.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==h.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==h.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z"))})})}},{"../../components/drawing":56,"../../lib":143,d3:14}],251:[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;il.end&&(l.start=l.end=(l.start+l.end)/2),e._input.contours||(e._input.contours={}),o(e._input.contours,{start:l.start,end:l.end,size:l.size}),e._input.autocontour=!0}else{var c=l.start,u=l.end,f=e._input.contours;if(c>u&&(l.start=f.start=u,u=l.end=f.end=c,c=l.start),!(l.size>0)){var d;d=c===u?1:n(c,u,e.ncontours).dtick,f.size=l.size=d}}return r}},{"../../lib":143,"../../plots/cartesian/axes":178,"../heatmap/calc":269}],255:[function(t,e,r){"use strict";var n=t("../../plots/plots"),a=t("../../components/colorbar/draw"),o=t("./make_color_map"),i=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,l="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void n.autoMargin(t,l);var s=a(t,l);e[0].t.cb=s;var c=r.contours,u=r.line,f=c.size||1,d=c.coloring,h=o(r,{isColorbar:!0});"heatmap"===d&&s.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),s.fillcolor("fill"===d||"heatmap"===d?h:"").line({color:"lines"===d?h:u.color,width:c.showlines!==!1?u.width:0,dash:u.dash}).levels({start:c.start,end:i(c),size:f}).options(r.colorbar)()}},{"../../components/colorbar/draw":35,"../../plots/plots":206,"./end_plus":259,"./make_color_map":263}],256:[function(t,e,r){"use strict";e.exports.BOTTOMSTART=[1,9,13,104,713],e.exports.TOPSTART=[4,6,7,104,713],e.exports.LEFTSTART=[8,12,14,208,1114],e.exports.RIGHTSTART=[2,3,11,208,1114],e.exports.NEWDELTA=[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],e.exports.CHOOSESADDLE={104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},e.exports.SADDLEREMAINDER={1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11}},{}],257:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){var o,i=n.coerce2(t,e,a,"contours.start"),l=n.coerce2(t,e,a,"contours.end"),s=i===!1||l===!1,c=r("contours.size");!(o=s?e.autocontour=!0:r("autocontour",!1))&&c||r("ncontours")}},{"../../lib":143,"./attributes":253}],258:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/has_columns"),o=t("../heatmap/xyz_defaults"),i=t("./contours_defaults"),l=t("./style_defaults"),s=t("./attributes");e.exports=function(t,e,r,c){function u(r,a){return n.coerce(t,e,s,r,a)}if(!o(t,e,u,c))return void(e.visible=!1);u("text"),u("connectgaps",a(e)),i(t,e,u),l(t,e,u,c)}},{"../../lib":143,"../heatmap/has_columns":275,"../heatmap/xyz_defaults":283,"./attributes":253,"./contours_defaults":257,"./style_defaults":267}],259:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],260:[function(t,e,r){"use strict";function n(t,e,r,n){return Math.abs(t[0]-e[0])20?(g=c.CHOOSESADDLE[g][(m[0]||m[1])<0?0:1],t.crossings[p]=c.SADDLEREMAINDER[g]):delete t.crossings[p],!(m=c.NEWDELTA[g])){s.log("Found bad marching index:",g,e,t.level);break}v.push(l(t,e,m)),e[0]+=m[0],e[1]+=m[1],n(v[v.length-1],v[v.length-2],o,u)&&v.pop(),p=e.join(",");var _=m[0]&&(e[0]<0||e[0]>b-2)||m[1]&&(e[1]<0||e[1]>x-2);if(p===h&&m.join(",")===y||r&&_)break;g=t.crossings[p]}1e4===d&&s.log("Infinite loop in contour?");var w,k,M,A,T,L,z,C=n(v[0],v[v.length-1],o,u),S=0,O=.2*t.smoothing,D=[],P=0;for(d=1;d=P;d--)if((w=D[d])=P&&w+D[k]20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:c.BOTTOMSTART.indexOf(t)!==-1?a=1:c.LEFTSTART.indexOf(t)!==-1?n=1:c.TOPSTART.indexOf(t)!==-1?a=-1:n=-1,[n,a]}function l(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)]}var s=t("../../lib"),c=t("./constants");e.exports=function(t,e,r){var n,a,i,l,c;for(e=e||.01,r=r||.01,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){return t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208}return 15===r?0:r}var a=t("./constants");e.exports=function(t){var e,r,o,i,l,s,c,u,f,d=t[0].z,h=d.length,p=d[0].length,g=2===h||2===p;for(r=0;r1e3){h.warn("Too many contours, clipping at 1000",t);break}return a}function o(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 i(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 l(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=s(t,r);e?d.select(this).attr("d",e).style("stroke","none"):d.select(this).remove()})}function s(t,e){function r(t){return Math.abs(t[0]-e[2][0])<.01}for(var n,a,o,i,l,s,c=Math.min(t.z[0][0],t.z[0][1]),u=t.edgepaths.length||c<=t.level?"":"M"+e.join("L")+"Z",f=0,d=t.edgepaths.map(function(t,e){return e}),g=!0;d.length;){for(s=p.smoothopen(t.edgepaths[f],t.smoothing),u+=g?s:s.replace(/^M/,"L"),d.splice(d.indexOf(f),1),n=t.edgepaths[f][t.edgepaths[f].length-1],i=-1,o=0;o<4;o++){if(!n){h.log("Missing end?",f,t);break}for(!function(t){return Math.abs(t[1]-e[0][1])<.01}(n)||r(n)?!function(t){return Math.abs(t[0]-e[0][0])<.01}(n)?!function(t){return Math.abs(t[1]-e[2][1])<.01}(n)?r(n)&&(a=e[2]):a=e[3]:a=e[0]:a=e[1],l=0;l=0&&(a=m,i=l):Math.abs(n[1]-a[1])<.01?Math.abs(n[1]-m[1])<.01&&(m[0]-n[0])*(a[0]-m[0])>=0&&(a=m,i=l):h.log("endpt to newendpt is not vert. or horz.",n,a,m)}if(n=a,i>=0)break;u+="L"+a}if(i===t.edgepaths.length){h.log("unclosed perimeter path");break}f=i,g=d.indexOf(f)===-1,g&&(f=d[0],u+="Z")}for(f=0;fO){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=u(_),I="scaled"===e.xtype?"":g,N=p(e,I,m,v,E,k),R="scaled"===e.ytype?"":y,F=p(e,R,x,b,_.length,M);L||(o.expand(k,N),o.expand(M,F));var j={x:N,y:F,z:_,text:e.text};if(l(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};j.xfill=p(B,I,m,v,E,k),j.yfill=p(B,R,x,b,_.length,M)}return[j]}},{"../../components/colorscale/calc":38,"../../lib":143,"../../plots/cartesian/axes":178,"../../registry":221,"../histogram2d/calc":294,"./clean_2d_array":270,"./convert_column_xyz":272,"./find_empties":274,"./has_columns":275,"./interp2d":278,"./make_bound_array":279,"./max_row_length":280}],270:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,a,o,i,l,s;if(e){for(r=0,l=0;l=0;i--)o=d[i],r=o[0],a=o[1],(l=((f[[r-1,a]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(s[o]=[r,a,l],d.splice(i,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(o in s)f[o]=s[o],u.push(s[o])}return u.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":280}],275:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],276:[function(t,e,r){"use strict";var n=t("../../components/fx"),a=t("../../lib"),o=n.constants.MAXDIST;e.exports=function(t,e,r,i,l){if(!(t.distance=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;wg&&(v=Math.max(v,Math.abs(t[a][o]-p)/(m-g))))}return v}var o=t("../../lib"),i=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var i,l,s=1;if(Array.isArray(r))for(i=0;i.01;i++)s=a(t,e,n(s));return s>.01&&o.log("interp2d didn't converge quickly",s),t}},{"../../lib":143}],279:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,a,o,i){var l,s,c,u=[],f=n.traceIs(t,"contour"),d=n.traceIs(t,"histogram"),h=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!d&&"category"!==i.type){var p=e.length;if(!(p<=o))return f?e.slice(0,o):e.slice(0,o+1);if(f||h)u=e.slice(0,o);else if(1===o)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],c=1;c0;)x=p.c2p(A[k]),k--;for(x0;)w=g.c2p(T[k]),k--;if(w<_&&(b=_,_=w,w=b,D=!0),L&&(A=r[0].xfill,T=r[0].yfill),"fast"!==z){var P="best"===z?0:.5;y=Math.max(-P*p._length,y),x=Math.min((1+P)*p._length,x),_=Math.max(-P*g._length,_),w=Math.min((1+P)*g._length,w)}var E=Math.round(x-y),I=Math.round(w-_),N=E<=0||I<=0,R=e.plot.select(".imagelayer").selectAll("g.hm."+v).data(N?[]:[0]);if(R.enter().append("g").classed("hm",!0).classed(v,!0),R.exit().remove(),!N){var F,j;"fast"===z?(F=S,j=C):(F=E,j=I);var B=document.createElement("canvas");B.width=F,B.height=j;var q,H,V=B.getContext("2d"),U=l.makeColorScaleFunc(l.extractScale(d.colorscale,d.zmin,d.zmax),{noNumericCheck:!0,returnArray:!0});"fast"===z?(q=O?function(t){return S-1-t}:i.identity,H=D?function(t){return C-1-t}:i.identity):(q=function(t){return i.constrain(Math.round(p.c2p(A[t])-y),0,E)},H=function(t){return i.constrain(Math.round(g.c2p(T[t])-_),0,I)});var X,Z,G,Y,W,$,Q,J=H(0),K=[J,J],tt=O?0:1,et=D?0:1,rt=0,nt=0,at=0,ot=0;if(z){var it,lt=0;try{it=new Uint8Array(E*I*4)}catch(t){it=new Array(E*I*4)}if("best"===z){var st,ct,ut,ft=new Array(A.length),dt=new Array(T.length),ht=new Array(E);for(k=0;k0&&o0&&l0&&(n=!0);for(var l=0;lo){var i=o-r[t];return r[t]=o,i}}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;o--)a(o);else if("increasing"===e){for(o=1;o=0;o--)t[o]+=t[o+1];"exclude"===r&&(t.push(0),t.shift())}}var a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/cartesian/axes"),l=t("../bar/arrays_to_calcdata"),s=t("./bin_functions"),c=t("./norm_functions"),u=t("./average"),f=t("./clean_bins");e.exports=function(t,e){if(e.visible===!0){var r,d=[],h=[],p=i.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),g="h"===e.orientation?"y":"x",m={x:"y",y:"x"}[g],v=e[g+"calendar"],y=e.cumulative;f(e,p,g);var x,b=p.makeCalcdata(e,g),_=g+"bins";e["autobin"+g]===!1&&_ in e?x=e[_]:(x=i.autoBin(b,p,e["nbins"+g],!1,v),y.enabled&&"include"!==y.currentbin&&("decreasing"===y.direction?x.start=p.c2r(p.r2c(x.start)-x.size):x.end=p.c2r(p.r2c(x.end)+x.size)),e._input[_]=e[_]=x);var w,k,M,A="string"==typeof x.size,T=A?[]:x,L=[],z=[],C=0,S=e.histnorm,O=e.histfunc,D=S.indexOf("density")!==-1;y.enabled&&D&&(S=S.replace(/ ?density$/,""),D=!1);var P,E="max"===O||"min"===O,I=E?null:0,N=s.count,R=c[S],F=!1,j=function(t){return p.r2c(t,0,v)};for(Array.isArray(e[m])&&"count"!==O&&(P=e[m],F="avg"===O,N=s[O]),r=j(x.start),k=j(x.end)+(r-i.tickIncrement(r,x.size,!1,v))/1e6;r=0&&MV;r--)if(h[r]){U=r;break}for(r=V;r<=U;r++)a(d[r])&&a(h[r])&&H.push({p:d[r],s:h[r],b:0});return l(H,e),H}}},{"../../lib":143,"../../plots/cartesian/axes":178,"../bar/arrays_to_calcdata":230,"./average":285,"./bin_functions":287,"./clean_bins":289,"./norm_functions":292,"fast-isnumeric":17}],289:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical"),i=o.ONEDAY,l=o.BADNUM;e.exports=function(t,e,r){var o=e.type,s=r+"bins",c=t[s];c||(c=t[s]={});var u="date"===o?function(t){return t||0===t?a(t,l,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=u(c.start),c.end=u(c.end);var f="date"===o?i:1,d=c.size;if(n(d))c.size=d>0?Number(d):f;else if("string"!=typeof d)c.size=f;else{var h=d.charAt(0),p=d.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==o||"M"!==h||p!==Math.round(p))&&(c.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((c.start||0===c.start)&&(c.end||0===c.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":129,"../../lib":143,"fast-isnumeric":17}],290:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("../../components/color"),i=t("./bin_defaults"),l=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function f(r,n){return a.coerce(t,e,c,r,n)}var d=f("x"),h=f("y");f("cumulative.enabled")&&(f("cumulative.direction"),f("cumulative.currentbin")),f("text");var p=f("orientation",h&&!d?"h":"v"),g=e["v"===p?"x":"y"];if(!g||!g.length)return void(e.visible=!1);n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],u),e["h"===p?"x":"y"]&&f("histfunc"),i(t,e,f,"h"===p?["y"]:["x"]),l(t,e,f,r,u),s(t,e,o.defaultLine,{axis:"y"}),s(t,e,o.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":32,"../../components/errorbars/defaults":61,"../../lib":143,"../../registry":221,"../bar/style_defaults":242,"./attributes":284,"./bin_defaults":286}],291:[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":188,"../bar/hover":234,"../bar/layout_attributes":236,"../bar/layout_defaults":237,"../bar/plot":238,"../bar/set_positions":239,"../bar/style":241,"../scatter/colorbar":316,"./attributes":284,"./calc":288,"./defaults":290}],292:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;aM&&g.splice(M,g.length-M),v.length>M&&v.splice(M,v.length-M),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(a.tickIncrement(b(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(a.tickIncrement(b(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d",x),"histogram2dcontour"===e.type&&(e.ybins.start=k(a.tickIncrement(_(e.ybins.start),e.ybins.size,!0,x)),e.ybins.end=k(a.tickIncrement(_(e.ybins.end),e.ybins.size,!1,x))),e._input.ybins=e.ybins),d=[];var A,T,L=[],z=[],C="string"==typeof e.xbins.size,S="string"==typeof e.ybins.size,O=C?[]:e.xbins,D=S?[]:e.ybins,P=0,E=[],I=e.histnorm,N=e.histfunc,R=I.indexOf("density")!==-1,F="max"===N||"min"===N,j=F?null:0,B=o.count,q=i[I],H=!1,V=[],U=[],X="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";X&&"count"!==N&&(H="avg"===N,B=o[N]);var Z=e.xbins,G=b(Z.start),Y=b(Z.end)+(G-a.tickIncrement(G,Z.size,!1,y))/1e6;for(h=G;h=0&&A=0&&T")}return g};var s},{"../../components/color":32,"./helpers":305,"fast-isnumeric":17,tinycolor2:20}],304:[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")),i("marker.line.width")&&i("marker.line.color");var u=i("marker.colors");Array.isArray(u)||(e.marker.colors=[]),i("scalegroup");var f=i("text"),d=i("textinfo",Array.isArray(f)?"text+percent":"percent");if(i("hovertext"),i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var h=i("textposition"),p=Array.isArray(h)||"auto"===h,g=p||"inside"===h,m=p||"outside"===h;if(g||m){var v=l(i,"textfont",o.font);g&&l(i,"insidetextfont",v),m&&l(i,"outsidetextfont",v)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":143,"./attributes":301}],305:[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":143}],306:[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":301,"./base_plot":302,"./calc":303,"./defaults":304,"./layout_attributes":307,"./layout_defaults":308,"./plot":309,"./style":310,"./style_one":311}],307:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],308:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){!function(r,o){n.coerce(t,e,a,r,o)}("hiddenlabels")}},{"../../lib":143,"./layout_attributes":307}],309:[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]}var a,o,i,l,s,c,u,f,d,h,p,g,m;for(o=0;o<2;o++)for(i=o?r:n,s=o?Math.max:Math.min,u=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(i),d=t[1-o][a],h=d.concat(f),g=[],p=0;p0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[i.i]||((t.pxmid[1]-i.pxmid[1])*u>0?(f=i.cyFinal+s(i.px0[1],i.px1[1]),(x=f-m-t.labelExtraY)*u>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*u>0&&(n=3*c*Math.abs(a-h.indexOf(t)),d=i.cxFinal+l(i.px0[0],i.px1[0]),(p=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*c>0&&(t.labelExtraX+=p)))}(g[p],v)}}}function l(t,e){var r,n,a,o,i,l,s,u,f,d,h=[];for(a=0;au&&(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("../../components/fx"),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=(m.depth||0)*c.r*Math.sin(0)/2,y=m.tiltaxis||0,x=y*Math.PI/180,b=[v*Math.sin(x),v*Math.cos(x)],_=c.r*Math.cos(0),w=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function i(n){n.originalEvent=u.event;var o=t._fullLayout,i=t._fullData[m.index],l=i.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),t._dragging||o.hovermode===!1||"none"===l||"skip"===l||!l)return void f.hover(t,n,"pie");var s=a(e,c),d=w+e.pxmid[0]*(1-s),h=k+e.pxmid[1]*(1-s),p=r.separators,v=[];l.indexOf("label")!==-1&&v.push(e.label),l.indexOf("text")!==-1&&(i.hovertext?v.push(Array.isArray(i.hovertext)?i.hovertext[e.i]:i.hovertext):i.text&&i.text[e.i]&&v.push(i.text[e.i])),l.indexOf("value")!==-1&&v.push(g.formatPieValue(e.v,p)),l.indexOf("percent")!==-1&&v.push(g.formatPiePercent(e.v/c.vTotal,p));var y=i.hoverlabel;f.loneHover({x0:d-s*c.r,x1:d+s*c.r,y:h,text:v.join("
"),name:l.indexOf("name")!==-1?i.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:e.hbg||y.bgcolor||e.color,borderColor:e.hbc||y.bordercolor,fontFamily:e.htf||y.font.family,fontSize:e.hts||y.font.size,fontColor:e.htc||y.font.color},{container:o._hoverlayer.node(),outerContainer:o._paper.node()}),f.hover(t,n,"pie"),T=!0}function l(e){e.originalEvent=u.event,t.emit("plotly_unhover",{event:u.event,points:[e]}),T&&(f.loneUnhover(r._hoverlayer.node()),T=!1)}function d(){t._hoverdata=[e],t._hoverdata.trace=c.trace,f.click(t,u.event)}function x(t,r,n,a){return"a"+a*c.r+","+a*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-t[0])+","+a*(r[1]-t[1])}if(e.hidden)return void u.select(this).selectAll("path,g").remove();s[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=c.cx+b[0],k=c.cy+b[1],M=u.select(this),A=M.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),M.select("path.textline").remove(),M.on("mouseover",i).on("mouseout",l).on("click",d),m.pull){var L=+(Array.isArray(m.pull)?m.pull[e.i]:m.pull)||0;L>0&&(w+=L*e.pxmid[0],k+=L*e.pxmid[1])}e.cxFinal=w,e.cyFinal=k;var z=m.hole;if(e.v===c.vTotal){var C="M"+(w+e.px0[0])+","+(k+e.px0[1])+x(e.px0,e.pxmid,!0,1)+x(e.pxmid,e.px0,!0,1)+"Z";z?A.attr("d","M"+(w+z*e.px0[0])+","+(k+z*e.px0[1])+x(e.px0,e.pxmid,!1,z)+x(e.pxmid,e.px0,!1,z)+"Z"+C):A.attr("d",C)}else{var S=x(e.px0,e.px1,!0,1);if(z){var O=1-z;A.attr("d","M"+(w+z*e.px1[0])+","+(k+z*e.px1[1])+x(e.px1,e.px0,!1,z)+"l"+O*e.px0[0]+","+O*e.px0[1]+S+"Z")}else A.attr("d","M"+w+","+k+"l"+e.px0[0]+","+e.px0[1]+S+"Z")}var D=Array.isArray(m.textposition)?m.textposition[e.i]:m.textposition,P=M.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]);P.enter().append("g").classed("slicetext",!0),P.exit().remove(),P.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(e.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 r,a=h.bBox(t.node());"outside"===D?r=o(a,e):(r=n(a,e,c),"auto"===D&&r.scale<1&&(t.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),a=h.bBox(t.node())),r=o(a,e)));var i=w+e.pxmid[0]*r.rCenter+(r.x||0),l=k+e.pxmid[1]*r.rCenter+(r.y||0);r.outside&&(e.yLabelMin=l-a.height/2,e.yLabelMid=l,e.yLabelMax=l+a.height/2,e.labelExtraX=0,e.labelExtraY=0,v=!0),t.attr("transform","translate("+i+","+l+")"+(r.scale<1?"scale("+r.scale+")":"")+(r.rotate?"rotate("+r.rotate+")":"")+"translate("+-(a.left+a.right)/2+","+-(a.top+a.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]);Math.abs(l)>Math.abs(s)?o+="l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):o+="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":32,"../../components/drawing":56,"../../components/fx":73,"../../lib/svg_text_utils":160,"./helpers":305,d3:14}],310:[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":311,d3:14}],311:[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}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":32}],312:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var m={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,c=r.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},m.ppad=v.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,a.expand(f,h,m),a.expand(d,p,v);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],316:[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":35,"../../components/colorscale":46,"../../lib":143,"../../plots/plots":206,"fast-isnumeric":17}],317:[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":38,"../../components/colorscale/has_colorscale":45,"./subtypes":333}],318:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],319:[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,p,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),F=Math.max(F,C));R=Math.max(R,0),F=Math.min(F,d._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:s+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":32,"../../components/errorbars":62,"../../components/fx":73,"../../lib":143,"./get_trace_color":321}],323:[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":188,"./arrays_to_calcdata":312,"./attributes":313,"./calc":314,"./clean_data":315,"./colorbar":316,"./defaults":319,"./hover":322,"./plot":330,"./select":331,"./style":332,"./subtypes":333}],324:[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,l){var s=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||r)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":41,"../../components/colorscale/has_colorscale":45}],325:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var o,i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=.2,C=new Array(t.length),S=0;for(k||(A=z=-1),o=0;oa(u))break;l=u,v=p[0]*h[0]+p[1]*h[1],v>g?(g=v,s=u,d=!1):v=t.length||!u)break;C[S++]=u,i=u}}else C[S++]=s}L.push(C.slice(0,S))}return L}},{"../../constants/numerical":129}],326:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],327:[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}],329:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(r=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?n.background:n.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":32,"../../components/colorscale/defaults":41,"../../components/colorscale/has_colorscale":45,"./subtypes":333}],330:[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,d,p){function g(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function x(){return!1}function b(e){var r,n,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,v=x;f&&(p=o.marker.maxdisplayed||o._needsCull?m:l.identity),d&&(v=o.marker.maxdisplayed||o._needsCull?m:l.identity),n=c.selectAll("path.point"),r=n.data(p,h);var b=r.enter().append("path").classed("point",!0);b.call(s.pointStyle,o).call(s.translatePoints,M,A,o),k&&b.style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");r.each(function(e){var r=i.select(this),n=g(r);(a=s.translatePoint(e,n,M,A))&&(s.singlePointStyle(e,n,o,_,w,t),o.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),k?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=c.selectAll("g"),r=n.data(v,h),r.enter().append("g").classed("textpoint",!0).append("text"),r.each(function(t){var e=i.select(this),r=g(e.select("text"));(a=s.translatePoint(t,r,M,A))||e.remove()}),r.selectAll("text").call(s.textPointStyle,o).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;o(t,e,r,n,a);var k=!!p&&p.duration>0,M=r.xaxis,A=r.yaxis,T=n[0].trace,L=T.line,z=i.select(d);if(z.call(c.plot,r,p),T.visible===!0){g(z).style("opacity",T.opacity);var C,S,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=z;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",S=E._nextFill,P=E._polygons);var I,N,R,F,j,B,q,H,V,U="",X="",Z=[],G=[],Y=l.noop;if(C=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(S&&S.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(R=s.steps(L.shape),F=s.steps(L.shape.split("").reverse().join(""))):R=F="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return F(t.reverse())},Z=f(n,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(Z.length),w=0;w1}), -Y=function(t){return function(e){if(I=R(e),N=j(e),U?O?(U+="L"+I.substr(1),X=N+"L"+X.substr(1)):(U+="Z"+I,X=N+"Z"+X):(U=I,X=N),u.hasLines(T)&&e.length>1){var r=i.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",I).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",I),s.singleLineStyle(n,a)}}}}}var W=z.selectAll(".js-line").data(G);g(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Y(!0)),Z.length&&(C?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(C).attr("d","M"+H+"L"+B+"L"+U.substr(1))):g(C).attr("d",U+"Z")):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(S).attr("d",U+"Z"+D+"Z"):g(S).attr("d",U+"L"+D.substr(1)+"Z"),T._polygons=T._polygons.concat(P)),T._prevRevpath=X,T._prevPolygons=V);var $=z.selectAll(".points");_=$.data([n]),$.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,s=r.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=n[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=n.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),m=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),d(t,e,r),n(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),m){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":56,"../../components/errorbars":62,"../../lib":143,"../../lib/polygon":153,"./line_points":325,"./link_traces":327,"./subtypes":333,d3:14}],331:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.index,h=f.marker,p=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!p){var g=Array.isArray(h.opacity)?1:h.opacity;if(e===!1)for(r=0;rM&&L.splice(M,L.length-M)}return i(e),l(A,e),A}},{"../../plots/cartesian/axes":178,"../scatter/arrays_to_calcdata":312,"../scatter/colorscale_calc":317,"../scatter/subtypes":333,"fast-isnumeric":17}],338:[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":178,"../scatter/hover":322}],340:[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":214,"../scatter/colorbar":316,"./attributes":336,"./calc":337,"./defaults":338,"./hover":339,"./plot":341,"./select":342,"./style":343}],341:[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=0;oe?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=$),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 $(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 Q(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?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)*Ji,n=mt(n)*Ki,o=mt(o)*tl,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)*Ui,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=nl.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)/Ji),a=vt((.2126729*t+.7151522*e+.072175*r)/Ki);return ht(116*a-16,500*(n-a),200*(a-vt((.0193339*t+.119192*e+.9503041*r)/tl)))}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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Nt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=al,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=ul.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=fl.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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=C[i in gl?e.charAt(l++):i])||(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{hl=qt;var e=new hl;return e._=t,n(e)}finally{hl=Date}}var n=e(t);return r.parse=function(t){try{hl=qt;var e=n.parse(t);return e&&e._}finally{hl=Date}},r.toString=n.toString,r},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 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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(dl.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"%"}},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:$t,x:s,X:c,y:Jt,Y:Qt,Z:Kt,"%":ce};return e}function Gt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o68?1900:2e3)}function ee(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){ml.lastIndex=0;var n=ml.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){ml.lastIndex=0;var n=ml.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+Gt(n,"0",2)+Gt(a,"0",2)}function ce(t,e,r){vl.lastIndex=0;var n=vl.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);kl.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Ml.point=function(i,l){Ml.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Ml.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 qe(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(kl.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?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);be(p,_e(l,d));var g=h,m=ye(p,g),v=ye(g,g),y=m*m-v*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-m-x)/v);if(be(b,p),b=ke(b),!r)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)ji^(w<=b[0]&&b[0]<=k)){var C=_e(g,(-m+x)/v);return be(C,p),[b,ke(C)]}}}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;return Ne(e,r,mr(t,6*Vi),i?[0,-t]:[-ji,t-ji])}function Ue(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 Ge(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(-Fl,Math.min(Fl,t)),e=Math.max(-Fl,Math.min(Fl,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=Ue(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 Xe(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 Ze(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){Bl+=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){tVl&&(Vl=t),eUl&&(Ul=e)}function $e(){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=Qe(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=Qe(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function Qe(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){Ll+=t,zl+=e,++Cl}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);Sl+=i*(e+t)/2,Ol+=i*(r+n)/2,Dl+=i,Je(e=t,r=n)}var e,r;Zl.point=function(n,a){Zl.point=t,Je(e=n,r=a)}}function tr(){Zl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);Sl+=i*(n+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-n*e,Pl+=i*(n+t),El+=i*(a+e),Nl+=3*i,Je(n=t,a=e)}var e,r,n,a;Zl.point=function(o,i){Zl.point=t,Je(e=n=o,r=a=i)},Zl.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*Ui,r*Ui])});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[0]*Ui,t[1]*Ui]}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,_=Rl,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,Rl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ge(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*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,n()):[v*Ui,y*Ui,x*Ui]},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-Bi:t<-ji?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>ji?e-Bi:e<-ji?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(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 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 Fr(t){var e=ls.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),as.remove(t),ls.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];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(!((a=o-Vr(l,i))>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(as.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),as.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 Ur(t){this.site=t,this.edges=[]}function Gr(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=ns,m=g.length;m--;)if((o=g[m])&&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=ss.pop()||new Zr;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=is._;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=fs.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 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 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(Un(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Un(r)+"rotate("+e+")")}function Zn(t,e,r,n){t!==e?n.push({i:r.push(Un(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Un(r)+"skewX("+e+")")}function Yn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Un(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(Un(r)+"scale("+e+")")}function Wn(t,e){var r=[],n=[];return t=ui.transform(t),e=ui.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Zn(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 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 Ua(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 Ga(t){var e=t[0],r=t[t.length-1];return e2?$a:Za,s=n?Qn:$n;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 Qa(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=Ga(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=ul.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 ks?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:As);return t.domain(e),n=e.map(o),i},i.ticks=function(){var t=Ga(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 Ms;arguments.length<2?r=Ms:"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($s,a);return o==$s.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/$s[o-1]<$s[o]/a?o-1:o]:[Ks,to(t,r)[2]]}return n.invert=function(e){return li(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(li)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,li(+r+1),e).length}var o=n.domain(),i=Ga(o),l=null==t?a(i,10):"number"==typeof t&&a(i,t);return l&&(t=l[0],e=l[1]),n.domain(Ya(o,e>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=Ga(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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=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=U.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=Q(a);Bs.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);Bs.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,fl=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))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});dl[t+"s"]=r.range,dl[t+"s"].utc=r.utc.range,dl[t+"OfYear"]=function(t){var r=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},ml=/^\s*\d+/,vl=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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]*Ui*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;Ml.point(t,r),e(t,r)}function o(){Ml.lineStart()}function i(){a(g,m),Ml.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){Al=Tl=Ll=zl=Cl=Sl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,Il);var e=Pl,r=El,n=Nl,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 jl,Bl,ql,Hl,Vl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Gl.lineStart=Ye},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,jl+=bi(Bl/2)}},Xl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Zl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Zl.lineStart=er},polygonEnd:function(){Zl.point=Je,Zl.lineStart=Ke,Zl.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 jl=0,ui.geo.stream(t,a(Gl)),jl},t.centroid=function(t){return Ll=zl=Cl=Sl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,a(Zl)),Nl?[Pl/Nl,El/Nl]:Dl?[Sl/Dl,Ol/Dl]:Cl?[Ll/Cl,zl/Cl]:[NaN,NaN]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Xl)),[[ql,Hl],[Vl,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 $e: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]*=Ui,e[1]*=Ui,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]*=Ui,e[1]*=Ui,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]*=Ui,t[1]*=Ui}}),{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 Yl=0,ui.geo.stream(t,Wl),Yl};var Yl,Wl={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},$l=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr($l)}).raw=$l;var Ql=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Ql)}).raw=Ql,(ui.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Jl=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(Jl)}).raw=Jl,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return zr(Lr)}).raw=Lr;var Kl=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(Kl)}).raw=Kl;var ts=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(ts)}).raw=ts,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]]:[]).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=cs;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=r.site,i=r.edges.sort(Xr),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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=hs.get(r)||ds,n=ps.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 Bn(r?r.matrix:gs)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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&&!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=ja(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===Ss?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=Go,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=Xo;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=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Zo(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Ns.get(e.call(this,t,n))||$o)(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 Ns=ui.map({circle:$o,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*Rs)),r=e*Rs;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/Is),r=e*Is/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),r=e*Is/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Ns.keys();var Is=Math.sqrt(3),Rs=Math.tan(30*Vi);Ci.transition=function(t){for(var e,r,n=Fs||++Hs,a=ei(t),o=[],i=js||{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){return 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(0===(t=+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=L(t,360),e=L(e,100),r=L(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=L(t,255),e=L(e,255),r=L(r,255);var n,a,o=U(t,e,r),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){S(t)&&(t="100%");var n=O(t);return t=V(r,U(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function z(t){return V(1,U(0,t))}function C(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function N(t){return C(t)/255}function I(t){return!!Y.CSS_UNIT.exec(t)}function R(t){t=t.replace(j,"").replace(B,"").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=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:N(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Y.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:N(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Y.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 j=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=e.max,G=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=T(t),this._roundA=H(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=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=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=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 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: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)&&(Z[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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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)&&(r[a]="a"===a?t[a]:P(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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100;return n({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})},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"},Z=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==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("../../plots/cartesian/axes"),o=t("./common_defaults"),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),f=c("clicktoshow");if(!u&&!f)return e;o(t,e,r,c);for(var d=e.showarrow,h=["x","y"],p=[-10,-30],g={_fullLayout:r},m=0;m<2;m++){var v=h[m],y=a.coerceRef(t,e,g,v,"","paper");if(a.coercePosition(e,g,c,y,v,.5),d){var x="a"+v,b=a.coerceRef(t,e,g,x,"pixel");"pixel"!==b&&b!==y&&(b=e[x]="pixel");var _="pixel"===b?p[m]:.4;a.coercePosition(e,g,c,b,x,_)}c(v+"anchor"),c(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),d&&n.noneOrAll(t,e,["ax","ay"]),f){var w=c("xclick"),k=c("yclick");e._xclick=void 0===w?e.x:a.cleanPosition(w,g,e.xref),e._yclick=void 0===k?e.y:a.cleanPosition(k,g,e.yref)}return e}},{"../../lib":150,"../../plots/cartesian/axes":185,"./attributes":23,"./common_defaults":26}],22:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:i({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":146,"../../plots/cartesian/constants":190,"../../plots/font_attributes":209,"./arrow_paths":22}],24:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=o.getFromId(t,e.xref),i=o.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=l+e.xshift,n=l-e.xshift,e.axref===e.xref?(o.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),o.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):o.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),i&&i.autorange&&(r=l-e.yshift,n=l+e.yshift,e.ayref===e.yref?(o.expand(i,[i.r2c(e.y)],{ppadplus:r,ppadminus:n}),o.expand(i,[i.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):o.expand(i,[i.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(o.list(t).filter(function(t){return t.autorange&&l[t._id]}).length)return a.syncOrAsync([i,n],t)}}},{"../../lib":150,"../../plots/cartesian/axes":185,"./draw":29}],25:[function(t,e,r){"use strict";function n(t,e){var r=o(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=o(t,e),a=n.on,i=n.off.concat(n.explicitOff),s={};if(a.length||i.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var l=I.selectAll("a");if(1===l.size()&&l.text()===I.text()){z.insert("a",":first-child").attr({"xlink:xlink:href":l.attr("xlink:href"),"xlink:xlink:show":l.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}var c=z.select(".annotation-text-math-group"),f=!c.empty(),p=h.bBox((f?c:I).node()),x=p.width,S=p.height,N=e.width||x,R=e.height||S,F=Math.round(N+2*O),j=Math.round(R+2*O);e._w=N,e._h=R;for(var B=!1,q=["x","y"],H=0;H1)&&($===W?((ot=Q.r2fraction(e["a"+Y]))<0||ot>1)&&(B=!0):B=!0,B))continue;V=Q._offset+Q.r2p(e[Y]),X=.5}else"x"===Y?(G=e[Y],V=w.l+w.w*G):(G=1-e[Y],V=w.t+w.h*G),X=e.showarrow?.5:G;if(e.showarrow){at.head=V;var it=e["a"+Y];Z=K*r(.5,e.xanchor)-tt*r(.5,e.yanchor),$===W?(at.tail=Q._offset+Q.r2p(it),U=Z):(at.tail=V+it,U=Z+it),at.text=at.tail+Z;var lt=_["x"===Y?"width":"height"];if("paper"===W&&(at.head=u.constrain(at.head,1,lt-1)),"pixel"===$){var st=-Math.max(at.tail-3,at.text),ct=Math.min(at.tail+3,at.text)-lt;st>0?(at.tail+=st,at.text+=st):ct>0&&(at.tail-=ct,at.text-=ct)}at.tail+=nt,at.head+=nt}else Z=et*r(X,rt),U=Z,at.text=V+Z;at.text+=nt,Z+=nt,U+=nt,e["_"+Y+"padplus"]=et/2+U,e["_"+Y+"padminus"]=et/2-U,e["_"+Y+"size"]=et,e["_"+Y+"shift"]=Z}if(B)return void z.remove();var ut=0,ft=0;if("left"!==e.align&&(ut=(N-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(R-S)*("middle"===e.valign?.5:1)),f)c.select("svg").attr({x:O+ut-1,y:O+ft}).call(h.setClipUrl,P?k:null);else{var dt=O+ft-p.top,ht=O+ut-p.left;I.call(g.positionText,ht,dt).call(h.setClipUrl,P?k:null)}E.select("rect").call(h.setRect,O,O,N,R),D.call(h.setRect,C/2,C/2,F-C,j-C),z.call(h.setTranslate,Math.round(M.x.text-F/2),Math.round(M.y.text-j/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var pt=function(r,l){T.selectAll(".annotation-arrow-g").remove();var c=M.x.head,f=M.y.head,p=M.x.tail+r,g=M.y.tail+l,m=M.x.text+r,x=M.y.text+l,_=u.rotationXYMatrix(A,m,x),k=u.apply2DTransform(_),C=u.apply2DTransform2(_),S=+D.attr("width"),O=+D.attr("height"),P=m-.5*S,E=P+S,N=x-.5*O,I=N+O,R=[[P,N,P,I],[P,I,E,I],[E,I,E,N],[E,N,P,N]].map(C);if(!R.reduce(function(t,e){return t^!!i(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=i(p,g,c,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,g=e.y)});var F=e.arrowwidth,j=e.arrowcolor,B=T.append("g").style({opacity:d.opacity(j)}).classed("annotation-arrow-g",!0),q=B.append("path").attr("d","M"+p+","+g+"L"+c+","+f).style("stroke-width",F+"px").call(d.stroke,d.rgb(j));if(y(q,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&q.node().parentNode&&!n){var H=c,V=f;if(e.standoff){var U=Math.sqrt(Math.pow(c-p,2)+Math.pow(f-g,2));H+=e.standoff*(p-c)/U,V+=e.standoff*(g-f)/U}var G,X,Z,Y=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-H)+","+(g-V),transform:"translate("+H+","+V+")"}).style("stroke-width",F+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");v.init({element:Y.node(),gd:t,prepFn:function(){var t=h.getTranslate(z);X=t.x,Z=t.y,G={},a&&a.autorange&&(G[a._name+".autorange"]=!0),o&&o.autorange&&(G[o._name+".autorange"]=!0)},moveFn:function(t,r){var n=k(X,Z),i=n[0]+t,l=n[1]+r;z.call(h.setTranslate,i,l),G[b+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/w.w,G[b+".y"]=o?o.p2r(o.r2p(e.y)+r):e.y-r/w.h,e.axref===e.xref&&(G[b+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(G[b+".ay"]=o.p2r(o.r2p(e.ay)+r)),B.attr("transform","translate("+t+","+r+")"),L.attr({transform:"rotate("+A+","+i+","+l+")"})},doneFn:function(e){if(e){s.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var gt,mt;v.init({element:z.node(),gd:t,prepFn:function(){mt=L.attr("transform"),gt={}},moveFn:function(t,r){var i="pointer";if(e.showarrow)e.axref===e.xref?gt[b+".ax"]=a.p2r(a.r2p(e.ax)+t):gt[b+".ax"]=e.ax+t,e.ayref===e.yref?gt[b+".ay"]=o.p2r(o.r2p(e.ay)+r):gt[b+".ay"]=e.ay+r,pt(t,r);else{if(n)return;if(a)gt[b+".x"]=e.x+t/a._m;else{var l=e._xsize/w.w,s=e.x+(e._xshift-e.xshift)/w.w-l/2;gt[b+".x"]=v.align(s+t/w.w,l,0,1,e.xanchor)}if(o)gt[b+".y"]=e.y+r/o._m;else{var c=e._ysize/w.h,u=e.y-(e._yshift+e.yshift)/w.h-c/2;gt[b+".y"]=v.align(u-r/w.h,c,0,1,e.yanchor)}a&&o||(i=v.getCursor(a?.5:gt[b+".x"],o?.5:gt[b+".y"],e.xanchor,e.yanchor))}L.attr({transform:"translate("+t+","+r+")"+mt}),m(z,i)},doneFn:function(e){if(m(z),e){s.relayout(t,gt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var x,b,_=t._fullLayout,w=t._fullLayout._size;n?(x="annotation-"+n,b=n+".annotations["+r+"]"):(x="annotation",b="annotations["+r+"]"),_._infolayer.selectAll("."+x+'[data-index="'+r+'"]').remove();var k="clip"+_._uid+"_ann"+r;if(!e._input||!1===e.visible)return void l.selectAll("#"+k).remove();var M={x:{},y:{}},A=+e.textangle||0,T=_._infolayer.append("g").classed(x,!0).attr("data-index",String(r)).style("opacity",e.opacity),L=T.append("g").classed("annotation-text-g",!0),z=L.append("g").style("pointer-events",e.captureevents?"all":null).call(m,"default").on("click",function(){t._dragging=!1;var a={index:r,annotation:e._input,fullAnnotation:e,event:l.event};n&&(a.subplotId=n),t.emit("plotly_clickannotation",a)});e.hovertext&&z.on("mouseover",function(){var r=e.hoverlabel,n=r.font,a=this.getBoundingClientRect(),o=t.getBoundingClientRect();p.loneHover({x0:a.left-o.left,x1:a.right-o.left,y:(a.top+a.bottom)/2-o.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var C=e.borderwidth,S=e.borderpad,O=C+S,D=z.append("rect").attr("class","bg").style("stroke-width",C+"px").call(d.stroke,e.bordercolor).call(d.fill,e.bgcolor),P=e.width||e.height,E=_._defs.select(".clips").selectAll("#"+k).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",k).append("rect"),E.exit().remove();var N=e.font,I=z.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?I.call(g.makeEditable,{delegate:z,gd:t}).call(c).on("edit",function(r){e.text=r,this.call(c);var n={};n[b+".text"]=e.text,a&&a.autorange&&(n[a._name+".autorange"]=!0),o&&o.autorange&&(n[o._name+".autorange"]=!0),s.relayout(t,n)}):I.call(c)}function i(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 l=t("d3"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../fx"),g=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),v=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:n,drawOne:a,drawRaw:o}},{"../../lib":150,"../../lib/setcursor":165,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/cartesian/axes":185,"../../plots/plots":214,"../color":38,"../dragelement":59,"../drawing":62,"../fx":79,"./draw_arrow_head":30,d3:14}],30:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(r,a){h.path&&(e>5&&(a=0),n.select(d.parentNode).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof r&&r||(r="end");var p,g,m,v,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(m=Math.atan2(A,M),v=m+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(m),L=k*Math.sin(m);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var z=d.getTotalLength(),C="";if(z1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+l+'"]').remove():(s.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(s.x)*r[0],e.yaxis.r2l(s.y)*r[1],e.zaxis.r2l(s.z)*r[2]]),n(t.graphDiv,s,l,t.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":211,"../annotations/draw":29}],36:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":32,"./convert":33,"./defaults":34,"./draw":35}],37:[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},{}],38:[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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(i.combine(t,c))),(n.isDark()?e?n.lighten(e):c:r?n.darken(r):s).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]-=(ct-l)/2):r.node()&&!r.classed("js-placeholder")&&(ct=h.bBox(r.node()).height),ct){if(ct+=5,"top"===k.titleside)et.domain[1]-=ct/z.h,o[1]*=-1;else{et.domain[0]+=ct/z.h;var c=m.lineCount(r);o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),et.setScale()}}lt.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(z.h*(1-et.domain[1]))+")");var f=lt.select(".cbfills").selectAll("rect.cbfill").data(D);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?S[0]:(D[e]+D[e-1])/2,e===D.length-1?S[1]:(D[e]+D[e+1])/2].map(et.c2p).map(Math.round);e!==D.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();n.select(this).attr({x:W,width:Math.max(H,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:i})});var d=lt.select(".cblines").selectAll("path.cbline").data(k.line.color&&k.line.width?O:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(et.c2p(t))+k.line.width/2%1)+"h"+H).call(h.lineGroupStyle,k.line.width,P(t),k.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=W+H+(k.outlinewidth||0)/2-("outside"===k.ticks?1:0),et.side="right",u.syncOrAsync([function(){return s.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(k.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,a=z.l+(et.position||0)*z.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));A("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:k.titleside,offsetLeft:z.l,offsetTop:z.t,maxShift:L.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,a=w();n=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:et,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:lt.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;lt.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,r||{}))}function T(){var r=H+k.outlinewidth/2+h.bBox(et._axislayer.node()).width;if(j=st.select("text"),j.node()&&!j.classed("js-placeholder")){var n,a=st.select(".h"+et._id+"title-math-group").node();n=a&&-1!==["top","bottom"].indexOf(k.titleside)?h.bBox(a).width:h.bBox(st.node()).right-W-z.l,r=Math.max(r,n)}var o=2*k.xpad+r+k.borderwidth+k.outlinewidth/2,l=J-K;lt.select(".cbbg").attr({x:W-k.xpad-(k.borderwidth+k.outlinewidth)/2,y:K-Z,width:Math.max(o,2),height:Math.max(l+2*Z,2)}).call(p.fill,k.bgcolor).call(p.stroke,k.bordercolor).style({"stroke-width":k.borderwidth}),lt.selectAll(".cboutline").attr({x:W,y:K+k.ypad+("top"===k.titleside?ct:0),width:Math.max(H,2),height:Math.max(l-2*k.ypad-ct,2)}).call(p.stroke,k.outlinecolor).style({fill:"None","stroke-width":k.outlinewidth});var s=({center:.5,right:1}[k.xanchor]||0)*o;lt.attr("transform","translate("+(z.l-s)+","+z.t+")"),i.autoMargin(t,e,{x:k.x,y:k.y,l:o*({right:1,center:.5}[k.xanchor]||0),r:o*({left:1,center:.5}[k.xanchor]||0),t:l*({bottom:1,middle:.5}[k.yanchor]||0),b:l*({top:1,middle:.5}[k.yanchor]||0)})}var L=t._fullLayout,z=L._size;if("function"!=typeof k.fillcolor&&"function"!=typeof k.line.color)return void L._infolayer.selectAll("g."+e).remove();var C,S=n.extent(("function"==typeof k.fillcolor?k.fillcolor:k.line.color).domain()),O=[],D=[],P="function"==typeof k.line.color?k.line.color:function(){return k.line.color},E="function"==typeof k.fillcolor?k.fillcolor:function(){return k.fillcolor},N=k.levels.end+k.levels.size/100,I=k.levels.size,R=1.001*S[0]-.001*S[1],F=1.001*S[1]-.001*S[0];for(C=k.levels.start;(C-N)*I<0;C+=I)C>R&&CS[0]&&C1){var it=Math.pow(10,Math.floor(Math.log(ot)/Math.LN10));nt*=it*u.roundUp(ot/it,[2,5,10]),(Math.abs(k.levels.start)/k.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[Q+Y,Q+G-Y],et.setScale();var lt=L._infolayer.selectAll("g."+e).data([0]);lt.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)}),lt.attr("transform","translate("+Math.round(z.l)+","+Math.round(z.t)+")");var st=lt.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(z.l)+",-"+Math.round(z.t)+")");et._axislayer=lt.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(k.titleside)){var ut,ft=z.l+(k.x+X)*z.w,dt=et.titlefont.size;ut="top"===k.titleside?(1-(Q+G-Y))*z.h+z.t+3+.75*dt:(1-(Q+Y))*z.h+z.t-3-.25*dt,A(et._id+"title",{attributes:{x:ft,y:ut,"text-anchor":"start"}})}var ht=u.syncOrAsync([i.previousPromises,M,i.previousPromises,T],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var pt,gt,mt;c.init({element:lt.node(),gd:t,prepFn:function(){pt=lt.attr("transform"),d(lt)},moveFn:function(t,e){lt.attr("transform",pt+" translate("+t+","+e+")"),gt=c.align($+t/z.w,V,0,1,k.xanchor),mt=c.align(Q-e/z.h,G,0,1,k.yanchor);var r=c.getCursor(gt,mt,k.xanchor,k.yanchor);d(lt,r)},doneFn:function(e){d(lt),e&&void 0!==gt&&void 0!==mt&&o.restyle(t,{"colorbar.x":gt,"colorbar.y":mt},w().index)}})}return ht}function w(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,s.colorscale=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":150,"./flip_scale":49,"./scales":56}],45:[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":146,"./attributes":43,"./scales.js":56}],46:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":56}],47:[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;c(f+d+"auto",!(n(m)&&n(v)&&m=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],50:[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":46,"./is_valid_scale_array":54,"./scales":56}],51:[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}},{}],58:[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":150}],59:[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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return g._dragged=!1,g._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m,e),!g._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g=t.gd,m=1,v=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=n},{"../../constants/interactions":135,"../../lib":150,"../../plotly":180,"../../plots/cartesian/constants":190,"./align":57,"./cursor":58,"./unhover":60}],60:[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,a=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":145}],61:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],62:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i,l){if(c.traceIs(r,"symbols")){var s=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:v.isBubble(r)?s(t.ms):(o.size||6)/2,t.mrc=e;var n=x.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,x.symbolFuncs[a](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,p=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?u.defaultLine:i.color,Array.isArray(o.color)&&(f=u.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var g=o.gradient,m=t.mgt;if(m?p=!0:m=g&&g.type,m&&"none"!==m){var b=t.mgc;b?p=!0:b=g.color;var _="g"+l._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(x.gradient,l,_,m,f,b)}else e.call(u.fill,f);h&&e.call(u.stroke,d)}}function a(t,e,r,n){var a=t[0]-e[0],o=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+o*o,T/2),u=Math.pow(l*l+s*s,T/2),f=(u*u*a-c*c*l)*n,d=(u*u*o-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[i.round(e[0]+(h&&f/h),2),i.round(e[1]+(h&&d/h),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&d/p),2)]]}function o(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var i=t("d3"),l=t("fast-isnumeric"),s=t("tinycolor2"),c=t("../../registry"),u=t("../color"),f=t("../colorscale"),d=t("../../lib"),h=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),m=g.LINE_SPACING,v=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),x=e.exports={};x.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(u.fill,n)},x.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},x.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},x.setRect=function(t,e,r,n,a){t.call(x.setPosition,e,r).call(x.setSize,n,a)},x.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);return!!(l(a)&&l(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},x.translatePoints=function(t,e,r,n){t.each(function(t){var a=i.select(this);x.translatePoint(t,a,e,r,n)})},x.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},x.crispRound=function(t,e,r){return e&&l(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},x.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||"";u.stroke(e,n||o.color),x.dashLine(e,l,i)},x.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=n||a.dash||"";i.select(this).call(u.stroke,r||a.color).call(x.dashLine,l,o)})},x.dashLine=function(t,e,r){r=+r||0,e=x.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},x.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},x.singleFillStyle=function(t){var e=i.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(u.fill,n)},x.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(u.fill,e[0].trace.fillcolor)}catch(e){d.error(e,t),r.remove()}})};var b=t("./symbol_defs");x.symbolNames=[],x.symbolFuncs=[],x.symbolNeedLines={},x.symbolNoDot={},x.symbolList=[],Object.keys(b).forEach(function(t){var e=b[t];x.symbolList=x.symbolList.concat([e.n,t,e.n+100,t+"-open"]),x.symbolNames[e.n]=t,x.symbolFuncs[e.n]=e.f,e.needLine&&(x.symbolNeedLines[e.n]=!0),e.noDot?x.symbolNoDot[e.n]=!0:x.symbolList=x.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=x.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";x.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=x.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var k={x1:1,x2:0,y1:0,y2:0},M={x1:0,x2:0,y1:1,y2:0};x.gradient=function(t,e,r,n,a,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+o],d.identity);l.exit().remove(),l.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=i.select(this);"horizontal"===n?t.attr(k):"vertical"===n&&t.attr(M),t.attr("id",r);var e=s(a),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},x.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},x.singlePointStyle=function(t,e,r,a,o,i){var l=r.marker;n(t,e,r,a,o,l,l.line,i)},x.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,a=x.tryColorscale(n,""),o=x.tryColorscale(n,"line");t.each(function(t){x.singlePointStyle(t,i.select(this),e,a,o,r)})}},x.tryColorscale=function(t,e){var r=e?d.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):d.identity};var A={start:1,end:-1,middle:0,bottom:1,top:-1};x.textPointStyle=function(t,e,r){t.each(function(t){var n=i.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void n.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",c=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=l(u)&&u>0?u:0,n.call(x.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",c).text(a).call(h.convertToTspans,r);var d=i.select(this.parentNode),p=(h.lineCount(n)-1)*m+1,g=A[c]*f,v=.75*u+A[s]*f+(A[s]-1)*p*u/2;d.attr("transform","translate("+g+","+v+")")})};var T=.5;x.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=1e4&&(x.savedBBoxes={},C=0),e&&(x.savedBBoxes[e]=m),C++,d.extendFlat({},m)},x.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")},x.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},x.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||0,r=r||0,i=i.replace(n,"").trim(),i+=" translate("+e+", "+r+")",i=i.trim(),t[o]("transform",i),i},x.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},x.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||1,r=r||1,i=i.replace(n,"").trim(),i+=" scale("+e+", "+r+")",i=i.trim(),t[o]("transform",i),i},x.setPointGroupScale=function(t,e,r){var n,a,o;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};var S=/translate\([^)]*\)\s*$/;x.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=i.select(this),a=n.select("text"),o=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(n.attr("transform")||"").match(S);t=1===e&&1===r?[]:["translate("+o+","+l+")","scale("+e+","+r+")","translate("+-o+","+-l+")"],s&&t.push(s),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":134,"../../constants/xmlns_namespaces":138,"../../lib":150,"../../lib/svg_text_utils":167,"../../registry":229,"../../traces/scatter/make_bubble_size_func":336,"../../traces/scatter/subtypes":341,"../color":38,"../colorscale":52,"./symbol_defs":63,d3:14,"fast-isnumeric":17,tinycolor2:20}],63:[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);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),o=n.round(-.309*t,2);return"M"+e+","+o+"L"+r+","+n.round(.809*t,2)+"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(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+n.round(.382*e,2)+"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}],64:[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"}}}},{}],65:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&-1!==["linear","log"].indexOf(r.type),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":341,d3:14,"fast-isnumeric":17}],70:[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":38,d3:14}],71:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":146,"../../plots/font_attributes":209}],72:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,i=0;i=0&&r.indexJ.width||$<0||$>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(z,$),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RX&&(Z.splice(0,X),K=Z[0].distance)}if(0===Z.length)return x.unhoverRaw(t,e);Z.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(I=0;I1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:P,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Z,ut,t);if(o(Z,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);m(u.select(e.target),dt?"pointer":"")}e.target&&!n&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:z,xvals:E,yvals:N}))}function a(t,e,r){var n,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],m=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,z=A.height,O=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(n=0;n15&&(n=n.substr(0,12)+"...")),void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var p=e.select("text.nums").call(v.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),m=e.select("text.name"),x=0;n&&n!==a?(m.call(v.font,t.fontFamily||d,t.fontSize||h,c).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),x=m.node().getBoundingClientRect().width+2*S):(m.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var b,w,k=p.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,P=Math.abs(t.x1-t.x0),E=Math.abs(t.y1-t.y0),N=k.width+C+S+x;t.ty0=T-k.top,t.bx=k.width+2*S,t.by=k.height+2*S,t.anchor="start",t.txwidth=k.width,t.tx2width=x,t.offset=0,i?(t.pos=A,b=D+E/2+N<=z,w=D-E/2-N>=0,"top"!==t.idealAlign&&b||!w?b?(D+=E/2,t.anchor="start"):t.anchor="middle":(D-=E/2,t.anchor="end")):(t.pos=D,b=A+P/2+N<=L,w=A-P/2-N>=0,"left"!==t.idealAlign&&b||!w?b?(A+=P/2,t.anchor="start"):t.anchor="middle":(A-=P/2,t.anchor="end")),p.attr("text-anchor",t.anchor),x&&m.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+D+")"+(i?"rotate("+M+")":""))}),E}function o(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)?T: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 i(t,e){t.each(function(t){var r=u.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*(C+S),l=i+o*(t.txwidth+S),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-z,s=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+s)+","+(C+c)+"v"+(t.by/2-C)+"h"+n*t.bx+"v-"+t.by+"H"+(n*C+s)+"V"+(c-C)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+S),t.tx2width&&(r.select("text.name").call(g.positionText,l+o*S+s,c+t.ty0-t.by/2+S),r.select("rect").call(v.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,m=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),z=Math.sin(A),C=k.HOVERARROWSIZE,S=k.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":150,"../../lib/events":145,"../../lib/override_cursor":159,"../../lib/svg_text_utils":167,"../../plots/cartesian/axes":185,"../../registry":229,"../color":38,"../dragelement":59,"../drawing":62,"./constants":74,"./helpers":76,d3:14,"fast-isnumeric":17,tinycolor2:20}],78:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":150}],79:[function(t,e,r){"use strict";function n(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return l.castOption(t,e,"hoverlabel."+r)}function o(t,e,r){function n(r){return l.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return l.castOption(t,r,"hoverinfo",n)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":150,"../dragelement":59,"./attributes":71,"./calc":72,"./click":73,"./constants":74,"./defaults":75,"./helpers":76,"./hover":77,"./layout_attributes":80,"./layout_defaults":81,"./layout_global_defaults":82,d3:14}],80:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":146,"../../plots/font_attributes":209,"./constants":74}],81:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],89:[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":146,"../../plots/font_attributes":209,"../color/attributes":37}],90:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],91:[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(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":150,"../../plots/layout_attributes":212,"../../registry":229,"./attributes":89,"./helpers":94}],92:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){i(t,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=n.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeL&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},L):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?-1===g?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var m,v=[],y=[];for(m=0;mn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),m.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+r,a.height=Math.max(a.height,e.height),y+=i+r,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(m.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var a="top";A.isBottomAnchor(r)?a="bottom":A.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){C.attr("data-scroll",e).call(m.setTranslate,0,e),S.call(m.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).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 T=r._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var z=M.selectAll("rect.bg").data([0]);z.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),z.call(v.stroke,y.bordercolor),z.call(v.fill,y.bgcolor),z.style("stroke-width",y.borderwidth+"px");var C=M.selectAll("g.scrollbox").data([0]);C.enter().append("g").attr("class","scrollbox");var S=M.selectAll("rect.scrollbar").data([0]);S.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(v.fill,"#808BA4");var O=C.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==M.enter().size();P&&(l(t,O,D),s(t));var E=r.width,N=r.height;l(t,O,D),y.height>N?c(t):s(t);var I=r._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?F-=y.height:A.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var q=y.height,H=I.h;q>H?(F=I.t,q=H):(F+q>N&&(F=N-q),F<0&&(F=0),q=Math.min(N-F,y.height)),m.setTranslate(M,R,F);var V,U,G=q-x.scrollBarHeight-2*x.scrollBarMargin,X=y.height-q;if(y.height<=q||t._context.staticPlot)z.attr({width:j-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(C,0,0),T.select("rect").attr({width:j-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),C.call(m.setClipUrl,i);else{V=x.scrollBarMargin,U=C.attr("data-scroll")||0,z.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),C.call(m.setClipUrl,i),P&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(C.attr("data-scroll")-u.event.deltaY/G*X,-X,0),V=x.scrollBarMargin-U/X*G,e(V,U),0!==U&&U!==-X&&u.event.preventDefault()}),S.on(".drag",null),C.on(".drag",null);var Z=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*X,e(V,U)});S.call(Z),C.call(Z)}if(t._context.editable){var Y,W,$,Q;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=m.getTranslate(M);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;m.setTranslate(M,r,n),Y=g.align(r,0,I.l,I.l+I.w,y.xanchor),W=g.align(n,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Y&&void 0!==W)f.relayout(t,{"legend.x":Y,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?M._clickTimeout=setTimeout(function(){o(i,t,n)},L):2===n&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/alignment":134,"../../constants/interactions":135,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/plots":214,"../../registry":229,"../color":38,"../dragelement":59,"../drawing":62,"./anchor_utils":88,"./constants":90,"./get_legend_data":93,"./helpers":94,"./style":96,d3:14}],93:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[1])return r[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},m={};d&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",o.mean,[.2,1]),g.ms=r("marker.size",o.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",o.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(m.line={width:r("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,m)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=v.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,r=e.marker||{},o=r.line||{},i=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=n.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||r.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&r.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(c,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(r).each(u)}},{"../../lib":150,"../../registry":229,"../../traces/pie/style_one":319,"../../traces/scatter/subtypes":341,"../color":38,"../drawing":62,d3:14}],97:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)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||p)&&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(["toggleSpikelines","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)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":150,"../color":38,"./attributes":101,"./button_attributes":102,"./constants":103}],105:[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;lX&&n>Z&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),G=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),q=v.getDataToPixel(t,j),H=v.getDataToPixel(t,B,!0),V=v.getPixelToData(t,j),U=v.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(m=q(r.x0),y=H(r.y0),x=q(r.x1),b=H(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),mZ&&(h[C]=r[P]=U(c),h[S]=r[E]=U(u)),d-f>X&&(h[O]=r[N]=V(f),h[D]=r[I]=V(d))}e.attr("d",i(t,r))}var h,m,y,x,b,_,w,k,M,A,T,L,z,C,S,O,D,P,E,N,I,R,F,j,B,q,H,V,U,G,X=10,Z=10,Y={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Y.element.getBoundingClientRect();p.init(Y),e.node().onmousemove=a}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=v.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=v.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=v.decodeDate(n)),c&&"date"===c.type&&(o=v.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var m=(d+h)/2,y=(p+g)/2,x=Math.abs(m-d),b=Math.abs(y-p),_="A"+x+","+b,w=m+x+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),o=m.paramIsX[a],i=m.paramIsY[a],l=m.numParams[a],s=t.substr(1).replace(m.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),o=m.paramIsX[a],i=m.paramIsY[a],l=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":150,"../../lib/setcursor":165,"../../plotly":180,"../../plots/cartesian/axes":185,"../color":38,"../dragelement":59,"../drawing":62,"./constants":116,"./helpers":119}],119:[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}},{}],120:[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":114,"./calc_autorange":115,"./defaults":117,"./draw":118}],121:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,x;"paper"!==m?(v=a.getFromId(g,m),x=i.rangeToShapePosition(v),y=i.shapePositionToRange(v)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,m,b,.25),a.coercePosition(e,g,c,m,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":150,"../../plots/cartesian/axes":185,"./attributes":114,"./helpers":119}],122:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":146,"../../plots/animation_attributes":181,"../../plots/font_attributes":209,"../../plots/pad_attributes":213,"./constants":123}],123:[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,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}},{}],124:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-z.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=z.currentValueInset,a="left"}o.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*C;return T.positionText(o,n,s),o}}function s(t,e,r){var n=t.selectAll("rect."+z.gripRectClass).data([0]);n.enter().append("rect").classed(z.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:z.gripWidth,height:z.gripHeight,rx:z.gripRadius,ry:z.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function u(t,e){var r=t.selectAll("g."+z.labelsClass).data([0]);r.enter().append("g").classed(z.labelsClass,!0);var n=r.selectAll("g."+z.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(z.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,v(e,t.fraction),z.tickOffset+e.ticklen+e.font.size*C+z.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active +;r._input.active=r.active=n;var s=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+z.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+z.tickRectClass).data(e.steps);r.enter().append("rect").classed(z.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?z.tickOffset:z.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(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,r){var n=t.selectAll("rect."+z.railTouchRectClass).data([0]);n.enter().append("rect").classed(z.railTouchRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,z.tickOffset+r.ticklen+r.labelHeight)}).call(M.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function b(t,e){var r=t.selectAll("rect."+z.railRectClass).data([0]);r.enter().append("rect").classed(z.railRectClass,!0);var n=e.inputAreaLength-2*z.railInset;r.attr({width:n,height:z.railWidth,rx:z.railRadius,ry:z.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,z.railInset,.5*(e.inputAreaWidth-z.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(z.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==r.length){var s=l.selectAll("g."+z.groupClassName).data(r,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 g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+g+")")}}}var m=r.propContainer,v=r.propName,y=r.traceIndex,x=r.dfltName,b=r.avoid||{},_=r.attributes,w=r.transform,k=r.containerGroup,M=t._fullLayout,A=m.titlefont.family,T=m.titlefont.size,L=m.titlefont.color,z=1,C=!1,S=m.title.trim(),O=t._context.editable;""===S&&(z=0),S.match(d)&&(z=.2,C=!0,O||(S=""));var D=S||O;k||(k=M._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var P=k.selectAll("text").data(D?[0]:[]);if(P.enter().append("text"),P.text(S).attr("class",e),P.exit().remove(),D){P.call(h);var E="Click to enter "+x+" title";O&&(S?P.on(".opacity",null):function(){z=0,C=!0,S=E,P.text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),P.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?o.restyle(t,v,e,y):o.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,_.x,_.y)})),P.classed("js-placeholder",C)}}},{"../../constants/interactions":135,"../../lib":150,"../../lib/svg_text_utils":167,"../../plotly":180,"../../plots/plots":214,"../color":38,"../drawing":62,d3:14,"fast-isnumeric":17}],128:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":146,"../../plots/font_attributes":209,"../../plots/pad_attributes":213,"../color/attributes":37}],129:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],130:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+C.headerGroupClassName).data(r,a);u.enter().append("g").classed(C.headerGroupClassName,!0);var f=o.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,z=p,C=m+v;C+L>c&&(C=c-L);var S=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:z,y:C,width:T,height:L}),this._hbarXMin=z+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=m;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":150,"../color":38,"../drawing":62,d3:14}],134:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],135:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],136:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],137:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],138:[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}},{}],139:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":31,"./components/annotations3d":36,"./components/fx":79,"./components/images":87,"./components/legend":95,"./components/rangeselector":107,"./components/rangeslider":113,"./components/shapes":120,"./components/sliders":126,"./components/updatemenus":132,"./fonts/mathjax_config":140,"./lib/queue":162,"./plot_api/plot_schema":174,"./plot_api/register":175,"./plot_api/set_plot_config":176,"./plot_api/to_image":178,"./plot_api/validate":179,"./plotly":180,"./snapshot":234,"./snapshot/download":231,"./traces/scatter":331,d3:14,"es6-promise":15}],140:[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},{}],141:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),n(t)?Number(t):a}},{"../constants/numerical":136,"fast-isnumeric":17}],142:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(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),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.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;!0!==n.strict&&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(i(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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);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(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,x=m.ONEHOUR,b=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;r.dateTick0=function(t,e){ +return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var z,C;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=z&&t<=C?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return v;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return v;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var m="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,m),u)}else p=g.newDate(s,Number(c),u)}catch(t){return v}return p?(p.toJD()-w)*y+f*x+d*b+h*_:v}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?v:M.getUTCDate()!==u?v:M.getTime()+h*_},z=r.MIN_MS=r.dateTime2ms("-9999"),C=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var S=90*y,O=3*x,D=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=z&&t<=C))return v;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=z+y&&t<=C-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),I=M("%b %Y"),R=M("%b %-d"),F=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=N(g):"m"===r?d=I(g):"d"===r?(o=N(g),d=R(g)):(o=F(g),d=l(t,r))}return d+(o?"\n"+o:"")};var j=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;ui?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var a=0;ar?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},s.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},s.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<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},s.syncOrAsync=function(t,e,r){function n(){return s.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(n).then(void 0,s.promiseError);return r&&r(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.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}},{"../constants/numerical":136,"./clean_number":141,"./coerce":142,"./dates":143,"./ensure_array":144,"./extend":146,"./filter_unique":147,"./filter_visible":148,"./identity":149,"./is_array":151,"./is_plain_object":152,"./loggers":153,"./matrix":154,"./mod":155,"./nested_property":156,"./noop":157,"./notifier":158,"./push_unique":161,"./relink_private":163,"./search":164,"./stats":166,"./to_log_range":168,d3:14,"fast-isnumeric":17}],151:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],152:[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}},{}],153:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(u=1;uMath.max(f,m)||c>Math.max(d,v)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":136,"./matrix":154}],161:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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}],167:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(v,"\\lt ").replace(y,"\\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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function l(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],I={type:M},R=i(N,S);if(R?(R=R.replace(E,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(I.style=R),"a"===M){l=!0;var F=i(N,O);if(F){var j=document.createElement("a");j.href=F,-1!==k.indexOf(j.protocol)&&(I.href=F,I.target=i(N,D)||"_blank",I.popup=i(N,P))}}n(I)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,m=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(m),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};o(s[2],r,function(r,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=r&&r.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=n(c,"width"),g=n(c,"height"),m=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||n(t,"height"),y=-v/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:m,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]} +}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,z=/<(\/?)([^ >]*)(\s+(.*))?>/i,C=//i,S=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,E=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(M," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),o=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=s.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(o),a=r.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,n)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():s.on("click",r),f.rebind(t,l,"on")}},{"../constants/alignment":134,"../constants/string_mappings":137,"../constants/xmlns_namespaces":138,"../lib":150,d3:14}],168:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":17}],169:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(m,v),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),z=L||[],C=n(v,f).get(),S=[],O=-1,D=z.length;for(x=0;xz.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?S.push(_):A?("add"===M&&(M={}),z.splice(_,0,M),C&&C.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)z.splice(S[x],1),C&&C.splice(S[x],1);if(z.length?L||e.set(z):e.set(null),g)return!1;if(d(m,v),p!==o){var P;if(-1===O)P=T;else{for(D=Math.max(z.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sH.range[0]?[1,2]:[2,1]);else{var G=H.range[0],X=H.range[1];V?(G<=0&&X<=0&&r(I+".autorange",!0),G<=0?G=X/1e6:X<=0&&(X=G/1e6),r(I+".range[0]",Math.log(G)/Math.LN10),r(I+".range[1]",Math.log(X)/Math.LN10)):(r(I+".range[0]",Math.pow(10,G)),r(I+".range[1]",Math.pow(10,X)))}else r(I+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,j,L,r),w.getComponentMethod("images","convertCoords")(t,j,L,r)}else r(I+".autorange",!0);x.nestedProperty(c,I+"._inputRange").set(null)}else if(E.match(P.AX_NAME_PATTERN)){var Z=x.nestedProperty(c,A).get(),Y=(L||{}).type;Y&&"-"!==Y||(Y="linear"),w.getComponentMethod("annotations","convertCoords")(t,Z,Y,r),w.getComponentMethod("images","convertCoords")(t,Z,Y,r)}var W=S.containerArrayMatch(A);if(W){o=W.array,i=W.index;var $=W.property,Q=x.nestedProperty(s,o),J=(Q||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(v.docalc=!0);else if(""===$){var K=L;S.isAddVal(L)?_[A]=null:S.isRemoveVal(L)?(_[A]=J,K=J):x.warn("unrecognized full object value",e),(n(K,"x")||n(K,"y")&&-1===A.indexOf("updatemenus"))&&(v.docalc=!0)}else!n(J,"x")&&!n(J,"y")||x.containsAny(A,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);d[o]||(d[o]={});var tt=d[o][i];tt||(tt=d[o][i]={}),tt[$]=L,delete e[A]}else if("reverse"===E)F.range?F.range.reverse():(r(I+".autorange",!0),F.range=[1,0]),j.autorange?v.docalc=!0:v.doplot=!0;else{var et=String(T.parts[1]||"");0===D.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===D.indexOf("geo")?v.doplot=!0:0===D.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===A?v.doplot=!0:"margin"===D||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?v.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===B||"select"===B?"hiddenlabels"===A?v.docalc=!0:-1!==D.indexOf("legend")?v.dolegend=!0:-1!==A.indexOf("title")?v.doticks=!0:-1!==D.indexOf("bgcolor")?v.dolayoutstyle=!0:z>1&&x.containsAny(et,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:z>1&&-1!==et.indexOf("line")?v.dolayoutstyle=!0:z>1&&"mirror"===et?v.doticks=v.dolayoutstyle=!0:"margin.pad"===A?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(L)}}}for(o in d){S.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],v)||(v.doplot=!0)}var rt=c._axisConstraintGroups;for(m in M)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?m>=l.length?t.transitionOpts=l[m]:t.transitionOpts=l[0]:t.transitionOpts=l,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&A.push(g);v=A}}v.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":62,"../components/errorbars":68,"../constants/xmlns_namespaces":138,"../lib":150,"../lib/events":145,"../lib/queue":162,"../lib/svg_text_utils":167,"../plotly":180,"../plots/cartesian/axis_ids":188,"../plots/cartesian/constants":190,"../plots/cartesian/constraints":192,"../plots/cartesian/graph_interact":194,"../plots/plots":214,"../plots/polar":217,"../registry":229,"./helpers":170,"./manage_arrays":171,"./subroutines":177,d3:14,"fast-isnumeric":17}],173:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],174:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,m),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},v)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[k]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=A,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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];-1===A.indexOf(n)&&(e(o,n,t,a),r.isValObject(o)||p.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){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":150,"../plotly":180,"../snapshot/cloneplot":230,"../snapshot/helpers":233,"../snapshot/svgtoimg":235,"../snapshot/tosvg":237,"fast-isnumeric":17}],179:[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;v.3*f||o(n)||o(a))){var d=r.dtick/2;t+=t+d.8){var i=Number(r.substr(1));o.exactYears>.8&&i%12==0?t=E.tickIncrement(t,"M6","reverse")+1.5*S:o.exactMonths>.8?t=E.tickIncrement(t,"M1","reverse")+15.5*S:t-=S/2;var l=E.tickIncrement(t,r);if(l<=n)return l}return t}function o(t){var e,r,n=t.tickvals,a=t.ticktext,o=new Array(n.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;ru&&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=t.l2r(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 s(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function c(t,e,r,n){var a=t._tickround,o=r&&t.hoverformat||t.tickformat;n&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");-1!==s&&(i=l.substr(s+1),l=l.substr(0,s)),n&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(r?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function d(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,n)}function h(t,e,r,n){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=V[s/3+5])}return a?"\u2212"+t:t}function p(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},E.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(),_.simpleMap(r,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},E.saveRangeInitial=function(t,e){for(var r=E.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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);v&&"domain"===t.constrain&&t._inputDomain&&(v*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=m-1;o>5;o--)a(o)}},E.autoBin=function(t,e,r,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(r)c=(s-l)/r;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},E.setConvert(h),E.autoTicks(h,c);var p,g=E.tickIncrement(E.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=n(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=E.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},E.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),E.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=E.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=E.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fz?(e/=z,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>C?(e/=C,t.dtick="M"+i(e,1,F)):n>S?(t.dtick=i(e,S,B),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=i(e,O,F):n>D?t.dtick=i(e,D,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=_.simpleMap(t.range,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 l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},E.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,n);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?H:q,s=t+.01*a,c=_.roundUp(_.mod(s,1),l,r);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,r=_.simpleMap(t.range,e),n=r[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":136,"../../lib":150,"fast-isnumeric":17}],187:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,r,p,g){function m(r,n){return o.coerce2(t,e,l,r,n)}var v=p.letter,y=p.font||{},x="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",b=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?h(v,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=r("color"),k=w===t.color?w:y.color;r("title",x),o.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,r,_),u(t,e,r,_,p),c(t,e,r,p);var M=m("linecolor",w),A=m("linewidth"),T=r("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var L=m("gridcolor",n(w,p.bgColor,i).toRgbString()),z=m("gridwidth") +;r("showgrid",p.showGrid||!!L||!!z)||(delete e.gridcolor,delete e.gridwidth);var C=m("zerolinecolor",w),S=m("zerolinewidth");return r("zeroline",p.showGrid||!!C||!!S)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":37,"../../lib":150,"../../registry":229,"./category_order_defaults":189,"./layout_attributes":196,"./ordered_categories":198,"./set_convert":202,"./tick_label_defaults":203,"./tick_mark_defaults":204,"./tick_value_defaults":205,tinycolor2:20}],188:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],190:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],191:[function(t,e,r){"use strict";function n(t,e,r,n){var a,o,l,s,c=n[i(e)].type,u=[];for(o=0;oi*v)||_)for(r=0;rO&&PC&&(C=P);var I=(C-z)/(2*S);f/=I,z=s.l2r(z),C=s.l2r(C),s.range=s._input.range=A=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,r,n,a,o){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function m(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function v(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,r){var n,a,o,i,l,s,c=!1,u={},f={};for(n=0;nF||l>F?(Mt="xy",i/ot>l/it?(l=i*it/ot,xt>o?bt.t=xt-l:bt.b=xt+l):(i=l*ot/it,yt>a?bt.l=yt-i:bt.r=yt+i),Tt.attr("d",y(bt))):n():!st||lzoom back out","long"),j=!1)}function Z(e,r){var n=1===(q+H).length;if(e)J();else if(2!==r||n){if(1===r&&n){var a=q?rt[0]:et[0],i="s"===q||"w"===H?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;q?(u="n"===q?"top":"bottom","right"===a.side&&(c="right")):"e"===H&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(mt).call(A.makeEditable,{gd:t,immediate:!0,background:ht.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,l,r)})}}else Q()}function Y(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ht._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var n=t.querySelector(".plotly");if(V(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Ct);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(H||ut){for(H||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":150,"fast-isnumeric":17}],200:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],o=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(o+(a[0]-o)*e),t.l2r(o+(a[1]-o)*e)]}},{"../../constants/alignment":134}],201:[function(t,e,r){"use strict";function n(t){return t._id}function a(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)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*w*Math.abs(n-a))}return h}function f(e,r,n){var a=c(e,n||t.calendar);if(a===h){if(!o(e))return h;a=c(new Date(+e))}return a}function m(e,r,n){return s(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(o(e))return+e}function b(e){return o(e)?a.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:u,t.l2c="log"===t.type?n:u,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(l(e))},t.p2d=t.p2r=_,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(l(t),e)},t.r2d=t.r2c=function(t){return n(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=u,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(l(e))},t.p2r=_,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=i.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=m,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return m(_(t),e,r)},t.cleanPos=function(e){return i.cleanDate(e,h,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=x,t.r2c=function(e){var r=x(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=i.nestedProperty(t,e).get(),l=(t._id||"x").charAt(0);if(n="date"===t.type?i.dfltRange(t.calendar):"y"===l?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void i.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=i.cleanDate(a[0],h,t.calendar),a[1]=i.cleanDate(a[1],h,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!i.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=i.constrain(t.r2l(a[0]),i.MIN_MS+1e3,i.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!o(a[r])){if(!o(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-d?a[r]=-d:a[r]>d&&(a[r]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var l=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(l);var c=t.r2l(t[l][0],s),u=t.r2l(t[l][1],s);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw i.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,o,i="date"===t.type&&e[r+"calendar"];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?a.dateTick0(e.calendar):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":136,"../../lib":150,"fast-isnumeric":17}],206:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(e,r){function n(e,r){for(a=0;ar.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var m=t._fullLayout,v=[],y=function(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=m[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,v.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(-1===l.indexOf(s)){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]||-1===e.indexOf(c)&&-1===e.indexOf(u)||l.push(s)}}return l}(m,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":62,"../../plotly":180,"../../registry":229,"./axes":185,d3:14}],207:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var c=a(e,r,n);if(c){if("histogram"===c.type&&n==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=n+"calendar",f=c[u];if(i(c,n)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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()?" - ":"")}},m.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=m.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},m.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||m.createTransitionData(t),r._initialAutoSizeIsDone){var c=r.width,f=r.height;m.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{m.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,p=t._context&&t._context.autosizable;d&&(h||p)?m.plotAutoSize(t,o,n):d&&m.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,m.supplyDataDefaults(s,l,o,n),n._has=m._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var u=i(t._boundingBoxMargins),f=u.left+u.right,d=u.bottom+u.top,p=1-2*l,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-d))}else{var v=s?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=m.layoutAttributes.width.min,x=m.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}),m.sanitizeMargins(r)}, +m.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];n._replotting||m.doAutoMargin(t)}},m.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),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(!1!==e.margin.autoexpand){s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(s),d=0;dm){var M=(v*w+(k-e.width)*m)/(w-m),A=(k*(1-m)+(v-e.width)*(1-w))/(w-m);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(c(x)&&s[_].t){var T=s[_].t.val,L=s[_].t.size;if(T>y){var z=(x*T+(L-e.height)*y)/(T-y),C=(L*(1-y)+(x-e.height)*(1-T))/(T-y);z>=0&&C>=0&&z+C>l+i&&(l=z,i=C)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},m.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):h.isJSDate(t)?h.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&m.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===n?c:JSON.stringify(c)},m.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(){b=!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,d=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,z=L?f.angularAxis.domain:n.extent(k),C=Math.abs(k[1]-k[0]);A&&!M&&(C=0);var S=z.slice();T&&M&&(S[1]+=C);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(S[1]-S[0])/O);var D=f.angularAxis.ticksStep||(S[1]-S[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),S[2]||(S[2]=D);var P=n.range.apply(this,S);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(S.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?C:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),N=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(N)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},j={"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 B=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=void 0===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:I,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=I.node().getBBox();x=Math.min(f.width-q.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}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(j).text(f.title),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=G.selectAll("circle.grid-circle").data(a.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(F),X.attr("r",a),X.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(F);var Z=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Y=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Y).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(F),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),$=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),$.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(F),$.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var Q=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(j);f.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(Z).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(Z).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(Z).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},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(void 0===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-2===r},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;return[t*Math.cos(r),t*Math.sin(r)]},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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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=[i.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),o(e[r],i.PolyChart.defaultConfig()),o(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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":-1!=n.svg.symbolTypes.indexOf(t)?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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var l=o({},t.layout);if([[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"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":150,d3:14}],219:[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":38,"../../lib":150,"./micropolar":218,"./undo_manager":220,d3:14}],220:[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-1!==n},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":38,"../../subplot_defaults":221,"./axis_defaults":225,"./layout_attributes":227}],227:[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":37,"./axis_attributes":224}],228:[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("../plots"),p=t("../cartesian/axes"),g=t("../../components/dragelement"),m=t("../../components/fx"),v=t("../../components/titles"),y=t("../cartesian/select"),x=t("../cartesian/constants");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=this,n=e[r.id],a=e._size;r.adjustLayout(n,a),h.generalUpdatePerTraceModule(r,t,n),r.layers.plotbg.select("path").call(c.fill,n.bgcolor)},b.makeFramework=function(){var t=this,e=t.defs.selectAll("g.clips").data([0]);e.enter().append("g").classed("clips",!0);var r="clip"+t.layoutId+t.id;t.clipDef=e.selectAll("#"+r).data([0]),t.clipDef.enter().append("clipPath").attr("id",r).append("path").attr("d","M0,0Z"),t.plotContainer=t.container.selectAll("g."+t.id).data([0]),t.plotContainer.enter().append("g").classed(t.id,!0),t.layers={};var n=["draglayer","plotbg","backplot","grids","frontplot","zoom","aaxis","baxis","caxis","axlines"];t.plotContainer.selectAll("g.toplevel").data(n).enter().append("g").attr("class",function(t){return"toplevel "+t}).each(function(e){var r=o.select(this);t.layers[e]=r,"frontplot"===e?r.append("g").classed("scatterlayer",!0):"backplot"===e?r.append("g").classed("maplayer",!0):"plotbg"===e?r.append("path").attr("d","M0,0Z"):"axlines"===e&&r.selectAll("path").data(["aline","bline","cline"]).enter().append("path").each(function(t){o.select(this).classed(t,!0)})}),t.plotContainer.select(".grids").selectAll("g.grid").data(["agrid","bgrid","cgrid"]).enter().append("g").attr("class",function(t){return"grid "+t}).each(function(e){t.layers[e]=o.select(this)}),t.plotContainer.selectAll(".backplot,.frontplot,.grids").call(u.setClipUrl,r),t.graphDiv._context.staticPlot||t.initInteractions()};var _=Math.sqrt(4/3);b.adjustLayout=function(t,e){var r,n,a,o,i,l,s=this,u=t.domain,h=(u.x[0]+u.x[1])/2,p=(u.y[0]+u.y[1])/2,g=u.x[1]-u.x[0],m=u.y[1]-u.y[0],v=g*e.w,y=m*e.h,x=t.sum,b=t.aaxis.min,w=t.baxis.min,k=t.caxis.min;v>_*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"},f(s.xaxis,s.graphDiv._fullLayout),s.xaxis.setScale(),s.yaxis={type:"linear",range:[b,x-w-k],domain:[p-l/2,p+l/2],_id:"y"},f(s.yaxis,s.graphDiv._fullLayout),s.yaxis.setScale();var M=s.yaxis.domain[0],A=s.aaxis=d({},t.aaxis,{visible:!0,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,_id:"y",_length:a,_gridpath:"M0,0l"+o+",-"+a/2});f(A,s.graphDiv._fullLayout),A.setScale();var T=s.baxis=d({},t.baxis,{visible:!0,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,_id:"x",_length:a,_gridpath:"M0,0l-"+a/2+",-"+o});f(T,s.graphDiv._fullLayout),T.setScale(),A._counteraxis=T;var L=s.caxis=d({},t.caxis,{visible:!0,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,_id:"y",_length:a,_gridpath:"M0,0l-"+o+","+a/2});f(L,s.graphDiv._fullLayout),L.setScale();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(p.doTicks(r,a,!0),p.doTicks(r,o,!0),p.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));v.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;v.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"}}),v.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=x.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=!0;b.initInteractions=function(){function t(t,e,r){var n=I.getBoundingClientRect();b=e-n.left,w=r-n.top,L={a:N.aaxis.range[0],b:N.baxis.range[1],c:N.caxis.range[1]},C=L,z=N.aaxis.range[1]-L.a,S=i(N.graphDiv._fullLayout[N.id].bgcolor).getLuminance(),O="M0,"+N.h+"L"+N.w/2+", 0L"+N.w+","+N.h+"Z",D=!1,P=F.append("path").attr("class","zoombox").style({fill:S>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",O),E=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/N.h}function r(t,e){return 1-(t+(N.h-e)/Math.sqrt(3))/N.w}function n(t,e){return(t-(N.h-e)/Math.sqrt(3))/N.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)*N.w,f=(1-l/2-s)*N.w,d=(u+f)/2,h=f-u,p=(1-l)*N.h,g=p-h/_;h.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),E.transition().style("opacity",1).duration(200),D=!0)}function u(t,e){if(C===L)return 2===e&&v(),a(R);a(R);var r={};r[N.id+".aaxis.min"]=C.a,r[N.id+".baxis.min"]=C.b,r[N.id+".caxis.min"]=C.c,l.relayout(R,r),T&&R.data&&R._context.showTips&&(s.notifier("Double-click to
zoom back out","long"),T=!1)}function f(){L={a:N.aaxis.range[0],b:N.baxis.range[1],c:N.caxis.range[1]},C=L}function d(t,e){var r=t/N.xaxis._m,n=e/N.yaxis._m;C={a:L.a-n,b:L.b+(r+n)/2,c:L.c-(r-n)/2};var a=[C.a,C.b,C.c].sort(),o={a:a.indexOf(C.a),b:a.indexOf(C.b),c:a.indexOf(C.c)};a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),C={a:a[o.a],b:a[o.b],c:a[o.c]},e=(L.a-C.a)*N.yaxis._m,t=(L.c-C.c-L.b+C.b)*N.xaxis._m);var i="translate("+(N.x0+t)+","+(N.y0+e)+")";N.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",i),N.aaxis.range=[C.a,N.sum-C.b-C.c],N.baxis.range=[N.sum-C.a-C.c,C.b],N.caxis.range=[N.sum-C.a-C.b,C.c],N.drawAxes(!1),N.plotContainer.selectAll(".crisp").classed("crisp",!1)}function h(t,e){if(t){var r={};r[N.id+".aaxis.min"]=C.a,r[N.id+".baxis.min"]=C.b,r[N.id+".caxis.min"]=C.c,l.relayout(R,r)}else 2===e&&v()}function p(){N.plotContainer.selectAll(".select-outline").remove()}function v(){var t={};t[N.id+".aaxis.min"]=0,t[N.id+".baxis.min"]=0,t[N.id+".caxis.min"]=0,R.emit("plotly_doubleclick",null),l.relayout(R,t)}var b,w,L,z,C,S,O,D,P,E,N=this,I=N.layers.plotbg.select("path").node(),R=N.graphDiv,F=N.layers.zoom,j={element:I,gd:R,plotinfo:{plot:F},doubleclick:v,subplot:N.id,prepFn:function(e,r,n){j.xaxes=[N.xaxis],j.yaxes=[N.yaxis];var a=R._fullLayout.dragmode;e.shiftKey&&(a="pan"===a?"zoom":"pan"),j.minDrag="lasso"===a?1:void 0,"zoom"===a?(j.moveFn=o,j.doneFn=u,t(e,r,n)):"pan"===a?(j.moveFn=d,j.doneFn=h,f(),p()):"select"!==a&&"lasso"!==a||y(e,r,n,j,a)}};I.onmousemove=function(t){m.hover(R,t,N.id),R._fullLayout._lasthover=I,R._fullLayout._hoversubplot=N.id},I.onmouseout=function(t){R._dragging||g.unhover(R,t)},I.onclick=function(t){m.click(R,t,N.id)},g.init(j)}},{"../../components/color":38,"../../components/dragelement":59,"../../components/drawing":62,"../../components/fx":79,"../../components/titles":127,"../../lib":150,"../../lib/extend":146,"../../plotly":180,"../cartesian/axes":185,"../cartesian/constants":190,"../cartesian/select":201,"../cartesian/set_convert":202,"../plots":214,d3:14,tinycolor2:20}],229:[function(t,e,r){"use strict";function n(t){if(t.layoutAttributes){var e=t.layoutAttributes._arrayAttrRegexps;if(e)for(var n=0;n-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)),d=t._context||{};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;r")?"":e.html(t).text()});return e.remove(),r}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var o=t("d3"),i=t("../components/drawing"),l=t("../components/color"),s=t("../constants/xmlns_namespaces"),c=/"/g,u=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,d=f._paper,h=f._toppaper;d.insert("rect",":first-child").call(i.setRect,0,0,f.width,f.height).call(l.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(r=0;r0&&A>0,j=k<=I&&A<=R,B=k<=R&&A<=I,q="h"===v?I>=k*(R/A):R>=A*(I/k);F&&(j||B||q)?x="inside":(x="outside",b.remove(),b=null)}else x="inside";if(!b&&(b=g(e,y,"outside"===x?z:L),_=M.bBox(b.node()),k=_.width,A=_.height,k<=0||A<=0))return void b.remove();var H;H="outside"===x?o(i,d,h,p,_,v):a(i,d,h,p,_,v),b.attr("transform",H)}}}function a(t,e,r,n,a,o){var l,s,c,u,f,d=a.width,h=a.height,p=(a.left+a.right)/2,g=(a.top+a.bottom)/2,m=Math.abs(e-t),v=Math.abs(n-r);m>2*D&&v>2*D?(f=D,m-=2*f,v-=2*f):f=0;var y,x;return d<=m&&h<=v?(y=!1,x=1):d<=v&&h<=m?(y=!0,x=1):dr?(c=(t+e)/2,u=n-f-s/2):(c=(t+e)/2,u=n+f+s/2),i(p,g,c,u,x,y)}function o(t,e,r,n,a,o){var l,s="h"===o?Math.abs(n-r):Math.abs(e-t);s>2*D&&(l=D,s-=2*l);var c,u,f,d,h="h"===o?Math.min(1,s/a.height):Math.min(1,s/a.width),p=(a.left+a.right)/2,g=(a.top+a.bottom)/2;return c=h*a.width,u=h*a.height,"h"===o?er?(f=(t+e)/2,d=n+l+u/2):(f=(t+e)/2,d=n-l-u/2),i(p,g,f,d,h,!1)}function i(t,e,r,n,a,o){var i,l;return a<1?i="scale("+a+") ":(a=1,i=""),l=o?"rotate("+o+" "+t+" "+e+") ":"","translate("+(r-a*t)+" "+(n-a*e)+")"+i+l}function l(t,e){var r=h(t.text,e);return p(L,r)}function s(t,e){var r=h(t.textposition,e);return g(z,r)}function c(t,e,r){return d(C,t.textfont,e,r)}function u(t,e,r){return d(S,t.insidetextfont,e,r)}function f(t,e,r){return d(O,t.outsidetextfont,e,r)}function d(t,e,r,n){e=e||{};var a=h(e.family,r),o=h(e.size,r),i=h(e.color,r);return{family:p(t.family,a,n.family),size:m(t.size,o,n.size),color:v(t.color,i,n.color)}}function h(t,e){var r;return Array.isArray(t)?ea))return e}return void 0!==r?r:t.dflt}function v(t,e,r){return b(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),x=t("fast-isnumeric"),b=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),k=t("../../components/color"),M=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),L=T.text,z=T.textposition,C=T.textfont,S=T.insidetextfont,O=T.outsidetextfont,D=3;e.exports=function(t,e,r){var a=e.xaxis,o=e.yaxis,i=t._fullLayout,l=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);l.enter().append("g").attr("class","trace bars"),l.append("g").attr("class","points").each(function(e){var r=e[0].t,l=e[0].trace,s=r.poffset,c=Array.isArray(s);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,u){function f(t){return 0===i.bargap&&0===i.bargroupgap?y.round(Math.round(t)-A,2):t}function d(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)}var h,p,g,m,v=r.p+(c?s[u]:s),b=v+r.w,_=r.b,w=_+r.s;if("h"===l.orientation?(g=o.c2p(v,!0),m=o.c2p(b,!0),h=a.c2p(_,!0),p=a.c2p(w,!0)):(h=a.c2p(v,!0),p=a.c2p(b,!0),g=o.c2p(_,!0),m=o.c2p(w,!0)),!(x(h)&&x(p)&&x(g)&&x(m)&&h!==p&&g!==m))return void y.select(this).remove();var M=(r.mlw+1||l.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(M/2%1,2);if(!t._context.staticPlot){var T=k.opacity(r.mc||l.marker.color),L=T<1||M>.01?f:d;h=L(h,p),p=L(p,h),g=L(g,m),m=L(m,g)}var z=y.select(this);z.append("path").attr("d","M"+h+","+g+"V"+m+"H"+p+"V"+g+"Z"),n(t,z,e,u,h,p,g,m)})}),l.call(A.plot,e)}},{"../../components/color":38,"../../components/drawing":62,"../../components/errorbars":68,"../../lib":150,"../../lib/svg_text_utils":167,"./attributes":239,d3:14,"fast-isnumeric":17,tinycolor2:20}],247:[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;cc+l||!y(s))&&(f=!0,d(u,t))}for(var a=r.traces,o=v(e),i="fraction"===t._fullLayout.barnorm?1:100,l=i/1e9,s=e.l2c(e.c2l(0)),c="stack"===t._fullLayout.barmode?i:s,u=[s,c],f=!1,h=0;h1||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":38,"../../components/drawing":62,"../../components/errorbars":68,d3:14}],250:[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":38,"../../components/colorscale/defaults":47,"../../components/colorscale/has_colorscale":51}],251:[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"},xcalendar:n.xcalendar,ycalendar:n.ycalendar,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":37,"../../lib/extend":146,"../scatter/attributes":321}],252:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,i,l,s,c,u,f,d,h,p=o.getFromId(t,e.xaxis||"x"),g=o.getFromId(t,e.yaxis||"y"),m=e.orientation,v=[];"h"===m?(r=p,i="x",c=g,u="y"):(r=g,i="y",c=p,u="x"),l=r.makeCalcdata(e,i),o.expand(r,l,{padded:!0}),f=function(t,e,r,o,i){var l;return r in e?f=o.makeCalcdata(e,r):(l=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&-1!==["linear","log"].indexOf(o.type)||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l,0,e[r+"calendar"]),f=i.map(function(){return l})),f}(t,e,u,c,l);var y=a.distinctVals(f);return d=y.vals,h=y.minDiff/2,s=function(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,g=r.dPos*(1-u.boxgap)*(1-u.boxgroupgap)/(p?t.numboxes:1),m=p?2*r.dPos*((r.boxnum+.5)/t.numboxes-.5)*(1-u.boxgap):0,v=g*h.whiskerwidth;if(!0!==h.visible||r.emptybox)return void o.select(this).remove();"h"===h.orientation?(s=d,c=f):(s=f,c=d),r.bPos=m,r.bdPos=g,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+m,!0),r=s.c2p(t.pos+m-g,!0),n=s.c2p(t.pos+m+g,!0),a=s.c2p(t.pos+m-v,!0),l=s.c2p(t.pos+m+v,!0),u=c.c2p(t.q1,!0),f=c.c2p(t.q3,!0),d=i.constrain(c.c2p(t.med,!0),Math.min(u,f)+1,Math.max(u,f)-1),p=c.c2p(!1===h.boxpoints?t.min:t.lf,!0),y=c.c2p(!1===h.boxpoints?t.max:t.uf,!0);"h"===h.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+f+"V"+r+"ZM"+u+","+e+"H"+p+"M"+f+","+e+"H"+y+(0===h.whiskerwidth?"":"M"+p+","+a+"V"+l+"M"+y+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+u+"H"+n+"V"+f+"H"+r+"ZM"+e+","+u+"V"+p+"M"+e+","+f+"V"+y+(0===h.whiskerwidth?"":"M"+a+","+p+"H"+l+"M"+a+","+y+"H"+l))}),h.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=h}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,c,u="all"===h.boxpoints?t.val:t.val.filter(function(e){return et.uf}),f=Math.max((t.max-t.min)/10,t.q3-t.q1),d=1e-9*f,p=.01*f,v=[],y=0;if(h.jitter){if(0===f)for(y=1,v=new Array(u.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,f,d),h.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+m,!0),r=s.c2p(t.pos+m-g,!0),n=s.c2p(t.pos+m+g,!0),a=c.c2p(t.mean,!0),i=c.c2p(t.mean-t.sd,!0),l=c.c2p(t.mean+t.sd,!0);"h"===h.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==h.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==h.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z"))})})}},{"../../components/drawing":62,"../../lib":150,d3:14}],259:[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;il.end&&(l.start=l.end=(l.start+l.end)/2),e._input.contours||(e._input.contours={}),o(e._input.contours,{start:l.start,end:l.end,size:l.size}),e._input.autocontour=!0}else{var c=l.start,u=l.end,f=e._input.contours;if(c>u&&(l.start=f.start=u,u=l.end=f.end=c,c=l.start),!(l.size>0)){var d;d=c===u?1:n(c,u,e.ncontours).dtick,f.size=l.size=d}}return r}},{"../../lib":150,"../../plots/cartesian/axes":185,"../heatmap/calc":277}],263:[function(t,e,r){"use strict";var n=t("../../plots/plots"),a=t("../../components/colorbar/draw"),o=t("./make_color_map"),i=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,l="cb"+r.uid +;if(t._fullLayout._infolayer.selectAll("."+l).remove(),!r.showscale)return void n.autoMargin(t,l);var s=a(t,l);e[0].t.cb=s;var c=r.contours,u=r.line,f=c.size||1,d=c.coloring,h=o(r,{isColorbar:!0});"heatmap"===d&&s.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),s.fillcolor("fill"===d||"heatmap"===d?h:"").line({color:"lines"===d?h:u.color,width:!1!==c.showlines?u.width:0,dash:u.dash}).levels({start:c.start,end:i(c),size:f}).options(r.colorbar)()}},{"../../components/colorbar/draw":41,"../../plots/plots":214,"./end_plus":267,"./make_color_map":271}],264:[function(t,e,r){"use strict";e.exports.BOTTOMSTART=[1,9,13,104,713],e.exports.TOPSTART=[4,6,7,104,713],e.exports.LEFTSTART=[8,12,14,208,1114],e.exports.RIGHTSTART=[2,3,11,208,1114],e.exports.NEWDELTA=[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],e.exports.CHOOSESADDLE={104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},e.exports.SADDLEREMAINDER={1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11}},{}],265:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){var o,i=n.coerce2(t,e,a,"contours.start"),l=n.coerce2(t,e,a,"contours.end"),s=!1===i||!1===l,c=r("contours.size");!(o=s?e.autocontour=!0:r("autocontour",!1))&&c||r("ncontours")}},{"../../lib":150,"./attributes":261}],266:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/has_columns"),o=t("../heatmap/xyz_defaults"),i=t("./contours_defaults"),l=t("./style_defaults"),s=t("./attributes");e.exports=function(t,e,r,c){function u(r,a){return n.coerce(t,e,s,r,a)}if(!o(t,e,u,c))return void(e.visible=!1);u("text"),u("connectgaps",a(e)),i(t,e,u),l(t,e,u,c)}},{"../../lib":150,"../heatmap/has_columns":283,"../heatmap/xyz_defaults":291,"./attributes":261,"./contours_defaults":265,"./style_defaults":275}],267:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],268:[function(t,e,r){"use strict";function n(t,e,r,n){return Math.abs(t[0]-e[0])20?(g=c.CHOOSESADDLE[g][(m[0]||m[1])<0?0:1],t.crossings[p]=c.SADDLEREMAINDER[g]):delete t.crossings[p],!(m=c.NEWDELTA[g])){s.log("Found bad marching index:",g,e,t.level);break}v.push(l(t,e,m)),e[0]+=m[0],e[1]+=m[1],n(v[v.length-1],v[v.length-2],o,u)&&v.pop(),p=e.join(",");var _=m[0]&&(e[0]<0||e[0]>b-2)||m[1]&&(e[1]<0||e[1]>x-2);if(p===h&&m.join(",")===y||r&&_)break;g=t.crossings[p]}1e4===d&&s.log("Infinite loop in contour?");var w,k,M,A,T,L,z,C=n(v[0],v[v.length-1],o,u),S=0,O=.2*t.smoothing,D=[],P=0;for(d=1;d=P;d--)if((w=D[d])=P&&w+D[k]20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:-1!==c.BOTTOMSTART.indexOf(t)?a=1:-1!==c.LEFTSTART.indexOf(t)?n=1:-1!==c.TOPSTART.indexOf(t)?a=-1:n=-1,[n,a]}function l(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)]}var s=t("../../lib"),c=t("./constants");e.exports=function(t,e,r){var n,a,i,l,c;for(e=e||.01,r=r||.01,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){return t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208}return 15===r?0:r}var a=t("./constants");e.exports=function(t){var e,r,o,i,l,s,c,u,f,d=t[0].z,h=d.length,p=d[0].length,g=2===h||2===p;for(r=0;r1e3){h.warn("Too many contours, clipping at 1000",t);break}return a}function o(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 i(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 l(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=s(t,r);e?d.select(this).attr("d",e).style("stroke","none"):d.select(this).remove()})}function s(t,e){function r(t){return Math.abs(t[0]-e[2][0])<.01}for(var n,a,o,i,l,s,c=Math.min(t.z[0][0],t.z[0][1]),u=t.edgepaths.length||c<=t.level?"":"M"+e.join("L")+"Z",f=0,d=t.edgepaths.map(function(t,e){return e}),g=!0;d.length;){for(s=p.smoothopen(t.edgepaths[f],t.smoothing),u+=g?s:s.replace(/^M/,"L"),d.splice(d.indexOf(f),1),n=t.edgepaths[f][t.edgepaths[f].length-1],i=-1,o=0;o<4;o++){if(!n){h.log("Missing end?",f,t);break}for(!function(t){return Math.abs(t[1]-e[0][1])<.01}(n)||r(n)?!function(t){return Math.abs(t[0]-e[0][0])<.01}(n)?!function(t){return Math.abs(t[1]-e[2][1])<.01}(n)?r(n)&&(a=e[2]):a=e[3]:a=e[0]:a=e[1],l=0;l=0&&(a=m,i=l):Math.abs(n[1]-a[1])<.01?Math.abs(n[1]-m[1])<.01&&(m[0]-n[0])*(a[0]-m[0])>=0&&(a=m,i=l):h.log("endpt to newendpt is not vert. or horz.",n,a,m)}if(n=a,i>=0)break;u+="L"+a}if(i===t.edgepaths.length){h.log("unclosed perimeter path");break}f=i,g=-1===d.indexOf(f),g&&(f=d[0],u+="Z")}for(f=0;fO){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=u(_),N="scaled"===e.xtype?"":g,I=p(e,N,m,v,E,k),R="scaled"===e.ytype?"":y,F=p(e,R,x,b,_.length,M);L||(o.expand(k,I),o.expand(M,F));var j={x:I,y:F,z:_,text:e.text};if(l(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};j.xfill=p(B,N,m,v,E,k),j.yfill=p(B,R,x,b,_.length,M)}return[j]}},{"../../components/colorscale/calc":44,"../../lib":150,"../../plots/cartesian/axes":185,"../../registry":229,"../histogram2d/calc":302,"./clean_2d_array":278,"./convert_column_xyz":280,"./find_empties":282,"./has_columns":283,"./interp2d":286,"./make_bound_array":287,"./max_row_length":288}],278:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,a,o,i,l,s;if(e){for(r=0,l=0;l=0;i--)o=d[i],r=o[0],a=o[1],(l=((f[[r-1,a]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(s[o]=[r,a,l],d.splice(i,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(o in s)f[o]=s[o],u.push(s[o])}return u.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":288}],283:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],284:[function(t,e,r){"use strict";var n=t("../../components/fx"),a=t("../../lib"),o=n.constants.MAXDIST;e.exports=function(t,e,r,i,l){if(!(t.distance=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;wg&&(v=Math.max(v,Math.abs(t[a][o]-p)/(m-g))))}return v}var o=t("../../lib"),i=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var i,l,s=1;if(Array.isArray(r))for(i=0;i.01;i++)s=a(t,e,n(s));return s>.01&&o.log("interp2d didn't converge quickly",s),t}},{"../../lib":150}],287:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,a,o,i){var l,s,c,u=[],f=n.traceIs(t,"contour"),d=n.traceIs(t,"histogram"),h=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!d&&"category"!==i.type){var p=e.length;if(!(p<=o))return f?e.slice(0,o):e.slice(0,o+1);if(f||h)u=e.slice(0,o);else if(1===o)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],c=1;c0;)x=p.c2p(A[k]),k--;for(x0;)w=g.c2p(T[k]),k--;if(w<_&&(b=_,_=w,w=b,D=!0),L&&(A=r[0].xfill,T=r[0].yfill),"fast"!==z){var P="best"===z?0:.5;y=Math.max(-P*p._length,y),x=Math.min((1+P)*p._length,x),_=Math.max(-P*g._length,_),w=Math.min((1+P)*g._length,w)}var E=Math.round(x-y),N=Math.round(w-_),I=E<=0||N<=0,R=e.plot.select(".imagelayer").selectAll("g.hm."+v).data(I?[]:[0]);if(R.enter().append("g").classed("hm",!0).classed(v,!0),R.exit().remove(),!I){var F,j;"fast"===z?(F=S,j=C):(F=E,j=N);var B=document.createElement("canvas");B.width=F,B.height=j;var q,H,V=B.getContext("2d"),U=l.makeColorScaleFunc(l.extractScale(d.colorscale,d.zmin,d.zmax),{noNumericCheck:!0,returnArray:!0});"fast"===z?(q=O?function(t){return S-1-t}:i.identity,H=D?function(t){return C-1-t}:i.identity):(q=function(t){return i.constrain(Math.round(p.c2p(A[t])-y),0,E)},H=function(t){return i.constrain(Math.round(g.c2p(T[t])-_),0,N)});var G,X,Z,Y,W,$,Q,J=H(0),K=[J,J],tt=O?0:1,et=D?0:1,rt=0,nt=0,at=0,ot=0;if(z){var it,lt=0;try{it=new Uint8Array(E*N*4)}catch(t){it=new Array(E*N*4)}if("best"===z){var st,ct,ut,ft=new Array(A.length),dt=new Array(T.length),ht=new Array(E);for(k=0;k0&&o0&&l0&&(n=!0);for(var l=0;lo){var i=o-r[t];return r[t]=o,i}}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;o--)a(o);else if("increasing"===e){for(o=1;o=0;o--)t[o]+=t[o+1];"exclude"===r&&(t.push(0),t.shift())}}var a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/cartesian/axes"),l=t("../bar/arrays_to_calcdata"),s=t("./bin_functions"),c=t("./norm_functions"),u=t("./average"),f=t("./clean_bins");e.exports=function(t,e){if(!0===e.visible){var r,d=[],h=[],p=i.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),g="h"===e.orientation?"y":"x",m={x:"y",y:"x"}[g],v=e[g+"calendar"],y=e.cumulative;f(e,p,g);var x,b=p.makeCalcdata(e,g),_=g+"bins";!1===e["autobin"+g]&&_ in e?x=e[_]:(x=i.autoBin(b,p,e["nbins"+g],!1,v),y.enabled&&"include"!==y.currentbin&&("decreasing"===y.direction?x.start=p.c2r(p.r2c(x.start)-x.size):x.end=p.c2r(p.r2c(x.end)+x.size)),e._input[_]=e[_]=x);var w,k,M,A="string"==typeof x.size,T=A?[]:x,L=[],z=[],C=0,S=e.histnorm,O=e.histfunc,D=-1!==S.indexOf("density");y.enabled&&D&&(S=S.replace(/ ?density$/,""),D=!1);var P,E="max"===O||"min"===O,N=E?null:0,I=s.count,R=c[S],F=!1,j=function(t){return p.r2c(t,0,v)};for(Array.isArray(e[m])&&"count"!==O&&(P=e[m],F="avg"===O,I=s[O]),r=j(x.start),k=j(x.end)+(r-i.tickIncrement(r,x.size,!1,v))/1e6;r=0&&MV;r--)if(h[r]){U=r;break}for(r=V;r<=U;r++)a(d[r])&&a(h[r])&&H.push({p:d[r],s:h[r],b:0});return l(H,e),H}}},{"../../lib":150,"../../plots/cartesian/axes":185,"../bar/arrays_to_calcdata":238,"./average":293,"./bin_functions":295,"./clean_bins":297,"./norm_functions":300,"fast-isnumeric":17}],297:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical"),i=o.ONEDAY,l=o.BADNUM;e.exports=function(t,e,r){var o=e.type,s=r+"bins",c=t[s];c||(c=t[s]={});var u="date"===o?function(t){return t||0===t?a(t,l,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=u(c.start),c.end=u(c.end);var f="date"===o?i:1,d=c.size;if(n(d))c.size=d>0?Number(d):f;else if("string"!=typeof d)c.size=f;else{var h=d.charAt(0),p=d.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==o||"M"!==h||p!==Math.round(p))&&(c.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((c.start||0===c.start)&&(c.end||0===c.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":136,"../../lib":150,"fast-isnumeric":17}],298:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("../../components/color"),i=t("./bin_defaults"),l=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function f(r,n){return a.coerce(t,e,c,r,n)}var d=f("x"),h=f("y");f("cumulative.enabled")&&(f("cumulative.direction"),f("cumulative.currentbin")),f("text");var p=f("orientation",h&&!d?"h":"v"),g=e["v"===p?"x":"y"];if(!g||!g.length)return void(e.visible=!1);n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],u),e["h"===p?"x":"y"]&&f("histfunc"),i(t,e,f,"h"===p?["y"]:["x"]),l(t,e,f,r,u),s(t,e,o.defaultLine,{axis:"y"}),s(t,e,o.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":38,"../../components/errorbars/defaults":67,"../../lib":150,"../../registry":229,"../bar/style_defaults":250,"./attributes":292,"./bin_defaults":294}],299:[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":195,"../bar/hover":242,"../bar/layout_attributes":244,"../bar/layout_defaults":245,"../bar/plot":246,"../bar/set_positions":247,"../bar/style":249,"../scatter/colorbar":324,"./attributes":292,"./calc":296,"./defaults":298}],300:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;aM&&g.splice(M,g.length-M),v.length>M&&v.splice(M,v.length-M),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(a.tickIncrement(b(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(a.tickIncrement(b(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d",x),"histogram2dcontour"===e.type&&(e.ybins.start=k(a.tickIncrement(_(e.ybins.start),e.ybins.size,!0,x)),e.ybins.end=k(a.tickIncrement(_(e.ybins.end),e.ybins.size,!1,x))),e._input.ybins=e.ybins),d=[];var A,T,L=[],z=[],C="string"==typeof e.xbins.size,S="string"==typeof e.ybins.size,O=C?[]:e.xbins,D=S?[]:e.ybins,P=0,E=[],N=e.histnorm,I=e.histfunc,R=-1!==N.indexOf("density"),F="max"===I||"min"===I,j=F?null:0,B=o.count,q=i[N],H=!1,V=[],U=[],G="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";G&&"count"!==I&&(H="avg"===I,B=o[I]);var X=e.xbins,Z=b(X.start),Y=b(X.end)+(Z-a.tickIncrement(Z,X.size,!1,y))/1e6;for(h=Z;h=0&&A=0&&T")}return g};var s},{"../../components/color":38,"./helpers":313,"fast-isnumeric":17,tinycolor2:20}],312:[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")),i("marker.line.width")&&i("marker.line.color");var u=i("marker.colors");Array.isArray(u)||(e.marker.colors=[]),i("scalegroup");var f=i("text"),d=i("textinfo",Array.isArray(f)?"text+percent":"percent");if(i("hovertext"),d&&"none"!==d){var h=i("textposition"),p=Array.isArray(h)||"auto"===h,g=p||"inside"===h,m=p||"outside"===h;if(g||m){var v=l(i,"textfont",o.font);g&&l(i,"insidetextfont",v),m&&l(i,"outsidetextfont",v)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":150,"./attributes":309}],313:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":150}],314:[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":309,"./base_plot":310,"./calc":311,"./defaults":312,"./layout_attributes":315,"./layout_defaults":316,"./plot":317,"./style":318,"./style_one":319}],315:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],316:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){!function(r,o){n.coerce(t,e,a,r,o)}("hiddenlabels")}},{"../../lib":150,"./layout_attributes":315}],317:[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]}var a,o,i,l,s,c,u,f,d,h,p,g,m;for(o=0;o<2;o++)for(i=o?r:n,s=o?Math.max:Math.min,u=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(i),d=t[1-o][a],h=d.concat(f),g=[],p=0;p0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[i.i]||((t.pxmid[1]-i.pxmid[1])*u>0?(f=i.cyFinal+s(i.px0[1],i.px1[1]),(x=f-m-t.labelExtraY)*u>0&&(t.labelExtraY+=x)):(v+t.labelExtraY-y)*u>0&&(n=3*c*Math.abs(a-h.indexOf(t)),d=i.cxFinal+l(i.px0[0],i.px1[0]),(p=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*c>0&&(t.labelExtraX+=p)))}(g[p],v)}}}function l(t,e){var r,n,a,o,i,l,s,u,f,d,h=[];for(a=0;au&&(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&&-1===h.indexOf(l.scalegroup)&&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("../../components/fx"),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=(m.depth||0)*c.r*Math.sin(0)/2,y=m.tiltaxis||0,x=y*Math.PI/180,b=[v*Math.sin(x),v*Math.cos(x)],_=c.r*Math.cos(0),w=l.selectAll("g.part").data(m.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function i(n){n.originalEvent=u.event;var o=t._fullLayout,i=t._fullData[m.index],l=f.castHoverinfo(i,o,e.i);if("all"===l&&(l="label+text+value+percent+name"),t._dragging||!1===o.hovermode||"none"===l||"skip"===l||!l)return void f.hover(t,n,"pie");var s=a(e,c),d=w+e.pxmid[0]*(1-s),h=k+e.pxmid[1]*(1-s),p=r.separators,v=[];-1!==l.indexOf("label")&&v.push(e.label),-1!==l.indexOf("text")&&(i.hovertext?v.push(Array.isArray(i.hovertext)?i.hovertext[e.i]:i.hovertext):i.text&&i.text[e.i]&&v.push(i.text[e.i])),-1!==l.indexOf("value")&&v.push(g.formatPieValue(e.v,p)),-1!==l.indexOf("percent")&&v.push(g.formatPiePercent(e.v/c.vTotal,p)),f.loneHover({x0:d-s*c.r,x1:d+s*c.r,y:h,text:v.join("
"),name:-1!==l.indexOf("name")?i.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:f.castHoverOption(m,e.i,"bgcolor")||e.color,borderColor:f.castHoverOption(m,e.i,"bordercolor"),fontFamily:f.castHoverOption(m,e.i,"font.family"),fontSize:f.castHoverOption(m,e.i,"font.size"),fontColor:f.castHoverOption(m,e.i,"font.color")},{container:o._hoverlayer.node(),outerContainer:o._paper.node(),gd:t}),f.hover(t,n,"pie"),T=!0}function l(e){e.originalEvent=u.event,t.emit("plotly_unhover",{event:u.event,points:[e]}),T&&(f.loneUnhover(r._hoverlayer.node()),T=!1)}function d(){t._hoverdata=[e],t._hoverdata.trace=c.trace,f.click(t,u.event)}function x(t,r,n,a){return"a"+a*c.r+","+a*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-t[0])+","+a*(r[1]-t[1])}if(e.hidden)return void u.select(this).selectAll("path,g").remove();s[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=c.cx+b[0],k=c.cy+b[1],M=u.select(this),A=M.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),M.select("path.textline").remove(),M.on("mouseover",i).on("mouseout",l).on("click",d),m.pull){var L=+(Array.isArray(m.pull)?m.pull[e.i]:m.pull)||0;L>0&&(w+=L*e.pxmid[0],k+=L*e.pxmid[1])}e.cxFinal=w,e.cyFinal=k;var z=m.hole;if(e.v===c.vTotal){var C="M"+(w+e.px0[0])+","+(k+e.px0[1])+x(e.px0,e.pxmid,!0,1)+x(e.pxmid,e.px0,!0,1)+"Z";z?A.attr("d","M"+(w+z*e.px0[0])+","+(k+z*e.px0[1])+x(e.px0,e.pxmid,!1,z)+x(e.pxmid,e.px0,!1,z)+"Z"+C):A.attr("d",C)}else{var S=x(e.px0,e.px1,!0,1);if(z){var O=1-z;A.attr("d","M"+(w+z*e.px1[0])+","+(k+z*e.px1[1])+x(e.px1,e.px0,!1,z)+"l"+O*e.px0[0]+","+O*e.px0[1]+S+"Z")}else A.attr("d","M"+w+","+k+"l"+e.px0[0]+","+e.px0[1]+S+"Z")}var D=Array.isArray(m.textposition)?m.textposition[e.i]:m.textposition,P=M.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]);P.enter().append("g").classed("slicetext",!0),P.exit().remove(),P.each(function(){var r=u.select(this).selectAll("text").data([0]);r.enter().append("text").attr("data-notex",1),r.exit().remove(),r.text(e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(h.font,"outside"===D?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans,t);var a,i=h.bBox(r.node());"outside"===D?a=o(i,e):(a=n(i,e,c),"auto"===D&&a.scale<1&&(r.call(h.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(i=h.bBox(r.node())),a=o(i,e)));var l=w+e.pxmid[0]*a.rCenter+(a.x||0),s=k+e.pxmid[1]*a.rCenter+(a.y||0);a.outside&&(e.yLabelMin=s-i.height/2,e.yLabelMid=s,e.yLabelMax=s+i.height/2,e.labelExtraX=0,e.labelExtraY=0,v=!0),r.attr("transform","translate("+l+","+s+")"+(a.scale<1?"scale("+a.scale+")":"")+(a.rotate?"rotate("+a.rotate+")":"")+"translate("+-(i.left+i.right)/2+","+-(i.top+i.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]);Math.abs(l)>Math.abs(s)?o+="l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):o+="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":38,"../../components/drawing":62,"../../components/fx":79,"../../lib/svg_text_utils":167,"./helpers":313,d3:14}],318:[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":319,d3:14}],319:[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}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":38}],320:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var m={padded:!0},v={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,c=r.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},m.ppad=v.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(f,h,m),a.expand(d,p,v);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],324:[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":41,"../../components/colorscale":52,"../../lib":150,"../../plots/plots":214,"fast-isnumeric":17}],325:[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":44,"../../components/colorscale/has_colorscale":51,"./subtypes":341}],326:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],327:[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,p,g),v=mH!=E>=H&&(O=C[L-1][0],D=C[L][0],S=O+(D-O)*(H-P)/(E-P),F=Math.min(F,S),j=Math.max(j,S));F=Math.max(F,0),j=Math.min(j,d._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:s+10,x0:F,x1:j,y0:H,y1:H,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":38,"../../components/errorbars":68,"../../components/fx":79,"../../lib":150,"./get_trace_color":329}],331:[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":195,"./arrays_to_calcdata":320,"./attributes":321,"./calc":322,"./clean_data":323,"./colorbar":324,"./defaults":327,"./hover":330,"./plot":338,"./select":339,"./style":340,"./subtypes":341}],332:[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,l){var s=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||r)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":47,"../../components/colorscale/has_colorscale":51}],333:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var o,i,l,s,c,u,f,d,h,p,g,m,v,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],z=.2,C=new Array(t.length),S=0;for(k||(A=z=-1),o=0;oa(u))break;l=u,v=p[0]*h[0]+p[1]*h[1],v>g?(g=v,s=u,d=!1):v=t.length||!u)break;C[S++]=u,i=u}}else C[S++]=s}L.push(C.slice(0,S))}return L}},{"../../constants/numerical":136}],334:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],335:[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}],337:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(r=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?n.background:n.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":38,"../../components/colorscale/defaults":47,"../../components/colorscale/has_colorscale":51,"./subtypes":341}],338:[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,d,p){function g(t){return k?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function x(){return!1}function b(e){var r,n,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,v=x;f&&(p=o.marker.maxdisplayed||o._needsCull?m:l.identity),d&&(v=o.marker.maxdisplayed||o._needsCull?m:l.identity),n=c.selectAll("path.point"),r=n.data(p,h);var b=r.enter().append("path").classed("point",!0);k&&b.call(s.pointStyle,o,t).call(s.translatePoints,M,A,o).style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");r.order(),r.each(function(e){var r=i.select(this),n=g(r);a=s.translatePoint(e,n,M,A),a?(s.singlePointStyle(e,n,o,_,w,t),o.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):n.remove()}),k?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=c.selectAll("g"),r=n.data(v,h),r.enter().append("g").classed("textpoint",!0).append("text"),r.order(),r.each(function(t){var e=i.select(this),r=g(e.select("text"));(a=s.translatePoint(t,r,M,A))||e.remove()}),r.selectAll("text").call(s.textPointStyle,o,t).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;o(t,e,r,n,a);var k=!!p&&p.duration>0,M=r.xaxis,A=r.yaxis,T=n[0].trace,L=T.line,z=i.select(d);if(z.call(c.plot,r,p),!0===T.visible){g(z).style("opacity",T.opacity);var C,S,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=z;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",S=E._nextFill,P=E._polygons);var N,I,R,F,j,B,q,H,V,U="",G="",X=[],Z=[],Y=l.noop;if(C=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(S&&S.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(L.shape)?(R=s.steps(L.shape),F=s.steps(L.shape.split("").reverse().join(""))):R=F="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return F(t.reverse())},X=f(n,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),Y=function(t){return function(e){if(N=R(e),I=j(e),U?O?(U+="L"+N.substr(1),G=I+"L"+G.substr(1)):(U+="Z"+N,G=I+"Z"+G):(U=N,G=I),u.hasLines(T)&&e.length>1){var r=i.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",N).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",N),s.singleLineStyle(n,a)}}}}}var W=z.selectAll(".js-line").data(Z);g(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Y(!0)),X.length&&(C?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(C).attr("d","M"+H+"L"+B+"L"+U.substr(1)).call(s.singleFillStyle)):g(C).attr("d",U+"Z").call(s.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(S).attr("d",U+"Z"+D+"Z").call(s.singleFillStyle):g(S).attr("d",U+"L"+D.substr(1)+"Z").call(s.singleFillStyle),T._polygons=T._polygons.concat(P)),T._prevRevpath=G,T._prevPolygons=V);var $=z.selectAll(".points");_=$.data([n]),$.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,s=r.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=n[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=n.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),m=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),d(t,e,r),n(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),m){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":62,"../../components/errorbars":68,"../../lib":150,"../../lib/polygon":160,"./line_points":333,"./link_traces":335,"./subtypes":341,d3:14}],339:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.marker,h=!n.hasMarkers(f)&&!n.hasText(f);if(!0===f.visible&&!h){var p=Array.isArray(d.opacity)?1:d.opacity;if(!1===e)for(r=0;rM&&L.splice(M,L.length-M)}return i(e),l(A,e),A}},{"../../plots/cartesian/axes":185,"../scatter/arrays_to_calcdata":320,"../scatter/colorscale_calc":325,"../scatter/subtypes":341,"fast-isnumeric":17}],346:[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":185,"../scatter/hover":330}],348:[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":222,"../scatter/colorbar":324,"./attributes":344,"./calc":345,"./defaults":346,"./hover":347,"./plot":349,"./select":350,"./style":351}],349:[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=0;o 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -14427,7 +14495,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":28,"../drawing":52,"./arrow_paths":18,"d3":10,"fast-isnumeric":13}],26:[function(require,module,exports){ +},{"../color":34,"../drawing":58,"./arrow_paths":18,"d3":10,"fast-isnumeric":13}],27:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14452,6 +14520,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -14459,7 +14528,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":19,"./calc_autorange":20,"./click":21,"./convert_coords":22,"./defaults":23,"./draw":24}],27:[function(require,module,exports){ +},{"./attributes":19,"./calc_autorange":20,"./click":21,"./convert_coords":23,"./defaults":24,"./draw":25}],28:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":19}],29:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":146,"../../plots/cartesian/axes":181}],30:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":146,"../../plots/array_container_defaults":178,"../../plots/cartesian/axes":181,"../annotations/common_defaults":22,"./attributes":28}],31:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":207,"../annotations/draw":25}],32:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":28,"./convert":29,"./defaults":30,"./draw":31}],33:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14499,7 +14875,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],28:[function(require,module,exports){ +},{}],34:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14670,7 +15046,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":27,"fast-isnumeric":13,"tinycolor2":16}],29:[function(require,module,exports){ +},{"./attributes":33,"fast-isnumeric":13,"tinycolor2":16}],35:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14826,7 +15202,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/cartesian/layout_attributes":185,"../../plots/font_attributes":198}],30:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/cartesian/layout_attributes":192,"../../plots/font_attributes":205}],36:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14893,7 +15269,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":139,"../../plots/cartesian/tick_label_defaults":192,"../../plots/cartesian/tick_mark_defaults":193,"../../plots/cartesian/tick_value_defaults":194,"./attributes":29}],31:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/tick_label_defaults":199,"../../plots/cartesian/tick_mark_defaults":200,"../../plots/cartesian/tick_value_defaults":201,"./attributes":35}],37:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -14919,6 +15295,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -15192,7 +15570,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -15204,8 +15582,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -15218,8 +15595,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -15452,6 +15828,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -15526,7 +15903,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":139,"../../lib/extend":135,"../../lib/setcursor":154,"../../plotly":169,"../../plots/cartesian/axes":174,"../../plots/cartesian/axis_defaults":176,"../../plots/cartesian/layout_attributes":185,"../../plots/cartesian/position_defaults":188,"../../plots/plots":202,"../../registry":209,"../color":28,"../dragelement":49,"../drawing":52,"../titles":117,"./attributes":29,"d3":10,"tinycolor2":16}],32:[function(require,module,exports){ +},{"../../constants/alignment":130,"../../lib":146,"../../lib/extend":142,"../../lib/setcursor":161,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/cartesian/axes":181,"../../plots/cartesian/axis_defaults":183,"../../plots/cartesian/layout_attributes":192,"../../plots/cartesian/position_defaults":195,"../../plots/plots":210,"../../registry":217,"../color":34,"../dragelement":55,"../drawing":58,"../titles":123,"./attributes":35,"d3":10,"tinycolor2":16}],38:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15545,7 +15922,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":139}],33:[function(require,module,exports){ +},{"../../lib":146}],39:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15600,7 +15977,7 @@ module.exports = { } }; -},{}],34:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15679,7 +16056,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":139,"./flip_scale":39,"./scales":46}],35:[function(require,module,exports){ +},{"../../lib":146,"./flip_scale":45,"./scales":52}],41:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15723,7 +16100,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":135,"./attributes":33,"./scales.js":46}],36:[function(require,module,exports){ +},{"../../lib/extend":142,"./attributes":39,"./scales.js":52}],42:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15739,7 +16116,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":46}],37:[function(require,module,exports){ +},{"./scales":52}],43:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15803,7 +16180,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":139,"../colorbar/defaults":30,"../colorbar/has_colorbar":32,"./flip_scale":39,"./is_valid_scale":43,"fast-isnumeric":13}],38:[function(require,module,exports){ +},{"../../lib":146,"../colorbar/defaults":36,"../colorbar/has_colorbar":38,"./flip_scale":45,"./is_valid_scale":49,"fast-isnumeric":13}],44:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15840,7 +16217,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],39:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15865,7 +16242,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],40:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15905,7 +16282,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":36,"./is_valid_scale_array":44,"./scales":46}],41:[function(require,module,exports){ +},{"./default_scale":42,"./is_valid_scale_array":50,"./scales":52}],47:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15951,7 +16328,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":139,"./is_valid_scale":43,"fast-isnumeric":13}],42:[function(require,module,exports){ +},{"../../lib":146,"./is_valid_scale":49,"fast-isnumeric":13}],48:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15985,7 +16362,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":33,"./calc":34,"./default_scale":36,"./defaults":37,"./extract_scale":38,"./flip_scale":39,"./get_scale":40,"./has_colorscale":41,"./is_valid_scale":43,"./make_color_scale_func":45,"./scales":46}],43:[function(require,module,exports){ +},{"./attributes":39,"./calc":40,"./default_scale":42,"./defaults":43,"./extract_scale":44,"./flip_scale":45,"./get_scale":46,"./has_colorscale":47,"./is_valid_scale":49,"./make_color_scale_func":51,"./scales":52}],49:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16006,7 +16383,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":44,"./scales":46}],44:[function(require,module,exports){ +},{"./is_valid_scale_array":50,"./scales":52}],50:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16043,7 +16420,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":16}],45:[function(require,module,exports){ +},{"tinycolor2":16}],51:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16139,7 +16516,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":28,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],46:[function(require,module,exports){ +},{"../color":34,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],52:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16270,7 +16647,7 @@ module.exports = { ] }; -},{}],47:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16303,7 +16680,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],48:[function(require,module,exports){ +},{}],54:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16341,7 +16718,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":139}],49:[function(require,module,exports){ +},{"../../lib":146}],55:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16370,6 +16747,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -16388,28 +16774,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -16460,10 +16838,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -16510,10 +16884,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -16543,7 +16913,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":124,"../../lib":139,"../../plotly":169,"../../plots/cartesian/constants":179,"./align":47,"./cursor":48,"./unhover":50}],50:[function(require,module,exports){ +},{"../../constants/interactions":131,"../../lib":146,"../../plotly":176,"../../plots/cartesian/constants":186,"./align":53,"./cursor":54,"./unhover":56}],56:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16599,7 +16969,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":134}],51:[function(require,module,exports){ +},{"../../lib/events":141}],57:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16623,7 +16993,7 @@ exports.dash = { }; -},{}],52:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16646,6 +17016,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -16667,13 +17040,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -16682,7 +17061,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -16697,7 +17076,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -16783,6 +17161,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -17009,7 +17397,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -17017,7 +17405,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -17038,9 +17425,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -17071,21 +17457,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -17224,34 +17605,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -17272,18 +17706,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -17438,17 +17883,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":127,"../../lib":139,"../../lib/svg_text_utils":156,"../../registry":209,"../../traces/scatter/make_bubble_size_func":288,"../../traces/scatter/subtypes":293,"../color":28,"../colorscale":42,"./symbol_defs":53,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],53:[function(require,module,exports){ +},{"../../constants/alignment":130,"../../constants/xmlns_namespaces":134,"../../lib":146,"../../lib/svg_text_utils":163,"../../registry":217,"../../traces/scatter/make_bubble_size_func":296,"../../traces/scatter/subtypes":301,"../color":34,"../colorscale":48,"./symbol_defs":59,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],59:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17924,7 +18359,7 @@ module.exports = { } }; -},{"d3":10}],54:[function(require,module,exports){ +},{"d3":10}],60:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18023,7 +18458,7 @@ module.exports = { } }; -},{}],55:[function(require,module,exports){ +},{}],61:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18086,7 +18521,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":174,"../../registry":209,"./compute_error":56,"fast-isnumeric":13}],56:[function(require,module,exports){ +},{"../../plots/cartesian/axes":181,"../../registry":217,"./compute_error":62,"fast-isnumeric":13}],62:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18182,7 +18617,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],57:[function(require,module,exports){ +},{}],63:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18259,7 +18694,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":139,"../../registry":209,"./attributes":54,"fast-isnumeric":13}],58:[function(require,module,exports){ +},{"../../lib":146,"../../registry":217,"./attributes":60,"fast-isnumeric":13}],64:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18318,7 +18753,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":54,"./calc":55,"./defaults":57,"./plot":59,"./style":60}],59:[function(require,module,exports){ +},{"./attributes":60,"./calc":61,"./defaults":63,"./plot":65,"./style":66}],65:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18482,7 +18917,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":293,"d3":10,"fast-isnumeric":13}],60:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":301,"d3":10,"fast-isnumeric":13}],66:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18519,7 +18954,7 @@ module.exports = function style(traces) { }); }; -},{"../color":28,"d3":10}],61:[function(require,module,exports){ +},{"../color":34,"d3":10}],67:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18555,7 +18990,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":198}],62:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":205}],68:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18571,30 +19006,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; + + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":139,"../../registry":209}],63:[function(require,module,exports){ +},{"../../lib":146,"../../registry":217}],69:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18606,10 +19057,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -18623,7 +19083,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":209}],64:[function(require,module,exports){ +},{"../../registry":217,"./hover":73}],70:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18655,7 +19115,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],65:[function(require,module,exports){ +},{}],71:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18678,7 +19138,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":139,"./attributes":61,"./hoverlabel_defaults":68}],66:[function(require,module,exports){ +},{"../../lib":146,"./attributes":67,"./hoverlabel_defaults":74}],72:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18689,6 +19149,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -18765,7 +19226,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":64}],67:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":146,"./constants":70}],73:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18834,7 +19321,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -18846,13 +19333,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -18929,15 +19416,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -19122,11 +19609,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -19225,6 +19712,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -19258,7 +19746,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -19272,7 +19760,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -19291,7 +19779,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -19326,7 +19814,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -19363,23 +19851,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -19395,14 +19876,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -19492,7 +19968,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -19508,12 +19986,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -19525,11 +20001,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -19797,17 +20271,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -19824,6 +20293,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -19891,7 +20384,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -19901,29 +20394,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -20075,7 +20545,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":139,"../../lib/events":134,"../../lib/override_cursor":148,"../../lib/svg_text_utils":156,"../../plots/cartesian/axes":174,"../../registry":209,"../color":28,"../dragelement":49,"../drawing":52,"./constants":64,"./helpers":66,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],68:[function(require,module,exports){ +},{"../../lib":146,"../../lib/events":141,"../../lib/override_cursor":155,"../../lib/svg_text_utils":163,"../../plots/cartesian/axes":181,"../../registry":217,"../color":34,"../dragelement":55,"../drawing":58,"./constants":70,"./helpers":72,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],74:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20096,7 +20566,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":139}],69:[function(require,module,exports){ +},{"../../lib":146}],75:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20134,7 +20604,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -20156,23 +20629,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":139,"../dragelement":49,"./attributes":61,"./calc":62,"./click":63,"./constants":64,"./defaults":65,"./helpers":66,"./hover":67,"./layout_attributes":70,"./layout_defaults":71,"./layout_global_defaults":72,"d3":10}],70:[function(require,module,exports){ +},{"../../lib":146,"../dragelement":55,"./attributes":67,"./calc":68,"./click":69,"./constants":70,"./defaults":71,"./helpers":72,"./hover":73,"./layout_attributes":76,"./layout_defaults":77,"./layout_global_defaults":78,"d3":10}],76:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20225,7 +20696,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":198,"./constants":64}],71:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":205,"./constants":70}],77:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20273,7 +20744,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":139,"./layout_attributes":70}],72:[function(require,module,exports){ +},{"../../lib":146,"./layout_attributes":76}],78:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20296,7 +20767,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":139,"./hoverlabel_defaults":68,"./layout_attributes":70}],73:[function(require,module,exports){ +},{"../../lib":146,"./hoverlabel_defaults":74,"./layout_attributes":76}],79:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20418,7 +20889,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":179}],74:[function(require,module,exports){ +},{"../../plots/cartesian/constants":186}],80:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20501,7 +20972,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":157,"fast-isnumeric":13}],75:[function(require,module,exports){ +},{"../../lib/to_log_range":164,"fast-isnumeric":13}],81:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20562,7 +21033,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":139,"../../plots/array_container_defaults":171,"../../plots/cartesian/axes":174,"./attributes":73}],76:[function(require,module,exports){ +},{"../../lib":146,"../../plots/array_container_defaults":178,"../../plots/cartesian/axes":181,"./attributes":79}],82:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20783,7 +21254,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":127,"../../plots/cartesian/axes":174,"../drawing":52,"d3":10}],77:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":134,"../../plots/cartesian/axes":181,"../drawing":58,"d3":10}],83:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20806,7 +21277,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":73,"./convert_coords":74,"./defaults":75,"./draw":76}],78:[function(require,module,exports){ +},{"./attributes":79,"./convert_coords":80,"./defaults":81,"./draw":82}],84:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20855,7 +21326,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],79:[function(require,module,exports){ +},{}],85:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20946,7 +21417,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":198,"../color/attributes":27}],80:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":205,"../color/attributes":33}],86:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20964,7 +21435,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],81:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21057,7 +21528,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":139,"../../plots/layout_attributes":200,"../../registry":209,"./attributes":79,"./helpers":84}],82:[function(require,module,exports){ +},{"../../lib":146,"../../plots/layout_attributes":208,"../../registry":217,"./attributes":85,"./helpers":90}],88:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21082,6 +21553,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -21171,7 +21644,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -21377,6 +21850,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -21428,30 +21902,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -21616,20 +22084,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -21637,18 +22106,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -21883,7 +22353,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":124,"../../lib":139,"../../lib/svg_text_utils":156,"../../plotly":169,"../../plots/plots":202,"../../registry":209,"../color":28,"../dragelement":49,"../drawing":52,"./anchor_utils":78,"./constants":80,"./get_legend_data":83,"./helpers":84,"./style":86,"d3":10}],83:[function(require,module,exports){ +},{"../../constants/alignment":130,"../../constants/interactions":131,"../../lib":146,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/plots":210,"../../registry":217,"../color":34,"../dragelement":55,"../drawing":58,"./anchor_utils":84,"./constants":86,"./get_legend_data":89,"./helpers":90,"./style":92,"d3":10}],89:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21988,7 +22458,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":209,"./helpers":84}],84:[function(require,module,exports){ +},{"../../registry":217,"./helpers":90}],90:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22019,7 +22489,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":209}],85:[function(require,module,exports){ +},{"../../registry":217}],91:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22043,7 +22513,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":79,"./defaults":81,"./draw":82,"./style":86}],86:[function(require,module,exports){ +},{"./attributes":85,"./defaults":87,"./draw":88,"./style":92}],92:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22066,7 +22536,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -22104,179 +22574,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } + + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); -},{"../../lib":139,"../../registry":209,"../../traces/pie/style_one":271,"../../traces/scatter/subtypes":293,"../color":28,"../drawing":52,"d3":10}],87:[function(require,module,exports){ + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; + +},{"../../lib":146,"../../registry":217,"../../traces/pie/style_one":279,"../../traces/scatter/subtypes":301,"../color":34,"../drawing":58,"d3":10}],93:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22854,7 +23324,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":139,"../../plotly":169,"../../plots/cartesian/axes":174,"../../plots/plots":202,"../../snapshot/download":211}],88:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":146,"../../plotly":176,"../../plots/cartesian/axes":181,"../../plots/plots":210,"../../snapshot/download":219}],94:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22868,7 +23338,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":89}],89:[function(require,module,exports){ +},{"./manage":95}],95:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22992,7 +23462,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -23044,7 +23514,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -23096,7 +23566,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":174,"../../traces/scatter/subtypes":293,"./buttons":87,"./modebar":90}],90:[function(require,module,exports){ +},{"../../plots/cartesian/axes":181,"../../traces/scatter/subtypes":301,"./buttons":93,"./modebar":96}],96:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23390,7 +23860,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":139,"d3":10}],91:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":146,"d3":10}],97:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23480,7 +23950,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":198,"../color/attributes":27,"./button_attributes":92}],92:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":205,"../color/attributes":33,"./button_attributes":98}],98:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23521,7 +23991,7 @@ module.exports = { } }; -},{}],93:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23550,7 +24020,7 @@ module.exports = { darkAmount: 10 }; -},{}],94:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23649,7 +24119,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":139,"../color":28,"./attributes":91,"./button_attributes":92,"./constants":93}],95:[function(require,module,exports){ +},{"../../lib":146,"../color":34,"./attributes":97,"./button_attributes":98,"./constants":99}],101:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23671,6 +24141,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -23711,7 +24183,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -23798,11 +24270,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -23834,26 +24304,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -23872,13 +24339,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -23924,7 +24386,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":156,"../../plotly":169,"../../plots/cartesian/axis_ids":177,"../../plots/plots":202,"../color":28,"../drawing":52,"../legend/anchor_utils":78,"./constants":93,"./get_update_object":96,"d3":10}],96:[function(require,module,exports){ +},{"../../constants/alignment":130,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/cartesian/axis_ids":184,"../../plots/plots":210,"../color":34,"../drawing":58,"../legend/anchor_utils":84,"./constants":99,"./get_update_object":102,"d3":10}],102:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23981,7 +24443,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":10}],97:[function(require,module,exports){ +},{"d3":10}],103:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24008,7 +24470,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":91,"./defaults":94,"./draw":95}],98:[function(require,module,exports){ +},{"./attributes":97,"./defaults":100,"./draw":101}],104:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24072,7 +24534,7 @@ module.exports = { } }; -},{"../color/attributes":27}],99:[function(require,module,exports){ +},{"../color/attributes":33}],105:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24108,7 +24570,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":174,"./constants":100}],100:[function(require,module,exports){ +},{"../../plots/cartesian/axes":181,"./constants":106}],106:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24160,7 +24622,7 @@ module.exports = { extraPad: 15 }; -},{}],101:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24217,7 +24679,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":139,"./attributes":98}],102:[function(require,module,exports){ +},{"../../lib":146,"./attributes":104}],108:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24768,7 +25230,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":139,"../../lib/setcursor":154,"../../plotly":169,"../../plots/cartesian":184,"../../plots/cartesian/axes":174,"../../plots/plots":202,"../color":28,"../dragelement":49,"../drawing":52,"./constants":100,"d3":10}],103:[function(require,module,exports){ +},{"../../lib":146,"../../lib/setcursor":161,"../../plotly":176,"../../plots/cartesian":191,"../../plots/cartesian/axes":181,"../../plots/plots":210,"../color":34,"../dragelement":55,"../drawing":58,"./constants":106,"d3":10}],109:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24795,7 +25257,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":98,"./calc_autorange":99,"./defaults":101,"./draw":102}],104:[function(require,module,exports){ +},{"./attributes":104,"./calc_autorange":105,"./defaults":107,"./draw":108}],110:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24892,7 +25354,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../traces/scatter/attributes":273,"../annotations/attributes":19,"../drawing/attributes":51}],105:[function(require,module,exports){ +},{"../../lib/extend":142,"../../traces/scatter/attributes":281,"../annotations/attributes":19,"../drawing/attributes":57}],111:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24938,7 +25400,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -24969,7 +25431,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":139,"../../plots/cartesian/axes":174,"./constants":106,"./helpers":109}],106:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"./constants":112,"./helpers":115}],112:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25033,7 +25495,7 @@ module.exports = { } }; -},{}],107:[function(require,module,exports){ +},{}],113:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25058,7 +25520,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":171,"./shape_defaults":111}],108:[function(require,module,exports){ +},{"../../plots/array_container_defaults":178,"./shape_defaults":117}],114:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25191,8 +25653,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -25201,6 +25663,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -25433,7 +25897,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":139,"../../lib/setcursor":154,"../../plotly":169,"../../plots/cartesian/axes":174,"../color":28,"../dragelement":49,"../drawing":52,"./constants":106,"./helpers":109}],109:[function(require,module,exports){ +},{"../../lib":146,"../../lib/setcursor":161,"../../plotly":176,"../../plots/cartesian/axes":181,"../color":34,"../dragelement":55,"../drawing":58,"./constants":112,"./helpers":115}],115:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25514,7 +25978,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],110:[function(require,module,exports){ +},{}],116:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25540,7 +26004,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":104,"./calc_autorange":105,"./defaults":107,"./draw":108}],111:[function(require,module,exports){ +},{"./attributes":110,"./calc_autorange":111,"./defaults":113,"./draw":114}],117:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25639,7 +26103,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":139,"../../plots/cartesian/axes":174,"./attributes":104,"./helpers":109}],112:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"./attributes":110,"./helpers":115}],118:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25662,7 +26126,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -25687,6 +26151,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -25873,7 +26343,7 @@ module.exports = { }, }; -},{"../../lib/extend":135,"../../plots/animation_attributes":170,"../../plots/font_attributes":198,"../../plots/pad_attributes":201,"./constants":113}],113:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/animation_attributes":177,"../../plots/font_attributes":205,"../../plots/pad_attributes":209,"./constants":119}],119:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25921,9 +26391,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -25970,7 +26437,7 @@ module.exports = { currentValueInset: 0, }; -},{}],114:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26068,14 +26535,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -26083,7 +26552,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":139,"../../plots/array_container_defaults":171,"./attributes":112,"./constants":113}],115:[function(require,module,exports){ +},{"../../lib":146,"../../plots/array_container_defaults":178,"./attributes":118,"./constants":119}],121:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26104,11 +26573,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -26172,24 +26642,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -26217,14 +26681,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -26234,26 +26696,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -26280,6 +26724,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -26371,7 +26840,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -26388,9 +26860,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; + + svgTextUtils.positionText(text, x0, y0); return text; } @@ -26422,11 +26899,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -26453,7 +26933,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -26495,7 +26981,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -26685,7 +27173,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":156,"../../plots/plots":202,"../color":28,"../drawing":52,"../legend/anchor_utils":78,"./constants":113,"d3":10}],116:[function(require,module,exports){ +},{"../../constants/alignment":130,"../../lib/svg_text_utils":163,"../../plots/plots":210,"../color":34,"../drawing":58,"../legend/anchor_utils":84,"./constants":119,"d3":10}],122:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26708,7 +27196,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":112,"./constants":113,"./defaults":114,"./draw":115}],117:[function(require,module,exports){ +},{"./attributes":118,"./constants":119,"./defaults":120,"./draw":121}],123:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26731,6 +27219,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -26763,29 +27252,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -26794,7 +27288,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -26803,6 +27297,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -26822,11 +27319,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -26838,33 +27332,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -26895,8 +27389,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -26904,8 +27397,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -26916,11 +27408,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -26930,18 +27422,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":124,"../../lib":139,"../../lib/svg_text_utils":156,"../../plotly":169,"../../plots/plots":202,"../color":28,"../drawing":52,"d3":10,"fast-isnumeric":13}],118:[function(require,module,exports){ +},{"../../constants/interactions":131,"../../lib":146,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/plots":210,"../color":34,"../drawing":58,"d3":10,"fast-isnumeric":13}],124:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26962,7 +27450,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -26983,6 +27471,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -27088,7 +27582,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":198,"../../plots/pad_attributes":201,"../color/attributes":27}],119:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":205,"../../plots/pad_attributes":209,"../color/attributes":33}],125:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27135,9 +27629,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -27161,10 +27652,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],120:[function(require,module,exports){ +},{}],126:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27243,13 +27742,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -27258,7 +27759,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":139,"../../plots/array_container_defaults":171,"./attributes":118,"./constants":119}],121:[function(require,module,exports){ +},{"../../lib":146,"../../plots/array_container_defaults":178,"./attributes":124,"./constants":125}],127:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27278,6 +27779,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -27463,7 +27966,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -27475,7 +27978,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -27583,7 +28086,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -27592,7 +28095,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -27693,9 +28198,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -27715,18 +28220,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -27777,19 +28285,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -27883,34 +28390,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); - - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -27926,8 +28428,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -27938,9 +28440,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":156,"../../plots/plots":202,"../color":28,"../drawing":52,"../legend/anchor_utils":78,"./constants":119,"./scrollbox":123,"d3":10}],122:[function(require,module,exports){ -arguments[4][116][0].apply(exports,arguments) -},{"./attributes":118,"./constants":119,"./defaults":120,"./draw":121,"dup":116}],123:[function(require,module,exports){ +},{"../../constants/alignment":130,"../../lib/svg_text_utils":163,"../../plots/plots":210,"../color":34,"../drawing":58,"../legend/anchor_utils":84,"./constants":125,"./scrollbox":129,"d3":10}],128:[function(require,module,exports){ +arguments[4][122][0].apply(exports,arguments) +},{"./attributes":124,"./constants":125,"./defaults":126,"./draw":127,"dup":122}],129:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28411,7 +28913,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":139,"../color":28,"../drawing":52,"d3":10}],124:[function(require,module,exports){ +},{"../../lib":146,"../color":34,"../drawing":58,"d3":10}],130:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],131:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28435,7 +28973,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],125:[function(require,module,exports){ +},{}],132:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28488,7 +29026,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],126:[function(require,module,exports){ +},{}],133:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28526,7 +29064,7 @@ module.exports = { }; -},{}],127:[function(require,module,exports){ +},{}],134:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28550,7 +29088,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],128:[function(require,module,exports){ +},{}],135:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28568,7 +29106,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -28609,6 +29147,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -28630,7 +29169,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":26,"./components/fx":69,"./components/images":77,"./components/legend":85,"./components/rangeselector":97,"./components/rangeslider":103,"./components/shapes":110,"./components/sliders":116,"./components/updatemenus":122,"./fonts/mathjax_config":129,"./lib/queue":151,"./plot_api/plot_schema":163,"./plot_api/register":164,"./plot_api/set_plot_config":165,"./plot_api/to_image":167,"./plot_api/validate":168,"./plotly":169,"./snapshot":214,"./snapshot/download":211,"./traces/scatter":283,"d3":10,"es6-promise":11}],129:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":27,"./components/annotations3d":32,"./components/fx":75,"./components/images":83,"./components/legend":91,"./components/rangeselector":103,"./components/rangeslider":109,"./components/shapes":116,"./components/sliders":122,"./components/updatemenus":128,"./fonts/mathjax_config":136,"./lib/queue":158,"./plot_api/plot_schema":170,"./plot_api/register":171,"./plot_api/set_plot_config":172,"./plot_api/to_image":174,"./plot_api/validate":175,"./plotly":176,"./snapshot":222,"./snapshot/download":219,"./traces/scatter":291,"d3":10,"es6-promise":11}],136:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28663,7 +29202,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],130:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28696,7 +29235,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":125,"fast-isnumeric":13}],131:[function(require,module,exports){ +},{"../constants/numerical":132,"fast-isnumeric":13}],138:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28711,6 +29250,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -28736,6 +29276,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -28988,6 +29542,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -29007,7 +29590,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":40,"../components/colorscale/scales":46,"./nested_property":145,"fast-isnumeric":13,"tinycolor2":16}],132:[function(require,module,exports){ +},{"../components/colorscale/get_scale":46,"../components/colorscale/scales":52,"../plots/attributes":179,"./nested_property":152,"fast-isnumeric":13,"tinycolor2":16}],139:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29635,7 +30218,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":125,"../registry":209,"./loggers":142,"./mod":144,"d3":10,"fast-isnumeric":13}],133:[function(require,module,exports){ +},{"../constants/numerical":132,"../registry":217,"./loggers":149,"./mod":151,"d3":10,"fast-isnumeric":13}],140:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29664,7 +30247,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],134:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29830,7 +30413,7 @@ var Events = { module.exports = Events; -},{"events":12}],135:[function(require,module,exports){ +},{"events":12}],142:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29944,7 +30527,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":141}],136:[function(require,module,exports){ +},{"./is_plain_object.js":148}],143:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29995,7 +30578,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],137:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30026,7 +30609,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],138:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30042,7 +30625,7 @@ module.exports = function filterVisible(container) { module.exports = function identity(d) { return d; }; -},{}],139:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30055,6 +30638,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -30071,6 +30659,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -30132,6 +30721,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -30382,6 +30978,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -30389,6 +30994,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -30429,7 +31079,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -30459,13 +31109,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -30706,7 +31349,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":130,"./coerce":131,"./dates":132,"./ensure_array":133,"./extend":135,"./filter_unique":136,"./filter_visible":137,"./identity":138,"./is_array":140,"./is_plain_object":141,"./loggers":142,"./matrix":143,"./mod":144,"./nested_property":145,"./noop":146,"./notifier":147,"./push_unique":150,"./relink_private":152,"./search":153,"./stats":155,"./to_log_range":157,"d3":10}],140:[function(require,module,exports){ +},{"../constants/numerical":132,"./clean_number":137,"./coerce":138,"./dates":139,"./ensure_array":140,"./extend":142,"./filter_unique":143,"./filter_visible":144,"./identity":145,"./is_array":147,"./is_plain_object":148,"./loggers":149,"./matrix":150,"./mod":151,"./nested_property":152,"./noop":153,"./notifier":154,"./push_unique":157,"./relink_private":159,"./search":160,"./stats":162,"./to_log_range":164,"d3":10,"fast-isnumeric":13}],147:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30730,7 +31373,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],141:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30759,7 +31402,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],142:[function(require,module,exports){ +},{}],149:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30833,7 +31476,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":162}],143:[function(require,module,exports){ +},{"../plot_api/plot_config":169}],150:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30943,7 +31586,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],144:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30963,7 +31606,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],145:[function(require,module,exports){ +},{}],152:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31267,7 +31910,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":158,"./is_array":140,"./is_plain_object":141,"fast-isnumeric":13}],146:[function(require,module,exports){ +},{"../plot_api/container_array_match":165,"./is_array":147,"./is_plain_object":148,"fast-isnumeric":13}],153:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31283,7 +31926,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],147:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31365,7 +32008,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":10,"fast-isnumeric":13}],148:[function(require,module,exports){ +},{"d3":10,"fast-isnumeric":13}],155:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31414,7 +32057,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":154}],149:[function(require,module,exports){ +},{"./setcursor":161}],156:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31655,7 +32298,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":125,"./matrix":143}],150:[function(require,module,exports){ +},{"../constants/numerical":132,"./matrix":150}],157:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31693,7 +32336,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],151:[function(require,module,exports){ +},{}],158:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31904,7 +32547,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":139,"../plot_api/plot_config":162}],152:[function(require,module,exports){ +},{"../lib":146,"../plot_api/plot_config":169}],159:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31961,7 +32604,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":140,"./is_plain_object":141}],153:[function(require,module,exports){ +},{"./is_array":147,"./is_plain_object":148}],160:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32072,7 +32715,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":142,"fast-isnumeric":13}],154:[function(require,module,exports){ +},{"./loggers":149,"fast-isnumeric":13}],161:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32095,7 +32738,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],155:[function(require,module,exports){ +},{}],162:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32191,7 +32834,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":13}],156:[function(require,module,exports){ +},{"fast-isnumeric":13}],163:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32210,62 +32853,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -32273,42 +32861,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); + .style('white-space', 'pre'); - result = _context.appendSVG(converted); + var hasLink = buildSVGText(_context.node(), str); - if(!result) _context.text(str); - - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -32316,14 +32906,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -32338,7 +32929,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -32355,36 +32950,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -32397,9 +32992,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -32430,23 +33028,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' +}; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' }; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -32457,24 +33067,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -32485,26 +33114,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -32514,122 +33149,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -32666,28 +33376,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + context.style({'pointer-events': _delegate ? 'none' : 'all'}); + + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -32702,63 +33425,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -32770,10 +33492,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":126,"../constants/xmlns_namespaces":127,"../lib":139,"d3":10}],157:[function(require,module,exports){ +},{"../constants/alignment":130,"../constants/string_mappings":133,"../constants/xmlns_namespaces":134,"../lib":146,"d3":10}],164:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32801,7 +33523,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":13}],158:[function(require,module,exports){ +},{"fast-isnumeric":13}],165:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32859,7 +33581,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":209}],159:[function(require,module,exports){ +},{"../registry":217}],166:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33077,7 +33799,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -33210,18 +33931,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -33277,7 +34018,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -33380,7 +34121,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":28,"../lib":139,"../plots/cartesian/axes":174,"../plots/plots":202,"../registry":209,"fast-isnumeric":13,"gl-mat4/fromQuat":14}],160:[function(require,module,exports){ +},{"../components/color":34,"../lib":146,"../plots/cartesian/axes":181,"../plots/plots":210,"../registry":217,"fast-isnumeric":13,"gl-mat4/fromQuat":14}],167:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33594,7 +34335,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":141,"../lib/loggers":142,"../lib/nested_property":145,"../lib/noop":146,"../lib/search":153,"../registry":209,"./container_array_match":158}],161:[function(require,module,exports){ +},{"../lib/is_plain_object":148,"../lib/loggers":149,"../lib/nested_property":152,"../lib/noop":153,"../lib/search":160,"../registry":217,"./container_array_match":165}],168:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33629,7 +34370,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -33786,9 +34529,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -33817,19 +34558,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; - - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); + if(JSON.stringify(fullLayout._size) === oldmargins) return; - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -33867,7 +34608,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -33967,6 +34711,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -34064,7 +34809,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -34073,9 +34818,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -34090,11 +34836,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -34980,6 +35725,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -35079,6 +35825,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -35510,10 +36259,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -35535,7 +36286,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -35543,7 +36295,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -35556,11 +36308,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -35640,6 +36406,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -35738,7 +36505,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -35786,7 +36562,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -36620,7 +37396,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":52,"../components/errorbars":58,"../constants/xmlns_namespaces":127,"../lib":139,"../lib/events":134,"../lib/queue":151,"../lib/svg_text_utils":156,"../plotly":169,"../plots/cartesian/axis_ids":177,"../plots/cartesian/constants":179,"../plots/cartesian/constraints":181,"../plots/cartesian/graph_interact":183,"../plots/plots":202,"../plots/polar":205,"../registry":209,"./helpers":159,"./manage_arrays":160,"./subroutines":166,"d3":10,"fast-isnumeric":13}],162:[function(require,module,exports){ +},{"../components/drawing":58,"../components/errorbars":64,"../constants/xmlns_namespaces":134,"../lib":146,"../lib/events":141,"../lib/queue":158,"../lib/svg_text_utils":163,"../plotly":176,"../plots/cartesian/axis_ids":184,"../plots/cartesian/constants":186,"../plots/cartesian/constraints":188,"../plots/cartesian/graph_interact":190,"../plots/plots":210,"../plots/polar":213,"../registry":217,"./helpers":166,"./manage_arrays":167,"./subroutines":173,"d3":10,"fast-isnumeric":13}],169:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -36746,7 +37522,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],163:[function(require,module,exports){ +},{}],170:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -36905,7 +37681,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -36925,9 +37704,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -37152,7 +37930,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":139,"../plots/animation_attributes":170,"../plots/attributes":172,"../plots/frame_attributes":199,"../plots/layout_attributes":200,"../plots/polar/area_attributes":203,"../plots/polar/axis_attributes":204,"../registry":209}],164:[function(require,module,exports){ +},{"../lib":146,"../plots/animation_attributes":177,"../plots/attributes":179,"../plots/frame_attributes":206,"../plots/layout_attributes":208,"../plots/polar/area_attributes":211,"../plots/polar/axis_attributes":212,"../registry":217}],171:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37251,7 +38029,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":139,"../registry":209}],165:[function(require,module,exports){ +},{"../lib":146,"../registry":217}],172:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37277,7 +38055,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":139,"../plotly":169}],166:[function(require,module,exports){ +},{"../lib":146,"../plotly":176}],173:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37406,15 +38184,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -37534,27 +38313,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -37655,19 +38436,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -37684,7 +38468,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":28,"../components/drawing":52,"../components/modebar":88,"../components/titles":117,"../lib":139,"../plotly":169,"../plots/cartesian/graph_interact":183,"../plots/plots":202,"../registry":209,"d3":10}],167:[function(require,module,exports){ +},{"../components/color":34,"../components/drawing":58,"../components/modebar":94,"../components/titles":123,"../lib":146,"../plotly":176,"../plots/cartesian/graph_interact":190,"../plots/plots":210,"../registry":217,"d3":10}],174:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37794,7 +38578,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":139,"../plotly":169,"../snapshot/cloneplot":210,"../snapshot/helpers":213,"../snapshot/svgtoimg":215,"../snapshot/tosvg":217,"fast-isnumeric":13}],168:[function(require,module,exports){ +},{"../lib":146,"../plotly":176,"../snapshot/cloneplot":218,"../snapshot/helpers":221,"../snapshot/svgtoimg":223,"../snapshot/tosvg":225,"fast-isnumeric":13}],175:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38016,6 +38800,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -38064,6 +38853,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -38081,7 +38880,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -38098,8 +38897,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -38165,7 +38964,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":139,"../plots/plots":202,"./plot_schema":163}],169:[function(require,module,exports){ +},{"../lib":146,"../plots/plots":210,"./plot_schema":170}],176:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38199,7 +38998,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":88,"./plot_api/plot_api":161,"./plot_api/plot_config":162,"./plots/cartesian/axes":174,"./plots/plots":202}],170:[function(require,module,exports){ +},{"./components/modebar":94,"./plot_api/plot_api":168,"./plot_api/plot_config":169,"./plots/cartesian/axes":181,"./plots/plots":210}],177:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38301,7 +39100,7 @@ module.exports = { } }; -},{}],171:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38382,7 +39181,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":139}],172:[function(require,module,exports){ +},{"../lib":146}],179:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38439,11 +39238,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -38467,7 +39275,7 @@ module.exports = { } }; -},{"../components/fx/attributes":61}],173:[function(require,module,exports){ +},{"../components/fx/attributes":67}],180:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38494,7 +39302,7 @@ module.exports = { } }; -},{}],174:[function(require,module,exports){ +},{}],181:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38524,7 +39332,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -38597,33 +39404,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -38864,6 +39665,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -38959,6 +39763,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -40310,10 +41121,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -40346,17 +41157,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -40822,7 +41626,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":28,"../../components/drawing":52,"../../components/titles":117,"../../constants/numerical":125,"../../lib":139,"../../lib/svg_text_utils":156,"../../registry":209,"./axis_autotype":175,"./axis_ids":177,"./layout_attributes":185,"./layout_defaults":186,"./set_convert":191,"d3":10,"fast-isnumeric":13}],175:[function(require,module,exports){ +},{"../../components/color":34,"../../components/drawing":58,"../../components/titles":123,"../../constants/numerical":132,"../../lib":146,"../../lib/svg_text_utils":163,"../../registry":217,"./axis_autotype":182,"./axis_ids":184,"./layout_attributes":192,"./layout_defaults":193,"./set_convert":198,"d3":10,"fast-isnumeric":13}],182:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -40897,7 +41701,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":125,"../../lib":139,"fast-isnumeric":13}],176:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../lib":146,"fast-isnumeric":13}],183:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41020,7 +41824,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":27,"../../lib":139,"../../registry":209,"./category_order_defaults":178,"./layout_attributes":185,"./ordered_categories":187,"./set_convert":191,"./tick_label_defaults":192,"./tick_mark_defaults":193,"./tick_value_defaults":194,"tinycolor2":16}],177:[function(require,module,exports){ +},{"../../components/color/attributes":33,"../../lib":146,"../../registry":217,"./category_order_defaults":185,"./layout_attributes":192,"./ordered_categories":194,"./set_convert":198,"./tick_label_defaults":199,"./tick_mark_defaults":200,"./tick_value_defaults":201,"tinycolor2":16}],184:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41142,7 +41946,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":139,"../../registry":209,"../plots":202,"./constants":179}],178:[function(require,module,exports){ +},{"../../lib":146,"../../registry":217,"../plots":210,"./constants":186}],185:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41176,7 +41980,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],179:[function(require,module,exports){ +},{}],186:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41231,7 +42035,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],180:[function(require,module,exports){ +},{}],187:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41249,10 +42053,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(containerOut.fixedrange) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); + + if(!containerIn.scaleanchor) return; + + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -41271,7 +42090,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -41370,7 +42189,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":139,"./axis_ids":177}],181:[function(require,module,exports){ +},{"../../lib":146,"./axis_ids":184}],188:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41387,12 +42206,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -41408,12 +42229,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -41421,32 +42248,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; + + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + updateDomain(ax, factor); + } + } + } + } +}; + +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; } } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } } }; -},{"../../constants/numerical":125,"./axis_ids":177,"./scale_zoom":189}],182:[function(require,module,exports){ +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":130,"../../constants/numerical":132,"./axis_ids":184,"./scale_zoom":196}],189:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41469,6 +42417,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -41578,7 +42529,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -41632,6 +42582,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -41730,8 +42683,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -41764,7 +42717,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -41783,11 +42737,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -41972,6 +42926,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -41991,8 +42947,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -42089,24 +43050,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -42141,11 +43095,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -42156,7 +43114,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -42165,7 +43123,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -42248,7 +43206,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -42264,13 +43222,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -42447,7 +43407,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":28,"../../components/dragelement":49,"../../components/drawing":52,"../../lib":139,"../../lib/setcursor":154,"../../lib/svg_text_utils":156,"../../plotly":169,"../../registry":209,"./axes":174,"./axis_ids":177,"./constants":179,"./scale_zoom":189,"./select":190,"d3":10,"tinycolor2":16}],183:[function(require,module,exports){ +},{"../../components/color":34,"../../components/dragelement":55,"../../components/drawing":58,"../../constants/alignment":130,"../../lib":146,"../../lib/setcursor":161,"../../lib/svg_text_utils":163,"../../plotly":176,"../../registry":217,"../plots":210,"./axes":181,"./axis_ids":184,"./constants":186,"./scale_zoom":196,"./select":197,"d3":10,"tinycolor2":16}],190:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42470,7 +43430,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -42488,8 +43448,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -42547,7 +43505,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -42608,7 +43566,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":49,"../../components/fx":69,"./constants":179,"./dragbox":182,"fast-isnumeric":13}],184:[function(require,module,exports){ +},{"../../components/dragelement":55,"../../components/fx":75,"./constants":186,"./dragbox":189,"fast-isnumeric":13}],191:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42795,6 +43753,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -42997,7 +43960,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":139,"../plots":202,"./attributes":173,"./axis_ids":177,"./constants":179,"./layout_attributes":185,"./transition_axes":195,"d3":10}],185:[function(require,module,exports){ +},{"../../lib":146,"../plots":210,"./attributes":180,"./axis_ids":184,"./constants":186,"./layout_attributes":192,"./transition_axes":202,"d3":10}],192:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43092,6 +44055,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -43389,7 +44366,7 @@ module.exports = { } }; -},{"../../components/color/attributes":27,"../../components/drawing/attributes":51,"../../lib/extend":135,"../font_attributes":198,"./constants":179}],186:[function(require,module,exports){ +},{"../../components/color/attributes":33,"../../components/drawing/attributes":57,"../../lib/extend":142,"../font_attributes":205,"./constants":186}],193:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43662,7 +44639,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":28,"../../lib":139,"../../registry":209,"../layout_attributes":200,"./axis_defaults":176,"./axis_ids":177,"./constants":179,"./constraint_defaults":180,"./layout_attributes":185,"./position_defaults":188,"./type_defaults":196}],187:[function(require,module,exports){ +},{"../../components/color":34,"../../lib":146,"../../registry":217,"../layout_attributes":208,"./axis_defaults":183,"./axis_ids":184,"./constants":186,"./constraint_defaults":187,"./layout_attributes":192,"./position_defaults":195,"./type_defaults":203}],194:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43741,7 +44718,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":10}],188:[function(require,module,exports){ +},{"d3":10}],195:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43806,7 +44783,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":139,"fast-isnumeric":13}],189:[function(require,module,exports){ +},{"../../lib":146,"fast-isnumeric":13}],196:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43818,20 +44795,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],190:[function(require,module,exports){ +},{"../../constants/alignment":130}],197:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43845,6 +44825,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -43985,7 +44966,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -44031,7 +45014,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":28,"../../lib/polygon":149,"./axes":174,"./constants":179}],191:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":34,"../../components/fx/helpers":72,"../../lib/polygon":156,"./axes":181,"./constants":186}],198:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44050,6 +45050,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -44062,13 +45063,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -44186,7 +45180,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -44199,8 +45193,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -44216,10 +45210,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -44227,16 +45223,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -44254,26 +45252,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -44474,7 +45484,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":125,"../../lib":139,"./axis_ids":177,"./constants":179,"d3":10,"fast-isnumeric":13}],192:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../lib":146,"./axis_ids":184,"./constants":186,"d3":10,"fast-isnumeric":13}],199:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44558,7 +45568,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":139}],193:[function(require,module,exports){ +},{"../../lib":146}],200:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44591,7 +45601,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":139,"./layout_attributes":185}],194:[function(require,module,exports){ +},{"../../lib":146,"./layout_attributes":192}],201:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44675,7 +45685,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":125,"../../lib":139,"fast-isnumeric":13}],195:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../lib":146,"fast-isnumeric":13}],202:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44991,7 +46001,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":52,"../../plotly":169,"../../registry":209,"./axes":174,"d3":10}],196:[function(require,module,exports){ +},{"../../components/drawing":58,"../../plotly":176,"../../registry":217,"./axes":181,"d3":10}],203:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45119,7 +46129,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":209,"./axis_autotype":175,"./axis_ids":177}],197:[function(require,module,exports){ +},{"../../registry":217,"./axis_autotype":182,"./axis_ids":184}],204:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45384,6 +46394,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -45544,7 +46556,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":139,"../plotly":169}],198:[function(require,module,exports){ +},{"../lib":146,"../plotly":176}],205:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45575,7 +46587,7 @@ module.exports = { } }; -},{}],199:[function(require,module,exports){ +},{}],206:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45621,7 +46633,41 @@ module.exports = { } }; -},{}],200:[function(require,module,exports){ +},{}],207:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; + + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } + } + + return out; +} + +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} + +module.exports = project; + +},{}],208:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45764,7 +46810,7 @@ module.exports = { } }; -},{"../components/color/attributes":27,"../lib":139,"./font_attributes":198}],201:[function(require,module,exports){ +},{"../components/color/attributes":33,"../lib":146,"./font_attributes":205}],209:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45802,7 +46848,7 @@ module.exports = { } }; -},{}],202:[function(require,module,exports){ +},{}],210:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45818,6 +46864,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -46310,12 +47357,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -46640,12 +47713,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -46658,7 +47731,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -47591,6 +48667,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -47806,7 +48886,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -47827,6 +48913,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -47874,25 +48961,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -47901,11 +48974,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -47978,7 +49047,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":28,"../components/errorbars":58,"../constants/numerical":125,"../lib":139,"../plotly":169,"../registry":209,"./animation_attributes":170,"./attributes":172,"./command":197,"./font_attributes":198,"./frame_attributes":199,"./layout_attributes":200,"d3":10,"fast-isnumeric":13}],203:[function(require,module,exports){ +},{"../components/color":34,"../components/errorbars":64,"../constants/numerical":132,"../lib":146,"../plot_api/plot_schema":170,"../plotly":176,"../registry":217,"./animation_attributes":177,"./attributes":179,"./command":204,"./font_attributes":205,"./frame_attributes":206,"./layout_attributes":208,"d3":10,"fast-isnumeric":13}],211:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48003,7 +49072,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":273}],204:[function(require,module,exports){ +},{"../../traces/scatter/attributes":281}],212:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48118,7 +49187,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../cartesian/layout_attributes":185}],205:[function(require,module,exports){ +},{"../../lib/extend":142,"../cartesian/layout_attributes":192}],213:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48133,7 +49202,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":206,"./micropolar_manager":207}],206:[function(require,module,exports){ +},{"./micropolar":214,"./micropolar_manager":215}],214:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49552,7 +50621,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":139,"d3":10}],207:[function(require,module,exports){ +},{"../../lib":146,"d3":10}],215:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49638,7 +50707,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":28,"../../lib":139,"./micropolar":206,"./undo_manager":208,"d3":10}],208:[function(require,module,exports){ +},{"../../components/color":34,"../../lib":146,"./micropolar":214,"./undo_manager":216,"d3":10}],216:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49704,7 +50773,7 @@ module.exports = function UndoManager() { }; }; -},{}],209:[function(require,module,exports){ +},{}],217:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49895,7 +50964,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":142,"./lib/noop":146,"./lib/push_unique":150,"./plots/attributes":172}],210:[function(require,module,exports){ +},{"./lib/loggers":149,"./lib/noop":153,"./lib/push_unique":157,"./plots/attributes":179}],218:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50067,7 +51136,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":139,"../plots/plots":202}],211:[function(require,module,exports){ +},{"../lib":146,"../plots/plots":210}],219:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50133,7 +51202,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":139,"../plot_api/to_image":167,"./filesaver":212}],212:[function(require,module,exports){ +},{"../lib":146,"../plot_api/to_image":174,"./filesaver":220}],220:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50201,7 +51270,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],213:[function(require,module,exports){ +},{}],221:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50234,7 +51303,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],214:[function(require,module,exports){ +},{}],222:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50260,7 +51329,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":210,"./download":211,"./helpers":213,"./svgtoimg":215,"./toimage":216,"./tosvg":217}],215:[function(require,module,exports){ +},{"./cloneplot":218,"./download":219,"./helpers":221,"./svgtoimg":223,"./toimage":224,"./tosvg":225}],223:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50298,7 +51367,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -50391,7 +51460,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":139,"events":12}],216:[function(require,module,exports){ +},{"../lib":146,"events":12}],224:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50471,7 +51540,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":139,"../plotly":169,"./cloneplot":210,"./helpers":213,"./svgtoimg":215,"./tosvg":217,"events":12}],217:[function(require,module,exports){ +},{"../lib":146,"../plotly":176,"./cloneplot":218,"./helpers":221,"./svgtoimg":223,"./tosvg":225,"events":12}],225:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50485,12 +51554,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -50543,20 +51629,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -50564,10 +51652,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -50581,16 +51680,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":28,"../components/drawing":52,"../constants/xmlns_namespaces":127,"../lib/svg_text_utils":156,"d3":10}],218:[function(require,module,exports){ +},{"../components/color":34,"../components/drawing":58,"../constants/xmlns_namespaces":134,"d3":10}],226:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50623,7 +51722,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":139}],219:[function(require,module,exports){ +},{"../../lib":146}],227:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50748,7 +51847,7 @@ module.exports = { } }; -},{"../../components/colorbar/attributes":29,"../../components/colorscale/color_attributes":35,"../../components/errorbars/attributes":54,"../../lib/extend":135,"../../plots/font_attributes":198,"../scatter/attributes":273}],220:[function(require,module,exports){ +},{"../../components/colorbar/attributes":35,"../../components/colorscale/color_attributes":41,"../../components/errorbars/attributes":60,"../../lib/extend":142,"../../plots/font_attributes":205,"../scatter/attributes":281}],228:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50841,7 +51940,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":34,"../../components/colorscale/has_colorscale":41,"../../plots/cartesian/axes":174,"./arrays_to_calcdata":218,"fast-isnumeric":13}],221:[function(require,module,exports){ +},{"../../components/colorscale/calc":40,"../../components/colorscale/has_colorscale":47,"../../plots/cartesian/axes":181,"./arrays_to_calcdata":226,"fast-isnumeric":13}],229:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50901,7 +52000,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":28,"../../components/errorbars/defaults":57,"../../lib":139,"../bar/style_defaults":230,"../scatter/xy_defaults":295,"./attributes":219}],222:[function(require,module,exports){ +},{"../../components/color":34,"../../components/errorbars/defaults":63,"../../lib":146,"../bar/style_defaults":238,"../scatter/xy_defaults":303,"./attributes":227}],230:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51013,7 +52112,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":28,"../../components/errorbars":58,"../../components/fx":69}],223:[function(require,module,exports){ +},{"../../components/color":34,"../../components/errorbars":64,"../../components/fx":75}],231:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51049,7 +52148,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":184,"../scatter/colorbar":276,"./arrays_to_calcdata":218,"./attributes":219,"./calc":220,"./defaults":221,"./hover":222,"./layout_attributes":224,"./layout_defaults":225,"./plot":226,"./set_positions":227,"./style":229}],224:[function(require,module,exports){ +},{"../../plots/cartesian":191,"../scatter/colorbar":284,"./arrays_to_calcdata":226,"./attributes":227,"./calc":228,"./defaults":229,"./hover":230,"./layout_attributes":232,"./layout_defaults":233,"./plot":234,"./set_positions":235,"./style":237}],232:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51093,7 +52192,7 @@ module.exports = { } }; -},{}],225:[function(require,module,exports){ +},{}],233:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51151,7 +52250,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":139,"../../plots/cartesian/axes":174,"../../registry":209,"./layout_attributes":224}],226:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"../../registry":217,"./layout_attributes":232}],234:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51293,22 +52392,17 @@ module.exports = function plot(gd, plotinfo, cdbar) { function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { function appendTextNode(bar, text, textFont) { var textSelection = bar.append('text') - // prohibit tex interpretation until we can handle - // tex and regular text together - .attr('data-notex', 1) .text(text) .attr({ 'class': 'bartext', transform: '', - 'data-bb': '', 'text-anchor': 'middle', - x: 0, - y: 0 + // prohibit tex interpretation until we can handle + // tex and regular text together + 'data-notex': 1 }) - .call(Drawing.font, textFont); - - textSelection.call(svgTextUtils.convertToTspans); - textSelection.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(Drawing.font, textFont) + .call(svgTextUtils.convertToTspans, gd); return textSelection; } @@ -51671,7 +52765,7 @@ function coerceColor(attributeDefinition, value, defaultValue) { attributeDefinition.dflt; } -},{"../../components/color":28,"../../components/drawing":52,"../../components/errorbars":58,"../../lib":139,"../../lib/svg_text_utils":156,"./attributes":219,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],227:[function(require,module,exports){ +},{"../../components/color":34,"../../components/drawing":58,"../../components/errorbars":64,"../../lib":146,"../../lib/svg_text_utils":163,"./attributes":227,"d3":10,"fast-isnumeric":13,"tinycolor2":16}],235:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52271,7 +53365,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../constants/numerical":125,"../../plots/cartesian/axes":174,"../../registry":209,"./sieve.js":228,"fast-isnumeric":13}],228:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../plots/cartesian/axes":181,"../../registry":217,"./sieve.js":236,"fast-isnumeric":13}],236:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52373,7 +53467,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":125,"../../lib":139}],229:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../lib":146}],237:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52443,15 +53537,12 @@ module.exports = function style(gd) { p.call(Color.stroke, lineColor); } }); - // TODO: text markers on bars, either extra text or just bar values - // d3.select(this).selectAll('text') - // .call(Drawing.textPointStyle,d.t||d[0].t); }); s.call(ErrorBars.style); }; -},{"../../components/color":28,"../../components/drawing":52,"../../components/errorbars":58,"d3":10}],230:[function(require,module,exports){ +},{"../../components/color":34,"../../components/drawing":58,"../../components/errorbars":64,"d3":10}],238:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52488,7 +53579,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":28,"../../components/colorscale/defaults":37,"../../components/colorscale/has_colorscale":41}],231:[function(require,module,exports){ +},{"../../components/color":34,"../../components/colorscale/defaults":43,"../../components/colorscale/has_colorscale":47}],239:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52621,7 +53712,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":27,"../../lib/extend":135,"../scatter/attributes":273}],232:[function(require,module,exports){ +},{"../../components/color/attributes":33,"../../lib/extend":142,"../scatter/attributes":281}],240:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52770,7 +53861,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":139,"../../plots/cartesian/axes":174,"fast-isnumeric":13}],233:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"fast-isnumeric":13}],241:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52843,7 +53934,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":28,"../../lib":139,"../../registry":209,"./attributes":231}],234:[function(require,module,exports){ +},{"../../components/color":34,"../../lib":146,"../../registry":217,"./attributes":239}],242:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52952,7 +54043,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":28,"../../components/fx":69,"../../lib":139,"../../plots/cartesian/axes":174}],235:[function(require,module,exports){ +},{"../../components/color":34,"../../components/fx":75,"../../lib":146,"../../plots/cartesian/axes":181}],243:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52985,7 +54076,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":184,"./attributes":231,"./calc":232,"./defaults":233,"./hover":234,"./layout_attributes":236,"./layout_defaults":237,"./plot":238,"./set_positions":239,"./style":240}],236:[function(require,module,exports){ +},{"../../plots/cartesian":191,"./attributes":239,"./calc":240,"./defaults":241,"./hover":242,"./layout_attributes":244,"./layout_defaults":245,"./plot":246,"./set_positions":247,"./style":248}],244:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53023,7 +54114,7 @@ module.exports = { } }; -},{}],237:[function(require,module,exports){ +},{}],245:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53057,7 +54148,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":139,"../../registry":209,"./layout_attributes":236}],238:[function(require,module,exports){ +},{"../../lib":146,"../../registry":217,"./layout_attributes":244}],246:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53297,7 +54388,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":52,"../../lib":139,"d3":10}],239:[function(require,module,exports){ +},{"../../components/drawing":58,"../../lib":146,"d3":10}],247:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53391,7 +54482,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":139,"../../plots/cartesian/axes":174,"../../registry":209}],240:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"../../registry":217}],248:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53426,11 +54517,11 @@ module.exports = function style(gd) { }) .call(Color.stroke, trace.line.color); d3.select(this).selectAll('g.points path') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, gd); }); }; -},{"../../components/color":28,"../../components/drawing":52,"d3":10}],241:[function(require,module,exports){ +},{"../../components/color":34,"../../components/drawing":58,"d3":10}],249:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53483,7 +54574,7 @@ module.exports = { whiskerwidth: Lib.extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }) }; -},{"../../lib":139,"../box/attributes":231,"../ohlc/attributes":254}],242:[function(require,module,exports){ +},{"../../lib":146,"../box/attributes":239,"../ohlc/attributes":262}],250:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53531,7 +54622,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor'); } -},{"../../lib":139,"../ohlc/direction_defaults":256,"../ohlc/helpers":257,"../ohlc/ohlc_defaults":259,"./attributes":241}],243:[function(require,module,exports){ +},{"../../lib":146,"../ohlc/direction_defaults":264,"../ohlc/helpers":265,"../ohlc/ohlc_defaults":267,"./attributes":249}],251:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53561,7 +54652,7 @@ module.exports = { register(require('../box')); register(require('./transform')); -},{"../../plot_api/register":164,"../../plots/cartesian":184,"../box":235,"./attributes":241,"./defaults":242,"./transform":244}],244:[function(require,module,exports){ +},{"../../plot_api/register":171,"../../plots/cartesian":191,"../box":243,"./attributes":249,"./defaults":250,"./transform":252}],252:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53573,6 +54664,8 @@ register(require('./transform')); 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); var helpers = require('../ohlc/helpers'); @@ -53679,7 +54772,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { }; for(var i = 0; i < len; i++) { - if(filterFn(open[i], close[i])) { + if(filterFn(open[i], close[i]) && isNumeric(high[i]) && isNumeric(low[i])) { appendX(i); appendY(open[i], high[i], low[i], close[i]); } @@ -53689,7 +54782,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { trace.y = y; }; -},{"../../lib":139,"../ohlc/helpers":257}],245:[function(require,module,exports){ +},{"../../lib":146,"../ohlc/helpers":265,"fast-isnumeric":13}],253:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53819,7 +54912,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":219}],246:[function(require,module,exports){ +},{"../bar/attributes":227}],254:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53845,7 +54938,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],247:[function(require,module,exports){ +},{}],255:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53878,7 +54971,7 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect return traceOut; }; -},{}],248:[function(require,module,exports){ +},{}],256:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53954,7 +55047,7 @@ module.exports = { } }; -},{"fast-isnumeric":13}],249:[function(require,module,exports){ +},{"fast-isnumeric":13}],257:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54185,7 +55278,7 @@ function cdf(size, direction, currentbin) { } } -},{"../../lib":139,"../../plots/cartesian/axes":174,"../bar/arrays_to_calcdata":218,"./average":246,"./bin_functions":248,"./clean_bins":250,"./norm_functions":253,"fast-isnumeric":13}],250:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"../bar/arrays_to_calcdata":226,"./average":254,"./bin_functions":256,"./clean_bins":258,"./norm_functions":261,"fast-isnumeric":13}],258:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54262,7 +55355,7 @@ module.exports = function cleanBins(trace, ax, binDirection) { if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; }; -},{"../../constants/numerical":125,"../../lib":139,"fast-isnumeric":13}],251:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../lib":146,"fast-isnumeric":13}],259:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54324,7 +55417,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":28,"../../components/errorbars/defaults":57,"../../lib":139,"../../registry":209,"../bar/style_defaults":230,"./attributes":245,"./bin_defaults":247}],252:[function(require,module,exports){ +},{"../../components/color":34,"../../components/errorbars/defaults":63,"../../lib":146,"../../registry":217,"../bar/style_defaults":238,"./attributes":253,"./bin_defaults":255}],260:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54373,7 +55466,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":184,"../bar/hover":222,"../bar/layout_attributes":224,"../bar/layout_defaults":225,"../bar/plot":226,"../bar/set_positions":227,"../bar/style":229,"../scatter/colorbar":276,"./attributes":245,"./calc":249,"./defaults":251}],253:[function(require,module,exports){ +},{"../../plots/cartesian":191,"../bar/hover":230,"../bar/layout_attributes":232,"../bar/layout_defaults":233,"../bar/plot":234,"../bar/set_positions":235,"../bar/style":237,"../scatter/colorbar":284,"./attributes":253,"./calc":257,"./defaults":259}],261:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54408,7 +55501,7 @@ module.exports = { } }; -},{}],254:[function(require,module,exports){ +},{}],262:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54516,7 +55609,7 @@ module.exports = { } }; -},{"../../components/drawing/attributes":51,"../../lib":139,"../scatter/attributes":273}],255:[function(require,module,exports){ +},{"../../components/drawing/attributes":57,"../../lib":146,"../scatter/attributes":281}],263:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54565,7 +55658,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":139,"./attributes":254,"./direction_defaults":256,"./helpers":257,"./ohlc_defaults":259}],256:[function(require,module,exports){ +},{"../../lib":146,"./attributes":262,"./direction_defaults":264,"./helpers":265,"./ohlc_defaults":267}],264:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54591,7 +55684,7 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir coerce(direction + '.name', nameDflt); }; -},{}],257:[function(require,module,exports){ +},{}],265:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54603,6 +55696,8 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); // This routine gets called during the trace supply-defaults step. @@ -54689,14 +55784,38 @@ exports.makeTransform = function(traceIn, state, direction) { }; exports.getFilterFn = function(direction) { - switch(direction) { - case 'increasing': - return function(o, c) { return o <= c; }; + return new _getFilterFn(direction); +}; + +function _getFilterFn(direction) { + // we're optimists - before we have any changing data, assume increasing + var isPrevIncreasing = true; + var cPrev = null; - case 'decreasing': - return function(o, c) { return o > c; }; + function _isIncreasing(o, c) { + if(o === c) { + if(c > cPrev) { + isPrevIncreasing = true; // increasing + } else if(c < cPrev) { + isPrevIncreasing = false; // decreasing + } + // else isPrevIncreasing is not changed + } + else isPrevIncreasing = (o < c); + cPrev = c; + return isPrevIncreasing; } -}; + + function isIncreasing(o, c) { + return isNumeric(o) && isNumeric(c) && _isIncreasing(+o, +c); + } + + function isDecreasing(o, c) { + return isNumeric(o) && isNumeric(c) && !_isIncreasing(+o, +c); + } + + return direction === 'increasing' ? isIncreasing : isDecreasing; +} exports.addRangeSlider = function(data, layout) { var hasOneVisibleTrace = false; @@ -54714,7 +55833,7 @@ exports.addRangeSlider = function(data, layout) { } }; -},{"../../lib":139}],258:[function(require,module,exports){ +},{"../../lib":146,"fast-isnumeric":13}],266:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54744,7 +55863,7 @@ module.exports = { register(require('../scatter')); register(require('./transform')); -},{"../../plot_api/register":164,"../../plots/cartesian":184,"../scatter":283,"./attributes":254,"./defaults":255,"./transform":260}],259:[function(require,module,exports){ +},{"../../plot_api/register":171,"../../plots/cartesian":191,"../scatter":291,"./attributes":262,"./defaults":263,"./transform":268}],267:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54786,7 +55905,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { return len; }; -},{"../../registry":209}],260:[function(require,module,exports){ +},{"../../registry":217}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54798,6 +55917,8 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); var helpers = require('./helpers'); var Axes = require('../../plots/cartesian/axes'); @@ -54984,7 +56105,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { }; for(var i = 0; i < len; i++) { - if(filterFn(open[i], close[i])) { + if(filterFn(open[i], close[i]) && isNumeric(high[i]) && isNumeric(low[i])) { appendX(i); appendY(open[i], high[i], low[i], close[i]); appendText(i, open[i], high[i], low[i], close[i]); @@ -55045,7 +56166,7 @@ function convertTickWidth(gd, xa, trace) { return minDiff * tickWidth; } -},{"../../lib":139,"../../plots/cartesian/axes":174,"../../plots/cartesian/axis_ids":177,"./helpers":257}],261:[function(require,module,exports){ +},{"../../lib":146,"../../plots/cartesian/axes":181,"../../plots/cartesian/axis_ids":184,"./helpers":265,"fast-isnumeric":13}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55238,7 +56359,7 @@ module.exports = { } }; -},{"../../components/color/attributes":27,"../../lib/extend":135,"../../plots/attributes":172,"../../plots/font_attributes":198}],262:[function(require,module,exports){ +},{"../../components/color/attributes":33,"../../lib/extend":142,"../../plots/attributes":179,"../../plots/font_attributes":205}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55285,7 +56406,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":209}],263:[function(require,module,exports){ +},{"../../registry":217}],271:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55437,7 +56558,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":28,"./helpers":265,"fast-isnumeric":13,"tinycolor2":16}],264:[function(require,module,exports){ +},{"../../components/color":34,"./helpers":273,"fast-isnumeric":13,"tinycolor2":16}],272:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55487,8 +56608,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); coerce('hovertext'); - coerce('hoverinfo', (layout._dataLength === 1) ? 'label+text+value+percent' : undefined); - if(textInfo && textInfo !== 'none') { var textPosition = coerce('textposition'), hasBoth = Array.isArray(textPosition) || textPosition === 'auto', @@ -55522,7 +56641,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":139,"./attributes":261}],265:[function(require,module,exports){ +},{"../../lib":146,"./attributes":269}],273:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55551,7 +56670,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":139}],266:[function(require,module,exports){ +},{"../../lib":146}],274:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55583,7 +56702,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":261,"./base_plot":262,"./calc":263,"./defaults":264,"./layout_attributes":267,"./layout_defaults":268,"./plot":269,"./style":270,"./style_one":271}],267:[function(require,module,exports){ +},{"./attributes":269,"./base_plot":270,"./calc":271,"./defaults":272,"./layout_attributes":275,"./layout_defaults":276,"./plot":277,"./style":278,"./style_one":279}],275:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55603,7 +56722,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],268:[function(require,module,exports){ +},{}],276:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55625,7 +56744,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":139,"./layout_attributes":267}],269:[function(require,module,exports){ +},{"../../lib":146,"./layout_attributes":275}],277:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55717,9 +56836,9 @@ module.exports = function plot(gd, cdpie) { evt.originalEvent = d3.event; // in case fullLayout or fullData has changed without a replot - var fullLayout2 = gd._fullLayout, - trace2 = gd._fullData[trace.index], - hoverinfo = trace2.hoverinfo; + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; + var hoverinfo = Fx.castHoverinfo(trace2, fullLayout2, pt.i); if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; @@ -55752,8 +56871,6 @@ module.exports = function plot(gd, cdpie) { if(hoverinfo.indexOf('value') !== -1) thisText.push(helpers.formatPieValue(pt.v, separators)); if(hoverinfo.indexOf('percent') !== -1) thisText.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators)); - var hoverLabelOpts = trace2.hoverlabel; - Fx.loneHover({ x0: hoverCenterX - rInscribed * cd0.r, x1: hoverCenterX + rInscribed * cd0.r, @@ -55761,14 +56878,15 @@ module.exports = function plot(gd, cdpie) { text: thisText.join('
'), name: hoverinfo.indexOf('name') !== -1 ? trace2.name : undefined, idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', - color: pt.hbg || hoverLabelOpts.bgcolor || pt.color, - borderColor: pt.hbc || hoverLabelOpts.bordercolor, - fontFamily: pt.htf || hoverLabelOpts.font.family, - fontSize: pt.hts || hoverLabelOpts.font.size, - fontColor: pt.htc || hoverLabelOpts.font.color + color: Fx.castHoverOption(trace, pt.i, 'bgcolor') || pt.color, + borderColor: Fx.castHoverOption(trace, pt.i, 'bordercolor'), + fontFamily: Fx.castHoverOption(trace, pt.i, 'font.family'), + fontSize: Fx.castHoverOption(trace, pt.i, 'font.size'), + fontColor: Fx.castHoverOption(trace, pt.i, 'font.color') }, { container: fullLayout2._hoverlayer.node(), - outerContainer: fullLayout2._paper.node() + outerContainer: fullLayout2._paper.node(), + gd: gd }); Fx.hover(gd, evt, 'pie'); @@ -55880,15 +56998,11 @@ module.exports = function plot(gd, cdpie) { .attr({ 'class': 'slicetext', transform: '', - 'data-bb': '', - 'text-anchor': 'middle', - x: 0, - y: 0 + 'text-anchor': 'middle' }) .call(Drawing.font, textPosition === 'outside' ? trace.outsidetextfont : trace.insidetextfont) - .call(svgTextUtils.convertToTspans); - sliceText.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(svgTextUtils.convertToTspans, gd); // position the text relative to the slice // TODO: so far this only accounts for flat @@ -55903,7 +57017,6 @@ module.exports = function plot(gd, cdpie) { sliceText.call(Drawing.font, trace.outsidetextfont); if(trace.outsidetextfont.family !== trace.insidetextfont.family || trace.outsidetextfont.size !== trace.insidetextfont.size) { - sliceText.attr({'data-bb': ''}); textBB = Drawing.bBox(sliceText.node()); } transform = transformOutsideText(textBB, pt); @@ -56339,7 +57452,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":28,"../../components/drawing":52,"../../components/fx":69,"../../lib/svg_text_utils":156,"./helpers":265,"d3":10}],270:[function(require,module,exports){ +},{"../../components/color":34,"../../components/drawing":58,"../../components/fx":75,"../../lib/svg_text_utils":163,"./helpers":273,"d3":10}],278:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56368,7 +57481,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":271,"d3":10}],271:[function(require,module,exports){ +},{"./style_one":279,"d3":10}],279:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56393,7 +57506,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":28}],272:[function(require,module,exports){ +},{"../../components/color":34}],280:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56445,7 +57558,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":139}],273:[function(require,module,exports){ +},{"../../lib":146}],281:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56491,20 +57604,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -56725,7 +57830,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":29,"../../components/colorscale/color_attributes":35,"../../components/drawing":52,"../../components/drawing/attributes":51,"../../components/errorbars/attributes":54,"../../lib/extend":135,"./constants":278}],274:[function(require,module,exports){ +},{"../../components/colorbar/attributes":35,"../../components/colorscale/color_attributes":41,"../../components/drawing":58,"../../components/drawing/attributes":57,"../../components/errorbars/attributes":60,"../../lib/extend":142,"./constants":286}],282:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56856,7 +57961,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":125,"../../plots/cartesian/axes":174,"./arrays_to_calcdata":272,"./colorscale_calc":277,"./subtypes":293,"fast-isnumeric":13}],275:[function(require,module,exports){ +},{"../../constants/numerical":132,"../../plots/cartesian/axes":181,"./arrays_to_calcdata":280,"./colorscale_calc":285,"./subtypes":301,"fast-isnumeric":13}],283:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56895,7 +58000,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],276:[function(require,module,exports){ +},{}],284:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56951,7 +58056,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":31,"../../components/colorscale":42,"../../lib":139,"../../plots/plots":202,"fast-isnumeric":13}],277:[function(require,module,exports){ +},{"../../components/colorbar/draw":37,"../../components/colorscale":48,"../../lib":146,"../../plots/plots":210,"fast-isnumeric":13}],285:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56984,7 +58089,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":34,"../../components/colorscale/has_colorscale":41,"./subtypes":293}],278:[function(require,module,exports){ +},{"../../components/colorscale/calc":40,"../../components/colorscale/has_colorscale":47,"./subtypes":301}],286:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57000,7 +58105,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],279:[function(require,module,exports){ +},{}],287:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57039,11 +58144,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -57082,7 +58185,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":57,"../../lib":139,"./attributes":273,"./constants":278,"./fillcolor_defaults":280,"./line_defaults":284,"./line_shape_defaults":286,"./marker_defaults":289,"./subtypes":293,"./text_defaults":294,"./xy_defaults":295}],280:[function(require,module,exports){ +},{"../../components/errorbars/defaults":63,"../../lib":146,"./attributes":281,"./constants":286,"./fillcolor_defaults":288,"./line_defaults":292,"./line_shape_defaults":294,"./marker_defaults":297,"./subtypes":301,"./text_defaults":302,"./xy_defaults":303}],288:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57120,7 +58223,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":28}],281:[function(require,module,exports){ +},{"../../components/color":34}],289:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57173,7 +58276,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":28,"./subtypes":293}],282:[function(require,module,exports){ +},{"../../components/color":34,"./subtypes":301}],290:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57200,11 +58303,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -57260,7 +58364,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -57344,7 +58448,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":28,"../../components/errorbars":58,"../../components/fx":69,"../../lib":139,"./get_trace_color":281}],283:[function(require,module,exports){ +},{"../../components/color":34,"../../components/errorbars":64,"../../components/fx":75,"../../lib":146,"./get_trace_color":289}],291:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57388,7 +58492,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":184,"./arrays_to_calcdata":272,"./attributes":273,"./calc":274,"./clean_data":275,"./colorbar":276,"./defaults":279,"./hover":282,"./plot":290,"./select":291,"./style":292,"./subtypes":293}],284:[function(require,module,exports){ +},{"../../plots/cartesian":191,"./arrays_to_calcdata":280,"./attributes":281,"./calc":282,"./clean_data":283,"./colorbar":284,"./defaults":287,"./hover":290,"./plot":298,"./select":299,"./style":300,"./subtypes":301}],292:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57421,7 +58525,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":37,"../../components/colorscale/has_colorscale":41}],285:[function(require,module,exports){ +},{"../../components/colorscale/defaults":43,"../../components/colorscale/has_colorscale":47}],293:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57594,7 +58698,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":125}],286:[function(require,module,exports){ +},{"../../constants/numerical":132}],294:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57613,7 +58717,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],287:[function(require,module,exports){ +},{}],295:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57654,7 +58758,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],288:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57696,7 +58800,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":13}],289:[function(require,module,exports){ +},{"fast-isnumeric":13}],297:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57771,7 +58875,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":28,"../../components/colorscale/defaults":37,"../../components/colorscale/has_colorscale":41,"./subtypes":293}],290:[function(require,module,exports){ +},{"../../components/color":34,"../../components/colorscale/defaults":43,"../../components/colorscale/has_colorscale":47,"./subtypes":301}],298:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58114,10 +59218,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -58128,7 +59234,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -58136,7 +59243,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -58193,17 +59301,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -58215,6 +59326,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -58234,6 +59347,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -58242,7 +59357,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -58319,7 +59434,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":52,"../../components/errorbars":58,"../../lib":139,"../../lib/polygon":149,"./line_points":285,"./link_traces":287,"./subtypes":293,"d3":10}],291:[function(require,module,exports){ +},{"../../components/drawing":58,"../../components/errorbars":64,"../../lib":146,"../../lib/polygon":156,"./line_points":293,"./link_traces":295,"./subtypes":301,"d3":10}],299:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58341,7 +59456,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -58365,11 +59479,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -58392,7 +59504,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":293}],292:[function(require,module,exports){ +},{"./subtypes":301}],300:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58423,10 +59535,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -58438,7 +59550,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":52,"../../components/errorbars":58,"d3":10}],293:[function(require,module,exports){ +},{"../../components/drawing":58,"../../components/errorbars":64,"d3":10}],301:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58474,7 +59586,7 @@ module.exports = { } }; -},{"../../lib":139}],294:[function(require,module,exports){ +},{"../../lib":146}],302:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58495,7 +59607,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":139}],295:[function(require,module,exports){ +},{"../../lib":146}],303:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58545,5 +59657,5 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":209}]},{},[7])(7) +},{"../../registry":217}]},{},[7])(7) }); \ No newline at end of file diff --git a/dist/plotly-finance.min.js b/dist/plotly-finance.min.js index 8fa09180c61..9b46377fba3 100644 --- a/dist/plotly-finance.min.js +++ b/dist/plotly-finance.min.js @@ -1,28 +1,29 @@ /** -* plotly.js (finance - minified) v1.27.1 +* plotly.js (finance - minified) v1.28.0 * Copyright 2012-2017, 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||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:0/0}function o(t){return null===t?0/0:+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 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,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=$),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 $(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 Q(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?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=vt(a)*Ji,n=vt(n)*Ki,o=vt(o)*tl,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)*Ui,Math.sqrt(e*e+r*r),t):new ft(0/0,0/0,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,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=nl.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=mt((.4124564*t+.3575761*e+.1804375*r)/Ji),a=mt((.2126729*t+.7151522*e+.072175*r)/Ki);return ht(116*a-16,500*(n-a),200*(a-mt((.0193339*t+.119192*e+.9503041*r)/tl)))}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,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 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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Nt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=al,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=ul.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="",v="",m=!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,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=fl.get(h)||Bt;var x=c&&f;return function(t){var r=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),r=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))+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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=S[i in gl?e.charAt(l++):i])||(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,C.c.toString(),e,n)}function s(t,e,n){return r(t,C.x.toString(),e,n)}function c(t,e,n){return r(t,C.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,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{hl=qt;var e=new hl;return e._=t,n(e)}finally{hl=Date}}var n=e(t);return r.parse=function(t){try{hl=qt;var e=n.parse(t);return e&&e._}finally{hl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Gt(g),_=Yt(g),w=Gt(v),k=Yt(v),M=Gt(m),A=Yt(m),T=Gt(y),L=Yt(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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Xt(dl.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"%"}},S={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:Zt,W:$t,x:s,X:c,y:Jt,Y:Qt,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){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){ -vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){vl.lastIndex=0;var n=vl.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){ml.lastIndex=0;var n=ml.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);kl.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Ml.point=function(i,l){Ml.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Ml.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 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,v=e(o),m=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(m,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=0/0,n=0/0,a=0/0;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 qe(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(kl.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=r^m>=r){var T=xe(me(f),me(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*nt(L[2]);(n>C||n===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 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),v=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 m;v&o||!(m=n(p,r,!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||r&&Me(r,p)||t.point(p[0],p[1]),r=p,s=g,o=v},lineEnd:function(){s&&t.lineEnd(),r=null},clean:function(){return u|(c&&s)<<1}}}function n(t,e,r){var n=me(t),a=me(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);be(p,_e(l,d));var g=h,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-v-x)/m);if(be(b,p),b=ke(b),!r)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)ji^(w<=b[0]&&b[0]<=k)){var S=_e(g,(-v+x)/m);return be(S,p),[b,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;return Ne(e,r,vr(t,6*Vi),i?[0,-t]:[-ji,t-ji])}function Ue(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=v.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(){S.point=p,v&&v.push(m=[]),M=!0,k=!1,_=w=0/0}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(-Fl,Math.min(Fl,t)),e=Math.max(-Fl,Math.min(Fl,e));var r=u(t,e);if(v&&m.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}};C(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,v,m,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Ue(t,e,r,n),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,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=v=m=null}};return S}}function Ge(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 Ye(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 Ze(){function t(t,e){Bl+=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){tVl&&(Vl=t),eUl&&(Ul=e)}function $e(){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=Qe(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=Qe(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function Qe(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){Ll+=t,Cl+=e,++Sl}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);zl+=i*(e+t)/2,Ol+=i*(r+n)/2,Dl+=i,Je(e=t,r=n)}var e,r;Yl.point=function(n,a){Yl.point=t,Je(e=n,r=a)}}function tr(){Yl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);zl+=i*(n+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-n*e,Pl+=i*(n+t),El+=i*(a+e),Nl+=3*i,Je(n=t,a=e)}var e,r,n,a;Yl.point=function(o,i){Yl.point=t,Je(e=n=o,r=a=i)},Yl.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=0/0,M.point=o,e.lineStart()}function o(r,n){var o=me([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=_,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: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,v,m){var y=u-e,x=f-r,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 ar(t){var e=nr(function(e,r){return t([e*Ui,r*Ui])});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[0]*Ui,t[1]*Ui]}function n(){l=ze(i=dr(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=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,v=0,m=0,y=0,x=0,_=Rl,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,Rl):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,v=t[1]%360*Vi,n()):[g*Ui,v*Ui]},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,n()):[m*Ui,y*Ui,x*Ui]},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-Bi:t<-ji?t+Bi:t,e]}function dr(t,e,r){return t?e||r?ze(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-Bi:e<-ji?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 vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=mr(r,a),o=mr(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(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 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 Fr(t){var e=ls.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),as.remove(t),ls.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];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(!((a=o-Vr(l,i))>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(as.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),as.insert(s,r),s.edge=r.edge=Kr(e.site,s.site),Zr(e),void Zr(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,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};en(r.edge,c,p,b),s.edge=Kr(c,t,null,b),r.edge=Kr(t,p,null,b),Zr(e),Zr(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 Ur(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=ns,v=g.length;v--;)if((o=g[v])&&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,v=(s*p-u*h)/d,f=v+l,m=ss.pop()||new Yr;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=is._;x;)if(m.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:v,y:s};r={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)/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=fs.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 Cn(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 zn(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 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 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(Un(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Un(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Un(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Un(r)+"skewX("+e+")")}function Zn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Un(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(Un(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),Gn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Zn(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 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((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(Sa),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 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 Ua(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?$a:Ya,s=n?Qn:$n;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 Qa(t,e,r,n)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Za(t,Wa(to(t,e)[2])),Za(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=ul.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 ks?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=Za(n.map(a),r?Math:As);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 Ms;arguments.length<2?r=Ms:"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,v=d-u,m=h-f,y=v*v+m*m,x=r-n,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*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=Ct(r),p=Ct(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($s,a);return o==$s.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/$s[o-1]<$s[o]/a?o-1:o]:[Ks,to(t,r)[2]]}return n.invert=function(e){return li(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(li)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,li(+r+1),e).length}var o=n.domain(),i=Xa(o),l=null==t?a(i,10):"number"==typeof t&&a(i,t);return l&&(t=l[0],e=l[1]),n.domain(Za(o,e>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,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,r){vi.call(this,t,e,r+"")},mi.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:0/0},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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=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++],v=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)},Ci=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Ci=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,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,r,n,a,o=[];t=z(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}},Si.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))},Si.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},Si.sort=function(t){t=U.apply(this,arguments);for(var e=-1,r=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 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=Q(a);Bs.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 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];m=d*d+h*h}}function n(){var t,e,r,n,i=ui.touches(p);Bs.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,fl=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))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});dl[t+"s"]=r.range,dl[t+"s"].utc=r.utc.range,dl[t+"OfYear"]=function(t){var r=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,ml=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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=me([e*Vi,r*Vi]);if(m){var a=xe(m,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]*Ui*c,v=bi(s)>180;if(v^(c*ph&&(h=y)}else if(g=(g+360)%360-180,v^(c*ph&&(h=r);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,r);m=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=d,_.point=t,m=null}function a(t,r){if(m){var n=t-p;y+=bi(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ml.point(t,r),e(t,r)}function o(){Ml.lineStart()}function i(){a(g,v),Ml.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 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,1/0===u||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Al=Tl=Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,Il);var e=Pl,r=El,n=Nl,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 jl,Bl,ql,Hl,Vl,Ul,Xl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Xl.lineStart=Ze},polygonEnd:function(){Xl.lineStart=Xl.lineEnd=Xl.point=k,jl+=bi(Bl/2)}},Gl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Yl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Yl.lineStart=er},polygonEnd:function(){Yl.point=Je,Yl.lineStart=Ke,Yl.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 jl=0,ui.geo.stream(t,a(Xl)),jl},t.centroid=function(t){return Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,a(Yl)),Nl?[Pl/Nl,El/Nl]:Dl?[zl/Dl,Ol/Dl]:Sl?[Ll/Sl,Cl/Sl]:[0/0,0/0]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Gl)),[[ql,Hl],[Vl,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 $e: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]*=Ui,e[1]*=Ui,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]*=Ui,e[1]*=Ui,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]*=Ui,t[1]*=Ui}}),{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=vr((e=+n)*Vi,a*Vi),t):e},t.precision=function(n){return arguments.length?(r=vr(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/v)*v,a,v).map(d).concat(ui.range(Math.ceil(c/m)*m,s,m).map(h)).concat(ui.range(Math.ceil(n/p)*p,r,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 r,n,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?(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?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(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 Zl=0,ui.geo.stream(t,Wl),Zl};var Zl,Wl={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},$l=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr($l)}).raw=$l;var Ql=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Ql)}).raw=Ql,(ui.geo.conicConformal=function(){return Ge(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Ge(Tr)}).raw=Tr;var Jl=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(Jl)}).raw=Jl,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Cr(Lr)}).raw=Lr;var Kl=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(Kl)}).raw=Kl;var ts=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(ts)}).raw=ts,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Cr(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,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(r),o=Ct(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]]:[]).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=zr,a=Or,o=n,i=a,l=cs;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=r.site,i=r.edges.sort(Gr),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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,v,m,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,v=r,m=n,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=pn();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gn(t,A,g,v,m,y)},A.find=function(t){return vn(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=hs.get(r)||ds,n=ps.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 Bn(r?r.matrix:gs)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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=0/0,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=Ct(e),t):n},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(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,Ca),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,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,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 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,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&&!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=ja(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,v,m,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===zs?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=nt(v/c*Math.sin(m))),t&&(T=nt(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 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=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=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=Go;return t.source=function(r){return arguments.length?(e=Ct(r),t):e},t.target=function(e){return arguments.length?(r=Ct(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=Go,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Ns.get(e.call(this,t,n))||$o)(r.call(this,t,n))}var e=Wo,r=Zo;return t.type=function(r){return arguments.length?(e=Ct(r),t):e},t.size=function(e){return arguments.length?(r=Ct(e),t):r},t};var Ns=ui.map({circle:$o,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*Rs)),r=e*Rs;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/Is),r=e*Is/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),r=e*Is/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Ns.keys();var Is=Math.sqrt(3),Rs=Math.tan(30*Vi);Si.transition=function(t){for(var e,r,n=Fs||++Hs,a=ei(t),o=[],i=js||{time:Date.now(),ease:Cn,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(_),n=!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>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){return 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)}},{}],13:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],14:[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,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=n},{}],15:[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(){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 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=L(t,360),e=L(e,100),r=L(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=L(t,255),e=L(e,255),r=L(r,255);var n,a,o=U(t,e,r),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){z(t)&&(t="100%");var n=O(t);return t=V(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 V(1,U(0,t))}function S(t){return parseInt(t,16)}function z(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function N(t){return S(t)/255}function I(t){return!!Z.CSS_UNIT.exec(t)}function R(t){t=t.replace(j,"").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=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:S(r[1]),g:S(r[2]),b:S(r[3]),a:N(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:N(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.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 j=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=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,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=T(t),this._roundA=H(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=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=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=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 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: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[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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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)&&(r[a]="a"===a?t[a]:P(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:X(),g:X(),b:X()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100;return n({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})},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 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=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(G),Z=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],17:[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),f=c("clicktoshow");if(!u&&!f)return e;c("opacity");var d=c("bgcolor"),h=c("bordercolor"),p=a.opacity(h);c("borderpad");var g=c("borderwidth"),v=c("showarrow");c("text",v?" ":"new text"),c("textangle"),n.coerceFont(c,"font",r.font),c("width"),c("align"),c("height")&&c("valign") -;for(var m=["x","y"],y=[-10,-30],x={_fullLayout:r},b=0;b<2;b++){var _=m[b],w=o.coerceRef(t,e,x,_,"","paper");if(o.coercePosition(e,x,c,w,_,.5),v){var k="a"+_,M=o.coerceRef(t,e,x,k,"pixel");"pixel"!==M&&M!==w&&(M=e[k]="pixel");var A="pixel"===M?y[b]:.4;o.coercePosition(e,x,c,M,k,A)}c(_+"anchor"),c(_+"shift")}if(n.noneOrAll(t,e,["x","y"]),v&&(c("arrowcolor",p?e.bordercolor:a.defaultLine),c("arrowhead"),c("arrowsize"),c("arrowwidth",2*(p&&g||1)),c("standoff"),n.noneOrAll(t,e,["ax","ay"])),f){var T=c("xclick"),L=c("yclick");e._xclick=void 0===T?e.x:T,e._yclick=void 0===L?e.y:L}var C=c("hovertext"),S=r.hoverlabel||{};if(C){var z=c("hoverlabel.bgcolor",S.bgcolor||(a.opacity(d)?a.rgb(d):a.defaultLine)),O=c("hoverlabel.bordercolor",S.bordercolor||a.contrast(z));n.coerceFont(c,"hoverlabel.font",{family:S.font.family,size:S.font.size,color:S.font.color||O})}return c("captureevents",!!C),e}},{"../../lib":139,"../../plots/cartesian/axes":174,"../color":28,"./attributes":19}],18:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],19:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:i({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":135,"../../plots/cartesian/constants":179,"../../plots/font_attributes":198,"./arrow_paths":18}],20:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=o.getFromId(t,e.xref),i=o.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=l+e.xshift,n=l-e.xshift,e.axref===e.xref?(o.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),o.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):o.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),i&&i.autorange&&(r=l-e.yshift,n=l+e.yshift,e.ayref===e.yref?(o.expand(i,[i.r2c(e.y)],{ppadplus:r,ppadminus:n}),o.expand(i,[i.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):o.expand(i,[i.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(o.list(t).filter(function(t){return t.autorange&&l[t._id]}).length)return a.syncOrAsync([i,n],t)}}},{"../../lib":139,"../../plots/cartesian/axes":174,"./draw":24}],21:[function(t,e,r){"use strict";function n(t,e){var r=o(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=o(t,e),a=n.on,l=n.off.concat(n.explicitOff),s={};if(a.length||l.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var n=I.selectAll("a");if(1===n.size()&&n.text()===I.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":n.attr("xlink:href"),"xlink:xlink:show":n.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}I.selectAll("tspan.line").attr({y:0,x:0});var a=C.select(".annotation-math-group"),h=!a.empty(),p=d.bBox((h?a:I).node()),x=p.width,z=p.height,N=b.width||x,R=b.height||z,F=Math.round(N+2*O),j=Math.round(R+2*O);b._w=N,b._h=R;var B=!1;if(["x","y"].forEach(function(e){var n,a,o,i,l,f=b[e+"ref"]||e,d=b["a"+e+"ref"],h=u.getFromId(t,f),p=(A+("x"===e?0:-90))*Math.PI/180,g=F*Math.cos(p),v=j*Math.sin(p),m=Math.abs(g)+Math.abs(v),x=b[e+"anchor"],_=b[e+"shift"]*("x"===e?1:-1),w=M[e];if(h){var k=h.r2fraction(b[e]);if((t._dragging||!h.autorange)&&(k<0||k>1)&&(d===f?((k=h.r2fraction(b["a"+e]))<0||k>1)&&(B=!0):B=!0,B))return;n=h._offset+h.r2p(b[e]),i=.5}else"x"===e?(o=b[e],n=y.l+y.w*o):(o=1-b[e],n=y.t+y.h*o),i=b.showarrow?.5:o;if(b.showarrow){w.head=n;var T=b["a"+e];l=g*r(.5,b.xanchor)-v*r(.5,b.yanchor),d===f?(w.tail=h._offset+h.r2p(T),a=l):(w.tail=n+T,a=l+T),w.text=w.tail+l;var L=s["x"===e?"width":"height"];if("paper"===f&&(w.head=c.constrain(w.head,1,L-1)),"pixel"===d){var C=-Math.max(w.tail-3,w.text),S=Math.min(w.tail+3,w.text)-L;C>0?(w.tail+=C,w.text+=C):S>0&&(w.tail-=S,w.text-=S)}w.tail+=_,w.head+=_}else l=m*r(i,x),a=l,w.text=n+l;w.text+=_,l+=_,a+=_,b["_"+e+"padplus"]=m/2+a,b["_"+e+"padminus"]=m/2-a,b["_"+e+"size"]=m,b["_"+e+"shift"]=l}),B)return void C.remove();var q=0,H=0;if("left"!==b.align&&(q=(N-x)*("center"===b.align?.5:1)),"top"!==b.valign&&(H=(R-z)*("middle"===b.valign?.5:1)),h)a.select("svg").attr({x:O+q-1,y:O+H}).call(d.setClipUrl,P?_:null);else{var V=O+H-p.top,U=O+q-p.left;I.attr({x:U,y:V}).call(d.setClipUrl,P?_:null),I.selectAll("tspan.line").attr({y:V,x:U})}E.select("rect").call(d.setRect,O,O,N,R),D.call(d.setRect,S/2,S/2,F-S,j-S),C.call(d.setTranslate,Math.round(M.x.text-F/2),Math.round(M.y.text-j/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var X="annotations["+e+"]",G=function(r,n){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a=M.x.head,s=M.y.head,u=M.x.tail+r,h=M.y.tail+n,p=M.x.text+r,g=M.y.text+n,x=c.rotationXYMatrix(A,p,g),_=c.apply2DTransform(x),S=c.apply2DTransform2(x),z=+D.attr("width"),O=+D.attr("height"),P=p-.5*z,E=P+z,N=g-.5*O,I=N+O,R=[[P,N,P,I],[P,I,E,I],[E,I,E,N],[E,N,P,N]].map(S);if(!R.reduce(function(t,e){return t^!!o(a,s,a+1e6,s+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=o(u,h,a,s,t[0],t[1],t[2],t[3]);e&&(u=e.x,h=e.y)});var F=b.arrowwidth,j=b.arrowcolor,B=T.append("g").style({opacity:f.opacity(j)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),q=B.append("path").attr("d","M"+u+","+h+"L"+a+","+s).style("stroke-width",F+"px").call(f.stroke,f.rgb(j));if(m(q,b.arrowhead,"end",b.arrowsize,b.standoff),t._context.editable&&q.node().parentNode){var H=a,V=s;if(b.standoff){var U=Math.sqrt(Math.pow(a-u,2)+Math.pow(s-h,2));H+=b.standoff*(u-a)/U,V+=b.standoff*(h-s)/U}var G,Y,Z,W=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(u-H)+","+(h-V),transform:"translate("+H+","+V+")"}).style("stroke-width",F+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");v.init({element:W.node(),prepFn:function(){var t=d.getTranslate(C);Y=t.x,Z=t.y,G={},w&&w.autorange&&(G[w._name+".autorange"]=!0),k&&k.autorange&&(G[k._name+".autorange"]=!0)},moveFn:function(t,e){var r=_(Y,Z),n=r[0]+t,a=r[1]+e;C.call(d.setTranslate,n,a),G[X+".x"]=w?w.p2r(w.r2p(b.x)+t):b.x+t/y.w,G[X+".y"]=k?k.p2r(k.r2p(b.y)+e):b.y-e/y.h,b.axref===b.xref&&(G[X+".ax"]=w.p2r(w.r2p(b.ax)+t)),b.ayref===b.yref&&(G[X+".ay"]=k.p2r(k.r2p(b.ay)+e)),B.attr("transform","translate("+t+","+e+")"),L.attr({transform:"rotate("+A+","+n+","+a+")"})},doneFn:function(e){if(e){l.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(b.showarrow&&G(0,0),t._context.editable){var Y,Z;v.init({element:C.node(),prepFn:function(){Z=L.attr("transform"),Y={}},moveFn:function(t,e){var r="pointer";if(b.showarrow)b.axref===b.xref?Y[X+".ax"]=w.p2r(w.r2p(b.ax)+t):Y[X+".ax"]=b.ax+t,b.ayref===b.yref?Y[X+".ay"]=k.p2r(k.r2p(b.ay)+e):Y[X+".ay"]=b.ay+e,G(t,e);else{if(w)Y[X+".x"]=b.x+t/w._m;else{var n=b._xsize/y.w,a=b.x+(b._xshift-b.xshift)/y.w-n/2;Y[X+".x"]=v.align(a+t/y.w,n,0,1,b.xanchor)}if(k)Y[X+".y"]=b.y+e/k._m;else{var o=b._ysize/y.h,i=b.y-(b._yshift+b.yshift)/y.h-o/2;Y[X+".y"]=v.align(i-e/y.h,o,0,1,b.yanchor)}w&&k||(r=v.getCursor(w?.5:Y[X+".x"],k?.5:Y[X+".y"],b.xanchor,b.yanchor))}L.attr({transform:"translate("+t+","+e+")"+Z}),g(C,r)},doneFn:function(e){if(g(C),e){l.relayout(t,Y);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var a=t.layout,s=t._fullLayout,y=t._fullLayout._size;s._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var x=(a.annotations||[])[e],b=s.annotations[e],_="clip"+s._uid+"_ann"+e;if(!x||b.visible===!1)return void i.selectAll("#"+_).remove();var w=u.getFromId(t,b.xref),k=u.getFromId(t,b.yref),M={x:{},y:{}},A=+b.textangle||0,T=s._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",b.opacity),L=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),C=L.append("g").style("pointer-events",b.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:x,fullAnnotation:b,event:i.event})});b.hovertext&&C.on("mouseover",function(){var e=b.hoverlabel,r=e.font,n=this.getBoundingClientRect(),a=t.getBoundingClientRect();h.loneHover({x0:n.left-a.left,x1:n.right-a.left,y:(n.top+n.bottom)/2-a.top,text:b.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:s._hoverlayer.node(),outerContainer:s._paper.node()})}).on("mouseout",function(){h.loneUnhover(s._hoverlayer.node())});var S=b.borderwidth,z=b.borderpad,O=S+z,D=C.append("rect").attr("class","bg").style("stroke-width",S+"px").call(f.stroke,b.bordercolor).call(f.fill,b.bgcolor),P=b.width||b.height,E=s._defs.select(".clips").selectAll("#"+_).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),E.exit().remove();var N=b.font,I=C.append("text").classed("annotation",!0).attr("data-unformatted",b.text).text(b.text);t._context.editable?I.call(p.makeEditable,C).call(r).on("edit",function(n){b.text=n,this.attr({"data-unformatted":b.text}),this.call(r);var a={};a["annotations["+e+"].text"]=b.text,w&&w.autorange&&(a[w._name+".autorange"]=!0),k&&k.autorange&&(a[k._name+".autorange"]=!0),l.relayout(t,a)}):I.call(r)}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,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("../../plotly"),s=t("../../plots/plots"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":139,"../../lib/setcursor":154,"../../lib/svg_text_utils":156,"../../plotly":169,"../../plots/cartesian/axes":174,"../../plots/plots":202,"../color":28,"../dragelement":49,"../drawing":52,"../fx":69,"./draw_arrow_head":25,d3:10}],25:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(r,a){h.path&&(e>5&&(a=0),n.select(d.parentElement).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(v=Math.atan2(A,M),m=v+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(v),L=k*Math.sin(v);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var C=d.getTotalLength(),S="";if(C=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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(i.combine(t,c))),(n.isDark()?e?n.lighten(e):c:r?n.darken(r):s).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(z);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[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&&(r[1]+=r[1]>r[0]?1:-1);var o=D(t).replace("e-",""),i=a(o).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: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){n.select(this).attr("d","M"+Y+","+(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=Y+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-Y-T.l,r=Math.max(r,n)}var o=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,l=$-Q;ot.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:Q-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:Y,y:Q+_.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=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],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(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+G,W+V-G],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+U)*T.w,ut=K.titlefont.size;st="top"===_.titleside?(1-(W+V-G))*T.h+T.t+3+.75*ut:(1-(W+G))*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(Z+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=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":139,"./flip_scale":39,"./scales":46}],35:[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":135,"./attributes":33,"./scales.js":46}],36:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":46}],37:[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,v=p[d+"min"],m=p[d+"max"],y=p.colorscale;c(f+d+"auto",!(n(v)&&n(m)&&v=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],40:[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":36,"./is_valid_scale_array":44,"./scales":46}],41:[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}},{}],48:[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":139}],49:[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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return t.element.onmousemove=g,v._dragged=!1,v._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-v._mouseDownTimey&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(v._dragged,m,e),!v._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(v),v._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g,v=i.getPlotDiv(t.element)||{},m=1,y=s.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),g=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=n},{"../../constants/interactions":124,"../../lib":139,"../../plotly":169,"../../plots/cartesian/constants":179,"./align":47,"./cursor":48,"./unhover":50}],50:[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,a=t._hoverdata;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":134}],51:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],52:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i,l){if(s.traceIs(r,"symbols")){var u=g(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:p.isBubble(r)?u(t.ms):(o.size||6)/2,t.mrc=e;var n=v.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,v.symbolFuncs[a](e)+(n>=200?x:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,m=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?c.defaultLine:i.color,Array.isArray(o.color)&&(f=c.defaultLine,m=!0),f="mc"in t?t.mcc=n(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var y=o.gradient,b=t.mgt;if(b?m=!0:b=y&&y.type,b&&"none"!==b){var _=t.mgc;_?m=!0:_=y.color;var w="g"+l._fullLayout._uid+"-"+r.uid;m&&(w+="-"+t.i),e.call(v.gradient,l,w,b,f,_)}else e.call(c.fill,f);h&&e.call(c.stroke,d)}}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,k/2),u=Math.pow(l*l+s*s,k/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("tinycolor2"),s=t("../../registry"),c=t("../color"),u=t("../colorscale"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.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(c.fill,n)},v.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},v.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},v.setRect=function(t,e,r,n,a){t.call(v.setPosition,e,r).call(v.setSize,n,a)},v.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);return i(a)&&i(o)&&e.node()?("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0):(e.remove(),!1)},v.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);v.translatePoint(t,a,e,r,n)})},v.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},v.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.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||"";c.stroke(e,n||o.color),v.dashLine(e,l,i)},v.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(c.stroke,r||a.color).call(v.dashLine,l,i)})},v.dashLine=function(t,e,r){r=+r||0,e=v.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},v.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),r.remove()}})};var m=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=v.symbolNames.length,x="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";v.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=v.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var b={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};v.gradient=function(t,e,r,n,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+i],f.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(b):"vertical"===n&&t.attr(_),t.attr("id",r);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},v.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},v.singlePointStyle=function(t,e,r,a,o,i){var l=r.marker;n(t,e,r,a,o,l,l.line,i)},v.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=v.tryColorscale(r,""),a=v.tryColorscale(r,"line"),i=f.getPlotDiv(t.node());t.each(function(t){v.singlePointStyle(t,o.select(this),e,n,a,i)})}},v.tryColorscale=function(t,e){var r=e?f.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?u.makeColorScaleFunc(u.extractScale(n,r.cmin,r.cmax)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};v.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(v.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(n).call(d.convertToTspans);var f=o.select(this.parentNode),h=r.selectAll("tspan.line"),p=1.3*((h[0].length||1)-1)+1,g=w[s]*u,m=.75*c+w[l]*u+(w[l]-1)*p*c/2;f.attr("transform","translate("+g+","+m+")"),p>1&&h.attr({x:r.attr("x"),y:r.attr("y")})})};var k=.5;v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=1e4&&(o.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(s),f.extendFlat({},s)},v.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},v.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||0,y:+n[1]||0}},v.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[n]("transform")||"";return e=e||0,r=r||0,o=o.replace(/(\btranslate\(.*?\);?)/,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},v.getScale=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||1,y:+n[1]||1}},v.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[n]("transform")||"";return e=e||1,r=r||1,o=o.replace(/(\bscale\(.*?\);?)/,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},v.setPointGroupScale=function(t,e,r){var n,a,o;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};v.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),a=n.select("text"),i=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(n.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===r?[]:["translate("+i+","+l+")","scale("+e+","+r+")","translate("+-i+","+-l+")"],s&&t.push(s),n.attr("transform",t.join(" "))})},v.measureText=function(t,e,r){var n=t.append("text").text(e).call(v.font,r),a=v.bBox(n.node());return n.remove(),a}},{"../../constants/xmlns_namespaces":127,"../../lib":139,"../../lib/svg_text_utils":156,"../../registry":209,"../../traces/scatter/make_bubble_size_func":288,"../../traces/scatter/subtypes":293,"../color":28,"../colorscale":42,"./symbol_defs":53,d3:10,"fast-isnumeric":13,tinycolor2:16}],53:[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);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),o=n.round(t*-.309,2);return"M"+e+","+o+"L"+r+","+n.round(.809*t,2)+"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);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+n.round(.382*e,2)+"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:10}],54:[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"}}}},{}],55:[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 v=g.enter().append("g").classed("errorbar",!0);u&&v.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 v=e.select("path.yerror");l=!v.size(), -l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(r.duration).ease(r.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(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":293,d3:10,"fast-isnumeric":13}],60:[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":28,d3:10}],61:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":135,"../../plots/font_attributes":198}],62:[function(t,e,r){"use strict";function n(t,e,r){Array.isArray(t)&&(e[0][r]=t)}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=0;r=0&&r.indexQ.width||W<0||W>Q.height)return x.unhoverRaw(t,e)}if(P="xval"in e?w.flat(n,e.xval):w.p2c(T,Z),E="yval"in e?w.flat(n,e.yval):w.p2c(L,W),!f(P[0])||!f(E[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var J=1/0;for(I=0;I1||F.hoverinfo.indexOf("name")!==-1?F.name:void 0,index:!1,distance:Math.min(J,k.MAXDIST),color:y.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},d[j]&&(U.subplot=d[j]._subplot),X=G.length,"array"===q){var K=e[I];"pointNumber"in K?(U.index=K.pointNumber,q="closest"):(q="","xval"in K&&(H=K.xval,q="x"),"yval"in K&&(V=K.yval,q=q?"closest":"y"))}else H=P[B],V=E[B];if(F._module&&F._module.hoverPoints){var tt=F._module.hoverPoints(U,H,V,q);if(tt)for(var et,rt=0;rtX&&(G.splice(0,X),J=G[0].distance)}if(0===G.length)return x.unhoverRaw(t,e);G.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,at=[];for(N=0;N1,st=y.combine(d.plot_bgcolor||y.background,d.paper_bgcolor),ct={hovermode:D,rotateLabels:lt,bgColor:st,container:d._hoverlayer,outerContainer:d._paperdiv,commonLabelOpts:d.hoverlabel},ut=a(G,ct);if(o(G,lt?"xa":"ya"),i(ut,lt),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,at);v(u.select(e.target),ft?"pointer":"")}e.target&&c(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:L,xvals:P,yvals:E}))}function a(t,e){var r,n,a=e.hovermode,o=e.rotateLabels,i=e.bgColor,l=e.container,s=e.outerContainer,c=e.commonLabelOpts||{},f=e.fontFamily||k.HOVERFONT,d=e.fontSize||k.HOVERFONTSIZE,h=t[0],p=h.xa,v=h.ya,x="y"===a?"yLabel":"xLabel",b=h[x],_=(String(b)||"").split(" ")[0],w=s.node().getBoundingClientRect(),A=w.top,T=w.width,L=w.height,C=h.distance<=k.MAXDIST&&("x"===a||"y"===a);for(r=0;r15&&(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):C&&t[a+"Label"]===b?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 h=e.select("text.nums").call(m.font,t.fontFamily||f,t.fontSize||d,t.fontColor||c).call(m.setPosition,0,0).text(n).attr("data-notex",1).call(g.convertToTspans);h.selectAll("tspan.line").call(m.setPosition,0,0);var p=e.select("text.name"),v=0;r&&r!==n?(p.call(m.font,t.fontFamily||f,t.fontSize||d,s).text(r).call(m.setPosition,0,0).attr("data-notex",1).call(g.convertToTspans),p.selectAll("tspan.line").call(m.setPosition,0,0),v=p.node().getBoundingClientRect().width+2*z):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var x,_,w=h.node().getBoundingClientRect(),k=t.xa._offset+(t.x0+t.x1)/2,O=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),E=w.width+S+z+v;t.ty0=A-w.top,t.bx=w.width+2*z,t.by=w.height+2*z,t.anchor="start",t.txwidth=w.width,t.tx2width=v,t.offset=0,o?(t.pos=k,x=O+P/2+E<=L,_=O-P/2-E>=0,"top"!==t.idealAlign&&x||!_?x?(O+=P/2,t.anchor="start"):t.anchor="middle":(O-=P/2,t.anchor="end")):(t.pos=O,x=k+D/2+E<=T,_=k-D/2-E>=0,"left"!==t.idealAlign&&x||!_?x?(k+=D/2,t.anchor="start"):t.anchor="middle":(k-=D/2,t.anchor="end")),h.attr("text-anchor",t.anchor),v&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+k+","+O+")"+(o?"rotate("+M+")":""))}),P}function o(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)?T: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 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 i(t,e){t.each(function(t){var r=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+s)+"V"+(c-S)+"Z"),a.call(m.setPosition,i+s,c+t.ty0-t.by/2+z).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(m.setPosition,l+o*z+s,c+t.ty0-t.by/2+z),r.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;r.hover=function(t,e,r){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return n(t,e,r),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l);return i(s,l.rotateLabels),s.node()}},{"../../lib":139,"../../lib/events":134,"../../lib/override_cursor":148,"../../lib/svg_text_utils":156,"../../plots/cartesian/axes":174,"../../registry":209,"../color":28,"../dragelement":49,"../drawing":52,"./constants":64,"./helpers":66,d3:10,"fast-isnumeric":13,tinycolor2:16}],68:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":139}],69:[function(t,e,r){"use strict";function n(t){var e=i.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){var n=t.hoverlabel||{},a=i.nestedProperty(n,r).get();return Array.isArray(a)?Array.isArray(e)&&Array.isArray(a[e[0]])?a[e[0]][e[1]]:a[e]:a}var o=t("d3"),i=t("../../lib"),l=t("../dragelement"),s=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:s.getDistanceFunction,getClosest:s.getClosest,inbox:s.inbox,castHoverOption:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":139,"../dragelement":49,"./attributes":61,"./calc":62,"./click":63,"./constants":64,"./defaults":65,"./helpers":66,"./hover":67,"./layout_attributes":70,"./layout_defaults":71,"./layout_global_defaults":72,d3:10}],70:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":135,"../../plots/font_attributes":198,"./constants":64}],71:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],79:[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":135,"../../plots/font_attributes":198,"../color/attributes":27}],80:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],81:[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,v="normal",m=0;m1)!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":139,"../../plots/layout_attributes":200,"../../registry":209,"./attributes":79,"./helpers":84}],82:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(i,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.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;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeT&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},T):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&A&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),A=!1):A=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?g===-1?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&g===-1&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vtspan"),f=u[0].length||1;r=l*f,n=c.node()&&v.bBox(c.node()).width;var d=l*(.3+(1-f)/2);c.attr("y",d),u.attr("y",d)}r=Math.max(r,16)+3,a.height=r,a.width=n}function l(t,e,r){var n=t._fullLayout,a=n.legend,o=a.borderwidth,i=k.isGrouped(a);if(k.isVertical(a))i&&e.each(function(t,e){v.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;v.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];u.select(this).select(".legendtoggle").call(v.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(),c=0,f=s.length;cn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),v.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+r,a.height=Math.max(a.height,e.height),y+=i+r,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center");var a="top";M.isBottomAnchor(r)?a="bottom":M.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),A=!0,T=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),L.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&_(t.calcdata,y),k=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).remove(),void h.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var L=r._topdefs.selectAll("#"+i).data([0]);L.enter().append("clipPath").attr("id",i).append("rect");var C=A.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=A.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var z=A.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 O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==A.enter().size();P&&(l(t,O,D),s(t));var E=r.width,N=r.height;l(t,O,D),y.height>N?c(t):s(t);var I=r._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);M.isRightAnchor(y)?R-=y.width:M.isCenterAnchor(y)&&(R-=y.width/2),M.isBottomAnchor(y)?F-=y.height:M.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var q=y.height,H=I.h;q>H?(F=I.t,q=H):(F+q>N&&(F=N-q),F<0&&(F=0),q=Math.min(N-F,y.height)),v.setTranslate(A,R,F);var V,U,X=q-x.scrollBarHeight-2*x.scrollBarMargin,G=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),L.select("rect").attr({width:j-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),L.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),A.on("wheel",null),A.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/X*G,-G,0),V=x.scrollBarMargin-U/G*X,e(V,U),0!==U&&U!==-G&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var Y=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+X),U=-(V-x.scrollBarMargin)/X*G,e(V,U)});z.call(Y),S.call(Y)}if(t._context.editable){var Z,W,$,Q;A.classed("cursor-move",!0),g.init({element:A.node(),prepFn:function(){var t=v.getTranslate(A);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;v.setTranslate(A,r,n),Z=g.align(r,0,I.l,I.l+I.w,y.xanchor),W=g.align(n,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?A._clickTimeout=setTimeout(function(){o(i,t,n)},T):2===n&&(A._clickTimeout&&clearTimeout(A._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/interactions":124,"../../lib":139,"../../lib/svg_text_utils":156,"../../plotly":169,"../../plots/plots":202,"../../registry":209,"../color":28,"../dragelement":49,"../drawing":52,"./anchor_utils":78,"./constants":80,"./get_legend_data":83,"./helpers":84,"./style":86,d3:10}],83:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))s.indexOf(t)===-1?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[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 v=s.select(this).select("g.legendpoints"),m=v.selectAll("path.scatterpts").data(l?n:[]);m.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),m.exit().remove(),m.call(f.pointStyle,a),l&&(n[0].mrc=3);var y=v.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=s.select(this),a=t[0],o=(a.mlw+1||n.width+1)-1;e.style("stroke-width",o+"px").call(d.fill,a.mc||r.color),o&&e.call(d.stroke,a.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(){var t=e.line.width,r=s.select(this);r.style("stroke-width",t+"px").call(d.fill,e.fillcolor),t&&r.call(d.stroke,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.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var n=r.selectAll("g.legendsymbols").data([t]);n.enter().append("g").classed("legendsymbols",!0),n.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(n).each(a)}},{"../../lib":139,"../../registry":209,"../../traces/pie/style_one":271,"../../traces/scatter/subtypes":293,"../color":28,"../drawing":52,d3:10}],87:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),i(v,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["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&&n(y),!c&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(v,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":139,"../color":28,"./attributes":91,"./button_attributes":92,"./constants":93}],95:[function(t,e,r){"use strict";function n(t){for(var e=m.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;lG&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),X=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),q=m.getDataToPixel(t,j),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,j),U=m.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(v=q(r.x0),y=H(r.y0),x=q(r.x1),b=H(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vY&&(h[S]=r[P]=U(c),h[z]=r[E]=U(u)),d-f>G&&(h[O]=r[N]=V(f),h[D]=r[I]=V(d))}e.attr("d",i(t,r))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,D,P,E,N,I,R,F,j,B,q,H,V,U,X,G=10,Y=10,Z={setCursor:a,element:e.node(),prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z)}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=m.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=m.decodeDate(n)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":139,"../../lib/setcursor":154,"../../plotly":169,"../../plots/cartesian/axes":174,"../color":28,"../dragelement":49,"../drawing":52,"./constants":106,"./helpers":109}],109:[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}},{}],110:[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":104,"./calc_autorange":105,"./defaults":107,"./draw":108}],111:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":139,"../../plots/cartesian/axes":174,"./attributes":104,"./helpers":109}],112:[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":135,"../../plots/animation_attributes":170,"../../plots/font_attributes":198,"../../plots/pad_attributes":201,"./constants":113}],113:[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}},{}],114:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",a);var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}return e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans),A.setTranslate(o,n,e.currentValueHeight),o}}function s(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]);n.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans),n}function u(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,m(e,t.fraction),C.tickOffset+e.ticklen+e.labelHeight+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(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(M.fill,r.bgcolor).attr("opacity",0),A.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(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.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 g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+g+")")}}}var g=r.propContainer,v=r.propName,m=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,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(d);var O="Click to enter "+y+" title";t._context.editable?(S?z.on(".opacity",null):function(){L=0,C=!0,S=O,z.attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),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(d)}).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)}},{"../../constants/interactions":124,"../../lib":139,"../../lib/svg_text_utils":156,"../../plotly":169,"../../plots/plots":202,"../color":28,"../drawing":52,d3:10,"fast-isnumeric":13}],118:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":135,"../../plots/font_attributes":198,"../../plots/pad_attributes":201,"../color/attributes":27}],119:[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"}},{}],120:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+C.headerGroupClassName).data(r,a);u.enter().append("g").classed(C.headerGroupClassName,!0);var f=o.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":139,"../color":28,"../drawing":52,d3:10}],124:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],125:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],126:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],127:[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}},{}],128:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.27.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/fx"),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=t("./components/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":26,"./components/fx":69,"./components/images":77,"./components/legend":85,"./components/rangeselector":97,"./components/rangeslider":103,"./components/shapes":110,"./components/sliders":116,"./components/updatemenus":122,"./fonts/mathjax_config":129,"./lib/queue":151,"./plot_api/plot_schema":163,"./plot_api/register":164,"./plot_api/set_plot_config":165,"./plot_api/to_image":167,"./plot_api/validate":168,"./plotly":169,"./snapshot":214,"./snapshot/download":211,"./traces/scatter":283,d3:10,"es6-promise":11}],129:[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},{}],130:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),n(t)?Number(t):a}},{"../constants/numerical":125,"fast-isnumeric":13}],131:[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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);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;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,L;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=T&&t<=L?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-A)%100+A:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},T=r.MIN_MS=r.dateTime2ms("-9999"),L=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var C=90*y,S=3*x,z=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=T&&t<=L))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=T+y&&t<=L-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=M("%Y"),E=M("%b %Y"),N=M("%b %-d"),I=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=P(g):"m"===r?d=E(g):"d"===r?(o=P(g),d=N(g)):(o=I(g),d=l(t,r))}return d+(o?"\n"+o:"")};var R=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+R);return s.setUTCMonth(s.getUTCMonth()+e)+a-R},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;ur?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.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||1/0!==u&&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)<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.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":130,"./coerce":131,"./dates":132,"./ensure_array":133,"./extend":135,"./filter_unique":136,"./filter_visible":137,"./identity":138,"./is_array":140,"./is_plain_object":141,"./loggers":142,"./matrix":143,"./mod":144,"./nested_property":145,"./noop":146,"./notifier":147,"./push_unique":150,"./relink_private":152,"./search":153,"./stats":155,"./to_log_range":157,d3:10}],140:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],141:[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}},{}],142:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":125,"./matrix":143}],150:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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":13}],156:[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-"+h.randstr([],64),o=d.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=d.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.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":"")+(m[n]||"");if("br"===n)return"
";var o,i=e[4];if("a"===n){var l=i&&i.match(T),c=l&&(l[3]||l[4]);if(o="':o+">"}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,d=t("d3"),h=t("../lib"),p=t("../constants/xmlns_namespaces"),g=t("../constants/string_mappings");r.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},d.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=r.getDOMParser(),a=n.parseFromString(e,"application/xml"),o=a.documentElement.firstChild;o;)this.node().appendChild(this.node().ownerDocument.importNode(o,!0)),o=o.nextSibling;return a.querySelector("parsererror")?(h.log(a.querySelector("parsererror div").textContent),null):d.select(this.node().lastChild)},r.html_entity_decode=function(t){var e=d.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=l.attr("class")+"-math",f.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,f=d.select(l.node().parentNode);if(!f.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=h.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){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return r(),void t();var c=f.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 d=n(s,"width"),h=n(s,"height"),g=+l.attr("x")-d*{start:0,middle:.5,end:1}[l.attr("text-anchor")||"start"],v=parseInt(l.style("font-size"),10)||n(l,"height"),m=-v/4;"y"===p[0]?(c.attr({transform:"rotate("+[-90,+l.attr("x"),+l.attr("y")]+") translate("+[-d/2,m-h/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-h/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-h/2}),e&&e.call(l,c),t(c)})}))}else r();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},m={sup:'',sub:''},y=["http:","https:","mailto:"],x=new RegExp("]*)?/?>","g"),b=Object.keys(g.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:g.entityToUnicode[t]}}),_=Object.keys(g.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+g.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,k=/(<[^<>]*>)/,M=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,L=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(x," ")},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]")&&d.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=h.getPlotDiv(i.node()),e=d.select(t),n=e.select(".svg-container"),o=n.append("div");o.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,n,r)).on("blur",function(){t._editing=!1,i.text(this.textContent).style({opacity:1});var e,r=d.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&d.select(i.node().parentNode).select(e).style({opacity:0});var n=this.textContent;d.select(this).transition().duration(0).remove(),d.select(document).on("mouseup",null),l.edit.call(i,n)}).on("focus",function(){var e=this;t._editing=!0,d.select(document).on("mouseup",function(){if(d.event.target===e)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===d.event.which?(t._editing=!1,i.style({opacity:1}),d.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),d.select(this).call(u(i,n,r)))}).on("keydown",function(){13===d.event.which&&this.blur()}).call(a)}r||(r={});var i=this,l=d.dispatch("edit","input","cancel"),s=d.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),r.immediate?n():c.on("click",n),d.rebind(this,l,"on")}},{"../constants/string_mappings":126,"../constants/xmlns_namespaces":127,"../lib":139,d3:10}],157:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":13}],158:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),C=L||[],S=n(m,f).get(),z=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),O===-1&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(O===-1)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sj.range[0]?[1,2]:[2,1]);else{var H=j.range[0],V=j.range[1];B?(H<=0&&V<=0&&r(I+".autorange",!0),H<=0?H=V/1e6:V<=0&&(V=H/1e6),r(I+".range[0]",Math.log(H)/Math.LN10),r(I+".range[1]",Math.log(V)/Math.LN10)):(r(I+".range[0]",Math.pow(10,H)),r(I+".range[1]",Math.pow(10,V)))}else r(I+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,F,T,r),w.getComponentMethod("images","convertCoords")(t,F,T,r)}else r(I+".autorange",!0)}else if(D.match(P.AX_NAME_PATTERN)){var U=x.nestedProperty(c,M).get(),X=(T||{}).type;X&&"-"!==X||(X="linear"),w.getComponentMethod("annotations","convertCoords")(t,U,X,r),w.getComponentMethod("images","convertCoords")(t,U,X,r)}var G=z.containerArrayMatch(M);if(G){o=G.array,i=G.index;var Y=G.property,Z=x.nestedProperty(s,o),W=(Z||[])[i]||{};if(""===i)M.indexOf("updatemenus")===-1&&(v.docalc=!0);else if(""===Y){var $=T;z.isAddVal(T)?b[M]=null:z.isRemoveVal(T)?(b[M]=W,$=W):x.warn("unrecognized full object value",e),(n($,"x")||n($,"y")&&M.indexOf("updatemenus")===-1)&&(v.docalc=!0)}else!n(W,"x")&&!n(W,"y")||x.containsAny(M,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);d[o]||(d[o]={});var Q=d[o][i];Q||(Q=d[o][i]={}),Q[Y]=T,delete e[M]}else if("reverse"===D)R.range?R.range.reverse():(r(I+".autorange",!0),R.range=[1,0]),F.autorange?v.docalc=!0:v.doplot=!0;else{var J=String(A.parts[1]||"");0===S.indexOf("scene")?"camera"===A.parts[1]?v.docamera=!0:v.doplot=!0:0===S.indexOf("geo")?v.doplot=!0:0===S.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===M?v.doplot=!0:"margin"===S||"autorange"===J||"rangemode"===J||"type"===J||"domain"===J||"fixedrange"===J||"scaleanchor"===J||"scaleratio"===J||M.indexOf("calendar")!==-1||M.match(/^(bar|box|font)/)?v.docalc=!0:!c._has("gl2d")||M.indexOf("axis")===-1&&"plot_bgcolor"!==M?"hiddenlabels"===M?v.docalc=!0:S.indexOf("legend")!==-1?v.dolegend=!0:M.indexOf("title")!==-1?v.doticks=!0:S.indexOf("bgcolor")!==-1?v.dolayoutstyle=!0:L>1&&x.containsAny(J,["tick","exponent","grid","zeroline"])?v.doticks=!0:M.indexOf(".linewidth")!==-1&&M.indexOf("axis")!==-1?v.doticks=v.dolayoutstyle=!0:L>1&&J.indexOf("line")!==-1?v.dolayoutstyle=!0:L>1&&"mirror"===J?v.doticks=v.dolayoutstyle=!0:"margin.pad"===M?v.doticks=v.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(M)!==-1||M.indexOf("spike")!==-1?v.domodebar=!0:["height","width","autosize"].indexOf(M)===-1&&(v.doplot=!0):v.doplot=!0,A.set(T)}}}for(o in d){z.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],v)||(v.doplot=!0)}var K=c._axisConstraintGroups;for(var tt in _)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&MM)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":52,"../components/errorbars":58,"../constants/xmlns_namespaces":127,"../lib":139,"../lib/events":134,"../lib/queue":151,"../lib/svg_text_utils":156,"../plotly":169,"../plots/cartesian/axis_ids":177,"../plots/cartesian/constants":179,"../plots/cartesian/constraints":181,"../plots/cartesian/graph_interact":183,"../plots/plots":202,"../plots/polar":205,"../registry":209,"./helpers":159,"./manage_arrays":160,"./subroutines":166,d3:10,"fast-isnumeric":13}],162:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],163:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[k]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=A,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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},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)||p.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){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||e.arrayOk===!0)){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}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;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":139,"../plotly":169,"../snapshot/cloneplot":210,"../snapshot/helpers":213,"../snapshot/svgtoimg":215,"../snapshot/tosvg":217,"fast-isnumeric":13}],168:[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,v=r.length,m=0;m.3*f||o(n)||o(a))){var d=r.dtick/2;t+=t+d.8){var i=Number(r.substr(1));o.exactYears>.8&&i%12==0?t=N.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=N.tickIncrement(t,r);if(l<=n)return l}return t}function o(t){var e,r,n=t.tickvals,a=t.ticktext,o=new Array(n.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;ru&&e10||"01-01"!==n.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>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=t.l2r(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 s(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function c(t,e,r,n){var a=t._tickround,o=r&&t.hoverformat||t.tickformat;n&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");s!==-1&&(i=l.substr(s+1),l=l.substr(0,s)),n&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(r?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function d(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,n)}function h(t,e,r,n){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=U[s/3+5])}return a?"\u2212"+t:t}function p(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,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 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(),_.simpleMap(r,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._input;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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type),b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},N.autoBin=function(t,e,r,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(r)c=(s-l)/r;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},N.setConvert(h),N.autoTicks(h,c);var p,g=N.tickIncrement(N.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=n(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=N.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},N.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),N.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=N.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=N.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fC?(e/=C,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,F)):n>S?(e/=S,t.dtick="M"+i(e,1,j)):n>z?(t.dtick=i(e,z,q),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=i(e,O,j):n>D?t.dtick=i(e,D,B):n>P?t.dtick=i(e,P,B):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,F))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,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,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,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,r,F));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,n){var a=r?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,n);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?V:H,s=t+.01*a,c=_.roundUp(_.mod(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=_.simpleMap(t.range,e),n=r[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":125,"../../lib":139,"fast-isnumeric":13}],176:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,r,p,g){function v(r,n){return o.coerce2(t,e,l,r,n)}var m=p.letter,y=p.font||{},x="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",b=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?h(m,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=r("color"),k=w===t.color?w:y.color;r("title",x),o.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,r,_),u(t,e,r,_,p),c(t,e,r,p);var M=v("linecolor",w),A=v("linewidth"),T=r("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var L=v("gridcolor",n(w,p.bgColor,i).toRgbString()),C=v("gridwidth");r("showgrid",p.showGrid||!!L||!!C)||(delete e.gridcolor,delete e.gridwidth);var S=v("zerolinecolor",w),z=v("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!z)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":27,"../../lib":139,"../../registry":209,"./category_order_defaults":178,"./layout_attributes":185,"./ordered_categories":187,"./set_convert":191,"./tick_label_defaults":192,"./tick_mark_defaults":193,"./tick_value_defaults":194,tinycolor2:16}],177:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],179:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],180:[function(t,e,r){"use strict";function n(t,e,r,n){var a,o,l,s,c=n[i(e)].type,u=[];for(o=0;oo*p))for(r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,r,n,a,o){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return["lasso","select"].indexOf(t)!==-1}function v(t,e){return"M"+(t.l-.5)+","+(e-I-.5)+"h-3v"+(2*I+1)+"h3ZM"+(t.r+.5)+","+(e-I-.5)+"h3v"+(2*I+1)+"h-3Z"}function m(t,e){return"M"+(e-I-.5)+","+(t.t-.5)+"v-3h"+(2*I+1)+"v3ZM"+(e-I-.5)+","+(t.b+.5)+"v3h"+(2*I+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,I)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,r){var n,a,o,i,l,s,c=!1,u={},f={};for(n=0;nI||l>I?(wt="xy",i/nt>l/at?(l=i*at/nt,mt>o?yt.t=mt-l:yt.b=mt+l):(i=l*nt/at,vt>a?yt.l=vt-i:yt.r=vt+i),Mt.attr("d",y(yt))):n():!it||lzoom back out","long"),R=!1)}function X(e,r){var n=1===(j+B).length;if(e)$();else if(2!==r||n){if(1===r&&n){var a=j?tt[0]:K[0],i="s"===j||"w"===B?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;j?(u="n"===j?"top":"bottom","right"===a.side&&(c="right")):"e"===B&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(pt).call(A.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,l,r)})}}else W()}function G(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var n=t.querySelector(".plotly");if(q(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Tt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ct.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(B||st){for(B||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":139,"fast-isnumeric":13}],189:[function(t,e,r){"use strict";e.exports=function(t,e,r){void 0===r&&(r=.5);var n=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=n[0]+(n[1]-n[0])*r,o=(a-n[0])*e;t.range=t._input.range=[t.l2r(a-o),t.l2r(a+o)]}},{}],190:[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,v=a.element.getBoundingClientRect(),m=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,x=e-v.left,b=r-v.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),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,D,P,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,F=[];for(z=0;zd?h:i(t)?Number(t):h):h}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../lib"),s=l.cleanNumber,c=l.ms2DateTime,u=l.dateTime2ms,f=t("../../constants/numerical"),d=f.FP_SAFE,h=f.BADNUM,p=t("./constants"),g=t("./axis_ids");e.exports=function(t,e){function r(e,r){if(e>0)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*w*Math.abs(n-a))}return h}function f(e,r,n){var a=u(e,n||t.calendar);if(a===h){if(!i(e))return h;a=u(new Date(+e))}return a}function v(e,r,n){return c(e,r,n||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if("number"==typeof e)return e}function b(e){return i(e)?o.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:a,t.l2c="log"===t.type?n:a,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,t.p2c="log"===t.type?function(t){return n(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=a,t.d2p=t.r2p=function(t){return b(s(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=a,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return b(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(t){return b(s(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=l.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(t,e,r){return b(f(t,0,r))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2l_noadd=x,t.r2l=t.l2r=t.r2c=t.c2r=a,t.d2p=function(t){return b(x(t))},t.p2d=function(t){return m(_(t))},t.r2p=b,t.p2r=_),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=l.nestedProperty(t,e).get(),o=(t._id||"x").charAt(0);if(n="date"===t.type?l.dfltRange(t.calendar):"y"===o?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void l.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=l.cleanDate(a[0],h,t.calendar),a[1]=l.cleanDate(a[1],h,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!l.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=l.constrain(t.r2l(a[0]),l.MIN_MS+1e3,l.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!i(a[r])){if(!i(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-d?a[r]=-d:a[r]>d&&(a[r]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var i=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(i);var c=t.r2l(t[i][0],s),u=t.r2l(t[i][1],s);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw l.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,o,i="date"===t.type&&e[r+"calendar"];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?a.dateTick0(e.calendar):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":125,"../../lib":139,"fast-isnumeric":13}],195:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(e,r){function n(e,r){for(a=0;ar.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(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}(v,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":52,"../../plotly":169,"../../registry":209,"./axes":174,d3:10}],196:[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 c=a(e,r,n);if(c){if("histogram"===c.type&&n==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=n+"calendar",f=c[u];if(i(c,n)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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"),s=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,i),s.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=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).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||[],i=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var s=r.width,u=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=s),a.height||(n.height=u)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,h=t._context&&t._context.autosizable;f&&(d||h)?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,i,a,n),n._has=p._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var u=o(t._boundingBoxMargins),d=u.left+u.right,h=u.bottom+u.top,g=1-2*l,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-d)),a=Math.round(g*(v.height-h))}else{var m=c?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,a=parseFloat(m.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;c.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];n._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),u=e._pushmargin;if(e.margin.autoexpand!==!1){u.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(u),d=0;dv){var M=(m*w+(k-e.width)*v)/(w-v),A=(k*(1-v)+(m-e.width)*(1-w))/(w-v);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(s(x)&&u[_].t){var T=u[_].t.val,L=u[_].t.size;if(T>y){var C=(x*T+(L-e.height)*y)/(T-y),S=(L*(1-y)+(x-e.height)*(1-T))/(T-y);C>=0&&S>=0&&C+S>l+i&&(l=C,i=S)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(f.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):f.isJSDate(t)?f.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===n?c:JSON.stringify(c)},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 c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,u=0,h=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=L?f.angularAxis.domain:n.extent(k),S=Math.abs(k[1]-k[0]);A&&!M&&(S=0);var z=C.slice();T&&M&&(z[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(z[1]-z[0])/O);var D=f.angularAxis.ticksStep||(z[1]-z[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),z[2]||(z[2]=D);var P=n.range.apply(this,z);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(z.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?S:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),N=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(N)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},j={"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 B=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=void 0===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:I,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=I.node().getBBox();x=Math.min(f.width-q.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}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(j).text(f.title),U=V.node().getBBox();V.attr({x:_[0]-U.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(F),G.attr("r",a),G.exit().remove()}X.select("circle.outside-circle").attr({r:x}).style(F);var Y=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Z=n.svg.axis().scale(a).ticks(5).tickSize(5);X.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),X.selectAll(".domain").style(F),X.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),X.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),$=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),$.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(F),$.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var Q=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(j);f.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(Y).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(Y).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(Y).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},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(void 0===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;return[t*Math.cos(r),t*Math.sin(r)]},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 v.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,a,o)},"stroke-width":function(t,e){return v["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,a,o)},opacity:function(t,e){return v.opacity(r,a,o)},display:function(t,e){return v.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 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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.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=[i.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),o(e[r],i.PolyChart.defaultConfig()),o(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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),v=n.scale[u?"linear":"ordinal"]().domain(g).range(s),m=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,m(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=n.svg.axis().scale(m).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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){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);if([[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"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":139,d3:10}],207:[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":28,"../../lib":139,"./micropolar":206,"./undo_manager":208,d3:10}],208:[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-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)),d=t._context||{};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&&A>0,j=k<=I&&A<=R,B=k<=R&&A<=I,q="h"===m?I>=k*(R/A):R>=A*(I/k);F&&(j||B||q)?x="inside":(x="outside",b.remove(),b=null)}else x="inside";if(!b&&(b=g(e,y,"outside"===x?C:L),_=M.bBox(b.node()),k=_.width,A=_.height,k<=0||A<=0))return void b.remove();var H;H="outside"===x?o(i,d,h,p,_,m):a(i,d,h,p,_,m),b.attr("transform",H)}}}function a(t,e,r,n,a,o){var l,s,c,u,f,d=a.width,h=a.height,p=(a.left+a.right)/2,g=(a.top+a.bottom)/2,v=Math.abs(e-t),m=Math.abs(n-r);v>2*D&&m>2*D?(f=D,v-=2*f,m-=2*f):f=0;var y,x;return d<=v&&h<=m?(y=!1,x=1):d<=m&&h<=v?(y=!0,x=1):dr?(c=(t+e)/2,u=n-f-s/2):(c=(t+e)/2,u=n+f+s/2),i(p,g,c,u,x,y)}function o(t,e,r,n,a,o){var l,s="h"===o?Math.abs(n-r):Math.abs(e-t);s>2*D&&(l=D,s-=2*l);var c,u,f,d,h="h"===o?Math.min(1,s/a.height):Math.min(1,s/a.width),p=(a.left+a.right)/2,g=(a.top+a.bottom)/2;return c=h*a.width,u=h*a.height,"h"===o?er?(f=(t+e)/2,d=n+l+u/2):(f=(t+e)/2,d=n-l-u/2),i(p,g,f,d,h,!1)}function i(t,e,r,n,a,o){var i,l;return a<1?i="scale("+a+") ":(a=1,i=""),l=o?"rotate("+o+" "+t+" "+e+") ":"","translate("+(r-a*t)+" "+(n-a*e)+")"+i+l}function l(t,e){var r=h(t.text,e);return p(L,r)}function s(t,e){var r=h(t.textposition,e);return g(C,r)}function c(t,e,r){return d(S,t.textfont,e,r)}function u(t,e,r){return d(z,t.insidetextfont,e,r)}function f(t,e,r){return d(O,t.outsidetextfont,e,r)}function d(t,e,r,n){e=e||{};var a=h(e.family,r),o=h(e.size,r),i=h(e.color,r);return{family:p(t.family,a,n.family),size:v(t.size,o,n.size),color:m(t.color,i,n.color)}}function h(t,e){var r;return Array.isArray(t)?ea))return e}return void 0!==r?r:t.dflt}function m(t,e,r){return b(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),x=t("fast-isnumeric"),b=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),k=t("../../components/color"),M=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),L=T.text,C=T.textposition,S=T.textfont,z=T.insidetextfont,O=T.outsidetextfont,D=3;e.exports=function(t,e,r){var a=e.xaxis,o=e.yaxis,i=t._fullLayout,l=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);l.enter().append("g").attr("class","trace bars"),l.append("g").attr("class","points").each(function(e){var r=e[0].t,l=e[0].trace,s=r.poffset,c=Array.isArray(s);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,u){function f(t){return 0===i.bargap&&0===i.bargroupgap?y.round(Math.round(t)-A,2):t}function d(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)}var h,p,g,v,m=r.p+(c?s[u]:s),b=m+r.w,_=r.b,w=_+r.s;if("h"===l.orientation?(g=o.c2p(m,!0),v=o.c2p(b,!0),h=a.c2p(_,!0),p=a.c2p(w,!0)):(h=a.c2p(m,!0),p=a.c2p(b,!0),g=o.c2p(_,!0),v=o.c2p(w,!0)),!(x(h)&&x(p)&&x(g)&&x(v)&&h!==p&&g!==v))return void y.select(this).remove();var M=(r.mlw+1||l.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(M/2%1,2);if(!t._context.staticPlot){var T=k.opacity(r.mc||l.marker.color),L=T<1||M>.01?f:d;h=L(h,p),p=L(p,h),g=L(g,v),v=L(v,g)}var C=y.select(this);C.append("path").attr("d","M"+h+","+g+"V"+v+"H"+p+"V"+g+"Z"),n(t,C,e,u,h,p,g,v)})}),l.call(A.plot,e)}},{"../../components/color":28,"../../components/drawing":52,"../../components/errorbars":58,"../../lib":139,"../../lib/svg_text_utils":156,"./attributes":219,d3:10,"fast-isnumeric":13,tinycolor2:16}],227:[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;cc+l||!y(s))&&(f=!0,d(u,t))}for(var a=r.traces,o=m(e),i="fraction"===t._fullLayout.barnorm?1:100,l=i/1e9,s=e.l2c(e.c2l(0)),c="stack"===t._fullLayout.barmode?i:s,u=[s,c],f=!1,h=0;h1||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":28,"../../components/drawing":52,"../../components/errorbars":58,d3:10}],230:[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":28,"../../components/colorscale/defaults":37,"../../components/colorscale/has_colorscale":41}],231:[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"},xcalendar:n.xcalendar,ycalendar:n.ycalendar,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":27,"../../lib/extend":135,"../scatter/attributes":273}],232:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,i,l,s,c,u,f,d,h,p=o.getFromId(t,e.xaxis||"x"),g=o.getFromId(t,e.yaxis||"y"),v=e.orientation,m=[];"h"===v?(r=p,i="x",c=g,u="y"):(r=g,i="y",c=p,u="x"),l=r.makeCalcdata(e,i),o.expand(r,l,{padded:!0}),f=function(t,e,r,o,i){var l;return r in e?f=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,0,e[r+"calendar"]),f=i.map(function(){return l})),f}(t,e,u,c,l);var y=a.distinctVals(f);return d=y.vals,h=y.minDiff/2,s=function(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,g=r.dPos*(1-u.boxgap)*(1-u.boxgroupgap)/(p?t.numboxes:1),v=p?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-u.boxgap):0,m=g*h.whiskerwidth;if(h.visible!==!0||r.emptybox)return void o.select(this).remove();"h"===h.orientation?(s=d,c=f):(s=f,c=d),r.bPos=v,r.bdPos=g,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+v,!0),r=s.c2p(t.pos+v-g,!0),n=s.c2p(t.pos+v+g,!0),a=s.c2p(t.pos+v-m,!0),l=s.c2p(t.pos+v+m,!0),u=c.c2p(t.q1,!0),f=c.c2p(t.q3,!0),d=i.constrain(c.c2p(t.med,!0),Math.min(u,f)+1,Math.max(u,f)-1),p=c.c2p(h.boxpoints===!1?t.min:t.lf,!0),y=c.c2p(h.boxpoints===!1?t.max:t.uf,!0) -;"h"===h.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+f+"V"+r+"ZM"+u+","+e+"H"+p+"M"+f+","+e+"H"+y+(0===h.whiskerwidth?"":"M"+p+","+a+"V"+l+"M"+y+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+u+"H"+n+"V"+f+"H"+r+"ZM"+e+","+u+"V"+p+"M"+e+","+f+"V"+y+(0===h.whiskerwidth?"":"M"+a+","+p+"H"+l+"M"+a+","+y+"H"+l))}),h.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=h}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,c,u="all"===h.boxpoints?t.val:t.val.filter(function(e){return et.uf}),f=Math.max((t.max-t.min)/10,t.q3-t.q1),d=1e-9*f,p=.01*f,m=[],y=0;if(h.jitter){if(0===f)for(y=1,m=new Array(u.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,f,d),h.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+v,!0),r=s.c2p(t.pos+v-g,!0),n=s.c2p(t.pos+v+g,!0),a=c.c2p(t.mean,!0),i=c.c2p(t.mean-t.sd,!0),l=c.c2p(t.mean+t.sd,!0);"h"===h.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==h.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==h.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z"))})})}},{"../../components/drawing":52,"../../lib":139,d3:10}],239:[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;io){var i=o-r[t];return r[t]=o,i}}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;o--)a(o);else if("increasing"===e){for(o=1;o=0;o--)t[o]+=t[o+1];"exclude"===r&&(t.push(0),t.shift())}}var a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/cartesian/axes"),l=t("../bar/arrays_to_calcdata"),s=t("./bin_functions"),c=t("./norm_functions"),u=t("./average"),f=t("./clean_bins");e.exports=function(t,e){if(e.visible===!0){var r,d=[],h=[],p=i.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),g="h"===e.orientation?"y":"x",v={x:"y",y:"x"}[g],m=e[g+"calendar"],y=e.cumulative;f(e,p,g);var x,b=p.makeCalcdata(e,g),_=g+"bins";e["autobin"+g]===!1&&_ in e?x=e[_]:(x=i.autoBin(b,p,e["nbins"+g],!1,m),y.enabled&&"include"!==y.currentbin&&("decreasing"===y.direction?x.start=p.c2r(p.r2c(x.start)-x.size):x.end=p.c2r(p.r2c(x.end)+x.size)),e._input[_]=e[_]=x);var w,k,M,A="string"==typeof x.size,T=A?[]:x,L=[],C=[],S=0,z=e.histnorm,O=e.histfunc,D=z.indexOf("density")!==-1;y.enabled&&D&&(z=z.replace(/ ?density$/,""),D=!1);var P,E="max"===O||"min"===O,N=E?null:0,I=s.count,R=c[z],F=!1,j=function(t){return p.r2c(t,0,m)};for(Array.isArray(e[v])&&"count"!==O&&(P=e[v],F="avg"===O,I=s[O]),r=j(x.start),k=j(x.end)+(r-i.tickIncrement(r,x.size,!1,m))/1e6;r=0&&MV;r--)if(h[r]){U=r;break}for(r=V;r<=U;r++)a(d[r])&&a(h[r])&&H.push({p:d[r],s:h[r],b:0});return l(H,e),H}}},{"../../lib":139,"../../plots/cartesian/axes":174,"../bar/arrays_to_calcdata":218,"./average":246,"./bin_functions":248,"./clean_bins":250,"./norm_functions":253,"fast-isnumeric":13}],250:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical"),i=o.ONEDAY,l=o.BADNUM;e.exports=function(t,e,r){var o=e.type,s=r+"bins",c=t[s];c||(c=t[s]={});var u="date"===o?function(t){return t||0===t?a(t,l,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=u(c.start),c.end=u(c.end);var f="date"===o?i:1,d=c.size;if(n(d))c.size=d>0?Number(d):f;else if("string"!=typeof d)c.size=f;else{var h=d.charAt(0),p=d.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==o||"M"!==h||p!==Math.round(p))&&(c.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((c.start||0===c.start)&&(c.end||0===c.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":125,"../../lib":139,"fast-isnumeric":13}],251:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("../../components/color"),i=t("./bin_defaults"),l=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function f(r,n){return a.coerce(t,e,c,r,n)}var d=f("x"),h=f("y");f("cumulative.enabled")&&(f("cumulative.direction"),f("cumulative.currentbin")),f("text");var p=f("orientation",h&&!d?"h":"v"),g=e["v"===p?"x":"y"];if(!g||!g.length)return void(e.visible=!1);n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],u),e["h"===p?"x":"y"]&&f("histfunc"),i(t,e,f,"h"===p?["y"]:["x"]),l(t,e,f,r,u),s(t,e,o.defaultLine,{axis:"y"}),s(t,e,o.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":28,"../../components/errorbars/defaults":57,"../../lib":139,"../../registry":209,"../bar/style_defaults":230,"./attributes":245,"./bin_defaults":247}],252:[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":184,"../bar/hover":222,"../bar/layout_attributes":224,"../bar/layout_defaults":225,"../bar/plot":226,"../bar/set_positions":227,"../bar/style":229,"../scatter/colorbar":276,"./attributes":245,"./calc":249,"./defaults":251}],253:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ae}}},r.addRangeSlider=function(t,e){for(var r=!1,n=0;n1)){var f=i.simpleMap(u.x,e.d2c,0,r.xcalendar),d=i.distinctVals(f).minDiff;o=Math.min(o,d)}}for(1/0===o&&(o=1),c=0;c");_.push(i,i,i,i,i,i,null)}(S,h[S],p[S],g[S],v[S]));e.x=x,e.y=b,e.text=_}},{"../../lib":139,"../../plots/cartesian/axes":174,"../../plots/cartesian/axis_ids":177,"./helpers":257}],261:[function(t,e,r){"use strict";var n=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:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},hovertext:{valType:"string",dflt:"",arrayOk:!0},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":27,"../../lib/extend":135,"../../plots/attributes":172,"../../plots/font_attributes":198}],262:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n")}return g};var s},{"../../components/color":28,"./helpers":265,"fast-isnumeric":13,tinycolor2:16}],264:[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")),i("marker.line.width")&&i("marker.line.color");var u=i("marker.colors");Array.isArray(u)||(e.marker.colors=[]),i("scalegroup");var f=i("text"),d=i("textinfo",Array.isArray(f)?"text+percent":"percent");if(i("hovertext"),i("hoverinfo",1===o._dataLength?"label+text+value+percent":void 0),d&&"none"!==d){var h=i("textposition"),p=Array.isArray(h)||"auto"===h,g=p||"inside"===h,v=p||"outside"===h;if(g||v){var m=l(i,"textfont",o.font);g&&l(i,"insidetextfont",m),v&&l(i,"outsidetextfont",m)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":139,"./attributes":261}],265:[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":139}],266:[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":261,"./base_plot":262,"./calc":263,"./defaults":264,"./layout_attributes":267,"./layout_defaults":268,"./plot":269,"./style":270,"./style_one":271}],267:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],268:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){!function(r,o){n.coerce(t,e,a,r,o)}("hiddenlabels")}},{"../../lib":139,"./layout_attributes":267}],269:[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)),v={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>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 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]}var a,o,i,l,s,c,u,f,d,h,p,g,v;for(o=0;o<2;o++)for(i=o?r:n,s=o?Math.max:Math.min,u=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(i),d=t[1-o][a],h=d.concat(f),g=[],p=0;p0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[i.i]||((t.pxmid[1]-i.pxmid[1])*u>0?(f=i.cyFinal+s(i.px0[1],i.px1[1]),(x=f-v-t.labelExtraY)*u>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*u>0&&(n=3*c*Math.abs(a-h.indexOf(t)),d=i.cxFinal+l(i.px0[0],i.px1[0]),(p=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*c>0&&(t.labelExtraX+=p)))}(g[p],m)}}}function l(t,e){var r,n,a,o,i,l,s,u,f,d,h=[];for(a=0;au&&(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("../../components/fx"),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],v=c.trace,m=(v.depth||0)*c.r*Math.sin(0)/2,y=v.tiltaxis||0,x=y*Math.PI/180,b=[m*Math.sin(x),m*Math.cos(x)],_=c.r*Math.cos(0),w=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function i(n){n.originalEvent=u.event;var o=t._fullLayout,i=t._fullData[v.index],l=i.hoverinfo;if("all"===l&&(l="label+text+value+percent+name"),t._dragging||o.hovermode===!1||"none"===l||"skip"===l||!l)return void f.hover(t,n,"pie");var s=a(e,c),d=w+e.pxmid[0]*(1-s),h=k+e.pxmid[1]*(1-s),p=r.separators,m=[];l.indexOf("label")!==-1&&m.push(e.label),l.indexOf("text")!==-1&&(i.hovertext?m.push(Array.isArray(i.hovertext)?i.hovertext[e.i]:i.hovertext):i.text&&i.text[e.i]&&m.push(i.text[e.i])),l.indexOf("value")!==-1&&m.push(g.formatPieValue(e.v,p)),l.indexOf("percent")!==-1&&m.push(g.formatPiePercent(e.v/c.vTotal,p));var y=i.hoverlabel;f.loneHover({x0:d-s*c.r,x1:d+s*c.r,y:h,text:m.join("
"),name:l.indexOf("name")!==-1?i.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:e.hbg||y.bgcolor||e.color,borderColor:e.hbc||y.bordercolor,fontFamily:e.htf||y.font.family,fontSize:e.hts||y.font.size,fontColor:e.htc||y.font.color},{container:o._hoverlayer.node(),outerContainer:o._paper.node()}),f.hover(t,n,"pie"),T=!0}function l(e){e.originalEvent=u.event,t.emit("plotly_unhover",{event:u.event,points:[e]}),T&&(f.loneUnhover(r._hoverlayer.node()),T=!1)}function d(){t._hoverdata=[e],t._hoverdata.trace=c.trace,f.click(t,u.event)}function x(t,r,n,a){return"a"+a*c.r+","+a*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-t[0])+","+a*(r[1]-t[1])}if(e.hidden)return void u.select(this).selectAll("path,g").remove();s[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=c.cx+b[0],k=c.cy+b[1],M=u.select(this),A=M.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),M.select("path.textline").remove(),M.on("mouseover",i).on("mouseout",l).on("click",d),v.pull){var L=+(Array.isArray(v.pull)?v.pull[e.i]:v.pull)||0;L>0&&(w+=L*e.pxmid[0],k+=L*e.pxmid[1])}e.cxFinal=w,e.cyFinal=k;var C=v.hole;if(e.v===c.vTotal){var S="M"+(w+e.px0[0])+","+(k+e.px0[1])+x(e.px0,e.pxmid,!0,1)+x(e.pxmid,e.px0,!0,1)+"Z";C?A.attr("d","M"+(w+C*e.px0[0])+","+(k+C*e.px0[1])+x(e.px0,e.pxmid,!1,C)+x(e.pxmid,e.px0,!1,C)+"Z"+S):A.attr("d",S)}else{var z=x(e.px0,e.px1,!0,1);if(C){var O=1-C;A.attr("d","M"+(w+C*e.px1[0])+","+(k+C*e.px1[1])+x(e.px1,e.px0,!1,C)+"l"+O*e.px0[0]+","+O*e.px0[1]+z+"Z")}else A.attr("d","M"+w+","+k+"l"+e.px0[0]+","+e.px0[1]+z+"Z")}var D=Array.isArray(v.textposition)?v.textposition[e.i]:v.textposition,P=M.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]) -;P.enter().append("g").classed("slicetext",!0),P.exit().remove(),P.each(function(){var t=u.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(e.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 r,a=h.bBox(t.node());"outside"===D?r=o(a,e):(r=n(a,e,c),"auto"===D&&r.scale<1&&(t.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),a=h.bBox(t.node())),r=o(a,e)));var i=w+e.pxmid[0]*r.rCenter+(r.x||0),l=k+e.pxmid[1]*r.rCenter+(r.y||0);r.outside&&(e.yLabelMin=l-a.height/2,e.yLabelMid=l,e.yLabelMax=l+a.height/2,e.labelExtraX=0,e.labelExtraY=0,m=!0),t.attr("transform","translate("+i+","+l+")"+(r.scale<1?"scale("+r.scale+")":"")+(r.rotate?"rotate("+r.rotate+")":"")+"translate("+-(a.left+a.right)/2+","+-(a.top+a.bottom)/2+")")})}),m&&i(s,v),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]);Math.abs(l)>Math.abs(s)?o+="l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):o+="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":28,"../../components/drawing":52,"../../components/fx":69,"../../lib/svg_text_utils":156,"./helpers":265,d3:10}],270:[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":271,d3:10}],271:[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}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":28}],272:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,c=r.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(f,h,v),a.expand(d,p,m);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],276:[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":31,"../../components/colorscale":42,"../../lib":139,"../../plots/plots":202,"fast-isnumeric":13}],277:[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":34,"../../components/colorscale/has_colorscale":41,"./subtypes":293}],278:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],279:[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 v=l(t,e,p,g),m=vq!=P>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-D)/(P-D),R=Math.min(R,S),F=Math.max(F,S));R=Math.max(R,0),F=Math.min(F,d._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:s+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":28,"../../components/errorbars":58,"../../components/fx":69,"../../lib":139,"./get_trace_color":281}],283:[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":184,"./arrays_to_calcdata":272,"./attributes":273,"./calc":274,"./clean_data":275,"./colorbar":276,"./defaults":279,"./hover":282,"./plot":290,"./select":291,"./style":292,"./subtypes":293}],284:[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,l){var s=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||r)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":37,"../../components/colorscale/has_colorscale":41}],285:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var o,i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],C=.2,S=new Array(t.length),z=0;for(k||(A=C=-1),o=0;oa(u))break;l=u,m=p[0]*h[0]+p[1]*h[1],m>g?(g=m,s=u,d=!1):m=t.length||!u)break;S[z++]=u,i=u}}else S[z++]=s}L.push(S.slice(0,z))}return L}},{"../../constants/numerical":125}],286:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],287:[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":13}],289:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(r=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?n.background:n.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":28,"../../components/colorscale/defaults":37,"../../components/colorscale/has_colorscale":41,"./subtypes":293}],290:[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,d,p){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function x(){return!1}function b(e){var r,n,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,m=x;f&&(p=o.marker.maxdisplayed||o._needsCull?v:l.identity),d&&(m=o.marker.maxdisplayed||o._needsCull?v:l.identity),n=c.selectAll("path.point"),r=n.data(p,h);var b=r.enter().append("path").classed("point",!0);b.call(s.pointStyle,o).call(s.translatePoints,M,A,o),k&&b.style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");r.each(function(e){var r=i.select(this),n=g(r);(a=s.translatePoint(e,n,M,A))&&(s.singlePointStyle(e,n,o,_,w,t),o.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),k?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=c.selectAll("g"),r=n.data(m,h),r.enter().append("g").classed("textpoint",!0).append("text"),r.each(function(t){var e=i.select(this),r=g(e.select("text"));(a=s.translatePoint(t,r,M,A))||e.remove()}),r.selectAll("text").call(s.textPointStyle,o).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;o(t,e,r,n,a);var k=!!p&&p.duration>0,M=r.xaxis,A=r.yaxis,T=n[0].trace,L=T.line,C=i.select(d);if(C.call(c.plot,r,p),T.visible===!0){g(C).style("opacity",T.opacity);var S,z,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=C;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",z=E._nextFill,P=E._polygons);var N,I,R,F,j,B,q,H,V,U="",X="",G=[],Y=[],Z=l.noop;if(S=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(z&&z.datum(n),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(R=s.steps(L.shape),F=s.steps(L.shape.split("").reverse().join(""))):R=F="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return F(t.reverse())},G=f(n,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(G.length),w=0;w1}),Z=function(t){return function(e){if(N=R(e),I=j(e),U?O?(U+="L"+N.substr(1),X=I+"L"+X.substr(1)):(U+="Z"+N,X=I+"Z"+X):(U=N,X=I),u.hasLines(T)&&e.length>1){var r=i.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",N).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",N),s.singleLineStyle(n,a)}}}}}var W=C.selectAll(".js-line").data(Y);g(W.exit()).style("opacity",0).remove(),W.each(Z(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),G.length&&(S?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(S).attr("d","M"+H+"L"+B+"L"+U.substr(1))):g(S).attr("d",U+"Z")):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(z).attr("d",U+"Z"+D+"Z"):g(z).attr("d",U+"L"+D.substr(1)+"Z"),T._polygons=T._polygons.concat(P)),T._prevRevpath=X,T._prevPolygons=V);var $=C.selectAll(".points");_=$.data([n]),$.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,s=r.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=n[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=n.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),v=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),d(t,e,r),n(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),v){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":52,"../../components/errorbars":58,"../../lib":139,"../../lib/polygon":149,"./line_points":285,"./link_traces":287,"./subtypes":293,d3:10}],291:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.index,h=f.marker,p=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!p){var g=Array.isArray(h.opacity)?1:h.opacity;if(e===!1)for(r=0;re?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 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,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=$),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 $(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 Q(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?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=vt(a)*Ji,n=vt(n)*Ki,o=vt(o)*tl,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)*Ui,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 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=nl.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=mt((.4124564*t+.3575761*e+.1804375*r)/Ji),a=mt((.2126729*t+.7151522*e+.072175*r)/Ki);return ht(116*a-16,500*(n-a),200*(a-mt((.0193339*t+.119192*e+.9503041*r)/tl)))}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,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 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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Nt(),e=It()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Nt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function It(){for(var t,e=al,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=ul.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="",v="",m=!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,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=fl.get(h)||Bt;var x=c&&f;return function(t){var r=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),r=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))+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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=S[i in gl?e.charAt(l++):i])||(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,C.c.toString(),e,n)}function s(t,e,n){return r(t,C.x.toString(),e,n)}function c(t,e,n){return r(t,C.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,v=t.shortDays,m=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{hl=qt;var e=new hl;return e._=t,n(e)}finally{hl=Date}}var n=e(t);return r.parse=function(t){try{hl=qt;var e=n.parse(t);return e&&e._}finally{hl=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ue;var x=ui.map(),b=Xt(g),_=Yt(g),w=Xt(v),k=Yt(v),M=Xt(m),A=Yt(m),T=Xt(y),L=Yt(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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(dl.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: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:Zt,W:$t,x:s,X:c,y:Jt,Y:Qt,Z:Kt,"%":ce};return e}function Gt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",o=a.length;return n+(o68?1900:2e3)}function ee(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function oe(t,e,r){vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function ie(t,e,r){ +vl.lastIndex=0;var n=vl.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function le(t,e,r){vl.lastIndex=0;var n=vl.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+Gt(n,"0",2)+Gt(a,"0",2)}function ce(t,e,r){ml.lastIndex=0;var n=ml.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);kl.add(Math.atan2(d,f)),n=t,a=s,o=c}var e,r,n,a,o;Ml.point=function(i,l){Ml.point=t,n=(e=i)*Vi,a=Math.cos(l=(r=l)*Vi/2+ji/4),o=Math.sin(l)},Ml.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 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,v=e(o),m=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(m,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 qe(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(kl.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),o+=M?_+w*Bi:_,M^d>=r^m>=r){var T=xe(me(f),me(t));we(T);var L=xe(a,T);we(L);var C=(M^_>=0?-1:1)*nt(L[2]);(n>C||n===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 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),v=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 m;v&o||!(m=n(p,r,!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||r&&Me(r,p)||t.point(p[0],p[1]),r=p,s=g,o=v},lineEnd:function(){s&&t.lineEnd(),r=null},clean:function(){return u|(c&&s)<<1}}}function n(t,e,r){var n=me(t),a=me(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);be(p,_e(l,d));var g=h,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-v-x)/m);if(be(b,p),b=ke(b),!r)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)ji^(w<=b[0]&&b[0]<=k)){var S=_e(g,(-v+x)/m);return be(S,p),[b,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;return Ne(e,r,vr(t,6*Vi),i?[0,-t]:[-ji,t-ji])}function Ue(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 Ge(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=v.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(){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(-Fl,Math.min(Fl,t)),e=Math.max(-Fl,Math.min(Fl,e));var r=u(t,e);if(v&&m.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}};C(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,v,m,y,x,b,_,w,k,M,A,T=l,L=Re(),C=Ue(t,e,r,n),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,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=v=m=null}};return S}}function Xe(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 Ye(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 Ze(){function t(t,e){Bl+=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){tVl&&(Vl=t),eUl&&(Ul=e)}function $e(){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=Qe(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=Qe(t),l},result:function(){if(i.length){var t=i.join("");return i=[],t}}};return l}function Qe(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){Ll+=t,Cl+=e,++Sl}function Ke(){function t(t,n){var a=t-e,o=n-r,i=Math.sqrt(a*a+o*o);zl+=i*(e+t)/2,Ol+=i*(r+n)/2,Dl+=i,Je(e=t,r=n)}var e,r;Yl.point=function(n,a){Yl.point=t,Je(e=n,r=a)}}function tr(){Yl.point=Je}function er(){function t(t,e){var r=t-n,o=e-a,i=Math.sqrt(r*r+o*o);zl+=i*(n+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-n*e,Pl+=i*(n+t),El+=i*(a+e),Nl+=3*i,Je(n=t,a=e)}var e,r,n,a;Yl.point=function(o,i){Yl.point=t,Je(e=n=o,r=a=i)},Yl.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=me([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=_,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: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,v,m){var y=u-e,x=f-r,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 ar(t){var e=nr(function(e,r){return t([e*Ui,r*Ui])});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[0]*Ui,t[1]*Ui]}function n(){l=ze(i=dr(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=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,v=0,m=0,y=0,x=0,_=Rl,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,Rl):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ge(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,v=t[1]%360*Vi,n()):[g*Ui,v*Ui]},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,n()):[m*Ui,y*Ui,x*Ui]},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-Bi:t<-ji?t+Bi:t,e]}function dr(t,e,r){return t?e||r?ze(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-Bi:e<-ji?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 vr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,o,i,l){var s=i*e;null!=a?(a=mr(r,a),o=mr(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(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 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 Fr(t){var e=ls.pop()||new Rr;return e.site=t,e}function jr(t){Wr(t),as.remove(t),ls.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];jr(t);for(var s=o;s.circle&&bi(r-s.circle.x)Ri)l=l.L;else{if(!((a=o-Vr(l,i))>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(as.insert(e,s),e||r){if(e===r)return Wr(e),r=Fr(e.site),as.insert(s,r),s.edge=r.edge=Kr(e.site,s.site),Zr(e),void Zr(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,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};en(r.edge,c,p,b),s.edge=Kr(c,t,null,b),r.edge=Kr(t,p,null,b),Zr(e),Zr(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 Ur(t){this.site=t,this.edges=[]}function Gr(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=ns,v=g.length;v--;)if((o=g[v])&&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,v=(s*p-u*h)/d,f=v+l,m=ss.pop()||new Yr;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=is._;x;)if(m.y=l)return;if(d>p){if(o){if(o.y>=c)return}else o={x:v,y:s};r={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)/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=fs.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 Cn(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 zn(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 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 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(Un(r)+"rotate(",null,")")-2,x:xn(t,e)})):e&&r.push(Un(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Un(r)+"skewX(",null,")")-2,x:xn(t,e)}):e&&r.push(Un(r)+"skewX("+e+")")}function Zn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Un(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(Un(r)+"scale("+e+")")}function Wn(t,e){var r=[],n=[];return t=ui.transform(t),e=ui.transform(e),Gn(t.translate,e.translate,r,n),Xn(t.rotate,e.rotate,r,n),Yn(t.skew,e.skew,r,n),Zn(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 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((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(Sa),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 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 Ua(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 Ga(t){var e=t[0],r=t[t.length-1];return e2?$a:Ya,s=n?Qn:$n;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 Qa(t,e,r,n)},a()}function Ja(t,e){return ui.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ka(t,e){return Za(t,Wa(to(t,e)[2])),Za(t,Wa(to(t,e)[2])),t}function to(t,e){null==e&&(e=10);var r=Ga(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=ul.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 ks?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=Za(n.map(a),r?Math:As);return t.domain(e),n=e.map(o),i},i.ticks=function(){var t=Ga(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 Ms;arguments.length<2?r=Ms:"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,v=d-u,m=h-f,y=v*v+m*m,x=r-n,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*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=Ct(r),p=Ct(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($s,a);return o==$s.length?[e.year,to(t.map(function(t){return t/31536e6}),r)[2]]:o?e[a/$s[o-1]<$s[o]/a?o-1:o]:[Ks,to(t,r)[2]]}return n.invert=function(e){return li(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(li)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,li(+r+1),e).length}var o=n.domain(),i=Ga(o),l=null==t?a(i,10):"number"==typeof t&&a(i,t);return l&&(t=l[0],e=l[1]),n.domain(Za(o,e>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=Ga(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,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,r){vi.call(this,t,e,r+"")},mi.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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=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++],v=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)},Ci=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Ci=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,Ci=Sizzle.matchesSelector),ui.selection=function(){return ui.select(hi.documentElement)};var Si=ui.selection.prototype=[];Si.select=function(t){var e,r,n,a,o=[];t=z(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}},Si.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))},Si.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},Si.sort=function(t){t=U.apply(this,arguments);for(var e=-1,r=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 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=Q(a);Bs.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 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];m=d*d+h*h}}function n(){var t,e,r,n,i=ui.touches(p);Bs.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,fl=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))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});dl[t+"s"]=r.range,dl[t+"s"].utc=r.utc.range,dl[t+"OfYear"]=function(t){var r=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(r+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,ml=/^%/;ui.locale=function(t){return{numberFormat:jt(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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=me([e*Vi,r*Vi]);if(m){var a=xe(m,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]*Ui*c,v=bi(s)>180;if(v^(c*ph&&(h=y)}else if(g=(g+360)%360-180,v^(c*ph&&(h=r);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,r);m=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=d,_.point=t,m=null}function a(t,r){if(m){var n=t-p;y+=bi(n)>180?n+(n>0?360:-360):n}else g=t,v=r;Ml.point(t,r),e(t,r)}function o(){Ml.lineStart()}function i(){a(g,v),Ml.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 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){Al=Tl=Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,Il);var e=Pl,r=El,n=Nl,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 jl,Bl,ql,Hl,Vl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Gl.lineStart=Ze},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,jl+=bi(Bl/2)}},Xl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Yl={point:Je,lineStart:Ke,lineEnd:tr,polygonStart:function(){Yl.lineStart=er},polygonEnd:function(){Yl.point=Je,Yl.lineStart=Ke,Yl.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 jl=0,ui.geo.stream(t,a(Gl)),jl},t.centroid=function(t){return Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Nl=0,ui.geo.stream(t,a(Yl)),Nl?[Pl/Nl,El/Nl]:Dl?[zl/Dl,Ol/Dl]:Sl?[Ll/Sl,Cl/Sl]:[NaN,NaN]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Xl)),[[ql,Hl],[Vl,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 $e: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]*=Ui,e[1]*=Ui,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]*=Ui,e[1]*=Ui,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]*=Ui,t[1]*=Ui}}),{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=vr((e=+n)*Vi,a*Vi),t):e},t.precision=function(n){return arguments.length?(r=vr(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/v)*v,a,v).map(d).concat(ui.range(Math.ceil(c/m)*m,s,m).map(h)).concat(ui.range(Math.ceil(n/p)*p,r,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 r,n,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?(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?(v=+e[0],m=+e[1],t):[v,m]},t.minorStep=function(e){return arguments.length?(p=+e[0],g=+e[1],t):[p,g]},t.precision=function(e){return arguments.length?(y=+e,u=yr(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 Zl=0,ui.geo.stream(t,Wl),Zl};var Zl,Wl={sphere:k,point:k,lineStart:kr,lineEnd:k,polygonStart:k,polygonEnd:k},$l=Mr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return lr($l)}).raw=$l;var Ql=Mr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return lr(Ql)}).raw=Ql,(ui.geo.conicConformal=function(){return Xe(Ar)}).raw=Ar,(ui.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Jl=Mr(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return lr(Jl)}).raw=Jl,Lr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Cr(Lr)}).raw=Lr;var Kl=Mr(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return lr(Kl)}).raw=Kl;var ts=Mr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return lr(ts)}).raw=ts,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Hi]},(ui.geo.transverseMercator=function(){var t=Cr(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,ui.geom={},ui.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,a=Ct(r),o=Ct(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]]:[]).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=zr,a=Or,o=n,i=a,l=cs;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=r.site,i=r.edges.sort(Xr),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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,v,m,y,x=Ct(l),b=Ct(s);if(null!=e)g=e,v=r,m=n,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=pn();if(A.add=function(t){o(A,t,+x(t,++h),+b(t,h),g,v,m,y)},A.visit=function(t){gn(t,A,g,v,m,y)},A.find=function(t){return vn(A,t[0],t[1],g,v,m,y)},h=-1,null==e){for(;++h=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=hs.get(r)||ds,n=ps.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 Bn(r?r.matrix:gs)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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=Ct(e),t):n},t.bins=function(e){return arguments.length?(a="number"==typeof e?function(t){return wa(t,e)}:Ct(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,Ca),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,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,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 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,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&&!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=ja(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,v,m,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===zs?Math.sqrt(t*t+c*c):+o.apply(this,arguments),h||(L*=-1),c&&(L=nt(v/c*Math.sin(m))),t&&(T=nt(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 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=Go,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=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=Xo;return t.source=function(r){return arguments.length?(e=Ct(r),t):e},t.target=function(e){return arguments.length?(r=Ct(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=Xo,r=t.projection;return t.projection=function(t){return arguments.length?r(Yo(e=t)):e},t},ui.svg.symbol=function(){function t(t,n){return(Ns.get(e.call(this,t,n))||$o)(r.call(this,t,n))}var e=Wo,r=Zo;return t.type=function(r){return arguments.length?(e=Ct(r),t):e},t.size=function(e){return arguments.length?(r=Ct(e),t):r},t};var Ns=ui.map({circle:$o,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*Rs)),r=e*Rs;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/Is),r=e*Is/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Is),r=e*Is/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});ui.svg.symbolTypes=Ns.keys();var Is=Math.sqrt(3),Rs=Math.tan(30*Vi);Si.transition=function(t){for(var e,r,n=Fs||++Hs,a=ei(t),o=[],i=js||{time:Date.now(),ease:Cn,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(_),n=!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>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){return 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)}},{}],13:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],14:[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,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=n},{}],15:[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(){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 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=L(t,360),e=L(e,100),r=L(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=L(t,255),e=L(e,255),r=L(r,255);var n,a,o=U(t,e,r),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,r){z(t)&&(t="100%");var n=O(t);return t=V(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 V(1,U(0,t))}function S(t){return parseInt(t,16)}function z(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function N(t){return S(t)/255}function I(t){return!!Z.CSS_UNIT.exec(t)}function R(t){t=t.replace(j,"").replace(B,"").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=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:S(r[1]),g:S(r[2]),b:S(r[3]),a:N(r[4]),format:e?"name":"hex8"}:(r=Z.hex6.exec(t))?{r:S(r[1]),g:S(r[2]),b:S(r[3]),format:e?"name":"hex"}:(r=Z.hex4.exec(t))?{r:S(r[1]+""+r[1]),g:S(r[2]+""+r[2]),b:S(r[3]+""+r[3]),a:N(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Z.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 j=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=e.max,G=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=T(t),this._roundA=H(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=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=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=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 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: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[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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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)&&(r[a]="a"===a?t[a]:P(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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),o=n(e).toRgb(),i=r/100;return n({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})},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"},Y=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),Z=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],17:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./common_defaults"),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),f=c("clicktoshow");if(!u&&!f)return e;o(t,e,r,c);for(var d=e.showarrow,h=["x","y"],p=[-10,-30],g={_fullLayout:r},v=0;v<2;v++){var m=h[v],y=a.coerceRef(t,e,g,m,"","paper");if(a.coercePosition(e,g,c,y,m,.5),d){ +var x="a"+m,b=a.coerceRef(t,e,g,x,"pixel");"pixel"!==b&&b!==y&&(b=e[x]="pixel");var _="pixel"===b?p[v]:.4;a.coercePosition(e,g,c,b,x,_)}c(m+"anchor"),c(m+"shift")}if(n.noneOrAll(t,e,["x","y"]),d&&n.noneOrAll(t,e,["ax","ay"]),f){var w=c("xclick"),k=c("yclick");e._xclick=void 0===w?e.x:a.cleanPosition(w,g,e.xref),e._yclick=void 0===k?e.y:a.cleanPosition(k,g,e.yref)}return e}},{"../../lib":146,"../../plots/cartesian/axes":181,"./attributes":19,"./common_defaults":22}],18:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],19:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",o.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:i({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":142,"../../plots/cartesian/constants":186,"../../plots/font_attributes":205,"./arrow_paths":18}],20:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=o.getFromId(t,e.xref),i=o.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=l+e.xshift,n=l-e.xshift,e.axref===e.xref?(o.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),o.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):o.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),i&&i.autorange&&(r=l-e.yshift,n=l+e.yshift,e.ayref===e.yref?(o.expand(i,[i.r2c(e.y)],{ppadplus:r,ppadminus:n}),o.expand(i,[i.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):o.expand(i,[i.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(o.list(t).filter(function(t){return t.autorange&&l[t._id]}).length)return a.syncOrAsync([i,n],t)}}},{"../../lib":146,"../../plots/cartesian/axes":181,"./draw":25}],21:[function(t,e,r){"use strict";function n(t,e){var r=o(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=o(t,e),a=n.on,i=n.off.concat(n.explicitOff),s={};if(a.length||i.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var l=I.selectAll("a");if(1===l.size()&&l.text()===I.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":l.attr("xlink:href"),"xlink:xlink:show":l.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}var c=C.select(".annotation-text-math-group"),f=!c.empty(),p=h.bBox((f?c:I).node()),x=p.width,z=p.height,N=e.width||x,R=e.height||z,F=Math.round(N+2*O),j=Math.round(R+2*O);e._w=N,e._h=R;for(var B=!1,q=["x","y"],H=0;H1)&&($===W?((ot=Q.r2fraction(e["a"+Z]))<0||ot>1)&&(B=!0):B=!0,B))continue;V=Q._offset+Q.r2p(e[Z]),X=.5}else"x"===Z?(G=e[Z],V=w.l+w.w*G):(G=1-e[Z],V=w.t+w.h*G),X=e.showarrow?.5:G;if(e.showarrow){at.head=V;var it=e["a"+Z];Y=K*r(.5,e.xanchor)-tt*r(.5,e.yanchor),$===W?(at.tail=Q._offset+Q.r2p(it),U=Y):(at.tail=V+it,U=Y+it),at.text=at.tail+Y;var lt=_["x"===Z?"width":"height"];if("paper"===W&&(at.head=u.constrain(at.head,1,lt-1)),"pixel"===$){var st=-Math.max(at.tail-3,at.text),ct=Math.min(at.tail+3,at.text)-lt;st>0?(at.tail+=st,at.text+=st):ct>0&&(at.tail-=ct,at.text-=ct)}at.tail+=nt,at.head+=nt}else Y=et*r(X,rt),U=Y,at.text=V+Y;at.text+=nt,Y+=nt,U+=nt,e["_"+Z+"padplus"]=et/2+U,e["_"+Z+"padminus"]=et/2-U,e["_"+Z+"size"]=et,e["_"+Z+"shift"]=Y}if(B)return void C.remove();var ut=0,ft=0;if("left"!==e.align&&(ut=(N-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(R-z)*("middle"===e.valign?.5:1)),f)c.select("svg").attr({x:O+ut-1,y:O+ft}).call(h.setClipUrl,P?k:null);else{var dt=O+ft-p.top,ht=O+ut-p.left;I.call(g.positionText,ht,dt).call(h.setClipUrl,P?k:null)}E.select("rect").call(h.setRect,O,O,N,R),D.call(h.setRect,S/2,S/2,F-S,j-S),C.call(h.setTranslate,Math.round(M.x.text-F/2),Math.round(M.y.text-j/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var pt=function(r,l){T.selectAll(".annotation-arrow-g").remove();var c=M.x.head,f=M.y.head,p=M.x.tail+r,g=M.y.tail+l,v=M.x.text+r,x=M.y.text+l,_=u.rotationXYMatrix(A,v,x),k=u.apply2DTransform(_),S=u.apply2DTransform2(_),z=+D.attr("width"),O=+D.attr("height"),P=v-.5*z,E=P+z,N=x-.5*O,I=N+O,R=[[P,N,P,I],[P,I,E,I],[E,I,E,N],[E,N,P,N]].map(S);if(!R.reduce(function(t,e){return t^!!i(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=i(p,g,c,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,g=e.y)});var F=e.arrowwidth,j=e.arrowcolor,B=T.append("g").style({opacity:d.opacity(j)}).classed("annotation-arrow-g",!0),q=B.append("path").attr("d","M"+p+","+g+"L"+c+","+f).style("stroke-width",F+"px").call(d.stroke,d.rgb(j));if(y(q,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&q.node().parentNode&&!n){var H=c,V=f;if(e.standoff){var U=Math.sqrt(Math.pow(c-p,2)+Math.pow(f-g,2));H+=e.standoff*(p-c)/U,V+=e.standoff*(g-f)/U}var G,X,Y,Z=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-H)+","+(g-V),transform:"translate("+H+","+V+")"}).style("stroke-width",F+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");m.init({element:Z.node(),gd:t,prepFn:function(){var t=h.getTranslate(C);X=t.x,Y=t.y,G={},a&&a.autorange&&(G[a._name+".autorange"]=!0),o&&o.autorange&&(G[o._name+".autorange"]=!0)},moveFn:function(t,r){var n=k(X,Y),i=n[0]+t,l=n[1]+r;C.call(h.setTranslate,i,l),G[b+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/w.w,G[b+".y"]=o?o.p2r(o.r2p(e.y)+r):e.y-r/w.h,e.axref===e.xref&&(G[b+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(G[b+".ay"]=o.p2r(o.r2p(e.ay)+r)),B.attr("transform","translate("+t+","+r+")"),L.attr({transform:"rotate("+A+","+i+","+l+")"})},doneFn:function(e){if(e){s.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var gt,vt;m.init({element:C.node(),gd:t,prepFn:function(){vt=L.attr("transform"),gt={}},moveFn:function(t,r){var i="pointer";if(e.showarrow)e.axref===e.xref?gt[b+".ax"]=a.p2r(a.r2p(e.ax)+t):gt[b+".ax"]=e.ax+t,e.ayref===e.yref?gt[b+".ay"]=o.p2r(o.r2p(e.ay)+r):gt[b+".ay"]=e.ay+r,pt(t,r);else{if(n)return;if(a)gt[b+".x"]=e.x+t/a._m;else{var l=e._xsize/w.w,s=e.x+(e._xshift-e.xshift)/w.w-l/2;gt[b+".x"]=m.align(s+t/w.w,l,0,1,e.xanchor)}if(o)gt[b+".y"]=e.y+r/o._m;else{var c=e._ysize/w.h,u=e.y-(e._yshift+e.yshift)/w.h-c/2;gt[b+".y"]=m.align(u-r/w.h,c,0,1,e.yanchor)}a&&o||(i=m.getCursor(a?.5:gt[b+".x"],o?.5:gt[b+".y"],e.xanchor,e.yanchor))}L.attr({transform:"translate("+t+","+r+")"+vt}),v(C,i)},doneFn:function(e){if(v(C),e){s.relayout(t,gt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var x,b,_=t._fullLayout,w=t._fullLayout._size;n?(x="annotation-"+n,b=n+".annotations["+r+"]"):(x="annotation",b="annotations["+r+"]"),_._infolayer.selectAll("."+x+'[data-index="'+r+'"]').remove();var k="clip"+_._uid+"_ann"+r;if(!e._input||!1===e.visible)return void l.selectAll("#"+k).remove();var M={x:{},y:{}},A=+e.textangle||0,T=_._infolayer.append("g").classed(x,!0).attr("data-index",String(r)).style("opacity",e.opacity),L=T.append("g").classed("annotation-text-g",!0),C=L.append("g").style("pointer-events",e.captureevents?"all":null).call(v,"default").on("click",function(){t._dragging=!1;var a={index:r,annotation:e._input,fullAnnotation:e,event:l.event};n&&(a.subplotId=n),t.emit("plotly_clickannotation",a)});e.hovertext&&C.on("mouseover",function(){var r=e.hoverlabel,n=r.font,a=this.getBoundingClientRect(),o=t.getBoundingClientRect();p.loneHover({x0:a.left-o.left,x1:a.right-o.left,y:(a.top+a.bottom)/2-o.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var S=e.borderwidth,z=e.borderpad,O=S+z,D=C.append("rect").attr("class","bg").style("stroke-width",S+"px").call(d.stroke,e.bordercolor).call(d.fill,e.bgcolor),P=e.width||e.height,E=_._defs.select(".clips").selectAll("#"+k).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",k).append("rect"),E.exit().remove();var N=e.font,I=C.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?I.call(g.makeEditable,{delegate:C,gd:t}).call(c).on("edit",function(r){e.text=r,this.call(c);var n={};n[b+".text"]=e.text,a&&a.autorange&&(n[a._name+".autorange"]=!0),o&&o.autorange&&(n[o._name+".autorange"]=!0),s.relayout(t,n)}):I.call(c)}function i(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,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 l=t("d3"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../fx"),g=t("../../lib/svg_text_utils"),v=t("../../lib/setcursor"),m=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:n,drawOne:a,drawRaw:o}},{"../../lib":146,"../../lib/setcursor":161,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/cartesian/axes":181,"../../plots/plots":210,"../color":34,"../dragelement":55,"../drawing":58,"../fx":75,"./draw_arrow_head":26,d3:10}],26:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(r,a){h.path&&(e>5&&(a=0),n.select(d.parentNode).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(v=Math.atan2(A,M),m=v+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(v),L=k*Math.sin(v);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var C=d.getTotalLength(),S="";if(C1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+l+'"]').remove():(s.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(s.x)*r[0],e.yaxis.r2l(s.y)*r[1],e.zaxis.r2l(s.z)*r[2]]),n(t.graphDiv,s,l,t.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":207,"../annotations/draw":25}],32:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":28,"./convert":29,"./defaults":30,"./draw":31}],33:[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},{}],34:[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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(i.combine(t,c))),(n.isDark()?e?n.lighten(e):c:r?n.darken(r):s).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]-=(ct-l)/2):r.node()&&!r.classed("js-placeholder")&&(ct=h.bBox(r.node()).height),ct){if(ct+=5,"top"===k.titleside)et.domain[1]-=ct/C.h,o[1]*=-1;else{et.domain[0]+=ct/C.h;var c=v.lineCount(r);o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),et.setScale()}}lt.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(C.h*(1-et.domain[1]))+")");var f=lt.select(".cbfills").selectAll("rect.cbfill").data(D);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?z[0]:(D[e]+D[e-1])/2,e===D.length-1?z[1]:(D[e]+D[e+1])/2].map(et.c2p).map(Math.round);e!==D.length-1&&(r[1]+=r[1]>r[0]?1:-1);var o=E(t).replace("e-",""),i=a(o).toHexString();n.select(this).attr({x:W,width:Math.max(H,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:i})});var d=lt.select(".cblines").selectAll("path.cbline").data(k.line.color&&k.line.width?O:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(et.c2p(t))+k.line.width/2%1)+"h"+H).call(h.lineGroupStyle,k.line.width,P(t),k.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=W+H+(k.outlinewidth||0)/2-("outside"===k.ticks?1:0),et.side="right",u.syncOrAsync([function(){return s.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(k.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,a=C.l+(et.position||0)*C.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));A("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:k.titleside,offsetLeft:C.l,offsetTop:C.t,maxShift:L.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,a=w();n=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:et,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:lt.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;lt.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,r||{}))}function T(){var r=H+k.outlinewidth/2+h.bBox(et._axislayer.node()).width;if(j=st.select("text"),j.node()&&!j.classed("js-placeholder")){var n,a=st.select(".h"+et._id+"title-math-group").node();n=a&&-1!==["top","bottom"].indexOf(k.titleside)?h.bBox(a).width:h.bBox(st.node()).right-W-C.l,r=Math.max(r,n)}var o=2*k.xpad+r+k.borderwidth+k.outlinewidth/2,l=J-K;lt.select(".cbbg").attr({x:W-k.xpad-(k.borderwidth+k.outlinewidth)/2,y:K-Y,width:Math.max(o,2),height:Math.max(l+2*Y,2)}).call(p.fill,k.bgcolor).call(p.stroke,k.bordercolor).style({"stroke-width":k.borderwidth}),lt.selectAll(".cboutline").attr({x:W,y:K+k.ypad+("top"===k.titleside?ct:0),width:Math.max(H,2),height:Math.max(l-2*k.ypad-ct,2)}).call(p.stroke,k.outlinecolor).style({fill:"None","stroke-width":k.outlinewidth});var s=({center:.5,right:1}[k.xanchor]||0)*o;lt.attr("transform","translate("+(C.l-s)+","+C.t+")"),i.autoMargin(t,e,{x:k.x,y:k.y,l:o*({right:1,center:.5}[k.xanchor]||0),r:o*({left:1,center:.5}[k.xanchor]||0),t:l*({bottom:1,middle:.5}[k.yanchor]||0),b:l*({top:1,middle:.5}[k.yanchor]||0)})}var L=t._fullLayout,C=L._size;if("function"!=typeof k.fillcolor&&"function"!=typeof k.line.color)return void L._infolayer.selectAll("g."+e).remove();var S,z=n.extent(("function"==typeof k.fillcolor?k.fillcolor:k.line.color).domain()),O=[],D=[],P="function"==typeof k.line.color?k.line.color:function(){return k.line.color},E="function"==typeof k.fillcolor?k.fillcolor:function(){return k.fillcolor},N=k.levels.end+k.levels.size/100,I=k.levels.size,R=1.001*z[0]-.001*z[1],F=1.001*z[1]-.001*z[0];for(S=k.levels.start;(S-N)*I<0;S+=I)S>R&&Sz[0]&&S1){var it=Math.pow(10,Math.floor(Math.log(ot)/Math.LN10));nt*=it*u.roundUp(ot/it,[2,5,10]),(Math.abs(k.levels.start)/k.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[Q+Z,Q+G-Z],et.setScale();var lt=L._infolayer.selectAll("g."+e).data([0]);lt.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)}),lt.attr("transform","translate("+Math.round(C.l)+","+Math.round(C.t)+")");var st=lt.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(C.l)+",-"+Math.round(C.t)+")");et._axislayer=lt.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(k.titleside)){var ut,ft=C.l+(k.x+X)*C.w,dt=et.titlefont.size;ut="top"===k.titleside?(1-(Q+G-Z))*C.h+C.t+3+.75*dt:(1-(Q+Z))*C.h+C.t-3-.25*dt,A(et._id+"title",{attributes:{x:ft,y:ut,"text-anchor":"start"}})}var ht=u.syncOrAsync([i.previousPromises,M,i.previousPromises,T],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var pt,gt,vt;c.init({element:lt.node(),gd:t,prepFn:function(){pt=lt.attr("transform"),d(lt)},moveFn:function(t,e){lt.attr("transform",pt+" translate("+t+","+e+")"),gt=c.align($+t/C.w,V,0,1,k.xanchor),vt=c.align(Q-e/C.h,G,0,1,k.yanchor);var r=c.getCursor(gt,vt,k.xanchor,k.yanchor);d(lt,r)},doneFn:function(e){d(lt),e&&void 0!==gt&&void 0!==vt&&o.restyle(t,{"colorbar.x":gt,"colorbar.y":vt},w().index)}})}return ht}function w(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,s.colorscale=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":146,"./flip_scale":45,"./scales":52}],41:[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":142,"./attributes":39,"./scales.js":52}],42:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":52}],43:[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,v=p[d+"min"],m=p[d+"max"],y=p.colorscale;c(f+d+"auto",!(n(v)&&n(m)&&v=0;a--,o++)e=t[a],n[o]=[1-e[0],e[1]];return n}},{}],46:[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":42,"./is_valid_scale_array":50,"./scales":52}],47:[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}},{}],54:[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":146}],55:[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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return g._dragged=!1,g._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v,e),!g._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(g),g._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g=t.gd,v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=n},{"../../constants/interactions":131,"../../lib":146,"../../plotly":176,"../../plots/cartesian/constants":186,"./align":53,"./cursor":54,"./unhover":56}],56:[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,a=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":141}],57:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],58:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,i,l){if(c.traceIs(r,"symbols")){var s=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:m.isBubble(r)?s(t.ms):(o.size||6)/2,t.mrc=e;var n=x.symbolNumber(t.mx||o.symbol)||0,a=n%100;return t.om=n%200>=100,x.symbolFuncs[a](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,p=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?u.defaultLine:i.color,Array.isArray(o.color)&&(f=u.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var g=o.gradient,v=t.mgt;if(v?p=!0:v=g&&g.type,v&&"none"!==v){var b=t.mgc;b?p=!0:b=g.color;var _="g"+l._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(x.gradient,l,_,v,f,b)}else e.call(u.fill,f);h&&e.call(u.stroke,d)}}function a(t,e,r,n){var a=t[0]-e[0],o=t[1]-e[1],l=r[0]-e[0],s=r[1]-e[1],c=Math.pow(a*a+o*o,T/2),u=Math.pow(l*l+s*s,T/2),f=(u*u*a-c*c*l)*n,d=(u*u*o-c*c*s)*n,h=3*u*(c+u),p=3*c*(c+u);return[[i.round(e[0]+(h&&f/h),2),i.round(e[1]+(h&&d/h),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&d/p),2)]]}function o(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var i=t("d3"),l=t("fast-isnumeric"),s=t("tinycolor2"),c=t("../../registry"),u=t("../color"),f=t("../colorscale"),d=t("../../lib"),h=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),v=g.LINE_SPACING,m=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),x=e.exports={};x.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(u.fill,n)},x.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},x.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},x.setRect=function(t,e,r,n,a){t.call(x.setPosition,e,r).call(x.setSize,n,a)},x.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),o=t.yp||n.c2p(t.y);return!!(l(a)&&l(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},x.translatePoints=function(t,e,r,n){t.each(function(t){var a=i.select(this);x.translatePoint(t,a,e,r,n)})},x.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},x.crispRound=function(t,e,r){return e&&l(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},x.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||"";u.stroke(e,n||o.color),x.dashLine(e,l,i)},x.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=n||a.dash||"";i.select(this).call(u.stroke,r||a.color).call(x.dashLine,l,o)})},x.dashLine=function(t,e,r){r=+r||0,e=x.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},x.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},x.singleFillStyle=function(t){var e=i.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(u.fill,n)},x.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(u.fill,e[0].trace.fillcolor)}catch(e){d.error(e,t),r.remove()}})};var b=t("./symbol_defs");x.symbolNames=[],x.symbolFuncs=[],x.symbolNeedLines={},x.symbolNoDot={},x.symbolList=[],Object.keys(b).forEach(function(t){var e=b[t];x.symbolList=x.symbolList.concat([e.n,t,e.n+100,t+"-open"]),x.symbolNames[e.n]=t,x.symbolFuncs[e.n]=e.f,e.needLine&&(x.symbolNeedLines[e.n]=!0),e.noDot?x.symbolNoDot[e.n]=!0:x.symbolList=x.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=x.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";x.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=x.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var k={x1:1,x2:0,y1:0,y2:0},M={x1:0,x2:0,y1:1,y2:0};x.gradient=function(t,e,r,n,a,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+o],d.identity);l.exit().remove(),l.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=i.select(this);"horizontal"===n?t.attr(k):"vertical"===n&&t.attr(M),t.attr("id",r);var e=s(a),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},x.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},x.singlePointStyle=function(t,e,r,a,o,i){var l=r.marker;n(t,e,r,a,o,l,l.line,i)},x.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,a=x.tryColorscale(n,""),o=x.tryColorscale(n,"line");t.each(function(t){x.singlePointStyle(t,i.select(this),e,a,o,r)})}},x.tryColorscale=function(t,e){var r=e?d.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):d.identity};var A={start:1,end:-1,middle:0,bottom:1,top:-1};x.textPointStyle=function(t,e,r){t.each(function(t){var n=i.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void n.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",c=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=l(u)&&u>0?u:0,n.call(x.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",c).text(a).call(h.convertToTspans,r);var d=i.select(this.parentNode),p=(h.lineCount(n)-1)*v+1,g=A[c]*f,m=.75*u+A[s]*f+(A[s]-1)*p*u/2;d.attr("transform","translate("+g+","+m+")")})};var T=.5;x.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],o=[];for(r=1;r=1e4&&(x.savedBBoxes={},S=0),e&&(x.savedBBoxes[e]=v),S++,d.extendFlat({},v)},x.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")},x.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},x.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||0,r=r||0,i=i.replace(n,"").trim(),i+=" translate("+e+", "+r+")",i=i.trim(),t[o]("transform",i),i},x.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},x.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||1,r=r||1,i=i.replace(n,"").trim(),i+=" scale("+e+", "+r+")",i=i.trim(),t[o]("transform",i),i},x.setPointGroupScale=function(t,e,r){var n,a,o;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",o=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(o,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};var z=/translate\([^)]*\)\s*$/;x.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=i.select(this),a=n.select("text"),o=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(n.attr("transform")||"").match(z);t=1===e&&1===r?[]:["translate("+o+","+l+")","scale("+e+","+r+")","translate("+-o+","+-l+")"],s&&t.push(s),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":130,"../../constants/xmlns_namespaces":134,"../../lib":146,"../../lib/svg_text_utils":163,"../../registry":217,"../../traces/scatter/make_bubble_size_func":296,"../../traces/scatter/subtypes":301,"../color":34,"../colorscale":48,"./symbol_defs":59,d3:10,"fast-isnumeric":13,tinycolor2:16}],59:[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);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),o=n.round(-.309*t,2);return"M"+e+","+o+"L"+r+","+n.round(.809*t,2)+"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(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+n.round(.382*e,2)+"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:10}],60:[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"}}}},{}],61:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e["error_"+n]||{},s=o.visible&&-1!==["linear","log"].indexOf(r.type),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(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 v=e.select("path.yerror");l=!v.size(),l?v=e.append("path").classed("yerror",!0):u&&(v=v.transition().duration(r.duration).ease(r.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(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":301,d3:10,"fast-isnumeric":13}],66:[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":34,d3:10}],67:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":142,"../../plots/font_attributes":205}],68:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,i=0;i=0&&r.indexJ.width||$<0||$>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(C,$),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RX&&(Y.splice(0,X),K=Y[0].distance)}if(0===Y.length)return x.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(I=0;I1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:P,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ut,t);if(o(Y,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);v(u.select(e.target),dt?"pointer":"")}e.target&&!n&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:C,xvals:E,yvals:N}))}function a(t,e,r){var n,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],v=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,O=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(n=0;n15&&(n=n.substr(0,12)+"...")),void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var p=e.select("text.nums").call(m.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),v=e.select("text.name"),x=0;n&&n!==a?(v.call(m.font,t.fontFamily||d,t.fontSize||h,c).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),x=v.node().getBoundingClientRect().width+2*z):(v.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var b,w,k=p.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,P=Math.abs(t.x1-t.x0),E=Math.abs(t.y1-t.y0),N=k.width+S+z+x;t.ty0=T-k.top,t.bx=k.width+2*z,t.by=k.height+2*z,t.anchor="start",t.txwidth=k.width,t.tx2width=x,t.offset=0,i?(t.pos=A,b=D+E/2+N<=C,w=D-E/2-N>=0,"top"!==t.idealAlign&&b||!w?b?(D+=E/2,t.anchor="start"):t.anchor="middle":(D-=E/2,t.anchor="end")):(t.pos=D,b=A+P/2+N<=L,w=A-P/2-N>=0,"left"!==t.idealAlign&&b||!w?b?(A+=P/2,t.anchor="start"):t.anchor="middle":(A-=P/2,t.anchor="end")),p.attr("text-anchor",t.anchor),x&&v.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+D+")"+(i?"rotate("+M+")":""))}),E}function o(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)?T: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 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 i(t,e){t.each(function(t){var r=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+s)+"V"+(c-S)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+z),t.tx2width&&(r.select("text.name").call(g.positionText,l+o*z+s,c+t.ty0-t.by/2+z),r.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function r(e,r,i){var l;if(o[r])l=o[r];else if(a[r]){var s=a[r];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(n,i).get();l&&(t[e]=l)}var n=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var r=e.hovermode,n=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:o},s=a([r],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":146,"../../lib/events":141,"../../lib/override_cursor":155,"../../lib/svg_text_utils":163,"../../plots/cartesian/axes":181,"../../registry":217,"../color":34,"../dragelement":55,"../drawing":58,"./constants":70,"./helpers":72,d3:10,"fast-isnumeric":13,tinycolor2:16}],74:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":146}],75:[function(t,e,r){"use strict";function n(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return l.castOption(t,e,"hoverlabel."+r)}function o(t,e,r){function n(r){return l.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return l.castOption(t,r,"hoverinfo",n)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":146,"../dragelement":55,"./attributes":67,"./calc":68,"./click":69,"./constants":70,"./defaults":71,"./helpers":72,"./hover":73,"./layout_attributes":76,"./layout_defaults":77,"./layout_global_defaults":78,d3:10}],76:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:o.HOVERFONT}),size:n({},a.size,{dflt:o.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":142,"../../plots/font_attributes":205,"./constants":70}],77:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],85:[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":142,"../../plots/font_attributes":205,"../color/attributes":33}],86:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],87:[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,v="normal",m=0;m1)){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":146,"../../plots/layout_attributes":208,"../../registry":217,"./attributes":85,"./helpers":90}],88:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){i(t,e)})}var n=t.data()[0][0],a=e._fullLayout,o=n.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?n.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,o=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=n.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeL&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){o(t,e,n)},L):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,o(t,e,n))}})}function o(t,e,r){if(!e._dragged&&!e._editing){var n,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===r&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===r?-1===g?o.push(h):o.splice(g,1):2===r&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),v.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+r,a.height=Math.max(a.height,e.height),y+=i+r,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:a.width,r.height)})}}function s(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var a="top";A.isBottomAnchor(r)?a="bottom":A.isMiddleAnchor(r)&&(a="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}[a]||0),t:r.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,j,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,i="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+i).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 T=r._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.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 O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(n,t).call(a,t)});var P=0!==M.enter().size();P&&(l(t,O,D),s(t));var E=r.width,N=r.height;l(t,O,D),y.height>N?c(t):s(t);var I=r._size,R=I.l+I.w*y.x,F=I.t+I.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?F-=y.height:A.isMiddleAnchor(y)&&(F-=y.height/2);var j=y.width,B=I.w;j>B?(R=I.l,j=B):(R+j>E&&(R=E-j),R<0&&(R=0),j=Math.min(E-R,y.width));var q=y.height,H=I.h;q>H?(F=I.t,q=H):(F+q>N&&(F=N-q),F<0&&(F=0),q=Math.min(N-F,y.height)),v.setTranslate(M,R,F);var V,U,G=q-x.scrollBarHeight-2*x.scrollBarMargin,X=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:j-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),T.select("rect").attr({width:j-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:j-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*X,-X,0),V=x.scrollBarMargin-U/X*G,e(V,U),0!==U&&U!==-X&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var Y=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*X,e(V,U)});z.call(Y),S.call(Y)}if(t._context.editable){var Z,W,$,Q;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=v.getTranslate(M);$=t.x,Q=t.y},moveFn:function(t,e){var r=$+t,n=Q+e;v.setTranslate(M,r,n),Z=g.align(r,0,I.l,I.l+I.w,y.xanchor),W=g.align(n,0,I.t+I.h,I.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===n?M._clickTimeout=setTimeout(function(){o(i,t,n)},L):2===n&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,n)))}}})}}}},{"../../constants/alignment":130,"../../constants/interactions":131,"../../lib":146,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/plots":210,"../../registry":217,"../color":34,"../dragelement":55,"../drawing":58,"./anchor_utils":84,"./constants":86,"./get_legend_data":89,"./helpers":90,"./style":92,d3:10}],89:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[r]]):l[t].push([r]);else{var n="~~i"+f;s.push(n),l[n]=[[r]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;or[1])return r[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},v={};d&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",o.mean,[.2,1]),g.ms=r("marker.size",o.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",o.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:r("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,v)}var m=n.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=m.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,r=e.marker||{},o=r.line||{},i=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=n.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||r.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&r.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(c,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(r).each(u)}},{"../../lib":146,"../../registry":217,"../../traces/pie/style_one":279,"../../traces/scatter/subtypes":301,"../color":34,"../drawing":58,d3:10}],93:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),i(v,r);u&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var m=a(l),y=[];return((c||p)&&!m||g)&&(y=["zoom2d","pan2d"]),(c||g||p)&&o(s)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!c&&!p||m||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),c&&h?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):c?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):h&&n(["hoverClosestPie"]),i(v,r)}function a(t){for(var e=s.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":146,"../color":34, +"./attributes":97,"./button_attributes":98,"./constants":99}],101:[function(t,e,r){"use strict";function n(t){for(var e=m.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;lX&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-o/n):"move";g(e,i),G=i.split("-")[0]}function o(e){j=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),q=m.getDataToPixel(t,j),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,j),U=m.getPixelToData(t,B,!0);var o="shapes["+n+"]";"path"===r.type?(R=r.path,F=o+".path"):(v=q(r.x0),y=H(r.y0),x=q(r.x1),b=H(r.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vY&&(h[S]=r[P]=U(c),h[z]=r[E]=U(u)),d-f>X&&(h[O]=r[N]=V(f),h[D]=r[I]=V(d))}e.attr("d",i(t,r))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,D,P,E,N,I,R,F,j,B,q,H,V,U,G,X=10,Y=10,Z={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z),e.node().onmousemove=a}function i(t,e){var r,n,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=m.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(n=m.decodeDate(n)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,n,o);var d=n(e.x0),h=n(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return n>=l?t:(o[n]?t=e(t):i[n]&&(t=r(t)),n++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":146,"../../lib/setcursor":161,"../../plotly":176,"../../plots/cartesian/axes":181,"../color":34,"../dragelement":55,"../drawing":58,"./constants":112,"./helpers":115}],115:[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}},{}],116:[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":110,"./calc_autorange":111,"./defaults":113,"./draw":114}],117:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:r},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=n.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":146,"../../plots/cartesian/axes":181,"./attributes":110,"./helpers":115}],118:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":142,"../../plots/animation_attributes":177,"../../plots/font_attributes":205,"../../plots/pad_attributes":209,"./constants":119}],119:[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,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}},{}],120:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;s=r.steps.length&&(r.active=0),e.call(l,r).call(b,r).call(u,r).call(p,r).call(x,t,r).call(s,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(l,r)}function l(t,e,r){if(e.currentvalue.visible){var n,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)i+=r;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*S;return T.positionText(o,n,s),o}}function s(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]);n.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,r.bordercolor).call(M.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function c(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function u(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(c,t,e),A.setTranslate(r,m(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*S+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var o=Math.round(n*(r.steps.length-1));o!==r.active&&d(t,e,r,o,!0,a)}function d(t,e,r,n,a,o){var i=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),o),e.call(l,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&k.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,r){function n(){return r.data()[0]}var a=r.node(),o=w.select(e) +;t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var i=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,r,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=n(),o=y(t,w.mouse(a)[0]);f(e,r,t,o,!1)}),o.on("mouseup",function(){var t=n();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(i=i.transition().duration(e.transition.duration).ease(e.transition.easing)),i.attr("transform","translate("+(o-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(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(M.fill,r.bgcolor).attr("opacity",0),A.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(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.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 g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+g+")")}}}var v=r.propContainer,m=r.propName,y=r.traceIndex,x=r.dfltName,b=r.avoid||{},_=r.attributes,w=r.transform,k=r.containerGroup,M=t._fullLayout,A=v.titlefont.family,T=v.titlefont.size,L=v.titlefont.color,C=1,S=!1,z=v.title.trim(),O=t._context.editable;""===z&&(C=0),z.match(d)&&(C=.2,S=!0,O||(z=""));var D=z||O;k||(k=M._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var P=k.selectAll("text").data(D?[0]:[]);if(P.enter().append("text"),P.text(z).attr("class",e),P.exit().remove(),D){P.call(h);var E="Click to enter "+x+" title";O&&(z?P.on(".opacity",null):function(){C=0,S=!0,z=E,P.text(z).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),P.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?o.restyle(t,m,e,y):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,_.x,_.y)})),P.classed("js-placeholder",S)}}},{"../../constants/interactions":131,"../../lib":146,"../../lib/svg_text_utils":163,"../../plotly":176,"../../plots/plots":210,"../color":34,"../drawing":58,d3:10,"fast-isnumeric":13}],124:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":142,"../../plots/font_attributes":205,"../../plots/pad_attributes":209,"../color/attributes":33}],125:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],126:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return o.coerce(t,e,l,r,n)}n("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==r.length){var u=o.selectAll("g."+S.headerGroupClassName).data(r,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=n.barLength+2*n.barPad,L=n.barWidth+2*n.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,n.barColor),A?(this.hbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,E=p+g,N=v;E+D>s&&(E=s-D);var I=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,n.barColor),O?(this.vbar=I.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:N,width:D,height:P}),this._vbarYMin=N+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,F=u-.5,j=O?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+R).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",R).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(F),y:Math.floor(B),width:Math.ceil(j)-Math.floor(F),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,R),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(l.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=l.constrain(t||0,0,r),e=l.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/n;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":146,"../color":34,"../drawing":58,d3:10}],130:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],131:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],132:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],133:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],134:[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}},{}],135:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":27,"./components/annotations3d":32,"./components/fx":75,"./components/images":83,"./components/legend":91,"./components/rangeselector":103,"./components/rangeslider":109,"./components/shapes":116,"./components/sliders":122,"./components/updatemenus":128,"./fonts/mathjax_config":136,"./lib/queue":158,"./plot_api/plot_schema":170,"./plot_api/register":171,"./plot_api/set_plot_config":172,"./plot_api/to_image":174,"./plot_api/validate":175,"./plotly":176,"./snapshot":222,"./snapshot/download":219,"./traces/scatter":291,d3:10,"es6-promise":11}],136:[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},{}],137:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),n(t)?Number(t):a}},{"../constants/numerical":132,"fast-isnumeric":13}],138:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(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),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.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;!0!==n.strict&&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(i(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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);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(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=n(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="") +;var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=r.MIN_MS=r.dateTime2ms("-9999"),S=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var z=90*y,O=3*x,D=5*b;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(n(r)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),I=M("%b %Y"),R=M("%b %-d"),F=M("%b %-d, %Y");r.formatDate=function(t,e,r,a){var o,d;if(a=n(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===r?d=s(p):"m"===r?d=c(p):"d"===r?(o=s(p),d=u(p)):(o=f(p),d=l(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?d=N(g):"m"===r?d=I(g):"d"===r?(o=N(g),d=R(g)):(o=F(g),d=l(t,r))}return d+(o?"\n"+o:"")};var j=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(r),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},r.findExactDates=function(t,e){for(var r,a,o=0,i=0,l=0,s=0,c=n(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;ui?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var a=0;ar?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},s.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},s.simpleMap=function(t,e,r,n){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<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},s.syncOrAsync=function(t,e,r){function n(){return s.syncOrAsync(t,e,r)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(n).then(void 0,s.promiseError);return r&&r(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.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}},{"../constants/numerical":132,"./clean_number":137,"./coerce":138,"./dates":139,"./ensure_array":140,"./extend":142,"./filter_unique":143,"./filter_visible":144,"./identity":145,"./is_array":147,"./is_plain_object":148,"./loggers":149,"./matrix":150,"./mod":151,"./nested_property":152,"./noop":153,"./notifier":154,"./push_unique":157,"./relink_private":159,"./search":160,"./stats":162,"./to_log_range":164,d3:10,"fast-isnumeric":13}],147:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],148:[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}},{}],149:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],o=t[e][1],s=!1,h(n))for(r=n.length-1;r>=0;r--)a(n[r],i(o,r))?s?n[r]=void 0:n.pop():s=!0;else if("object"==typeof n&&null!==n)for(l=Object.keys(n),s=!1,r=l.length-1;r>=0;r--)a(n[l[r]],i(o,l[r]))?delete n[l[r]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||n===a||ns)&&(!e||!u(t))}function r(t,e){var r=t[0],c=t[1];if(r===a||ri||c===a||cs)return!1;var u,f,d,h,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(n(i,d))>a)return!0;return!1};o.filter=function(t,e){function r(r){t.push(r);var l=n.length,s=a;n.splice(o+1);for(var c=s+1;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":132,"./matrix":150}],157:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ro.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":13}],163:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function l(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],I={type:M},R=i(N,z);if(R?(R=R.replace(E,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(I.style=R),"a"===M){l=!0;var F=i(N,O);if(F){var j=document.createElement("a");j.href=F,-1!==k.indexOf(j.protocol)&&(I.href=F,I.target=i(N,D)||"_blank",I.popup=i(N,P))}}n(I)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(v),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};o(s[2],r,function(r,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=r&&r.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=n(c,"width"),g=n(c,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||n(t,"height"),y=-m/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,z=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,E=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(M," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),o=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=s.attr("class") +;(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(o),a=r.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,n)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():s.on("click",r),f.rebind(t,l,"on")}},{"../constants/alignment":130,"../constants/string_mappings":133,"../constants/xmlns_namespaces":134,"../lib":146,d3:10}],164:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":13}],165:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,a=n.layoutArrayContainers,o=n.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(l),L=e.get(),C=L||[],S=n(m,f).get(),z=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(-1===O)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&l(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function c(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&sH.range[0]?[1,2]:[2,1]);else{var G=H.range[0],X=H.range[1];V?(G<=0&&X<=0&&r(I+".autorange",!0),G<=0?G=X/1e6:X<=0&&(X=G/1e6),r(I+".range[0]",Math.log(G)/Math.LN10),r(I+".range[1]",Math.log(X)/Math.LN10)):(r(I+".range[0]",Math.pow(10,G)),r(I+".range[1]",Math.pow(10,X)))}else r(I+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,j,L,r),w.getComponentMethod("images","convertCoords")(t,j,L,r)}else r(I+".autorange",!0);x.nestedProperty(c,I+"._inputRange").set(null)}else if(E.match(P.AX_NAME_PATTERN)){var Y=x.nestedProperty(c,A).get(),Z=(L||{}).type;Z&&"-"!==Z||(Z="linear"),w.getComponentMethod("annotations","convertCoords")(t,Y,Z,r),w.getComponentMethod("images","convertCoords")(t,Y,Z,r)}var W=z.containerArrayMatch(A);if(W){o=W.array,i=W.index;var $=W.property,Q=x.nestedProperty(s,o),J=(Q||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(m.docalc=!0);else if(""===$){var K=L;z.isAddVal(L)?_[A]=null:z.isRemoveVal(L)?(_[A]=J,K=J):x.warn("unrecognized full object value",e),(n(K,"x")||n(K,"y")&&-1===A.indexOf("updatemenus"))&&(m.docalc=!0)}else!n(J,"x")&&!n(J,"y")||x.containsAny(A,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var tt=d[o][i];tt||(tt=d[o][i]={}),tt[$]=L,delete e[A]}else if("reverse"===E)F.range?F.range.reverse():(r(I+".autorange",!0),F.range=[1,0]),j.autorange?m.docalc=!0:m.doplot=!0;else{var et=String(T.parts[1]||"");0===D.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===D.indexOf("geo")?m.doplot=!0:0===D.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===A?m.doplot=!0:"margin"===D||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===B||"select"===B?"hiddenlabels"===A?m.docalc=!0:-1!==D.indexOf("legend")?m.dolegend=!0:-1!==A.indexOf("title")?m.doticks=!0:-1!==D.indexOf("bgcolor")?m.dolayoutstyle=!0:C>1&&x.containsAny(et,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:C>1&&-1!==et.indexOf("line")?m.dolayoutstyle=!0:C>1&&"mirror"===et?m.doticks=m.dolayoutstyle=!0:"margin.pad"===A?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(L)}}}for(o in d){z.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var rt=c._axisConstraintGroups;for(v in M)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(n++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":58,"../components/errorbars":64,"../constants/xmlns_namespaces":134,"../lib":146,"../lib/events":141,"../lib/queue":158,"../lib/svg_text_utils":163,"../plotly":176,"../plots/cartesian/axis_ids":184,"../plots/cartesian/constants":186,"../plots/cartesian/constraints":188,"../plots/cartesian/graph_interact":190,"../plots/plots":210,"../plots/polar":213,"../registry":217,"./helpers":166,"./manage_arrays":167,"./subroutines":173,d3:10,"fast-isnumeric":13}],169:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],170:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:x},r={}):(e=h.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){d(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:l(n)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var r=h.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){d(t,r.schema.layout[e],e)}):d(t,r.layoutAttributes,r.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],r=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){d(r,n.schema.transforms[t][e],e)})}),{attributes:l(r)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function c(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[k]=!0,n.set(a)}function d(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=k,r.IS_LINKED_TO_ARRAY=M,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=A,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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var o=t[n];-1===A.indexOf(n)&&(e(o,n,t,a),r.isValObject(o)||p.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){if(o=o.slice(0,l).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)){var s=n(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function n(t){return t.join(".")}var a=[],o=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":146,"../plotly":176,"../snapshot/cloneplot":218,"../snapshot/helpers":221,"../snapshot/svgtoimg":223,"../snapshot/tosvg":225,"fast-isnumeric":13}],175:[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,v=r.length,m=0;m.3*f||o(n)||o(a))){var d=r.dtick/2;t+=t+d.8){var i=Number(r.substr(1));o.exactYears>.8&&i%12==0?t=E.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=E.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=E.tickIncrement(t,r);if(l<=n)return l}return t}function o(t){var e,r,n=t.tickvals,a=t.ticktext,o=new Array(n.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;ru&&e10||"01-01"!==n.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>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=t.l2r(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 s(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function c(t,e,r,n){var a=t._tickround,o=r&&t.hoverformat||t.tickformat;n&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");-1!==s&&(i=l.substr(s+1),l=l.substr(0,s)),n&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(r?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,n);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function d(t,e,r,n,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,n)}function h(t,e,r,n){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=V[s/3+5])}return a?"\u2212"+t:t}function p(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},E.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,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 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(),_.simpleMap(r,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},E.saveRangeInitial=function(t,e){for(var r=E.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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,v=e.length,m=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type);m&&"domain"===t.constrain&&t._inputDomain&&(m*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var b=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),M=n(r.vpadminus||r.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},E.autoBin=function(t,e,r,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(r)c=(s-l)/r;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},E.setConvert(h),E.autoTicks(h,c);var p,g=E.tickIncrement(E.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=n(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=E.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},E.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),E.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=E.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=E.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fC?(e/=C,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,r,R)):n>S?(e/=S,t.dtick="M"+i(e,1,F)):n>z?(t.dtick=i(e,z,B),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=i(e,O,F):n>D?t.dtick=i(e,D,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=_.simpleMap(t.range,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 l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},E.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,n);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?H:q,s=t+.01*a,c=_.roundUp(_.mod(s,1),l,r);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,r=_.simpleMap(t.range,e),n=r[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":132,"../../lib":146,"fast-isnumeric":13}],183:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,r,p,g){function v(r,n){return o.coerce2(t,e,l,r,n)}var m=p.letter,y=p.font||{},x="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",b=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?h(m,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=r("color"),k=w===t.color?w:y.color;r("title",x),o.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,r,_),u(t,e,r,_,p),c(t,e,r,p);var M=v("linecolor",w),A=v("linewidth"),T=r("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var L=v("gridcolor",n(w,p.bgColor,i).toRgbString()),C=v("gridwidth");r("showgrid",p.showGrid||!!L||!!C)||(delete e.gridcolor,delete e.gridwidth);var S=v("zerolinecolor",w),z=v("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!z)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":33,"../../lib":146,"../../registry":217,"./category_order_defaults":185,"./layout_attributes":192,"./ordered_categories":194,"./set_convert":198,"./tick_label_defaults":199,"./tick_mark_defaults":200,"./tick_value_defaults":201,tinycolor2:16}],184:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(n="array");var i=r("categoryorder",n);"array"===i&&r("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],186:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],187:[function(t,e,r){"use strict";function n(t,e,r,n){var a,o,l,s,c=n[i(e)].type,u=[];for(o=0;oi*m)||_)for(r=0;rO&&PS&&(S=P);var I=(S-C)/(2*z);f/=I,C=s.l2r(C),S=s.l2r(S),s.range=s._input.range=A=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,r,n,a,o){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function v(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function m(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,r){var n,a,o,i,l,s,c=!1,u={},f={};for(n=0;nF||l>F?(Mt="xy",i/ot>l/it?(l=i*it/ot,xt>o?bt.t=xt-l:bt.b=xt+l):(i=l*ot/it,yt>a?bt.l=yt-i:bt.r=yt+i),Tt.attr("d",y(bt))):n():!st||lzoom back out","long"),j=!1)}function Y(e,r){var n=1===(q+H).length;if(e)J();else if(2!==r||n){if(1===r&&n){var a=q?rt[0]:et[0],i="s"===q||"w"===H?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;q?(u="n"===q?"top":"bottom","right"===a.side&&(c="right")):"e"===H&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(vt).call(A.makeEditable,{gd:t,immediate:!0,background:ht.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,l,r)})}}else Q()}function Z(e){function r(t,e,r){function n(e){return t.l2r(o+(e-o)*r)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ht._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var n=t.querySelector(".plotly");if(V(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(St);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(H||ut){for(H||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":146,"fast-isnumeric":13}],196:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],o=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(o+(a[0]-o)*e),t.l2r(o+(a[1]-o)*e)]}},{"../../constants/alignment":130}],197:[function(t,e,r){"use strict";function n(t){return t._id}function a(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)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*w*Math.abs(n-a))}return h}function f(e,r,n){var a=c(e,n||t.calendar);if(a===h){if(!o(e))return h;a=c(new Date(+e))}return a}function v(e,r,n){return s(e,r,n||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h}function x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(o(e))return+e}function b(e){return o(e)?a.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:u,t.l2c="log"===t.type?n:u,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(l(e))},t.p2d=t.p2r=_,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(l(t),e)},t.r2d=t.r2c=function(t){return n(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=u,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(l(e))},t.p2r=_,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=i.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)},t.cleanPos=function(e){return i.cleanDate(e,h,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2r=t.d2l_noadd=x,t.r2c=function(e){var r=x(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return m(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=i.nestedProperty(t,e).get(),l=(t._id||"x").charAt(0);if(n="date"===t.type?i.dfltRange(t.calendar):"y"===l?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void i.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=i.cleanDate(a[0],h,t.calendar),a[1]=i.cleanDate(a[1],h,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!i.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=i.constrain(t.r2l(a[0]),i.MIN_MS+1e3,i.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!o(a[r])){if(!o(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-d?a[r]=-d:a[r]>d&&(a[r]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var l=r&&t._r?"_r":"range",s=t.calendar;t.cleanRange(l);var c=t.r2l(t[l][0],s),u=t.r2l(t[l][1],s);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw i.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,o,i="date"===t.type&&e[r+"calendar"];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?a.dateTick0(e.calendar):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":132,"../../lib":146,"fast-isnumeric":13}],202:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,c){function u(e,r){function n(e,r){for(a=0;ar.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(t,e,r){var n,a,o,i=t._plots,l=[];for(n in i){var s=i[n];if(-1===l.indexOf(s)){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]||-1===e.indexOf(c)&&-1===e.indexOf(u)||l.push(s)}}return l}(v,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":58,"../../plotly":176,"../../registry":217,"./axes":181,d3:10}],203:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var c=a(e,r,n);if(c){if("histogram"===c.type&&n==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=n+"calendar",f=c[u];if(i(c,n)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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()?" - ":"")}},v.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=v.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},v.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||v.createTransitionData(t),r._initialAutoSizeIsDone){var c=r.width,f=r.height;v.supplyLayoutGlobalDefaults(o,n),o.width||(n.width=c),o.height||(n.height=f)}else{v.supplyLayoutGlobalDefaults(o,n);var d=!o.width||!o.height,h=n.autosize,p=t._context&&t._context.autosizable;d&&(h||p)?v.plotAutoSize(t,o,n):d&&v.sanitizeMargins(t),!h&&d&&(o.width=n.width,o.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,v.supplyDataDefaults(s,l,o,n),n._has=v._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var u=i(t._boundingBoxMargins),f=u.left+u.right,d=u.bottom+u.top,p=1-2*l,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-d))}else{var m=s?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,a=parseFloat(m.height)||r.height}var y=v.layoutAttributes.width.min,x=v.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}),v.sanitizeMargins(r)},v.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];n._replotting||v.doAutoMargin(t)}},v.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(!1!==e.margin.autoexpand){s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(s),d=0;dv){var M=(m*w+(k-e.width)*v)/(w-v),A=(k*(1-v)+(m-e.width)*(1-w))/(w-v);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(c(x)&&s[_].t){var T=s[_].t.val,L=s[_].t.size;if(T>y){var C=(x*T+(L-e.height)*y)/(T-y),S=(L*(1-y)+(x-e.height)*(1-T))/(T-y);C>=0&&S>=0&&C+S>l+i&&(l=C,i=S)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},v.graphJson=function(t,e,r,n,a){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):h.isJSDate(t)?h.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&v.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var r=o(t);return e&&delete r.fit,r})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===n?c:JSON.stringify(c)},v.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(){b=!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,d=t._fullLayout._basePlotModules,p=!1;if(r)for(l=0;l=0,C=L?f.angularAxis.domain:n.extent(k),S=Math.abs(k[1]-k[0]);A&&!M&&(S=0);var z=C.slice();T&&M&&(z[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(z[1]-z[0])/O);var D=f.angularAxis.ticksStep||(z[1]-z[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),z[2]||(z[2]=D);var P=n.range.apply(this,z);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=n.scale.linear().domain(z.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?S:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),N=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=n.select(N)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var I,R=e.select(".chart-group"),F={fill:"none",stroke:f.tickColor},j={"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 B=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=void 0===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:I,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=I.node().getBBox();x=Math.min(f.width-q.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}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(j).text(f.title),U=V.node().getBBox();V.attr({x:_[0]-U.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=G.selectAll("circle.grid-circle").data(a.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(F),X.attr("r",a),X.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(F);var Y=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Z=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(F),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),$=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),$.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(F),$.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),$.append("text").classed("axis-text",!0).style(j);var Q=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(j);f.angularAxis.rewriteTicks&&Q.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));I.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=l,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=i.util.getMousePos(Y).angle;ft.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=l.invert(n);var a=i.util.convertToCartesian(x+12,r+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=i.util.getMousePos(Y).radius;dt.attr({r:r}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(Y).radius);var n=i.util.convertToCartesian(r,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},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(void 0===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-2===r},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;return[t*Math.cos(r),t*Math.sin(r)]},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 v.fill(r,a,o)},"fill-opacity":0,stroke:function(t,e){return v.stroke(r,a,o)},"stroke-width":function(t,e){return v["stroke-width"](r,a,o)},"stroke-dasharray":function(t,e){return v["stroke-dasharray"](r,a,o)},opacity:function(t,e){return v.opacity(r,a,o)},display:function(t,e){return v.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 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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},m=n.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=[i.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),o(e[r],i.PolyChart.defaultConfig()),o(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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),v=n.scale[u?"linear":"ordinal"]().domain(g).range(s),m=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":-1!=n.svg.symbolTypes.indexOf(t)?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,m(e)+c/2]+")"},d:function(t,e){var r=t.symbol;return y(r,c)},fill:function(t,e){return v(e)}}),b.exit().remove()}var _=n.svg.axis().scale(m).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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=n.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=i.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var l=o({},t.layout);if([[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"]]].forEach(function(t,r){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":146,d3:10}],215:[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":34,"../../lib":146,"./micropolar":214,"./undo_manager":216,d3:10}],216:[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-1!==n},hasRedo:function(){return n-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)),d=t._context||{};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;r")?"":e.html(t).text()});return e.remove(),r}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var o=t("d3"),i=t("../components/drawing"),l=t("../components/color"),s=t("../constants/xmlns_namespaces"),c=/"/g,u=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,d=f._paper,h=f._toppaper;d.insert("rect",":first-child").call(i.setRect,0,0,f.width,f.height).call(l.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(r=0;r0&&A>0,j=k<=I&&A<=R,B=k<=R&&A<=I,q="h"===m?I>=k*(R/A):R>=A*(I/k);F&&(j||B||q)?x="inside":(x="outside",b.remove(),b=null)}else x="inside";if(!b&&(b=g(e,y,"outside"===x?C:L),_=M.bBox(b.node()),k=_.width,A=_.height,k<=0||A<=0))return void b.remove();var H;H="outside"===x?o(i,d,h,p,_,m):a(i,d,h,p,_,m),b.attr("transform",H)}}}function a(t,e,r,n,a,o){var l,s,c,u,f,d=a.width,h=a.height,p=(a.left+a.right)/2,g=(a.top+a.bottom)/2,v=Math.abs(e-t),m=Math.abs(n-r);v>2*D&&m>2*D?(f=D,v-=2*f,m-=2*f):f=0;var y,x;return d<=v&&h<=m?(y=!1,x=1):d<=m&&h<=v?(y=!0,x=1):dr?(c=(t+e)/2,u=n-f-s/2):(c=(t+e)/2,u=n+f+s/2),i(p,g,c,u,x,y)}function o(t,e,r,n,a,o){var l,s="h"===o?Math.abs(n-r):Math.abs(e-t);s>2*D&&(l=D,s-=2*l);var c,u,f,d,h="h"===o?Math.min(1,s/a.height):Math.min(1,s/a.width),p=(a.left+a.right)/2,g=(a.top+a.bottom)/2;return c=h*a.width,u=h*a.height,"h"===o?er?(f=(t+e)/2,d=n+l+u/2):(f=(t+e)/2,d=n-l-u/2),i(p,g,f,d,h,!1)}function i(t,e,r,n,a,o){var i,l;return a<1?i="scale("+a+") ":(a=1,i=""),l=o?"rotate("+o+" "+t+" "+e+") ":"","translate("+(r-a*t)+" "+(n-a*e)+")"+i+l}function l(t,e){var r=h(t.text,e);return p(L,r)}function s(t,e){var r=h(t.textposition,e);return g(C,r)}function c(t,e,r){return d(S,t.textfont,e,r)}function u(t,e,r){return d(z,t.insidetextfont,e,r)}function f(t,e,r){return d(O,t.outsidetextfont,e,r)}function d(t,e,r,n){e=e||{};var a=h(e.family,r),o=h(e.size,r),i=h(e.color,r);return{family:p(t.family,a,n.family),size:v(t.size,o,n.size),color:m(t.color,i,n.color)}}function h(t,e){var r;return Array.isArray(t)?ea))return e}return void 0!==r?r:t.dflt}function m(t,e,r){return b(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),x=t("fast-isnumeric"),b=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),k=t("../../components/color"),M=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),L=T.text,C=T.textposition,S=T.textfont,z=T.insidetextfont,O=T.outsidetextfont,D=3;e.exports=function(t,e,r){var a=e.xaxis,o=e.yaxis,i=t._fullLayout,l=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);l.enter().append("g").attr("class","trace bars"),l.append("g").attr("class","points").each(function(e){var r=e[0].t,l=e[0].trace,s=r.poffset,c=Array.isArray(s);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,u){function f(t){return 0===i.bargap&&0===i.bargroupgap?y.round(Math.round(t)-A,2):t}function d(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)}var h,p,g,v,m=r.p+(c?s[u]:s),b=m+r.w,_=r.b,w=_+r.s;if("h"===l.orientation?(g=o.c2p(m,!0),v=o.c2p(b,!0),h=a.c2p(_,!0),p=a.c2p(w,!0)):(h=a.c2p(m,!0),p=a.c2p(b,!0),g=o.c2p(_,!0),v=o.c2p(w,!0)),!(x(h)&&x(p)&&x(g)&&x(v)&&h!==p&&g!==v))return void y.select(this).remove();var M=(r.mlw+1||l.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(M/2%1,2);if(!t._context.staticPlot){var T=k.opacity(r.mc||l.marker.color),L=T<1||M>.01?f:d;h=L(h,p),p=L(p,h),g=L(g,v),v=L(v,g)}var C=y.select(this);C.append("path").attr("d","M"+h+","+g+"V"+v+"H"+p+"V"+g+"Z"),n(t,C,e,u,h,p,g,v)})}),l.call(A.plot,e)}},{"../../components/color":34,"../../components/drawing":58,"../../components/errorbars":64,"../../lib":146,"../../lib/svg_text_utils":163,"./attributes":227,d3:10,"fast-isnumeric":13,tinycolor2:16}],235:[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;cc+l||!y(s))&&(f=!0,d(u,t))} +for(var a=r.traces,o=m(e),i="fraction"===t._fullLayout.barnorm?1:100,l=i/1e9,s=e.l2c(e.c2l(0)),c="stack"===t._fullLayout.barmode?i:s,u=[s,c],f=!1,h=0;h1||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":34,"../../components/drawing":58,"../../components/errorbars":64,d3:10}],238:[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":34,"../../components/colorscale/defaults":43,"../../components/colorscale/has_colorscale":47}],239:[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"},xcalendar:n.xcalendar,ycalendar:n.ycalendar,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":33,"../../lib/extend":142,"../scatter/attributes":281}],240:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,i,l,s,c,u,f,d,h,p=o.getFromId(t,e.xaxis||"x"),g=o.getFromId(t,e.yaxis||"y"),v=e.orientation,m=[];"h"===v?(r=p,i="x",c=g,u="y"):(r=g,i="y",c=p,u="x"),l=r.makeCalcdata(e,i),o.expand(r,l,{padded:!0}),f=function(t,e,r,o,i){var l;return r in e?f=o.makeCalcdata(e,r):(l=r+"0"in e?e[r+"0"]:"name"in e&&("category"===o.type||n(e.name)&&-1!==["linear","log"].indexOf(o.type)||a.isDateTime(e.name)&&"date"===o.type)?e.name:t.numboxes,l=o.d2c(l,0,e[r+"calendar"]),f=i.map(function(){return l})),f}(t,e,u,c,l);var y=a.distinctVals(f);return d=y.vals,h=y.minDiff/2,s=function(t,e,r,o,i){var l,s,c,u,f=o.length,d=e.length,h=[],p=[];for(l=0;l=0&&c1,g=r.dPos*(1-u.boxgap)*(1-u.boxgroupgap)/(p?t.numboxes:1),v=p?2*r.dPos*((r.boxnum+.5)/t.numboxes-.5)*(1-u.boxgap):0,m=g*h.whiskerwidth;if(!0!==h.visible||r.emptybox)return void o.select(this).remove();"h"===h.orientation?(s=d,c=f):(s=f,c=d),r.bPos=v,r.bdPos=g,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+v,!0),r=s.c2p(t.pos+v-g,!0),n=s.c2p(t.pos+v+g,!0),a=s.c2p(t.pos+v-m,!0),l=s.c2p(t.pos+v+m,!0),u=c.c2p(t.q1,!0),f=c.c2p(t.q3,!0),d=i.constrain(c.c2p(t.med,!0),Math.min(u,f)+1,Math.max(u,f)-1),p=c.c2p(!1===h.boxpoints?t.min:t.lf,!0),y=c.c2p(!1===h.boxpoints?t.max:t.uf,!0);"h"===h.orientation?o.select(this).attr("d","M"+d+","+r+"V"+n+"M"+u+","+r+"V"+n+"H"+f+"V"+r+"ZM"+u+","+e+"H"+p+"M"+f+","+e+"H"+y+(0===h.whiskerwidth?"":"M"+p+","+a+"V"+l+"M"+y+","+a+"V"+l)):o.select(this).attr("d","M"+r+","+d+"H"+n+"M"+r+","+u+"H"+n+"V"+f+"H"+r+"ZM"+e+","+u+"V"+p+"M"+e+","+f+"V"+y+(0===h.whiskerwidth?"":"M"+a+","+p+"H"+l+"M"+a+","+y+"H"+l))}),h.boxpoints&&o.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=h}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,o,l,s,c,u="all"===h.boxpoints?t.val:t.val.filter(function(e){return et.uf}),f=Math.max((t.max-t.min)/10,t.q3-t.q1),d=1e-9*f,p=.01*f,m=[],y=0;if(h.jitter){if(0===f)for(y=1,m=new Array(u.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(l.translatePoints,f,d),h.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+v,!0),r=s.c2p(t.pos+v-g,!0),n=s.c2p(t.pos+v+g,!0),a=c.c2p(t.mean,!0),i=c.c2p(t.mean-t.sd,!0),l=c.c2p(t.mean+t.sd,!0);"h"===h.orientation?o.select(this).attr("d","M"+a+","+r+"V"+n+("sd"!==h.boxmean?"":"m0,0L"+i+","+e+"L"+a+","+r+"L"+l+","+e+"Z")):o.select(this).attr("d","M"+r+","+a+"H"+n+("sd"!==h.boxmean?"":"m0,0L"+e+","+i+"L"+r+","+a+"L"+e+","+l+"Z"))})})}},{"../../components/drawing":58,"../../lib":146,d3:10}],247:[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;io){var i=o-r[t];return r[t]=o,i}}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;o--)a(o);else if("increasing"===e){for(o=1;o=0;o--)t[o]+=t[o+1];"exclude"===r&&(t.push(0),t.shift())}}var a=t("fast-isnumeric"),o=t("../../lib"),i=t("../../plots/cartesian/axes"),l=t("../bar/arrays_to_calcdata"),s=t("./bin_functions"),c=t("./norm_functions"),u=t("./average"),f=t("./clean_bins");e.exports=function(t,e){if(!0===e.visible){var r,d=[],h=[],p=i.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),g="h"===e.orientation?"y":"x",v={x:"y",y:"x"}[g],m=e[g+"calendar"],y=e.cumulative;f(e,p,g);var x,b=p.makeCalcdata(e,g),_=g+"bins";!1===e["autobin"+g]&&_ in e?x=e[_]:(x=i.autoBin(b,p,e["nbins"+g],!1,m),y.enabled&&"include"!==y.currentbin&&("decreasing"===y.direction?x.start=p.c2r(p.r2c(x.start)-x.size):x.end=p.c2r(p.r2c(x.end)+x.size)),e._input[_]=e[_]=x);var w,k,M,A="string"==typeof x.size,T=A?[]:x,L=[],C=[],S=0,z=e.histnorm,O=e.histfunc,D=-1!==z.indexOf("density");y.enabled&&D&&(z=z.replace(/ ?density$/,""),D=!1);var P,E="max"===O||"min"===O,N=E?null:0,I=s.count,R=c[z],F=!1,j=function(t){return p.r2c(t,0,m)};for(Array.isArray(e[v])&&"count"!==O&&(P=e[v],F="avg"===O,I=s[O]),r=j(x.start),k=j(x.end)+(r-i.tickIncrement(r,x.size,!1,m))/1e6;r=0&&MV;r--)if(h[r]){U=r;break}for(r=V;r<=U;r++)a(d[r])&&a(h[r])&&H.push({p:d[r],s:h[r],b:0});return l(H,e),H}}},{"../../lib":146,"../../plots/cartesian/axes":181,"../bar/arrays_to_calcdata":226,"./average":254,"./bin_functions":256,"./clean_bins":258,"./norm_functions":261,"fast-isnumeric":13}],258:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib").cleanDate,o=t("../../constants/numerical"),i=o.ONEDAY,l=o.BADNUM;e.exports=function(t,e,r){var o=e.type,s=r+"bins",c=t[s];c||(c=t[s]={});var u="date"===o?function(t){return t||0===t?a(t,l,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=u(c.start),c.end=u(c.end);var f="date"===o?i:1,d=c.size;if(n(d))c.size=d>0?Number(d):f;else if("string"!=typeof d)c.size=f;else{var h=d.charAt(0),p=d.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==o||"M"!==h||p!==Math.round(p))&&(c.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((c.start||0===c.start)&&(c.end||0===c.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":132,"../../lib":146,"fast-isnumeric":13}],259:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),o=t("../../components/color"),i=t("./bin_defaults"),l=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function f(r,n){return a.coerce(t,e,c,r,n)}var d=f("x"),h=f("y");f("cumulative.enabled")&&(f("cumulative.direction"),f("cumulative.currentbin")),f("text");var p=f("orientation",h&&!d?"h":"v"),g=e["v"===p?"x":"y"];if(!g||!g.length)return void(e.visible=!1);n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],u),e["h"===p?"x":"y"]&&f("histfunc"),i(t,e,f,"h"===p?["y"]:["x"]),l(t,e,f,r,u),s(t,e,o.defaultLine,{axis:"y"}),s(t,e,o.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":34,"../../components/errorbars/defaults":63,"../../lib":146,"../../registry":217,"../bar/style_defaults":238,"./attributes":253,"./bin_defaults":255}],260:[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":191,"../bar/hover":230,"../bar/layout_attributes":232,"../bar/layout_defaults":233,"../bar/plot":234,"../bar/set_positions":235,"../bar/style":237,"../scatter/colorbar":284,"./attributes":253,"./calc":257,"./defaults":259}],261:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ai?o=!0:e1)){var f=l.simpleMap(u.x,e.d2c,0,r.xcalendar),d=l.distinctVals(f).minDiff;o=Math.min(o,d)}}for(o===1/0&&(o=1),c=0;c");w.push(i,i,i,i,i,i,null)}(z,p[z],g[z],v[z],m[z]));e.x=b,e.y=_,e.text=w}},{"../../lib":146,"../../plots/cartesian/axes":181,"../../plots/cartesian/axis_ids":184,"./helpers":265,"fast-isnumeric":13}],269:[function(t,e,r){"use strict";var n=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:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},hovertext:{valType:"string",dflt:"",arrayOk:!0},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":33,"../../lib/extend":142,"../../plots/attributes":179,"../../plots/font_attributes":205}],270:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n")}return g};var s},{"../../components/color":34,"./helpers":273,"fast-isnumeric":13,tinycolor2:16}],272:[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")),i("marker.line.width")&&i("marker.line.color");var u=i("marker.colors");Array.isArray(u)||(e.marker.colors=[]),i("scalegroup");var f=i("text"),d=i("textinfo",Array.isArray(f)?"text+percent":"percent");if(i("hovertext"),d&&"none"!==d){var h=i("textposition"),p=Array.isArray(h)||"auto"===h,g=p||"inside"===h,v=p||"outside"===h;if(g||v){var m=l(i,"textfont",o.font);g&&l(i,"insidetextfont",m),v&&l(i,"outsidetextfont",m)}}i("domain.x"),i("domain.y"),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")}},{"../../lib":146,"./attributes":269}],273:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":146}],274:[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":269,"./base_plot":270,"./calc":271,"./defaults":272,"./layout_attributes":275,"./layout_defaults":276,"./plot":277,"./style":278,"./style_one":279}],275:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],276:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./layout_attributes");e.exports=function(t,e){!function(r,o){n.coerce(t,e,a,r,o)}("hiddenlabels")}},{"../../lib":146,"./layout_attributes":275}],277:[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)),v={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/o/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},m=v.scale>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 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]}var a,o,i,l,s,c,u,f,d,h,p,g,v;for(o=0;o<2;o++)for(i=o?r:n,s=o?Math.max:Math.min,u=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(i),d=t[1-o][a],h=d.concat(f),g=[],p=0;p0&&(t.labelExtraY=x),Array.isArray(e.pull))for(a=0;a=e.pull[i.i]||((t.pxmid[1]-i.pxmid[1])*u>0?(f=i.cyFinal+s(i.px0[1],i.px1[1]),(x=f-v-t.labelExtraY)*u>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*u>0&&(n=3*c*Math.abs(a-h.indexOf(t)),d=i.cxFinal+l(i.px0[0],i.px1[0]),(p=d+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*c>0&&(t.labelExtraX+=p)))}(g[p],m)}}}function l(t,e){var r,n,a,o,i,l,s,u,f,d,h=[];for(a=0;au&&(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&&-1===h.indexOf(l.scalegroup)&&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("../../components/fx"),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],v=c.trace,m=(v.depth||0)*c.r*Math.sin(0)/2,y=v.tiltaxis||0,x=y*Math.PI/180,b=[m*Math.sin(x),m*Math.cos(x)],_=c.r*Math.cos(0),w=l.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function i(n){n.originalEvent=u.event;var o=t._fullLayout,i=t._fullData[v.index],l=f.castHoverinfo(i,o,e.i);if("all"===l&&(l="label+text+value+percent+name"),t._dragging||!1===o.hovermode||"none"===l||"skip"===l||!l)return void f.hover(t,n,"pie");var s=a(e,c),d=w+e.pxmid[0]*(1-s),h=k+e.pxmid[1]*(1-s),p=r.separators,m=[];-1!==l.indexOf("label")&&m.push(e.label),-1!==l.indexOf("text")&&(i.hovertext?m.push(Array.isArray(i.hovertext)?i.hovertext[e.i]:i.hovertext):i.text&&i.text[e.i]&&m.push(i.text[e.i])),-1!==l.indexOf("value")&&m.push(g.formatPieValue(e.v,p)),-1!==l.indexOf("percent")&&m.push(g.formatPiePercent(e.v/c.vTotal,p)),f.loneHover({x0:d-s*c.r,x1:d+s*c.r,y:h,text:m.join("
"),name:-1!==l.indexOf("name")?i.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:f.castHoverOption(v,e.i,"bgcolor")||e.color,borderColor:f.castHoverOption(v,e.i,"bordercolor"),fontFamily:f.castHoverOption(v,e.i,"font.family"),fontSize:f.castHoverOption(v,e.i,"font.size"),fontColor:f.castHoverOption(v,e.i,"font.color")},{container:o._hoverlayer.node(),outerContainer:o._paper.node(),gd:t}),f.hover(t,n,"pie"),T=!0}function l(e){e.originalEvent=u.event,t.emit("plotly_unhover",{event:u.event,points:[e]}),T&&(f.loneUnhover(r._hoverlayer.node()),T=!1)}function d(){t._hoverdata=[e],t._hoverdata.trace=c.trace,f.click(t,u.event)}function x(t,r,n,a){return"a"+a*c.r+","+a*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-t[0])+","+a*(r[1]-t[1])}if(e.hidden)return void u.select(this).selectAll("path,g").remove();s[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=c.cx+b[0],k=c.cy+b[1],M=u.select(this),A=M.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),M.select("path.textline").remove(),M.on("mouseover",i).on("mouseout",l).on("click",d),v.pull){var L=+(Array.isArray(v.pull)?v.pull[e.i]:v.pull)||0;L>0&&(w+=L*e.pxmid[0],k+=L*e.pxmid[1])}e.cxFinal=w,e.cyFinal=k;var C=v.hole;if(e.v===c.vTotal){var S="M"+(w+e.px0[0])+","+(k+e.px0[1])+x(e.px0,e.pxmid,!0,1)+x(e.pxmid,e.px0,!0,1)+"Z";C?A.attr("d","M"+(w+C*e.px0[0])+","+(k+C*e.px0[1])+x(e.px0,e.pxmid,!1,C)+x(e.pxmid,e.px0,!1,C)+"Z"+S):A.attr("d",S)}else{var z=x(e.px0,e.px1,!0,1);if(C){var O=1-C;A.attr("d","M"+(w+C*e.px1[0])+","+(k+C*e.px1[1])+x(e.px1,e.px0,!1,C)+"l"+O*e.px0[0]+","+O*e.px0[1]+z+"Z")}else A.attr("d","M"+w+","+k+"l"+e.px0[0]+","+e.px0[1]+z+"Z")}var D=Array.isArray(v.textposition)?v.textposition[e.i]:v.textposition,P=M.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]);P.enter().append("g").classed("slicetext",!0),P.exit().remove(),P.each(function(){var r=u.select(this).selectAll("text").data([0]);r.enter().append("text").attr("data-notex",1),r.exit().remove(),r.text(e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(h.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans,t);var a,i=h.bBox(r.node());"outside"===D?a=o(i,e):(a=n(i,e,c),"auto"===D&&a.scale<1&&(r.call(h.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(i=h.bBox(r.node())),a=o(i,e)));var l=w+e.pxmid[0]*a.rCenter+(a.x||0),s=k+e.pxmid[1]*a.rCenter+(a.y||0);a.outside&&(e.yLabelMin=s-i.height/2,e.yLabelMid=s,e.yLabelMax=s+i.height/2,e.labelExtraX=0,e.labelExtraY=0,m=!0),r.attr("transform","translate("+l+","+s+")"+(a.scale<1?"scale("+a.scale+")":"")+(a.rotate?"rotate("+a.rotate+")":"")+"translate("+-(i.left+i.right)/2+","+-(i.top+i.bottom)/2+")")})}),m&&i(s,v),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]);Math.abs(l)>Math.abs(s)?o+="l"+s*t.pxmid[0]/t.pxmid[1]+","+s+"H"+(n+t.labelExtraX+i):o+="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":34,"../../components/drawing":58,"../../components/fx":75,"../../lib/svg_text_utils":163,"./helpers":273,d3:10}],278:[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":279,d3:10}],279:[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}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":34}],280:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(r=e.marker,c=r.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(f,h,v),a.expand(d,p,m);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}}}}},{}],284:[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":37,"../../components/colorscale":48,"../../lib":146,"../../plots/plots":210,"fast-isnumeric":13}],285:[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":40,"../../components/colorscale/has_colorscale":47,"./subtypes":301}],286:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],287:[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 v=l(t,e,p,g),m=vH!=E>=H&&(O=S[L-1][0],D=S[L][0],z=O+(D-O)*(H-P)/(E-P),F=Math.min(F,z),j=Math.max(j,z));F=Math.max(F,0),j=Math.min(j,d._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:s+10,x0:F,x1:j,y0:H,y1:H,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":34,"../../components/errorbars":64,"../../components/fx":75,"../../lib":146,"./get_trace_color":289}],291:[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":191,"./arrays_to_calcdata":280,"./attributes":281,"./calc":282,"./clean_data":283,"./colorbar":284,"./defaults":287,"./hover":290,"./plot":298,"./select":299,"./style":300,"./subtypes":301}],292:[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,l){var s=(t.marker||{}).color;if(i("line.color",r),n(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||r)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":43,"../../components/colorscale/has_colorscale":47}],293:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var o,i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],C=.2,S=new Array(t.length),z=0;for(k||(A=C=-1),o=0;oa(u))break;l=u,m=p[0]*h[0]+p[1]*h[1],m>g?(g=m,s=u,d=!1):m=t.length||!u)break;S[z++]=u,i=u}}else S[z++]=s}L.push(S.slice(0,z))}return L}},{"../../constants/numerical":132}],294:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],295:[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":13}],297:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(r=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",r),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?n.background:n.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":34,"../../components/colorscale/defaults":43,"../../components/colorscale/has_colorscale":47,"./subtypes":301}],298:[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,d,p){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function x(){return!1}function b(e){var r,n,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,m=x;f&&(p=o.marker.maxdisplayed||o._needsCull?v:l.identity),d&&(m=o.marker.maxdisplayed||o._needsCull?v:l.identity),n=c.selectAll("path.point"),r=n.data(p,h);var b=r.enter().append("path").classed("point",!0);k&&b.call(s.pointStyle,o,t).call(s.translatePoints,M,A,o).style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");r.order(),r.each(function(e){var r=i.select(this),n=g(r);a=s.translatePoint(e,n,M,A),a?(s.singlePointStyle(e,n,o,_,w,t),o.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):n.remove()}),k?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=c.selectAll("g"),r=n.data(m,h),r.enter().append("g").classed("textpoint",!0).append("text"),r.order(),r.each(function(t){var e=i.select(this),r=g(e.select("text"));(a=s.translatePoint(t,r,M,A))||e.remove()}),r.selectAll("text").call(s.textPointStyle,o,t).each(function(t){var e=t.xp||M.c2p(t.x),r=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;o(t,e,r,n,a);var k=!!p&&p.duration>0,M=r.xaxis,A=r.yaxis,T=n[0].trace,L=T.line,C=i.select(d);if(C.call(c.plot,r,p),!0===T.visible){g(C).style("opacity",T.opacity);var S,z,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=C;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",z=E._nextFill,P=E._polygons);var N,I,R,F,j,B,q,H,V,U="",G="",X=[],Y=[],Z=l.noop;if(S=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(z&&z.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(L.shape)?(R=s.steps(L.shape),F=s.steps(L.shape.split("").reverse().join(""))):R=F="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},j=function(t){return F(t.reverse())},X=f(n,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),Z=function(t){return function(e){if(N=R(e),I=j(e),U?O?(U+="L"+N.substr(1),G=I+"L"+G.substr(1)):(U+="Z"+N,G=I+"Z"+G):(U=N,G=I),u.hasLines(T)&&e.length>1){var r=i.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",N).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",N),s.singleLineStyle(n,a)}}}}}var W=C.selectAll(".js-line").data(Y);g(W.exit()).style("opacity",0).remove(),W.each(Z(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)), +X.length&&(S?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(S).attr("d","M"+H+"L"+B+"L"+U.substr(1)).call(s.singleFillStyle)):g(S).attr("d",U+"Z").call(s.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(z).attr("d",U+"Z"+D+"Z").call(s.singleFillStyle):g(z).attr("d",U+"L"+D.substr(1)+"Z").call(s.singleFillStyle),T._polygons=T._polygons.concat(P)),T._prevRevpath=G,T._prevPolygons=V);var $=C.selectAll(".points");_=$.data([n]),$.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,r,n,a){var o=r.xaxis,s=r.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=n[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=n.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),v=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),d(t,e,r),n(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),v){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":58,"../../components/errorbars":64,"../../lib":146,"../../lib/polygon":156,"./line_points":293,"./link_traces":295,"./subtypes":301,d3:10}],299:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.marker,h=!n.hasMarkers(f)&&!n.hasText(f);if(!0===f.visible&&!h){var p=Array.isArray(d.opacity)?1:d.opacity;if(!1===e)for(r=0;r 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -15164,7 +15232,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":27,"../drawing":51,"./arrow_paths":17,"d3":8,"fast-isnumeric":11}],25:[function(require,module,exports){ +},{"../color":33,"../drawing":57,"./arrow_paths":17,"d3":8,"fast-isnumeric":11}],26:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15189,6 +15257,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -15196,7 +15265,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":18,"./calc_autorange":19,"./click":20,"./convert_coords":21,"./defaults":22,"./draw":23}],26:[function(require,module,exports){ +},{"./attributes":18,"./calc_autorange":19,"./click":20,"./convert_coords":22,"./defaults":23,"./draw":24}],27:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":18}],28:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":148,"../../plots/cartesian/axes":184}],29:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":148,"../../plots/array_container_defaults":181,"../../plots/cartesian/axes":184,"../annotations/common_defaults":21,"./attributes":27}],30:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":222,"../annotations/draw":24}],31:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":27,"./convert":28,"./defaults":29,"./draw":30}],32:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15236,7 +15612,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],27:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15407,7 +15783,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":26,"fast-isnumeric":11,"tinycolor2":14}],28:[function(require,module,exports){ +},{"./attributes":32,"fast-isnumeric":11,"tinycolor2":14}],34:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15563,7 +15939,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/cartesian/layout_attributes":188,"../../plots/font_attributes":201}],29:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/cartesian/layout_attributes":195,"../../plots/font_attributes":208}],35:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15630,7 +16006,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":141,"../../plots/cartesian/tick_label_defaults":195,"../../plots/cartesian/tick_mark_defaults":196,"../../plots/cartesian/tick_value_defaults":197,"./attributes":28}],30:[function(require,module,exports){ +},{"../../lib":148,"../../plots/cartesian/tick_label_defaults":202,"../../plots/cartesian/tick_mark_defaults":203,"../../plots/cartesian/tick_value_defaults":204,"./attributes":34}],36:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -15656,6 +16032,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -15929,7 +16307,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -15941,8 +16319,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -15955,8 +16332,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -16189,6 +16565,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -16263,7 +16640,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":141,"../../lib/extend":135,"../../lib/setcursor":156,"../../plotly":172,"../../plots/cartesian/axes":177,"../../plots/cartesian/axis_defaults":179,"../../plots/cartesian/layout_attributes":188,"../../plots/cartesian/position_defaults":191,"../../plots/plots":217,"../../registry":225,"../color":27,"../dragelement":48,"../drawing":51,"../titles":116,"./attributes":28,"d3":8,"tinycolor2":14}],31:[function(require,module,exports){ +},{"../../constants/alignment":129,"../../lib":148,"../../lib/extend":142,"../../lib/setcursor":163,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/cartesian/axes":184,"../../plots/cartesian/axis_defaults":186,"../../plots/cartesian/layout_attributes":195,"../../plots/cartesian/position_defaults":198,"../../plots/plots":225,"../../registry":233,"../color":33,"../dragelement":54,"../drawing":57,"../titles":122,"./attributes":34,"d3":8,"tinycolor2":14}],37:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16282,7 +16659,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":141}],32:[function(require,module,exports){ +},{"../../lib":148}],38:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16337,7 +16714,7 @@ module.exports = { } }; -},{}],33:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16416,7 +16793,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":141,"./flip_scale":38,"./scales":45}],34:[function(require,module,exports){ +},{"../../lib":148,"./flip_scale":44,"./scales":51}],40:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16460,7 +16837,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":135,"./attributes":32,"./scales.js":45}],35:[function(require,module,exports){ +},{"../../lib/extend":142,"./attributes":38,"./scales.js":51}],41:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16476,7 +16853,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":45}],36:[function(require,module,exports){ +},{"./scales":51}],42:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16540,7 +16917,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":141,"../colorbar/defaults":29,"../colorbar/has_colorbar":31,"./flip_scale":38,"./is_valid_scale":42,"fast-isnumeric":11}],37:[function(require,module,exports){ +},{"../../lib":148,"../colorbar/defaults":35,"../colorbar/has_colorbar":37,"./flip_scale":44,"./is_valid_scale":48,"fast-isnumeric":11}],43:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16577,7 +16954,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],38:[function(require,module,exports){ +},{}],44:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16602,7 +16979,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],39:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16642,7 +17019,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":41,"./is_valid_scale_array":49,"./scales":51}],46:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16688,7 +17065,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":141,"./is_valid_scale":42,"fast-isnumeric":11}],41:[function(require,module,exports){ +},{"../../lib":148,"./is_valid_scale":48,"fast-isnumeric":11}],47:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16722,7 +17099,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":38,"./calc":39,"./default_scale":41,"./defaults":42,"./extract_scale":43,"./flip_scale":44,"./get_scale":45,"./has_colorscale":46,"./is_valid_scale":48,"./make_color_scale_func":50,"./scales":51}],48:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16743,7 +17120,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":49,"./scales":51}],49:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16780,7 +17157,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":14}],44:[function(require,module,exports){ +},{"tinycolor2":14}],50:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -16876,7 +17253,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":27,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],45:[function(require,module,exports){ +},{"../color":33,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],51:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17007,7 +17384,7 @@ module.exports = { ] }; -},{}],46:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17040,7 +17417,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],47:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17078,7 +17455,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":141}],48:[function(require,module,exports){ +},{"../../lib":148}],54:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17107,6 +17484,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -17125,28 +17511,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -17197,10 +17575,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -17247,10 +17621,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -17280,7 +17650,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":123,"../../lib":141,"../../plotly":172,"../../plots/cartesian/constants":182,"./align":46,"./cursor":47,"./unhover":49}],49:[function(require,module,exports){ +},{"../../constants/interactions":130,"../../lib":148,"../../plotly":179,"../../plots/cartesian/constants":189,"./align":52,"./cursor":53,"./unhover":55}],55:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17336,7 +17706,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":134}],50:[function(require,module,exports){ +},{"../../lib/events":141}],56:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17360,7 +17730,7 @@ exports.dash = { }; -},{}],51:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -17383,6 +17753,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -17404,13 +17777,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -17419,7 +17798,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -17434,7 +17813,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -17520,6 +17898,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -17746,7 +18134,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -17754,7 +18142,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -17775,9 +18162,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -17808,21 +18194,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -17961,34 +18342,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -18009,18 +18443,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -18175,17 +18620,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":126,"../../lib":141,"../../lib/svg_text_utils":158,"../../registry":225,"../../traces/scatter/make_bubble_size_func":259,"../../traces/scatter/subtypes":264,"../color":27,"../colorscale":41,"./symbol_defs":52,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],52:[function(require,module,exports){ +},{"../../constants/alignment":129,"../../constants/xmlns_namespaces":133,"../../lib":148,"../../lib/svg_text_utils":165,"../../registry":233,"../../traces/scatter/make_bubble_size_func":267,"../../traces/scatter/subtypes":272,"../color":33,"../colorscale":47,"./symbol_defs":58,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],58:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18661,7 +19096,7 @@ module.exports = { } }; -},{"d3":8}],53:[function(require,module,exports){ +},{"d3":8}],59:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18760,7 +19195,7 @@ module.exports = { } }; -},{}],54:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18823,7 +19258,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":177,"../../registry":225,"./compute_error":55,"fast-isnumeric":11}],55:[function(require,module,exports){ +},{"../../plots/cartesian/axes":184,"../../registry":233,"./compute_error":61,"fast-isnumeric":11}],61:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18919,7 +19354,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],56:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -18996,7 +19431,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":141,"../../registry":225,"./attributes":53,"fast-isnumeric":11}],57:[function(require,module,exports){ +},{"../../lib":148,"../../registry":233,"./attributes":59,"fast-isnumeric":11}],63:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19055,7 +19490,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":53,"./calc":54,"./defaults":56,"./plot":58,"./style":59}],58:[function(require,module,exports){ +},{"./attributes":59,"./calc":60,"./defaults":62,"./plot":64,"./style":65}],64:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19219,7 +19654,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":264,"d3":8,"fast-isnumeric":11}],59:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":272,"d3":8,"fast-isnumeric":11}],65:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19256,7 +19691,7 @@ module.exports = function style(traces) { }); }; -},{"../color":27,"d3":8}],60:[function(require,module,exports){ +},{"../color":33,"d3":8}],66:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19292,7 +19727,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":201}],61:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":208}],67:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19308,30 +19743,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; + + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":141,"../../registry":225}],62:[function(require,module,exports){ +},{"../../lib":148,"../../registry":233}],68:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19343,10 +19794,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -19360,7 +19820,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":225}],63:[function(require,module,exports){ +},{"../../registry":233,"./hover":72}],69:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19392,7 +19852,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],64:[function(require,module,exports){ +},{}],70:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19415,7 +19875,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":141,"./attributes":60,"./hoverlabel_defaults":67}],65:[function(require,module,exports){ +},{"../../lib":148,"./attributes":66,"./hoverlabel_defaults":73}],71:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19426,6 +19886,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -19502,7 +19963,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":63}],66:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":148,"./constants":69}],72:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -19571,7 +20058,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -19583,13 +20070,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -19666,15 +20153,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -19859,11 +20346,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -19962,6 +20449,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -19995,7 +20483,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -20009,7 +20497,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -20028,7 +20516,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -20063,7 +20551,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -20100,23 +20588,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -20132,14 +20613,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -20229,7 +20705,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -20245,12 +20723,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -20262,11 +20738,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -20534,17 +21008,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -20561,6 +21030,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -20628,7 +21121,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -20638,29 +21131,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -20812,7 +21282,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":141,"../../lib/events":134,"../../lib/override_cursor":150,"../../lib/svg_text_utils":158,"../../plots/cartesian/axes":177,"../../registry":225,"../color":27,"../dragelement":48,"../drawing":51,"./constants":63,"./helpers":65,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],67:[function(require,module,exports){ +},{"../../lib":148,"../../lib/events":141,"../../lib/override_cursor":157,"../../lib/svg_text_utils":165,"../../plots/cartesian/axes":184,"../../registry":233,"../color":33,"../dragelement":54,"../drawing":57,"./constants":69,"./helpers":71,"d3":8,"fast-isnumeric":11,"tinycolor2":14}],73:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20833,7 +21303,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":141}],68:[function(require,module,exports){ +},{"../../lib":148}],74:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20871,7 +21341,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -20893,23 +21366,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":141,"../dragelement":48,"./attributes":60,"./calc":61,"./click":62,"./constants":63,"./defaults":64,"./helpers":65,"./hover":66,"./layout_attributes":69,"./layout_defaults":70,"./layout_global_defaults":71,"d3":8}],69:[function(require,module,exports){ +},{"../../lib":148,"../dragelement":54,"./attributes":66,"./calc":67,"./click":68,"./constants":69,"./defaults":70,"./helpers":71,"./hover":72,"./layout_attributes":75,"./layout_defaults":76,"./layout_global_defaults":77,"d3":8}],75:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -20962,7 +21433,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":201,"./constants":63}],70:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":208,"./constants":69}],76:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21010,7 +21481,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":141,"./layout_attributes":69}],71:[function(require,module,exports){ +},{"../../lib":148,"./layout_attributes":75}],77:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21033,7 +21504,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":141,"./hoverlabel_defaults":67,"./layout_attributes":69}],72:[function(require,module,exports){ +},{"../../lib":148,"./hoverlabel_defaults":73,"./layout_attributes":75}],78:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21155,7 +21626,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":182}],73:[function(require,module,exports){ +},{"../../plots/cartesian/constants":189}],79:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21238,7 +21709,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":159,"fast-isnumeric":11}],74:[function(require,module,exports){ +},{"../../lib/to_log_range":166,"fast-isnumeric":11}],80:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21299,7 +21770,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":141,"../../plots/array_container_defaults":174,"../../plots/cartesian/axes":177,"./attributes":72}],75:[function(require,module,exports){ +},{"../../lib":148,"../../plots/array_container_defaults":181,"../../plots/cartesian/axes":184,"./attributes":78}],81:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21520,7 +21991,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":126,"../../plots/cartesian/axes":177,"../drawing":51,"d3":8}],76:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":133,"../../plots/cartesian/axes":184,"../drawing":57,"d3":8}],82:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21543,7 +22014,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":72,"./convert_coords":73,"./defaults":74,"./draw":75}],77:[function(require,module,exports){ +},{"./attributes":78,"./convert_coords":79,"./defaults":80,"./draw":81}],83:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21592,7 +22063,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],78:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21683,7 +22154,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":201,"../color/attributes":26}],79:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":208,"../color/attributes":32}],85:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21701,7 +22172,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],80:[function(require,module,exports){ +},{}],86:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21794,7 +22265,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":141,"../../plots/layout_attributes":215,"../../registry":225,"./attributes":78,"./helpers":83}],81:[function(require,module,exports){ +},{"../../lib":148,"../../plots/layout_attributes":223,"../../registry":233,"./attributes":84,"./helpers":89}],87:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -21819,6 +22290,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -21908,7 +22381,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -22114,6 +22587,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -22165,30 +22639,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -22353,20 +22821,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -22374,18 +22843,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -22620,7 +23090,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":123,"../../lib":141,"../../lib/svg_text_utils":158,"../../plotly":172,"../../plots/plots":217,"../../registry":225,"../color":27,"../dragelement":48,"../drawing":51,"./anchor_utils":77,"./constants":79,"./get_legend_data":82,"./helpers":83,"./style":85,"d3":8}],82:[function(require,module,exports){ +},{"../../constants/alignment":129,"../../constants/interactions":130,"../../lib":148,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/plots":225,"../../registry":233,"../color":33,"../dragelement":54,"../drawing":57,"./anchor_utils":83,"./constants":85,"./get_legend_data":88,"./helpers":89,"./style":91,"d3":8}],88:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22725,7 +23195,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":225,"./helpers":83}],83:[function(require,module,exports){ +},{"../../registry":233,"./helpers":89}],89:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22756,7 +23226,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":225}],84:[function(require,module,exports){ +},{"../../registry":233}],90:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22780,7 +23250,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":78,"./defaults":80,"./draw":81,"./style":85}],85:[function(require,module,exports){ +},{"./attributes":84,"./defaults":86,"./draw":87,"./style":91}],91:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -22803,7 +23273,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -22841,179 +23311,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); + + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); + + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; -},{"../../lib":141,"../../registry":225,"../../traces/pie/style_one":242,"../../traces/scatter/subtypes":264,"../color":27,"../drawing":51,"d3":8}],86:[function(require,module,exports){ +},{"../../lib":148,"../../registry":233,"../../traces/pie/style_one":250,"../../traces/scatter/subtypes":272,"../color":33,"../drawing":57,"d3":8}],92:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23591,7 +24061,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":141,"../../plotly":172,"../../plots/cartesian/axes":177,"../../plots/plots":217,"../../snapshot/download":227}],87:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":148,"../../plotly":179,"../../plots/cartesian/axes":184,"../../plots/plots":225,"../../snapshot/download":235}],93:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23605,7 +24075,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":88}],88:[function(require,module,exports){ +},{"./manage":94}],94:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -23729,7 +24199,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -23781,7 +24251,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -23833,7 +24303,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":177,"../../traces/scatter/subtypes":264,"./buttons":86,"./modebar":89}],89:[function(require,module,exports){ +},{"../../plots/cartesian/axes":184,"../../traces/scatter/subtypes":272,"./buttons":92,"./modebar":95}],95:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24127,7 +24597,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":141,"d3":8}],90:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":148,"d3":8}],96:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24217,7 +24687,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":201,"../color/attributes":26,"./button_attributes":91}],91:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":208,"../color/attributes":32,"./button_attributes":97}],97:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24258,7 +24728,7 @@ module.exports = { } }; -},{}],92:[function(require,module,exports){ +},{}],98:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24287,7 +24757,7 @@ module.exports = { darkAmount: 10 }; -},{}],93:[function(require,module,exports){ +},{}],99:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24386,7 +24856,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":141,"../color":27,"./attributes":90,"./button_attributes":91,"./constants":92}],94:[function(require,module,exports){ +},{"../../lib":148,"../color":33,"./attributes":96,"./button_attributes":97,"./constants":98}],100:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24408,6 +24878,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -24448,7 +24920,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -24535,11 +25007,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -24571,26 +25041,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -24609,13 +25076,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -24661,7 +25123,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":158,"../../plotly":172,"../../plots/cartesian/axis_ids":180,"../../plots/plots":217,"../color":27,"../drawing":51,"../legend/anchor_utils":77,"./constants":92,"./get_update_object":95,"d3":8}],95:[function(require,module,exports){ +},{"../../constants/alignment":129,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/cartesian/axis_ids":187,"../../plots/plots":225,"../color":33,"../drawing":57,"../legend/anchor_utils":83,"./constants":98,"./get_update_object":101,"d3":8}],101:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24718,7 +25180,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":8}],96:[function(require,module,exports){ +},{"d3":8}],102:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24745,7 +25207,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":90,"./defaults":93,"./draw":94}],97:[function(require,module,exports){ +},{"./attributes":96,"./defaults":99,"./draw":100}],103:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24809,7 +25271,7 @@ module.exports = { } }; -},{"../color/attributes":26}],98:[function(require,module,exports){ +},{"../color/attributes":32}],104:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24845,7 +25307,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":177,"./constants":99}],99:[function(require,module,exports){ +},{"../../plots/cartesian/axes":184,"./constants":105}],105:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24897,7 +25359,7 @@ module.exports = { extraPad: 15 }; -},{}],100:[function(require,module,exports){ +},{}],106:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -24954,7 +25416,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":141,"./attributes":97}],101:[function(require,module,exports){ +},{"../../lib":148,"./attributes":103}],107:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25505,7 +25967,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":141,"../../lib/setcursor":156,"../../plotly":172,"../../plots/cartesian":187,"../../plots/cartesian/axes":177,"../../plots/plots":217,"../color":27,"../dragelement":48,"../drawing":51,"./constants":99,"d3":8}],102:[function(require,module,exports){ +},{"../../lib":148,"../../lib/setcursor":163,"../../plotly":179,"../../plots/cartesian":194,"../../plots/cartesian/axes":184,"../../plots/plots":225,"../color":33,"../dragelement":54,"../drawing":57,"./constants":105,"d3":8}],108:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25532,7 +25994,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":97,"./calc_autorange":98,"./defaults":100,"./draw":101}],103:[function(require,module,exports){ +},{"./attributes":103,"./calc_autorange":104,"./defaults":106,"./draw":107}],109:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25629,7 +26091,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../traces/scatter/attributes":244,"../annotations/attributes":18,"../drawing/attributes":50}],104:[function(require,module,exports){ +},{"../../lib/extend":142,"../../traces/scatter/attributes":252,"../annotations/attributes":18,"../drawing/attributes":56}],110:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25675,7 +26137,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -25706,7 +26168,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":141,"../../plots/cartesian/axes":177,"./constants":105,"./helpers":108}],105:[function(require,module,exports){ +},{"../../lib":148,"../../plots/cartesian/axes":184,"./constants":111,"./helpers":114}],111:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25770,7 +26232,7 @@ module.exports = { } }; -},{}],106:[function(require,module,exports){ +},{}],112:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25795,7 +26257,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":174,"./shape_defaults":110}],107:[function(require,module,exports){ +},{"../../plots/array_container_defaults":181,"./shape_defaults":116}],113:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -25928,8 +26390,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -25938,6 +26400,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -26170,7 +26634,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":141,"../../lib/setcursor":156,"../../plotly":172,"../../plots/cartesian/axes":177,"../color":27,"../dragelement":48,"../drawing":51,"./constants":105,"./helpers":108}],108:[function(require,module,exports){ +},{"../../lib":148,"../../lib/setcursor":163,"../../plotly":179,"../../plots/cartesian/axes":184,"../color":33,"../dragelement":54,"../drawing":57,"./constants":111,"./helpers":114}],114:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26251,7 +26715,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],109:[function(require,module,exports){ +},{}],115:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26277,7 +26741,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":103,"./calc_autorange":104,"./defaults":106,"./draw":107}],110:[function(require,module,exports){ +},{"./attributes":109,"./calc_autorange":110,"./defaults":112,"./draw":113}],116:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26376,7 +26840,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":141,"../../plots/cartesian/axes":177,"./attributes":103,"./helpers":108}],111:[function(require,module,exports){ +},{"../../lib":148,"../../plots/cartesian/axes":184,"./attributes":109,"./helpers":114}],117:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26399,7 +26863,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -26424,6 +26888,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -26610,7 +27080,7 @@ module.exports = { }, }; -},{"../../lib/extend":135,"../../plots/animation_attributes":173,"../../plots/font_attributes":201,"../../plots/pad_attributes":216,"./constants":112}],112:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/animation_attributes":180,"../../plots/font_attributes":208,"../../plots/pad_attributes":224,"./constants":118}],118:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26658,9 +27128,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -26707,7 +27174,7 @@ module.exports = { currentValueInset: 0, }; -},{}],113:[function(require,module,exports){ +},{}],119:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26805,14 +27272,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -26820,7 +27289,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":141,"../../plots/array_container_defaults":174,"./attributes":111,"./constants":112}],114:[function(require,module,exports){ +},{"../../lib":148,"../../plots/array_container_defaults":181,"./attributes":117,"./constants":118}],120:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -26841,11 +27310,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -26909,24 +27379,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -26954,14 +27418,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -26971,26 +27433,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -27017,6 +27461,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -27108,7 +27577,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -27125,9 +27597,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + var lines = svgTextUtils.lineCount(text); + + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; + + svgTextUtils.positionText(text, x0, y0); return text; } @@ -27159,11 +27636,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -27190,7 +27670,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -27232,7 +27718,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -27422,7 +27910,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":158,"../../plots/plots":217,"../color":27,"../drawing":51,"../legend/anchor_utils":77,"./constants":112,"d3":8}],115:[function(require,module,exports){ +},{"../../constants/alignment":129,"../../lib/svg_text_utils":165,"../../plots/plots":225,"../color":33,"../drawing":57,"../legend/anchor_utils":83,"./constants":118,"d3":8}],121:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27445,7 +27933,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":111,"./constants":112,"./defaults":113,"./draw":114}],116:[function(require,module,exports){ +},{"./attributes":117,"./constants":118,"./defaults":119,"./draw":120}],122:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27468,6 +27956,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -27500,29 +27989,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -27531,7 +28025,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -27540,6 +28034,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -27559,11 +28056,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -27575,33 +28069,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -27632,8 +28126,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -27641,8 +28134,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -27653,11 +28145,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -27667,18 +28159,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":123,"../../lib":141,"../../lib/svg_text_utils":158,"../../plotly":172,"../../plots/plots":217,"../color":27,"../drawing":51,"d3":8,"fast-isnumeric":11}],117:[function(require,module,exports){ +},{"../../constants/interactions":130,"../../lib":148,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/plots":225,"../color":33,"../drawing":57,"d3":8,"fast-isnumeric":11}],123:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27699,7 +28187,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -27720,6 +28208,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -27825,7 +28319,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../../plots/font_attributes":201,"../../plots/pad_attributes":216,"../color/attributes":26}],118:[function(require,module,exports){ +},{"../../lib/extend":142,"../../plots/font_attributes":208,"../../plots/pad_attributes":224,"../color/attributes":32}],124:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27872,9 +28366,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -27898,10 +28389,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],119:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -27980,13 +28479,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -27995,7 +28496,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":141,"../../plots/array_container_defaults":174,"./attributes":117,"./constants":118}],120:[function(require,module,exports){ +},{"../../lib":148,"../../plots/array_container_defaults":181,"./attributes":123,"./constants":124}],126:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -28015,6 +28516,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -28200,7 +28703,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -28212,7 +28715,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -28320,7 +28823,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -28329,7 +28832,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -28430,9 +28935,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -28452,18 +28957,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -28514,19 +29022,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -28620,34 +29127,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); - - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -28663,8 +29165,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -28675,9 +29177,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":158,"../../plots/plots":217,"../color":27,"../drawing":51,"../legend/anchor_utils":77,"./constants":118,"./scrollbox":122,"d3":8}],121:[function(require,module,exports){ -arguments[4][115][0].apply(exports,arguments) -},{"./attributes":117,"./constants":118,"./defaults":119,"./draw":120,"dup":115}],122:[function(require,module,exports){ +},{"../../constants/alignment":129,"../../lib/svg_text_utils":165,"../../plots/plots":225,"../color":33,"../drawing":57,"../legend/anchor_utils":83,"./constants":124,"./scrollbox":128,"d3":8}],127:[function(require,module,exports){ +arguments[4][121][0].apply(exports,arguments) +},{"./attributes":123,"./constants":124,"./defaults":125,"./draw":126,"dup":121}],128:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29148,7 +29650,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":141,"../color":27,"../drawing":51,"d3":8}],123:[function(require,module,exports){ +},{"../../lib":148,"../color":33,"../drawing":57,"d3":8}],129:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],130:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29172,7 +29710,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],124:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29225,7 +29763,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],125:[function(require,module,exports){ +},{}],132:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29263,7 +29801,7 @@ module.exports = { }; -},{}],126:[function(require,module,exports){ +},{}],133:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29287,7 +29825,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],127:[function(require,module,exports){ +},{}],134:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29305,7 +29843,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -29346,6 +29884,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -29367,7 +29906,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":25,"./components/fx":68,"./components/images":76,"./components/legend":84,"./components/rangeselector":96,"./components/rangeslider":102,"./components/shapes":109,"./components/sliders":115,"./components/updatemenus":121,"./fonts/mathjax_config":128,"./lib/queue":153,"./plot_api/plot_schema":166,"./plot_api/register":167,"./plot_api/set_plot_config":168,"./plot_api/to_image":170,"./plot_api/validate":171,"./plotly":172,"./snapshot":230,"./snapshot/download":227,"./traces/scatter":254,"d3":8,"es6-promise":9}],128:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":26,"./components/annotations3d":31,"./components/fx":74,"./components/images":82,"./components/legend":90,"./components/rangeselector":102,"./components/rangeslider":108,"./components/shapes":115,"./components/sliders":121,"./components/updatemenus":127,"./fonts/mathjax_config":135,"./lib/queue":160,"./plot_api/plot_schema":173,"./plot_api/register":174,"./plot_api/set_plot_config":175,"./plot_api/to_image":177,"./plot_api/validate":178,"./plotly":179,"./snapshot":238,"./snapshot/download":235,"./traces/scatter":262,"d3":8,"es6-promise":9}],135:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29400,7 +29939,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],129:[function(require,module,exports){ +},{}],136:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29417,7 +29956,7 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { if(Array.isArray(traceAttr)) calcItem[calcAttr] = traceAttr[i]; }; -},{}],130:[function(require,module,exports){ +},{}],137:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29450,7 +29989,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":124,"fast-isnumeric":11}],131:[function(require,module,exports){ +},{"../constants/numerical":131,"fast-isnumeric":11}],138:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -29465,6 +30004,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -29490,6 +30030,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -29742,6 +30296,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -29761,7 +30344,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":39,"../components/colorscale/scales":45,"./nested_property":147,"fast-isnumeric":11,"tinycolor2":14}],132:[function(require,module,exports){ +},{"../components/colorscale/get_scale":45,"../components/colorscale/scales":51,"../plots/attributes":182,"./nested_property":154,"fast-isnumeric":11,"tinycolor2":14}],139:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30389,7 +30972,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":124,"../registry":225,"./loggers":144,"./mod":146,"d3":8,"fast-isnumeric":11}],133:[function(require,module,exports){ +},{"../constants/numerical":131,"../registry":233,"./loggers":151,"./mod":153,"d3":8,"fast-isnumeric":11}],140:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30418,7 +31001,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],134:[function(require,module,exports){ +},{}],141:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30584,7 +31167,7 @@ var Events = { module.exports = Events; -},{"events":10}],135:[function(require,module,exports){ +},{"events":10}],142:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30698,7 +31281,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":143}],136:[function(require,module,exports){ +},{"./is_plain_object.js":150}],143:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30749,7 +31332,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],137:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30780,7 +31363,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],138:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30842,7 +31425,7 @@ function countryNameToISO3(countryName) { return false; } -},{"../lib":141,"country-regex":7}],139:[function(require,module,exports){ +},{"../lib":148,"country-regex":7}],146:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30979,7 +31562,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":124}],140:[function(require,module,exports){ +},{"../constants/numerical":131}],147:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -30995,7 +31578,7 @@ exports.makeBlank = function() { module.exports = function identity(d) { return d; }; -},{}],141:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31008,6 +31591,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -31024,6 +31612,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -31085,6 +31674,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -31335,6 +31931,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -31342,6 +31947,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -31382,7 +32032,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -31412,13 +32062,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -31659,7 +32302,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":130,"./coerce":131,"./dates":132,"./ensure_array":133,"./extend":135,"./filter_unique":136,"./filter_visible":137,"./identity":140,"./is_array":142,"./is_plain_object":143,"./loggers":144,"./matrix":145,"./mod":146,"./nested_property":147,"./noop":148,"./notifier":149,"./push_unique":152,"./relink_private":154,"./search":155,"./stats":157,"./to_log_range":159,"d3":8}],142:[function(require,module,exports){ +},{"../constants/numerical":131,"./clean_number":137,"./coerce":138,"./dates":139,"./ensure_array":140,"./extend":142,"./filter_unique":143,"./filter_visible":144,"./identity":147,"./is_array":149,"./is_plain_object":150,"./loggers":151,"./matrix":152,"./mod":153,"./nested_property":154,"./noop":155,"./notifier":156,"./push_unique":159,"./relink_private":161,"./search":162,"./stats":164,"./to_log_range":166,"d3":8,"fast-isnumeric":11}],149:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31683,7 +32326,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],143:[function(require,module,exports){ +},{}],150:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31712,7 +32355,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],144:[function(require,module,exports){ +},{}],151:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31786,7 +32429,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":165}],145:[function(require,module,exports){ +},{"../plot_api/plot_config":172}],152:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31896,7 +32539,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],146:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -31916,7 +32559,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],147:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32220,7 +32863,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":161,"./is_array":142,"./is_plain_object":143,"fast-isnumeric":11}],148:[function(require,module,exports){ +},{"../plot_api/container_array_match":168,"./is_array":149,"./is_plain_object":150,"fast-isnumeric":11}],155:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32236,7 +32879,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],149:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32318,7 +32961,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":8,"fast-isnumeric":11}],150:[function(require,module,exports){ +},{"d3":8,"fast-isnumeric":11}],157:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32367,7 +33010,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":156}],151:[function(require,module,exports){ +},{"./setcursor":163}],158:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32608,7 +33251,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":124,"./matrix":145}],152:[function(require,module,exports){ +},{"../constants/numerical":131,"./matrix":152}],159:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32646,7 +33289,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],153:[function(require,module,exports){ +},{}],160:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32857,7 +33500,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":141,"../plot_api/plot_config":165}],154:[function(require,module,exports){ +},{"../lib":148,"../plot_api/plot_config":172}],161:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -32914,7 +33557,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":142,"./is_plain_object":143}],155:[function(require,module,exports){ +},{"./is_array":149,"./is_plain_object":150}],162:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33025,7 +33668,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":144,"fast-isnumeric":11}],156:[function(require,module,exports){ +},{"./loggers":151,"fast-isnumeric":11}],163:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33048,7 +33691,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],157:[function(require,module,exports){ +},{}],164:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33144,7 +33787,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":11}],158:[function(require,module,exports){ +},{"fast-isnumeric":11}],165:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33163,62 +33806,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -33226,42 +33814,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); - - result = _context.appendSVG(converted); + .style('white-space', 'pre'); - if(!result) _context.text(str); + var hasLink = buildSVGText(_context.node(), str); - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -33269,14 +33859,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -33291,7 +33882,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -33308,36 +33903,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -33350,9 +33945,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -33383,23 +33981,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -33410,24 +34020,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -33438,26 +34067,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -33467,122 +34102,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -33619,28 +34329,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; + + context.style({'pointer-events': _delegate ? 'none' : 'all'}); - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -33655,63 +34378,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -33723,10 +34445,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":125,"../constants/xmlns_namespaces":126,"../lib":141,"d3":8}],159:[function(require,module,exports){ +},{"../constants/alignment":129,"../constants/string_mappings":132,"../constants/xmlns_namespaces":133,"../lib":148,"d3":8}],166:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33754,7 +34476,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":11}],160:[function(require,module,exports){ +},{"fast-isnumeric":11}],167:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33790,7 +34512,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":203,"topojson-client":15}],161:[function(require,module,exports){ +},{"../plots/geo/constants":210,"topojson-client":15}],168:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -33848,7 +34570,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":225}],162:[function(require,module,exports){ +},{"../registry":233}],169:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -34066,7 +34788,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -34199,18 +34920,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -34266,7 +35007,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -34369,7 +35110,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":27,"../lib":141,"../plots/cartesian/axes":177,"../plots/plots":217,"../registry":225,"fast-isnumeric":11,"gl-mat4/fromQuat":12}],163:[function(require,module,exports){ +},{"../components/color":33,"../lib":148,"../plots/cartesian/axes":184,"../plots/plots":225,"../registry":233,"fast-isnumeric":11,"gl-mat4/fromQuat":12}],170:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -34583,7 +35324,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":143,"../lib/loggers":144,"../lib/nested_property":147,"../lib/noop":148,"../lib/search":155,"../registry":225,"./container_array_match":161}],164:[function(require,module,exports){ +},{"../lib/is_plain_object":150,"../lib/loggers":151,"../lib/nested_property":154,"../lib/noop":155,"../lib/search":162,"../registry":233,"./container_array_match":168}],171:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -34618,7 +35359,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -34775,9 +35518,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -34806,19 +35547,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; + if(JSON.stringify(fullLayout._size) === oldmargins) return; - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); - - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -34856,7 +35597,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -34956,6 +35700,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -35053,7 +35798,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -35062,9 +35807,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -35079,11 +35825,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -35969,6 +36714,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -36068,6 +36814,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -36499,10 +37248,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -36524,7 +37275,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -36532,7 +37284,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -36545,11 +37297,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -36629,6 +37395,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -36727,7 +37494,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -36775,7 +37551,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -37609,7 +38385,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":51,"../components/errorbars":57,"../constants/xmlns_namespaces":126,"../lib":141,"../lib/events":134,"../lib/queue":153,"../lib/svg_text_utils":158,"../plotly":172,"../plots/cartesian/axis_ids":180,"../plots/cartesian/constants":182,"../plots/cartesian/constraints":184,"../plots/cartesian/graph_interact":186,"../plots/plots":217,"../plots/polar":220,"../registry":225,"./helpers":162,"./manage_arrays":163,"./subroutines":169,"d3":8,"fast-isnumeric":11}],165:[function(require,module,exports){ +},{"../components/drawing":57,"../components/errorbars":63,"../constants/xmlns_namespaces":133,"../lib":148,"../lib/events":141,"../lib/queue":160,"../lib/svg_text_utils":165,"../plotly":179,"../plots/cartesian/axis_ids":187,"../plots/cartesian/constants":189,"../plots/cartesian/constraints":191,"../plots/cartesian/graph_interact":193,"../plots/plots":225,"../plots/polar":228,"../registry":233,"./helpers":169,"./manage_arrays":170,"./subroutines":176,"d3":8,"fast-isnumeric":11}],172:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37735,7 +38511,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],166:[function(require,module,exports){ +},{}],173:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -37894,7 +38670,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -37914,9 +38693,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -38141,7 +38919,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":141,"../plots/animation_attributes":173,"../plots/attributes":175,"../plots/frame_attributes":202,"../plots/layout_attributes":215,"../plots/polar/area_attributes":218,"../plots/polar/axis_attributes":219,"../registry":225}],167:[function(require,module,exports){ +},{"../lib":148,"../plots/animation_attributes":180,"../plots/attributes":182,"../plots/frame_attributes":209,"../plots/layout_attributes":223,"../plots/polar/area_attributes":226,"../plots/polar/axis_attributes":227,"../registry":233}],174:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38240,7 +39018,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":141,"../registry":225}],168:[function(require,module,exports){ +},{"../lib":148,"../registry":233}],175:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38266,7 +39044,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":141,"../plotly":172}],169:[function(require,module,exports){ +},{"../lib":148,"../plotly":179}],176:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38395,15 +39173,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -38523,27 +39302,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -38644,19 +39425,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -38673,7 +39457,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":27,"../components/drawing":51,"../components/modebar":87,"../components/titles":116,"../lib":141,"../plotly":172,"../plots/cartesian/graph_interact":186,"../plots/plots":217,"../registry":225,"d3":8}],170:[function(require,module,exports){ +},{"../components/color":33,"../components/drawing":57,"../components/modebar":93,"../components/titles":122,"../lib":148,"../plotly":179,"../plots/cartesian/graph_interact":193,"../plots/plots":225,"../registry":233,"d3":8}],177:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -38783,7 +39567,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":141,"../plotly":172,"../snapshot/cloneplot":226,"../snapshot/helpers":229,"../snapshot/svgtoimg":231,"../snapshot/tosvg":233,"fast-isnumeric":11}],171:[function(require,module,exports){ +},{"../lib":148,"../plotly":179,"../snapshot/cloneplot":234,"../snapshot/helpers":237,"../snapshot/svgtoimg":239,"../snapshot/tosvg":241,"fast-isnumeric":11}],178:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39005,6 +39789,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -39053,6 +39842,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -39070,7 +39869,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -39087,8 +39886,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -39154,7 +39953,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":141,"../plots/plots":217,"./plot_schema":166}],172:[function(require,module,exports){ +},{"../lib":148,"../plots/plots":225,"./plot_schema":173}],179:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39188,7 +39987,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":87,"./plot_api/plot_api":164,"./plot_api/plot_config":165,"./plots/cartesian/axes":177,"./plots/plots":217}],173:[function(require,module,exports){ +},{"./components/modebar":93,"./plot_api/plot_api":171,"./plot_api/plot_config":172,"./plots/cartesian/axes":184,"./plots/plots":225}],180:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39290,7 +40089,7 @@ module.exports = { } }; -},{}],174:[function(require,module,exports){ +},{}],181:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39371,7 +40170,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":141}],175:[function(require,module,exports){ +},{"../lib":148}],182:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39428,11 +40227,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -39456,7 +40264,7 @@ module.exports = { } }; -},{"../components/fx/attributes":60}],176:[function(require,module,exports){ +},{"../components/fx/attributes":66}],183:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39483,7 +40291,7 @@ module.exports = { } }; -},{}],177:[function(require,module,exports){ +},{}],184:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -39513,7 +40321,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -39586,33 +40393,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -39853,6 +40654,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -39948,6 +40752,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -41299,10 +42110,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -41335,17 +42146,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -41811,7 +42615,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":27,"../../components/drawing":51,"../../components/titles":116,"../../constants/numerical":124,"../../lib":141,"../../lib/svg_text_utils":158,"../../registry":225,"./axis_autotype":178,"./axis_ids":180,"./layout_attributes":188,"./layout_defaults":189,"./set_convert":194,"d3":8,"fast-isnumeric":11}],178:[function(require,module,exports){ +},{"../../components/color":33,"../../components/drawing":57,"../../components/titles":122,"../../constants/numerical":131,"../../lib":148,"../../lib/svg_text_utils":165,"../../registry":233,"./axis_autotype":185,"./axis_ids":187,"./layout_attributes":195,"./layout_defaults":196,"./set_convert":201,"d3":8,"fast-isnumeric":11}],185:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -41886,7 +42690,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":124,"../../lib":141,"fast-isnumeric":11}],179:[function(require,module,exports){ +},{"../../constants/numerical":131,"../../lib":148,"fast-isnumeric":11}],186:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42009,7 +42813,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":26,"../../lib":141,"../../registry":225,"./category_order_defaults":181,"./layout_attributes":188,"./ordered_categories":190,"./set_convert":194,"./tick_label_defaults":195,"./tick_mark_defaults":196,"./tick_value_defaults":197,"tinycolor2":14}],180:[function(require,module,exports){ +},{"../../components/color/attributes":32,"../../lib":148,"../../registry":233,"./category_order_defaults":188,"./layout_attributes":195,"./ordered_categories":197,"./set_convert":201,"./tick_label_defaults":202,"./tick_mark_defaults":203,"./tick_value_defaults":204,"tinycolor2":14}],187:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42131,7 +42935,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":141,"../../registry":225,"../plots":217,"./constants":182}],181:[function(require,module,exports){ +},{"../../lib":148,"../../registry":233,"../plots":225,"./constants":189}],188:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42165,7 +42969,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],182:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42220,7 +43024,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],183:[function(require,module,exports){ +},{}],190:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42238,10 +43042,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); + + if(containerOut.fixedrange) return; + + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(!containerIn.scaleanchor) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -42260,7 +43079,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -42359,7 +43178,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":141,"./axis_ids":180}],184:[function(require,module,exports){ +},{"../../lib":148,"./axis_ids":187}],191:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42376,12 +43195,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -42397,12 +43218,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -42410,32 +43237,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } } } } }; -},{"../../constants/numerical":124,"./axis_ids":180,"./scale_zoom":192}],185:[function(require,module,exports){ +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; + } + } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } + } +}; + +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":129,"../../constants/numerical":131,"./axis_ids":187,"./scale_zoom":199}],192:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -42458,6 +43406,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -42567,7 +43518,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -42621,6 +43571,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -42719,8 +43672,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -42753,7 +43706,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -42772,11 +43726,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -42961,6 +43915,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -42980,8 +43936,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -43078,24 +44039,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -43130,11 +44084,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -43145,7 +44103,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -43154,7 +44112,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -43237,7 +44195,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -43253,13 +44211,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -43436,7 +44396,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":27,"../../components/dragelement":48,"../../components/drawing":51,"../../lib":141,"../../lib/setcursor":156,"../../lib/svg_text_utils":158,"../../plotly":172,"../../registry":225,"./axes":177,"./axis_ids":180,"./constants":182,"./scale_zoom":192,"./select":193,"d3":8,"tinycolor2":14}],186:[function(require,module,exports){ +},{"../../components/color":33,"../../components/dragelement":54,"../../components/drawing":57,"../../constants/alignment":129,"../../lib":148,"../../lib/setcursor":163,"../../lib/svg_text_utils":165,"../../plotly":179,"../../registry":233,"../plots":225,"./axes":184,"./axis_ids":187,"./constants":189,"./scale_zoom":199,"./select":200,"d3":8,"tinycolor2":14}],193:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43459,7 +44419,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -43477,8 +44437,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -43536,7 +44494,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -43597,7 +44555,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":48,"../../components/fx":68,"./constants":182,"./dragbox":185,"fast-isnumeric":11}],187:[function(require,module,exports){ +},{"../../components/dragelement":54,"../../components/fx":74,"./constants":189,"./dragbox":192,"fast-isnumeric":11}],194:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -43784,6 +44742,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -43986,7 +44949,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":141,"../plots":217,"./attributes":176,"./axis_ids":180,"./constants":182,"./layout_attributes":188,"./transition_axes":198,"d3":8}],188:[function(require,module,exports){ +},{"../../lib":148,"../plots":225,"./attributes":183,"./axis_ids":187,"./constants":189,"./layout_attributes":195,"./transition_axes":205,"d3":8}],195:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44081,6 +45044,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -44378,7 +45355,7 @@ module.exports = { } }; -},{"../../components/color/attributes":26,"../../components/drawing/attributes":50,"../../lib/extend":135,"../font_attributes":201,"./constants":182}],189:[function(require,module,exports){ +},{"../../components/color/attributes":32,"../../components/drawing/attributes":56,"../../lib/extend":142,"../font_attributes":208,"./constants":189}],196:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44651,7 +45628,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":27,"../../lib":141,"../../registry":225,"../layout_attributes":215,"./axis_defaults":179,"./axis_ids":180,"./constants":182,"./constraint_defaults":183,"./layout_attributes":188,"./position_defaults":191,"./type_defaults":199}],190:[function(require,module,exports){ +},{"../../components/color":33,"../../lib":148,"../../registry":233,"../layout_attributes":223,"./axis_defaults":186,"./axis_ids":187,"./constants":189,"./constraint_defaults":190,"./layout_attributes":195,"./position_defaults":198,"./type_defaults":206}],197:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44730,7 +45707,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":8}],191:[function(require,module,exports){ +},{"d3":8}],198:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44795,7 +45772,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":141,"fast-isnumeric":11}],192:[function(require,module,exports){ +},{"../../lib":148,"fast-isnumeric":11}],199:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44807,20 +45784,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],193:[function(require,module,exports){ +},{"../../constants/alignment":129}],200:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -44834,6 +45814,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -44974,7 +45955,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -45020,7 +46003,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":27,"../../lib/polygon":151,"./axes":177,"./constants":182}],194:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":33,"../../components/fx/helpers":71,"../../lib/polygon":158,"./axes":184,"./constants":189}],201:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45039,6 +46039,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -45051,13 +46052,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -45175,7 +46169,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -45188,8 +46182,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -45205,10 +46199,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -45216,16 +46212,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -45243,26 +46241,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -45463,7 +46473,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":124,"../../lib":141,"./axis_ids":180,"./constants":182,"d3":8,"fast-isnumeric":11}],195:[function(require,module,exports){ +},{"../../constants/numerical":131,"../../lib":148,"./axis_ids":187,"./constants":189,"d3":8,"fast-isnumeric":11}],202:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45547,7 +46557,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":141}],196:[function(require,module,exports){ +},{"../../lib":148}],203:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45580,7 +46590,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":141,"./layout_attributes":188}],197:[function(require,module,exports){ +},{"../../lib":148,"./layout_attributes":195}],204:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45664,7 +46674,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":124,"../../lib":141,"fast-isnumeric":11}],198:[function(require,module,exports){ +},{"../../constants/numerical":131,"../../lib":148,"fast-isnumeric":11}],205:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -45980,7 +46990,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":51,"../../plotly":172,"../../registry":225,"./axes":177,"d3":8}],199:[function(require,module,exports){ +},{"../../components/drawing":57,"../../plotly":179,"../../registry":233,"./axes":184,"d3":8}],206:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -46108,7 +47118,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":225,"./axis_autotype":178,"./axis_ids":180}],200:[function(require,module,exports){ +},{"../../registry":233,"./axis_autotype":185,"./axis_ids":187}],207:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -46373,6 +47383,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -46533,7 +47545,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":141,"../plotly":172}],201:[function(require,module,exports){ +},{"../lib":148,"../plotly":179}],208:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -46564,7 +47576,7 @@ module.exports = { } }; -},{}],202:[function(require,module,exports){ +},{}],209:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -46610,7 +47622,7 @@ module.exports = { } }; -},{}],203:[function(require,module,exports){ +},{}],210:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -46770,7 +47782,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],204:[function(require,module,exports){ +},{}],211:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47243,7 +48255,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":27,"../../components/drawing":51,"../../components/fx":68,"../../lib/topojson_utils":160,"../cartesian/axes":177,"../plots":217,"./constants":203,"./projections":211,"./set_scale":212,"./zoom":213,"./zoom_reset":214,"d3":8,"topojson-client":15}],205:[function(require,module,exports){ +},{"../../components/color":33,"../../components/drawing":57,"../../components/fx":74,"../../lib/topojson_utils":167,"../cartesian/axes":184,"../plots":225,"./constants":210,"./projections":218,"./set_scale":219,"./zoom":220,"./zoom_reset":221,"d3":8,"topojson-client":15}],212:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47323,7 +48335,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":217,"./geo":204,"./layout/attributes":206,"./layout/defaults":209,"./layout/layout_attributes":210}],206:[function(require,module,exports){ +},{"../../plots/plots":225,"./geo":211,"./layout/attributes":213,"./layout/defaults":216,"./layout/layout_attributes":217}],213:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47344,7 +48356,7 @@ module.exports = { } }; -},{}],207:[function(require,module,exports){ +},{}],214:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47399,7 +48411,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":26}],208:[function(require,module,exports){ +},{"../../../components/color/attributes":32}],215:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47473,7 +48485,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":141,"../constants":203,"./axis_attributes":207}],209:[function(require,module,exports){ +},{"../../../lib":148,"../constants":210,"./axis_attributes":214}],216:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47592,7 +48604,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":224,"../constants":203,"./axis_defaults":208,"./layout_attributes":210}],210:[function(require,module,exports){ +},{"../../subplot_defaults":232,"../constants":210,"./axis_defaults":215,"./layout_attributes":217}],217:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -47825,7 +48837,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":26,"../constants":203,"./axis_attributes":207}],211:[function(require,module,exports){ +},{"../../../components/color/attributes":32,"../constants":210,"./axis_attributes":214}],218:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48271,7 +49283,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],212:[function(require,module,exports){ +},{}],219:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48422,7 +49434,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":203,"d3":8}],213:[function(require,module,exports){ +},{"./constants":210,"d3":8}],220:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48849,7 +49861,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":8}],214:[function(require,module,exports){ +},{"d3":8}],221:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48878,7 +49890,41 @@ module.exports = function createGeoZoomReset(geo, geoLayout) { return zoomReset; }; -},{}],215:[function(require,module,exports){ +},{}],222:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; + + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } + } + + return out; +} + +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} + +module.exports = project; + +},{}],223:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49021,7 +50067,7 @@ module.exports = { } }; -},{"../components/color/attributes":26,"../lib":141,"./font_attributes":201}],216:[function(require,module,exports){ +},{"../components/color/attributes":32,"../lib":148,"./font_attributes":208}],224:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49059,7 +50105,7 @@ module.exports = { } }; -},{}],217:[function(require,module,exports){ +},{}],225:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49075,6 +50121,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -49567,12 +50614,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -49897,12 +50970,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -49915,7 +50988,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -50848,6 +51924,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -51063,7 +52143,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -51084,6 +52170,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -51131,25 +52218,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -51158,11 +52231,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -51235,7 +52304,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":27,"../components/errorbars":57,"../constants/numerical":124,"../lib":141,"../plotly":172,"../registry":225,"./animation_attributes":173,"./attributes":175,"./command":200,"./font_attributes":201,"./frame_attributes":202,"./layout_attributes":215,"d3":8,"fast-isnumeric":11}],218:[function(require,module,exports){ +},{"../components/color":33,"../components/errorbars":63,"../constants/numerical":131,"../lib":148,"../plot_api/plot_schema":173,"../plotly":179,"../registry":233,"./animation_attributes":180,"./attributes":182,"./command":207,"./font_attributes":208,"./frame_attributes":209,"./layout_attributes":223,"d3":8,"fast-isnumeric":11}],226:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51260,7 +52329,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":244}],219:[function(require,module,exports){ +},{"../../traces/scatter/attributes":252}],227:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51375,7 +52444,7 @@ module.exports = { } }; -},{"../../lib/extend":135,"../cartesian/layout_attributes":188}],220:[function(require,module,exports){ +},{"../../lib/extend":142,"../cartesian/layout_attributes":195}],228:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51390,7 +52459,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":221,"./micropolar_manager":222}],221:[function(require,module,exports){ +},{"./micropolar":229,"./micropolar_manager":230}],229:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52809,7 +53878,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":141,"d3":8}],222:[function(require,module,exports){ +},{"../../lib":148,"d3":8}],230:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52895,7 +53964,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":27,"../../lib":141,"./micropolar":221,"./undo_manager":223,"d3":8}],223:[function(require,module,exports){ +},{"../../components/color":33,"../../lib":148,"./micropolar":229,"./undo_manager":231,"d3":8}],231:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52961,7 +54030,7 @@ module.exports = function UndoManager() { }; }; -},{}],224:[function(require,module,exports){ +},{}],232:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53036,7 +54105,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":141,"./plots":217}],225:[function(require,module,exports){ +},{"../lib":148,"./plots":225}],233:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53227,7 +54296,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":144,"./lib/noop":148,"./lib/push_unique":152,"./plots/attributes":175}],226:[function(require,module,exports){ +},{"./lib/loggers":151,"./lib/noop":155,"./lib/push_unique":159,"./plots/attributes":182}],234:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53399,7 +54468,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":141,"../plots/plots":217}],227:[function(require,module,exports){ +},{"../lib":148,"../plots/plots":225}],235:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53465,7 +54534,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":141,"../plot_api/to_image":170,"./filesaver":228}],228:[function(require,module,exports){ +},{"../lib":148,"../plot_api/to_image":177,"./filesaver":236}],236:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53533,7 +54602,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],229:[function(require,module,exports){ +},{}],237:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53566,7 +54635,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],230:[function(require,module,exports){ +},{}],238:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53592,7 +54661,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":226,"./download":227,"./helpers":229,"./svgtoimg":231,"./toimage":232,"./tosvg":233}],231:[function(require,module,exports){ +},{"./cloneplot":234,"./download":235,"./helpers":237,"./svgtoimg":239,"./toimage":240,"./tosvg":241}],239:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53630,7 +54699,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -53723,7 +54792,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":141,"events":10}],232:[function(require,module,exports){ +},{"../lib":148,"events":10}],240:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53803,7 +54872,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":141,"../plotly":172,"./cloneplot":226,"./helpers":229,"./svgtoimg":231,"./tosvg":233,"events":10}],233:[function(require,module,exports){ +},{"../lib":148,"../plotly":179,"./cloneplot":234,"./helpers":237,"./svgtoimg":239,"./tosvg":241,"events":10}],241:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53817,12 +54886,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} + +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -53875,20 +54961,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -53896,10 +54984,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -53913,16 +55012,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":27,"../components/drawing":51,"../constants/xmlns_namespaces":126,"../lib/svg_text_utils":158,"d3":8}],234:[function(require,module,exports){ +},{"../components/color":33,"../components/drawing":57,"../constants/xmlns_namespaces":133,"d3":8}],242:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53970,7 +55069,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":28,"../../components/colorscale/attributes":32,"../../lib/extend":135,"../../plots/attributes":175,"../scattergeo/attributes":267}],235:[function(require,module,exports){ +},{"../../components/colorbar/attributes":34,"../../components/colorscale/attributes":38,"../../lib/extend":142,"../../plots/attributes":182,"../scattergeo/attributes":275}],243:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53989,7 +55088,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":33}],236:[function(require,module,exports){ +},{"../../components/colorscale/calc":39}],244:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54040,11 +55139,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults( traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} ); - - coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":36,"../../lib":141,"./attributes":234}],237:[function(require,module,exports){ +},{"../../components/colorscale/defaults":42,"../../lib":148,"./attributes":242}],245:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54063,7 +55160,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],238:[function(require,module,exports){ +},{}],246:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54133,7 +55230,7 @@ function makeHoverInfo(pointData, trace, pt, axis) { pointData.extraText = text.join('
'); } -},{"../../plots/cartesian/axes":177,"./attributes":234}],239:[function(require,module,exports){ +},{"../../plots/cartesian/axes":184,"./attributes":242}],247:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54165,7 +55262,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":205,"../heatmap/colorbar":241,"./attributes":234,"./calc":235,"./defaults":236,"./event_data":237,"./hover":238,"./plot":240}],240:[function(require,module,exports){ +},{"../../plots/geo":212,"../heatmap/colorbar":249,"./attributes":242,"./calc":243,"./defaults":244,"./event_data":245,"./hover":246,"./plot":248}],248:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54299,7 +55396,7 @@ function style(geo) { }); } -},{"../../components/color":27,"../../components/colorscale":41,"../../components/drawing":51,"../../lib/array_to_calc_item":129,"../../lib/geo_location_utils":138,"../../lib/topojson_utils":160,"../../plots/geo/constants":203,"d3":8}],241:[function(require,module,exports){ +},{"../../components/color":33,"../../components/colorscale":47,"../../components/drawing":57,"../../lib/array_to_calc_item":136,"../../lib/geo_location_utils":145,"../../lib/topojson_utils":167,"../../plots/geo/constants":210,"d3":8}],249:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54350,7 +55447,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":30,"../../components/colorscale":41,"../../lib":141,"../../plots/plots":217,"fast-isnumeric":11}],242:[function(require,module,exports){ +},{"../../components/colorbar/draw":36,"../../components/colorscale":47,"../../lib":148,"../../plots/plots":225,"fast-isnumeric":11}],250:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54375,7 +55472,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":27}],243:[function(require,module,exports){ +},{"../../components/color":33}],251:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54427,7 +55524,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":141}],244:[function(require,module,exports){ +},{"../../lib":148}],252:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54473,20 +55570,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -54707,7 +55796,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":28,"../../components/colorscale/color_attributes":34,"../../components/drawing":51,"../../components/drawing/attributes":50,"../../components/errorbars/attributes":53,"../../lib/extend":135,"./constants":249}],245:[function(require,module,exports){ +},{"../../components/colorbar/attributes":34,"../../components/colorscale/color_attributes":40,"../../components/drawing":57,"../../components/drawing/attributes":56,"../../components/errorbars/attributes":59,"../../lib/extend":142,"./constants":257}],253:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54838,7 +55927,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":124,"../../plots/cartesian/axes":177,"./arrays_to_calcdata":243,"./colorscale_calc":248,"./subtypes":264,"fast-isnumeric":11}],246:[function(require,module,exports){ +},{"../../constants/numerical":131,"../../plots/cartesian/axes":184,"./arrays_to_calcdata":251,"./colorscale_calc":256,"./subtypes":272,"fast-isnumeric":11}],254:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54877,7 +55966,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],247:[function(require,module,exports){ +},{}],255:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54933,7 +56022,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":30,"../../components/colorscale":41,"../../lib":141,"../../plots/plots":217,"fast-isnumeric":11}],248:[function(require,module,exports){ +},{"../../components/colorbar/draw":36,"../../components/colorscale":47,"../../lib":148,"../../plots/plots":225,"fast-isnumeric":11}],256:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54966,7 +56055,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":33,"../../components/colorscale/has_colorscale":40,"./subtypes":264}],249:[function(require,module,exports){ +},{"../../components/colorscale/calc":39,"../../components/colorscale/has_colorscale":46,"./subtypes":272}],257:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54982,7 +56071,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],250:[function(require,module,exports){ +},{}],258:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55021,11 +56110,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -55064,7 +56151,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":56,"../../lib":141,"./attributes":244,"./constants":249,"./fillcolor_defaults":251,"./line_defaults":255,"./line_shape_defaults":257,"./marker_defaults":260,"./subtypes":264,"./text_defaults":265,"./xy_defaults":266}],251:[function(require,module,exports){ +},{"../../components/errorbars/defaults":62,"../../lib":148,"./attributes":252,"./constants":257,"./fillcolor_defaults":259,"./line_defaults":263,"./line_shape_defaults":265,"./marker_defaults":268,"./subtypes":272,"./text_defaults":273,"./xy_defaults":274}],259:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55102,7 +56189,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":27}],252:[function(require,module,exports){ +},{"../../components/color":33}],260:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55155,7 +56242,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":27,"./subtypes":264}],253:[function(require,module,exports){ +},{"../../components/color":33,"./subtypes":272}],261:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55182,11 +56269,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -55242,7 +56330,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -55326,7 +56414,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":27,"../../components/errorbars":57,"../../components/fx":68,"../../lib":141,"./get_trace_color":252}],254:[function(require,module,exports){ +},{"../../components/color":33,"../../components/errorbars":63,"../../components/fx":74,"../../lib":148,"./get_trace_color":260}],262:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55370,7 +56458,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":187,"./arrays_to_calcdata":243,"./attributes":244,"./calc":245,"./clean_data":246,"./colorbar":247,"./defaults":250,"./hover":253,"./plot":261,"./select":262,"./style":263,"./subtypes":264}],255:[function(require,module,exports){ +},{"../../plots/cartesian":194,"./arrays_to_calcdata":251,"./attributes":252,"./calc":253,"./clean_data":254,"./colorbar":255,"./defaults":258,"./hover":261,"./plot":269,"./select":270,"./style":271,"./subtypes":272}],263:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55403,7 +56491,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40}],256:[function(require,module,exports){ +},{"../../components/colorscale/defaults":42,"../../components/colorscale/has_colorscale":46}],264:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55576,7 +56664,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":124}],257:[function(require,module,exports){ +},{"../../constants/numerical":131}],265:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55595,7 +56683,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],258:[function(require,module,exports){ +},{}],266:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55636,7 +56724,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],259:[function(require,module,exports){ +},{}],267:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55678,7 +56766,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":11}],260:[function(require,module,exports){ +},{"fast-isnumeric":11}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55753,7 +56841,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":27,"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40,"./subtypes":264}],261:[function(require,module,exports){ +},{"../../components/color":33,"../../components/colorscale/defaults":42,"../../components/colorscale/has_colorscale":46,"./subtypes":272}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56096,10 +57184,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -56110,7 +57200,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -56118,7 +57209,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -56175,17 +57267,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -56197,6 +57292,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -56216,6 +57313,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -56224,7 +57323,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -56301,7 +57400,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":51,"../../components/errorbars":57,"../../lib":141,"../../lib/polygon":151,"./line_points":256,"./link_traces":258,"./subtypes":264,"d3":8}],262:[function(require,module,exports){ +},{"../../components/drawing":57,"../../components/errorbars":63,"../../lib":148,"../../lib/polygon":158,"./line_points":264,"./link_traces":266,"./subtypes":272,"d3":8}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56323,7 +57422,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -56347,11 +57445,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -56374,7 +57470,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":264}],263:[function(require,module,exports){ +},{"./subtypes":272}],271:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56405,10 +57501,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -56420,7 +57516,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":51,"../../components/errorbars":57,"d3":8}],264:[function(require,module,exports){ +},{"../../components/drawing":57,"../../components/errorbars":63,"d3":8}],272:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56456,7 +57552,7 @@ module.exports = { } }; -},{"../../lib":141}],265:[function(require,module,exports){ +},{"../../lib":148}],273:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56477,7 +57573,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":141}],266:[function(require,module,exports){ +},{"../../lib":148}],274:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56527,7 +57623,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":225}],267:[function(require,module,exports){ +},{"../../registry":233}],275:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56622,7 +57718,7 @@ module.exports = { }) }; -},{"../../components/colorscale/color_attributes":34,"../../components/drawing/attributes":50,"../../lib/extend":135,"../../plots/attributes":175,"../scatter/attributes":244}],268:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":40,"../../components/drawing/attributes":56,"../../lib/extend":142,"../../plots/attributes":182,"../scatter/attributes":252}],276:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56666,7 +57762,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":124,"../scatter/arrays_to_calcdata":243,"../scatter/colorscale_calc":248,"fast-isnumeric":11}],269:[function(require,module,exports){ +},{"../../constants/numerical":131,"../scatter/arrays_to_calcdata":251,"../scatter/colorscale_calc":256,"fast-isnumeric":11}],277:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56721,8 +57817,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } - - coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+location+text' : undefined); }; function handleLonLatLocDefaults(traceIn, traceOut, coerce) { @@ -56747,7 +57841,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":141,"../scatter/fillcolor_defaults":251,"../scatter/line_defaults":255,"../scatter/marker_defaults":260,"../scatter/subtypes":264,"../scatter/text_defaults":265,"./attributes":267}],270:[function(require,module,exports){ +},{"../../lib":148,"../scatter/fillcolor_defaults":259,"../scatter/line_defaults":263,"../scatter/marker_defaults":268,"../scatter/subtypes":272,"../scatter/text_defaults":273,"./attributes":275}],278:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56768,7 +57862,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],271:[function(require,module,exports){ +},{}],279:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56885,7 +57979,7 @@ function getExtraText(trace, pt, axis) { return text.join('
'); } -},{"../../components/fx":68,"../../constants/numerical":124,"../../plots/cartesian/axes":177,"../scatter/get_trace_color":252,"./attributes":267}],272:[function(require,module,exports){ +},{"../../components/fx":74,"../../constants/numerical":131,"../../plots/cartesian/axes":184,"../scatter/get_trace_color":260,"./attributes":275}],280:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56918,7 +58012,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":205,"../scatter/colorbar":247,"./attributes":267,"./calc":268,"./defaults":269,"./event_data":270,"./hover":271,"./plot":273}],273:[function(require,module,exports){ +},{"../../plots/geo":212,"../scatter/colorbar":255,"./attributes":275,"./calc":276,"./defaults":277,"./event_data":278,"./hover":279,"./plot":281}],281:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57035,9 +58129,9 @@ function style(geo) { group = d3.select(this); group.selectAll('path.point') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, geo.graphDiv); group.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, geo.graphDiv); }); // this part is incompatible with Drawing.lineGroupStyle @@ -57057,5 +58151,5 @@ function style(geo) { }); } -},{"../../components/color":27,"../../components/drawing":51,"../../constants/numerical":124,"../../lib":141,"../../lib/geo_location_utils":138,"../../lib/geojson_utils":139,"../../lib/topojson_utils":160,"../scatter/subtypes":264,"d3":8}]},{},[5])(5) +},{"../../components/color":33,"../../components/drawing":57,"../../constants/numerical":131,"../../lib":148,"../../lib/geo_location_utils":145,"../../lib/geojson_utils":146,"../../lib/topojson_utils":167,"../scatter/subtypes":272,"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 65367d72e3c..b9dd074b624 100644 --- a/dist/plotly-geo.min.js +++ b/dist/plotly-geo.min.js @@ -1,28 +1,29 @@ /** -* plotly.js (geo - minified) v1.27.1 +* plotly.js (geo - minified) v1.28.0 * Copyright 2012-2017, 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||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:0/0}function o(t){return null===t?0/0:+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=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-"+ ++Ri,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(Ni<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();Ni=!(i.f||i.e),n.remove()}}return Ni?(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)*Ji,r=vt(r)*Ki,o=vt(o)*tl,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(0/0,0/0,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=rl.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)/Ji),a=mt((.2126729*t+.7151522*e+.072175*n)/Ki);return ht(116*a-16,500*(r-a),200*(a-mt((.0193339*t+.119192*e+.9503041*n)/tl)))}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&&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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Rt(),e=Nt()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Rt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Nt(){for(var t,e=al,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=ul.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=fl.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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=S[i in gl?e.charAt(l++):i])||(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{hl=qt;var e=new hl;return e._=t,r(e)}finally{hl=Date}}var r=e(t);return n.parse=function(t){try{hl=qt;var e=r.parse(t);return e&&e._}finally{hl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Yt(g),_=Xt(g),w=Yt(v),k=Xt(v),M=Yt(m),A=Xt(m),T=Yt(y),L=Xt(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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(dl.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:Zt,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){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){vl.lastIndex=0;var r=vl.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){ml.lastIndex=0;var r=ml.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);kl.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Ml.point=function(i,l){Ml.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+Fi/4),o=Math.sin(l)},Ml.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 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(Ne))}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),De(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 Ne(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:k,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=0/0,r=0/0,a=0/0;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,k=w*_,M=k>Fi,A=p*x;if(kl.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<-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),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]+=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 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);be(p,_e(l,d));var g=h,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-v-x)/m);if(be(b,p),b=ke(b),!n)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)Fi^(w<=b[0]&&b[0]<=k)){var S=_e(g,(-v+x)/m);return be(S,p),[b,ke(S)]}}}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;return Re(e,n,mn(t,6*Vi),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=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=0/0}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(-Il,Math.min(Il,t)),e=Math.max(-Il,Math.min(Il,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=je(),C=Ue(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&&De(g,o,e,c,l),l.polygonEnd()),g=v=m=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 Xe(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 Ze(){function t(t,e){Bl+=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){tVl&&(Vl=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){Ll+=t,Cl+=e,++Sl}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);zl+=i*(e+t)/2,Ol+=i*(n+r)/2,Dl+=i,Je(e=t,n=r)}var e,n;Xl.point=function(r,a){Xl.point=t,Je(e=r,n=a)}}function tn(){Xl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);zl+=i*(r+t)/2,Ol+=i*(a+e)/2,Dl+=i,i=a*t-r*e,Pl+=i*(r+t),El+=i*(a+e),Rl+=3*i,Je(r=t,a=e)}var e,n,r,a;Xl.point=function(o,i){Xl.point=t,Je(e=r=o,n=a=i)},Xl.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=0/0,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*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[0]*Ui,t[1]*Ui]}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?Ge(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*Ui,v*Ui]},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*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),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+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 Rn(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function Nn(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=ls.pop()||new In;return e.site=t,e}function Bn(t){Qn(t),as.remove(t),ls.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))>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(as.insert(e,s),e||n){if(e===n)return Qn(e),n=Fn(e.site),as.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 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=rs,v=g.length;v--;)if((o=g[v])&&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,v=(s*p-u*h)/d,f=v+l,m=ss.pop()||new Zn;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=is._;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=fs.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 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 Rr(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 Nr(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 Xr(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 Zr(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),Xr(t.skew,e.skew,n,r),Zr(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],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 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:Xa,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 Za(t,Wa(to(t,e)[2])),Za(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=ul.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 ks?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=Za(r.map(a),n?Math:As);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 Ms;arguments.length<2?n=Ms:"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=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(Qs,a);return o==Qs.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Qs[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,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:0/0},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=0,n=t.length-1,r=t[0],a=new Array(n<0?0:n);e=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(D(e,t[e]));return this}return this.each(D(t,e))},Si.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),r=(t=R(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-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(D,null).on(P,null),h(l),u(i)}var a=this,i=R.of(a,arguments),l=0,f=ui.select(r(a)).on(D,t).on(P,n),d=e(ui.mouse(a)),h=$(a);Bs.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);Bs.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,fl=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))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});dl[t+"s"]=n.range,dl[t+"s"].utc=n.utc.range,dl[t+"OfYear"]=function(t){var n=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(n+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,ml=/^%/;ui.locale=function(t){return{numberFormat:Ft(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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]*Ui*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;Ml.point(t,n),e(t,n)}function o(){Ml.lineStart()}function i(){a(g,v),Ml.lineEnd(),bi(y)>ji&&(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]: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,1/0===u||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[u,f],[d,h]]}}(),ui.geo.centroid=function(t){Al=Tl=Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Rl=0,ui.geo.stream(t,Nl);var e=Pl,n=El,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+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 Fl,Bl,ql,Hl,Vl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Gl.lineStart=Ze},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,Fl+=bi(Bl/2)}},Yl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Xl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Xl.lineStart=en},polygonEnd:function(){Xl.point=Je,Xl.lineStart=Ke,Xl.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 Fl=0,ui.geo.stream(t,a(Gl)),Fl},t.centroid=function(t){return Ll=Cl=Sl=zl=Ol=Dl=Pl=El=Rl=0,ui.geo.stream(t,a(Xl)),Rl?[Pl/Rl,El/Rl]:Dl?[zl/Dl,Ol/Dl]:Sl?[Ll/Sl,Cl/Sl]:[0/0,0/0]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Yl)),[[ql,Hl],[Vl,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]*=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=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)>ji}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%m)>ji}).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+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 kn(t[0]*Vi,t[1]*Vi,e[0]*Vi,e[1]*Vi)},ui.geo.length=function(t){return Zl=0,ui.geo.stream(t,Wl),Zl};var Zl,Wl={sphere:k,point:k,lineStart:Mn,lineEnd:k,polygonStart:k,polygonEnd:k},Ql=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Ql)}).raw=Ql;var $l=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn($l)}).raw=$l,(ui.geo.conicConformal=function(){return Ye(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Ye(Ln)}).raw=Ln;var Jl=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(Jl)}).raw=Jl,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Sn(Cn)}).raw=Cn;var Kl=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(Kl)}).raw=Kl;var ts=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ts)}).raw=ts,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]]:[]).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=Dn,o=r,i=a,l=cs;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=n.site,i=n.edges.sort(Xn),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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=hs.get(n)||ds,r=ps.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Nr,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:gs)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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=0/0,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 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&&(Na(Ia(i,t,n),t,r),c+=r,u+=r),f+=i.m,c+=a.m,d+=s.m,u+=o.m;i&&!Ra(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,v,m,y,x,b,_,w,k,M,A,T=0,L=0,C=[];if((m=(+s.apply(this,arguments)||0)/2)&&(v=o===zs?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 D=(u+f)/2;w=t*Math.cos(D),k=t*Math.sin(D),M=A=null}}else w=k=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=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=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(Xo(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=Zo;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/Ns),n=e*Ns/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Ns),n=e*Ns/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Rs.keys();var Ns=Math.sqrt(3),js=Math.tan(30*Vi);Si.transition=function(t){for(var e,n,r=Is||++Hs,a=ei(t),o=[],i=Fs||{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){return 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(0===(t=+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,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},{}],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(){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=L(t,360),e=L(e,100),n=L(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=L(t,255),e=L(e,255),n=L(n,255);var r,a,o=U(t,e,n),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,n){z(t)&&(t="100%");var r=O(t);return t=V(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function C(t){return V(1,U(0,t))}function S(t){return parseInt(t,16)}function z(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function R(t){return S(t)/255}function N(t){return!!Z.CSS_UNIT.exec(t)}function j(t){t=t.replace(F,"").replace(B,"").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 n;return(n=Z.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=Z.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Z.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=Z.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Z.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=Z.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Z.hex8.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:R(n[4]),format:e?"name":"hex8"}:(n=Z.hex6.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:e?"name":"hex"}:(n=Z.hex4.exec(t))?{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:R(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=Z.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 I(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 F=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=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,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=T(t),this._roundA=H(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=H(360*t.h),n=H(100*t.s),r=H(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=H(360*t.h),n=H(100*t.s),r=H(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: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)&&(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;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("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()):"name"===t&&0===this._a?this.toName():this.toRgbString()},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)&&(n[a]="a"===a?t[a]:P(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:G(),g:G(),b:G()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100;return r({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})},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=I(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 Y=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=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(Y),Z=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==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&&void 0!==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);a0||n.explicitOff.length>0}function a(t,e){var n,r=o(t,e),a=r.on,l=r.off.concat(r.explicitOff),s={};if(a.length||l.length){for(n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var r=N.selectAll("a");if(1===r.size()&&r.text()===N.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":r.attr("xlink:href"),"xlink:xlink:show":r.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}N.selectAll("tspan.line").attr({y:0,x:0});var a=C.select(".annotation-math-group"),h=!a.empty(),p=d.bBox((h?a:N).node()),x=p.width,z=p.height,R=b.width||x,j=b.height||z,I=Math.round(R+2*O),F=Math.round(j+2*O);b._w=R,b._h=j;var B=!1;if(["x","y"].forEach(function(e){var r,a,o,i,l,f=b[e+"ref"]||e,d=b["a"+e+"ref"],h=u.getFromId(t,f),p=(A+("x"===e?0:-90))*Math.PI/180,g=I*Math.cos(p),v=F*Math.sin(p),m=Math.abs(g)+Math.abs(v),x=b[e+"anchor"],_=b[e+"shift"]*("x"===e?1:-1),w=M[e];if(h){var k=h.r2fraction(b[e]);if((t._dragging||!h.autorange)&&(k<0||k>1)&&(d===f?((k=h.r2fraction(b["a"+e]))<0||k>1)&&(B=!0):B=!0,B))return;r=h._offset+h.r2p(b[e]),i=.5}else"x"===e?(o=b[e],r=y.l+y.w*o):(o=1-b[e],r=y.t+y.h*o),i=b.showarrow?.5:o;if(b.showarrow){w.head=r;var T=b["a"+e];l=g*n(.5,b.xanchor)-v*n(.5,b.yanchor),d===f?(w.tail=h._offset+h.r2p(T),a=l):(w.tail=r+T,a=l+T),w.text=w.tail+l;var L=s["x"===e?"width":"height"];if("paper"===f&&(w.head=c.constrain(w.head,1,L-1)),"pixel"===d){var C=-Math.max(w.tail-3,w.text),S=Math.min(w.tail+3,w.text)-L;C>0?(w.tail+=C,w.text+=C):S>0&&(w.tail-=S,w.text-=S)}w.tail+=_,w.head+=_}else l=m*n(i,x),a=l,w.text=r+l;w.text+=_,l+=_,a+=_,b["_"+e+"padplus"]=m/2+a,b["_"+e+"padminus"]=m/2-a,b["_"+e+"size"]=m,b["_"+e+"shift"]=l}),B)return void C.remove();var q=0,H=0;if("left"!==b.align&&(q=(R-x)*("center"===b.align?.5:1)),"top"!==b.valign&&(H=(j-z)*("middle"===b.valign?.5:1)),h)a.select("svg").attr({x:O+q-1,y:O+H}).call(d.setClipUrl,P?_:null);else{var V=O+H-p.top,U=O+q-p.left;N.attr({x:U,y:V}).call(d.setClipUrl,P?_:null),N.selectAll("tspan.line").attr({y:V,x:U})}E.select("rect").call(d.setRect,O,O,R,j),D.call(d.setRect,S/2,S/2,I-S,F-S),C.call(d.setTranslate,Math.round(M.x.text-I/2),Math.round(M.y.text-F/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var G="annotations["+e+"]",Y=function(n,r){i.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a=M.x.head,s=M.y.head,u=M.x.tail+n,h=M.y.tail+r,p=M.x.text+n,g=M.y.text+r,x=c.rotationXYMatrix(A,p,g),_=c.apply2DTransform(x),S=c.apply2DTransform2(x),z=+D.attr("width"),O=+D.attr("height"),P=p-.5*z,E=P+z,R=g-.5*O,N=R+O,j=[[P,R,P,N],[P,N,E,N],[E,N,E,R],[E,R,P,R]].map(S);if(!j.reduce(function(t,e){return t^!!o(a,s,a+1e6,s+1e6,e[0],e[1],e[2],e[3])},!1)){j.forEach(function(t){var e=o(u,h,a,s,t[0],t[1],t[2],t[3]);e&&(u=e.x,h=e.y)});var I=b.arrowwidth,F=b.arrowcolor,B=T.append("g").style({opacity:f.opacity(F)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),q=B.append("path").attr("d","M"+u+","+h+"L"+a+","+s).style("stroke-width",I+"px").call(f.stroke,f.rgb(F));if(m(q,b.arrowhead,"end",b.arrowsize,b.standoff),t._context.editable&&q.node().parentNode){var H=a,V=s;if(b.standoff){var U=Math.sqrt(Math.pow(a-u,2)+Math.pow(s-h,2));H+=b.standoff*(u-a)/U,V+=b.standoff*(h-s)/U}var Y,X,Z,W=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(u-H)+","+(h-V),transform:"translate("+H+","+V+")"}).style("stroke-width",I+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");v.init({element:W.node(),prepFn:function(){var t=d.getTranslate(C);X=t.x,Z=t.y,Y={},w&&w.autorange&&(Y[w._name+".autorange"]=!0),k&&k.autorange&&(Y[k._name+".autorange"]=!0)},moveFn:function(t,e){var n=_(X,Z),r=n[0]+t,a=n[1]+e;C.call(d.setTranslate,r,a),Y[G+".x"]=w?w.p2r(w.r2p(b.x)+t):b.x+t/y.w,Y[G+".y"]=k?k.p2r(k.r2p(b.y)+e):b.y-e/y.h,b.axref===b.xref&&(Y[G+".ax"]=w.p2r(w.r2p(b.ax)+t)),b.ayref===b.yref&&(Y[G+".ay"]=k.p2r(k.r2p(b.ay)+e)),B.attr("transform","translate("+t+","+e+")"),L.attr({transform:"rotate("+A+","+r+","+a+")"})},doneFn:function(e){if(e){l.relayout(t,Y);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};if(b.showarrow&&Y(0,0),t._context.editable){var X,Z;v.init({element:C.node(),prepFn:function(){Z=L.attr("transform"),X={}},moveFn:function(t,e){var n="pointer";if(b.showarrow)b.axref===b.xref?X[G+".ax"]=w.p2r(w.r2p(b.ax)+t):X[G+".ax"]=b.ax+t,b.ayref===b.yref?X[G+".ay"]=k.p2r(k.r2p(b.ay)+e):X[G+".ay"]=b.ay+e,Y(t,e);else{if(w)X[G+".x"]=b.x+t/w._m;else{var r=b._xsize/y.w,a=b.x+(b._xshift-b.xshift)/y.w-r/2;X[G+".x"]=v.align(a+t/y.w,r,0,1,b.xanchor)}if(k)X[G+".y"]=b.y+e/k._m;else{var o=b._ysize/y.h,i=b.y-(b._yshift+b.yshift)/y.h-o/2;X[G+".y"]=v.align(i-e/y.h,o,0,1,b.yanchor)}w&&k||(n=v.getCursor(w?.5:X[G+".x"],k?.5:X[G+".y"],b.xanchor,b.yanchor))}L.attr({transform:"translate("+t+","+e+")"+Z}),g(C,n)},doneFn:function(e){if(g(C),e){l.relayout(t,X);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var a=t.layout,s=t._fullLayout,y=t._fullLayout._size;s._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var x=(a.annotations||[])[e],b=s.annotations[e],_="clip"+s._uid+"_ann"+e;if(!x||b.visible===!1)return void i.selectAll("#"+_).remove();var w=u.getFromId(t,b.xref),k=u.getFromId(t,b.yref),M={x:{},y:{}},A=+b.textangle||0,T=s._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",b.opacity),L=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),C=L.append("g").style("pointer-events",b.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:x,fullAnnotation:b,event:i.event})});b.hovertext&&C.on("mouseover",function(){var e=b.hoverlabel,n=e.font,r=this.getBoundingClientRect(),a=t.getBoundingClientRect();h.loneHover({x0:r.left-a.left,x1:r.right-a.left,y:(r.top+r.bottom)/2-a.top,text:b.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:s._hoverlayer.node(),outerContainer:s._paper.node()})}).on("mouseout",function(){h.loneUnhover(s._hoverlayer.node())});var S=b.borderwidth,z=b.borderpad,O=S+z,D=C.append("rect").attr("class","bg").style("stroke-width",S+"px").call(f.stroke,b.bordercolor).call(f.fill,b.bgcolor),P=b.width||b.height,E=s._defs.select(".clips").selectAll("#"+_).data(P?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),E.exit().remove();var R=b.font,N=C.append("text").classed("annotation",!0).attr("data-unformatted",b.text).text(b.text);t._context.editable?N.call(p.makeEditable,C).call(n).on("edit",function(r){b.text=r,this.attr({"data-unformatted":b.text}),this.call(n);var a={};a["annotations["+e+"].text"]=b.text,w&&w.autorange&&(a[w._name+".autorange"]=!0),k&&k.autorange&&(a[k._name+".autorange"]=!0),l.relayout(t,a)}):N.call(n)}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("../../plotly"),s=t("../../plots/plots"),c=t("../../lib"),u=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),h=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./draw_arrow_head");e.exports={draw:r,drawOne:a}},{"../../lib":141,"../../lib/setcursor":156,"../../lib/svg_text_utils":158,"../../plotly":172,"../../plots/cartesian/axes":177,"../../plots/plots":217,"../color":27,"../dragelement":48,"../drawing":51,"../fx":68,"./draw_arrow_head":24,d3:8}],24:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(n,a){h.path&&(e>5&&(a=0),r.select(d.parentElement).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof n&&n||(n="end");var p,g,v,m,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=n.indexOf("start")>=0,w=n.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(v=Math.atan2(A,M),m=v+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(v),L=k*Math.sin(v);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var C=d.getTotalLength(),S="";if(C=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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,n){var r=a(t);return 1!==r.getAlpha()&&(r=a(i.combine(t,c))),(r.isDark()?e?r.lighten(e):c:n?r.darken(n):s).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=D(t).replace("e-",""),i=a(o).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: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"+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,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(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-X-T.l,n=Math.max(n,r)}var o=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,l=Q-$;ot.select(".cbbg").attr({x:X-_.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: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,C=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),S=[],z=[],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,R=1.001*C[0]-.001*C[1],N=1.001*C[1]-.001*C[0];for(L=_.levels.start;(L-P)*E<0;L+=E)L>R&&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,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(Z+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=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":141,"./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":135,"./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,v=p[d+"min"],m=p[d+"max"],y=p.colorscale;c(f+d+"auto",!(r(v)&&r(m)&&v=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":141}],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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return t.element.onmousemove=g,v._dragged=!1,v._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-v._mouseDownTimey&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(v._dragged,m,e),!v._dragged){var n;try{n=new MouseEvent("click",e)}catch(t){n=document.createEvent("MouseEvents"),n.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(n)}return a(v),v._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g,v=i.getPlotDiv(t.element)||{},m=1,y=s.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),g=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=r},{"../../constants/interactions":123,"../../lib":141,"../../plotly":172,"../../plots/cartesian/constants":182,"./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,a=t._hoverdata;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),n._hoverlayer.selectAll("line").remove(),n._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":134}],50:[function(t,e,n){"use strict";n.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],51:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i,l){if(s.traceIs(n,"symbols")){var u=g(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:p.isBubble(n)?u(t.ms):(o.size||6)/2,t.mrc=e;var r=v.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,v.symbolFuncs[a](e)+(r>=200?x:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,m=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?c.defaultLine:i.color,Array.isArray(o.color)&&(f=c.defaultLine,m=!0),f="mc"in t?t.mcc=r(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var y=o.gradient,b=t.mgt;if(b?m=!0:b=y&&y.type,b&&"none"!==b){var _=t.mgc;_?m=!0:_=y.color;var w="g"+l._fullLayout._uid+"-"+n.uid;m&&(w+="-"+t.i),e.call(v.gradient,l,w,b,f,_)}else e.call(c.fill,f);h&&e.call(c.stroke,d)}}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,k/2),u=Math.pow(l*l+s*s,k/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("tinycolor2"),s=t("../../registry"),c=t("../color"),u=t("../colorscale"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),h=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.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(c.fill,r)},v.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},v.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},v.setRect=function(t,e,n,r,a){t.call(v.setPosition,e,n).call(v.setSize,r,a)},v.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);return i(a)&&i(o)&&e.node()?("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0):(e.remove(),!1)},v.translatePoints=function(t,e,n,r){t.each(function(t){var a=o.select(this);v.translatePoint(t,a,e,n,r)})},v.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},v.crispRound=function(t,e,n){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},v.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||"";c.stroke(e,r||o.color),v.dashLine(e,l,i)},v.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(c.stroke,n||a.color).call(v.dashLine,l,i)})},v.dashLine=function(t,e,n){n=+n||0,e=v.dashStyle(e,n),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},v.dashStyle=function(t,e){e=+e||1;var n=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=n+"px,"+n+"px":"dash"===t?t=3*n+"px,"+3*n+"px":"longdash"===t?t=5*n+"px,"+5*n+"px":"dashdot"===t?t=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===t&&(t=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(c.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),n.remove()}})};var m=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=v.symbolNames.length,x="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";v.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=v.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var b={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};v.gradient=function(t,e,n,r,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+n).data([r+a+i],f.identity);s.exit().remove(),s.enter().append("radial"===r?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===r?t.attr(b):"vertical"===r&&t.attr(_),t.attr("id",n);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+n+")","fill-opacity":null})},v.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},v.singlePointStyle=function(t,e,n,a,o,i){var l=n.marker;r(t,e,n,a,o,l,l.line,i)},v.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=v.tryColorscale(n,""),a=v.tryColorscale(n,"line"),i=f.getPlotDiv(t.node());t.each(function(t){v.singlePointStyle(t,o.select(this),e,r,a,i)})}},v.tryColorscale=function(t,e){var n=e?f.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?u.makeColorScaleFunc(u.extractScale(r,n.cmin,n.cmax)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};v.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(v.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",s).text(r).call(d.convertToTspans);var f=o.select(this.parentNode),h=n.selectAll("tspan.line"),p=1.3*((h[0].length||1)-1)+1,g=w[s]*u,m=.75*c+w[l]*u+(w[l]-1)*p*c/2;f.attr("transform","translate("+g+","+m+")"),p>1&&h.attr({x:n.attr("x"),y:n.attr("y")})})};var k=.5;v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=1e4&&(o.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(s),f.extendFlat({},s)},v.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.split("#")[0]+n),t.attr("clip-path","url("+n+")")},v.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",n=t[e]("transform")||"",r=n.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+r[0]||0,y:+r[1]||0}},v.setTranslate=function(t,e,n){var r=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[r]("transform")||"";return e=e||0,n=n||0,o=o.replace(/(\btranslate\(.*?\);?)/,"").trim(),o+=" translate("+e+", "+n+")",o=o.trim(),t[a]("transform",o),o},v.getScale=function(t){ -var e=t.attr?"attr":"getAttribute",n=t[e]("transform")||"",r=n.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+r[0]||1,y:+r[1]||1}},v.setScale=function(t,e,n){var r=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[r]("transform")||"";return e=e||1,n=n||1,o=o.replace(/(\bscale\(.*?\);?)/,"").trim(),o+=" scale("+e+", "+n+")",o=o.trim(),t[a]("transform",o),o},v.setPointGroupScale=function(t,e,n){var r,a,o;return e=e||1,n=n||1,a=1===e&&1===n?"":" scale("+e+","+n+")",o=/\s*sc.*/,t.each(function(){r=(this.getAttribute("transform")||"").replace(o,""),r+=a,r=r.trim(),this.setAttribute("transform",r)}),a};v.setTextPointsScale=function(t,e,n){t.each(function(){var t,r=o.select(this),a=r.select("text"),i=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(r.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===n?[]:["translate("+i+","+l+")","scale("+e+","+n+")","translate("+-i+","+-l+")"],s&&t.push(s),r.attr("transform",t.join(" "))})},v.measureText=function(t,e,n){var r=t.append("text").text(e).call(v.font,n),a=v.bBox(r.node());return r.remove(),a}},{"../../constants/xmlns_namespaces":126,"../../lib":141,"../../lib/svg_text_utils":158,"../../registry":225,"../../traces/scatter/make_bubble_size_func":259,"../../traces/scatter/subtypes":264,"../color":27,"../colorscale":41,"./symbol_defs":52,d3:8,"fast-isnumeric":11,tinycolor2:14}],52:[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);return"M-"+e+","+r.round(t/2,2)+"H"+e+"L0,-"+r.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+r.round(t/2,2)+"H"+e+"L0,"+r.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M"+r.round(t/2,2)+",-"+e+"V"+e+"L-"+r.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+r.round(t/2,2)+",-"+e+"V"+e+"L"+r.round(t,2)+",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);return"M"+e+","+o+"L"+n+","+r.round(.809*t,2)+"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);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+r.round(.382*e,2)+"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}],53:[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"}}}},{}],54:[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":264,d3:8,"fast-isnumeric":11}],59:[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":27,d3:8}],60:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},a.family,{arrayOk:!0}),size:r({},a.size,{arrayOk:!0}),color:r({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":135,"../../plots/font_attributes":201}],61:[function(t,e,n){"use strict";function r(t,e,n){Array.isArray(t)&&(e[0][n]=t)}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=0;n=0&&n.index$.width||W<0||W>$.height)return x.unhoverRaw(t,e)}if(P="xval"in e?w.flat(r,e.xval):w.p2c(T,Z),E="yval"in e?w.flat(r,e.yval):w.p2c(L,W),!f(P[0])||!f(E[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var J=1/0;for(N=0;N1||I.hoverinfo.indexOf("name")!==-1?I.name:void 0,index:!1,distance:Math.min(J,k.MAXDIST),color:y.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},d[F]&&(U.subplot=d[F]._subplot),G=Y.length,"array"===q){var K=e[N];"pointNumber"in K?(U.index=K.pointNumber,q="closest"):(q="","xval"in K&&(H=K.xval,q="x"),"yval"in K&&(V=K.yval,q=q?"closest":"y"))}else H=P[B],V=E[B];if(I._module&&I._module.hoverPoints){var tt=I._module.hoverPoints(U,H,V,q);if(tt)for(var et,nt=0;ntG&&(Y.splice(0,G),J=Y[0].distance)}if(0===Y.length)return x.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var rt=t._hoverdata,at=[];for(R=0;R1,st=y.combine(d.plot_bgcolor||y.background,d.paper_bgcolor),ct={hovermode:D,rotateLabels:lt,bgColor:st,container:d._hoverlayer,outerContainer:d._paperdiv,commonLabelOpts:d.hoverlabel},ut=a(Y,ct);if(o(Y,lt?"xa":"ya"),i(ut,lt),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,at);v(u.select(e.target),ft?"pointer":"")}e.target&&c(t,e,rt)&&(rt&&t.emit("plotly_unhover",{event:e,points:rt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:L,xvals:P,yvals:E}))}function a(t,e){var n,r,a=e.hovermode,o=e.rotateLabels,i=e.bgColor,l=e.container,s=e.outerContainer,c=e.commonLabelOpts||{},f=e.fontFamily||k.HOVERFONT,d=e.fontSize||k.HOVERFONTSIZE,h=t[0],p=h.xa,v=h.ya,x="y"===a?"yLabel":"xLabel",b=h[x],_=(String(b)||"").split(" ")[0],w=s.node().getBoundingClientRect(),A=w.top,T=w.width,L=w.height,C=h.distance<=k.MAXDIST&&("x"===a||"y"===a);for(n=0;n15&&(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):C&&t[a+"Label"]===b?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 h=e.select("text.nums").call(m.font,t.fontFamily||f,t.fontSize||d,t.fontColor||c).call(m.setPosition,0,0).text(r).attr("data-notex",1).call(g.convertToTspans);h.selectAll("tspan.line").call(m.setPosition,0,0);var p=e.select("text.name"),v=0;n&&n!==r?(p.call(m.font,t.fontFamily||f,t.fontSize||d,s).text(n).call(m.setPosition,0,0).attr("data-notex",1).call(g.convertToTspans),p.selectAll("tspan.line").call(m.setPosition,0,0),v=p.node().getBoundingClientRect().width+2*z):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:s,stroke:c});var x,_,w=h.node().getBoundingClientRect(),k=t.xa._offset+(t.x0+t.x1)/2,O=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),E=w.width+S+z+v;t.ty0=A-w.top,t.bx=w.width+2*z,t.by=w.height+2*z,t.anchor="start",t.txwidth=w.width,t.tx2width=v,t.offset=0,o?(t.pos=k,x=O+P/2+E<=L,_=O-P/2-E>=0,"top"!==t.idealAlign&&x||!_?x?(O+=P/2,t.anchor="start"):t.anchor="middle":(O-=P/2,t.anchor="end")):(t.pos=O,x=k+D/2+E<=T,_=k-D/2-E>=0,"left"!==t.idealAlign&&x||!_?x?(k+=D/2,t.anchor="start"):t.anchor="middle":(k-=D/2,t.anchor="end")),h.attr("text-anchor",t.anchor),v&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+k+","+O+")"+(o?"rotate("+M+")":""))}),P}function o(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)?T: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 i(t,e){t.each(function(t){var n=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+r*t.bx+"v-"+t.by+"H"+(r*S+s)+"V"+(c-S)+"Z"),a.call(m.setPosition,i+s,c+t.ty0-t.by/2+z).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(m.setPosition,l+o*z+s,c+t.ty0-t.by/2+z),n.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function n(e,n,i){var l;if(o[n])l=o[n];else if(a[n]){var s=a[n];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(r,i).get();l&&(t[e]=l)}var r=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),t}function s(t,e){var n=e.hovermode,r=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;n.hover=function(t,e,n){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return r(t,e,n),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):r,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:o},s=a([n],l);return i(s,l.rotateLabels),s.node()}},{"../../lib":141,"../../lib/events":134,"../../lib/override_cursor":150,"../../lib/svg_text_utils":158,"../../plots/cartesian/axes":177,"../../registry":225,"../color":27,"../dragelement":48,"../drawing":51,"./constants":63,"./helpers":65,d3:8,"fast-isnumeric":11,tinycolor2:14}],67:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,a){a=a||{},n("hoverlabel.bgcolor",a.bgcolor),n("hoverlabel.bordercolor",a.bordercolor),r.coerceFont(n,"hoverlabel.font",a.font)}},{"../../lib":141}],68:[function(t,e,n){"use strict";function r(t){var e=i.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,n){var r=t.hoverlabel||{},a=i.nestedProperty(r,n).get() -;return Array.isArray(a)?Array.isArray(e)&&Array.isArray(a[e[0]])?a[e[0]][e[1]]:a[e]:a}var o=t("d3"),i=t("../../lib"),l=t("../dragelement"),s=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:s.getDistanceFunction,getClosest:s.getClosest,inbox:s.inbox,castHoverOption:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":141,"../dragelement":48,"./attributes":60,"./calc":61,"./click":62,"./constants":63,"./defaults":64,"./helpers":65,"./hover":66,"./layout_attributes":69,"./layout_defaults":70,"./layout_global_defaults":71,d3:8}],69:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},a.family,{dflt:o.HOVERFONT}),size:r({},a.size,{dflt:o.HOVERFONTSIZE}),color:r({},a.color)}}}},{"../../lib/extend":135,"../../plots/font_attributes":201,"./constants":63}],70:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],78:[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":135,"../../plots/font_attributes":201,"../color/attributes":26}],79:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],80:[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)!==!1){if(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":141,"../../plots/layout_attributes":215,"../../registry":225,"./attributes":78,"./helpers":83}],81:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(i,e)})}var r=t.data()[0][0],a=e._fullLayout,o=r.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?r.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr({x:40,y:0,"data-unformatted":c}).style("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.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;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(n)}function a(t,e){var n,r=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeT&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){o(t,e,r)},T):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,o(t,e,r))}})}function o(t,e,n){if(!e._dragged&&!e._editing){var r,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===n&&A&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),A=!1):A=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===n?g===-1?o.push(h):o.splice(g,1):2===n&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&g===-1&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vtspan"),f=u[0].length||1;n=l*f,r=c.node()&&v.bBox(c.node()).width;var d=l*(.3+(1-f)/2);c.attr("y",d),u.attr("y",d)}n=Math.max(n,16)+3,a.height=n,a.width=r}function l(t,e,n){var r=t._fullLayout,a=r.legend,o=a.borderwidth,i=k.isGrouped(a);if(k.isVertical(a))i&&e.each(function(t,e){v.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;v.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];u.select(this).select(".legendtoggle").call(v.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(),c=0,f=s.length;cr.width-(r.margin.r+r.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),v.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(v.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";M.isRightAnchor(n)?r="right":M.isCenterAnchor(n)&&(r="center");var a="top";M.isBottomAnchor(n)?a="bottom":M.isMiddleAnchor(n)&&(a="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}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,n=e.legend,r="left";M.isRightAnchor(n)?r="right":M.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),A=!0,T=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,F,t,x.scrollBarWidth,x.scrollBarHeight),L.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,i="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,b=n.showlegend&&_(t.calcdata,y),k=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+i).remove(),void h.autoMargin(t,"legend");var A=n._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var L=n._topdefs.selectAll("#"+i).data([0]);L.enter().append("clipPath").attr("id",i).append("rect");var C=A.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=A.selectAll("g.scrollbox").data([0]);S.enter().append("g").attr("class","scrollbox");var z=A.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 O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var D=O.selectAll("g.traces").data(d.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?k.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(a,t)});var P=0!==A.enter().size();P&&(l(t,O,D),s(t));var E=n.width,R=n.height;l(t,O,D),y.height>R?c(t):s(t);var N=n._size,j=N.l+N.w*y.x,I=N.t+N.h*(1-y.y);M.isRightAnchor(y)?j-=y.width:M.isCenterAnchor(y)&&(j-=y.width/2),M.isBottomAnchor(y)?I-=y.height:M.isMiddleAnchor(y)&&(I-=y.height/2);var F=y.width,B=N.w;F>B?(j=N.l,F=B):(j+F>E&&(j=E-F),j<0&&(j=0),F=Math.min(E-j,y.width));var q=y.height,H=N.h;q>H?(I=N.t,q=H):(I+q>R&&(I=R-q),I<0&&(I=0),q=Math.min(R-I,y.height)),v.setTranslate(A,j,I);var V,U,G=q-x.scrollBarHeight-2*x.scrollBarMargin,Y=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:F-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),L.select("rect").attr({width:F-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:F-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),L.select("rect").attr({width:F-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),P&&e(V,U),A.on("wheel",null),A.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*Y,-Y,0),V=x.scrollBarMargin-U/Y*G,e(V,U),0!==U&&U!==-Y&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*Y,e(V,U)});z.call(X),S.call(X)}if(t._context.editable){var Z,W,Q,$;A.classed("cursor-move",!0),g.init({element:A.node(),prepFn:function(){var t=v.getTranslate(A);Q=t.x,$=t.y},moveFn:function(t,e){var n=Q+t,r=$+e;v.setTranslate(A,n,r),Z=g.align(n,0,N.l,N.l+N.w,y.xanchor),W=g.align(r,0,N.t+N.h,N.t,y.yanchor)},doneFn:function(e,r,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===r?A._clickTimeout=setTimeout(function(){o(i,t,r)},T):2===r&&(A._clickTimeout&&clearTimeout(A._clickTimeout),o(i,t,r)))}}})}}}},{"../../constants/interactions":123,"../../lib":141,"../../lib/svg_text_utils":158,"../../plotly":172,"../../plots/plots":217,"../../registry":225,"../color":27,"../dragelement":48,"../drawing":51,"./anchor_utils":77,"./constants":79,"./get_legend_data":82,"./helpers":83,"./style":85,d3:8}],82:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))s.indexOf(t)===-1?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;on[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=s.select(this),a=t[0],o=(a.mlw+1||r.width+1)-1;e.style("stroke-width",o+"px").call(d.fill,a.mc||n.color),o&&e.call(d.stroke,a.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(){var t=e.line.width,n=s.select(this);n.style("stroke-width",t+"px").call(d.fill,e.fillcolor),t&&n.call(d.stroke,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.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var r=n.selectAll("g.legendsymbols").data([t]);r.enter().append("g").classed("legendsymbols",!0),r.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(o).each(i).each(l).each(r).each(a)}},{"../../lib":141,"../../registry":225,"../../traces/pie/style_one":242,"../../traces/scatter/subtypes":264,"../color":27,"../drawing":51,d3:8}],86:[function(t,e,n){"use strict";function r(t,e){var n,r,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(r=0;r1)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(["toggleSpikelines","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)){var p=a(e,n,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",n.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":141,"../color":27,"./attributes":90,"./button_attributes":91,"./constants":92}],94:[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;lY&&r>X&&!t.shiftKey?p.getCursor(a/n,1-o/r):"move";g(e,i),G=i.split("-")[0]}function o(e){F=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),q=m.getDataToPixel(t,F),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,F),U=m.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(j=n.path,I=o+".path"):(v=q(n.x0),y=H(n.y0),x=q(n.x1),b=H(n.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vX&&(h[S]=n[P]=U(c),h[z]=n[E]=U(u)),d-f>Y&&(h[O]=n[R]=V(f),h[D]=n[N]=V(d))}e.attr("d",i(t,n))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,D,P,E,R,N,j,I,F,B,q,H,V,U,G,Y=10,X=10,Z={setCursor:a,element:e.node(),prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z)}function i(t,e){var n,r,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=m.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(r=m.decodeDate(r)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,r,o);var d=r(e.x0),h=r(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:r,drawOne:a}},{"../../lib":141,"../../lib/setcursor":156,"../../plotly":172,"../../plots/cartesian/axes":177,"../color":27,"../dragelement":48,"../drawing":51,"./constants":105,"./helpers":108}],108:[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}},{}],109:[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":103,"./calc_autorange":104,"./defaults":106,"./draw":107}],110:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:n},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=r.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":141,"../../plots/cartesian/axes":177,"./attributes":103,"./helpers":108}],111:[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":135,"../../plots/animation_attributes":173,"../../plots/font_attributes":201,"../../plots/pad_attributes":216,"./constants":112}],112:[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}},{}],113:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(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),r("currentvalue.visible")&&(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;s=n.steps.length&&(n.active=0),e.call(l,n).call(b,n).call(u,n).call(p,n).call(x,t,n).call(s,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(v,n,n.active/(n.steps.length-1),!1),e.call(l,n)}function l(t,e,n){if(e.currentvalue.visible){var r,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":r=.5*e.inputAreaLength,a="middle";break;default:r=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",a);var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)i+=n;else{i+=e.steps[e.active].label}return e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans),A.setTranslate(o,r,e.currentValueHeight),o}}function s(t,e,n){var r=t.selectAll("rect."+C.gripRectClass).data([0]);r.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,n.bordercolor).call(M.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function c(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans),r}function u(t,e){var n=t.selectAll("g."+C.labelsClass).data([0]);n.enter().append("g").classed(C.labelsClass,!0);var r=n.selectAll("g."+C.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(C.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(c,t,e),A.setTranslate(n,m(e,t.fraction),C.tickOffset+e.ticklen+e.labelHeight+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,a){var o=Math.round(r*(n.steps.length-1));o!==n.active&&d(t,e,n,o,!0,a)}function d(t,e,n,r,a,o){var i=n.active;n._input.active=n.active=r;var s=n.steps[n.active];e.call(v,n,n.active/(n.steps.length-1),o),e.call(l,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(k.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,n){function r(){return n.data()[0]}var a=n.node(),o=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var i=n.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,n,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=r(),o=y(t,w.mouse(a)[0]);f(e,n,t,o,!1)}),o.on("mouseup",function(){var t=r();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+C.tickRectClass).data(e.steps);n.enter().append("rect").classed(C.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,a=w.select(this);a.attr({height:r?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,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 m(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,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.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(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,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 g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+g+")")}}}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(d);var O="Click to enter "+y+" title";t._context.editable?(S?z.on(".opacity",null):function(){L=0,C=!0,S=O,z.attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),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(d)}).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)}},{"../../constants/interactions":123,"../../lib":141,"../../lib/svg_text_utils":158,"../../plotly":172,"../../plots/plots":217,"../color":27,"../drawing":51,d3:8,"fast-isnumeric":11}],117:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":135,"../../plots/font_attributes":201,"../../plots/pad_attributes":216,"../color/attributes":26}],118:[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"}},{}],119:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+C.headerGroupClassName).data(n,a);u.enter().append("g").classed(C.headerGroupClassName,!0);var f=o.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=z.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,D=r.barWidth+2*r.barPad,P=r.barLength+2*r.barPad,E=p+g,R=v;E+D>s&&(E=s-D);var N=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);N.exit().on(".drag",null).remove(),N.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),O?(this.vbar=N.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:R,width:D,height:P}),this._vbarYMin=R+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var j=this.id,I=u-.5,F=O?f+D+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+j).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",j).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(I),y:Math.floor(B),width:Math.ceil(F)-Math.floor(I),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,j),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":141,"../color":27,"../drawing":51,d3:8}],123:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],124:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],125:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],126:[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}},{}],127:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.27.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/fx"),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=t("./components/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":25,"./components/fx":68,"./components/images":76,"./components/legend":84,"./components/rangeselector":96,"./components/rangeslider":102,"./components/shapes":109,"./components/sliders":115,"./components/updatemenus":121,"./fonts/mathjax_config":128,"./lib/queue":153,"./plot_api/plot_schema":166,"./plot_api/register":167,"./plot_api/set_plot_config":168,"./plot_api/to_image":170,"./plot_api/validate":171,"./plotly":172,"./snapshot":230,"./snapshot/download":227,"./traces/scatter":254,d3:8,"es6-promise":9}],128:[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},{}],129:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],130:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),r(t)?Number(t):a}},{"../constants/numerical":124,"fast-isnumeric":11}],131:[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;if("string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r)))return void e.set(t);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;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+i}return r}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,L;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=T&&t<=L?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=r(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-A)%100+A:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},T=n.MIN_MS=n.dateTime2ms("-9999"),L=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==m};var C=90*y,S=3*x,z=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=T&&t<=L))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(r(n)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(n).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=T+y&&t<=L-y))return m;var e=Math.floor(10*g(t+.05,1)),n=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,a){if(n.isJSDate(t)||"number"==typeof t){if(r(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,a))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=M("%Y"),E=M("%b %Y"),R=M("%b %-d"),N=M("%b %-d, %Y");n.formatDate=function(t,e,n,a){var o,d;if(a=r(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===n?d=s(p):"m"===n?d=c(p):"d"===n?(o=s(p),d=u(p)):(o=f(p),d=l(t,n))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===n?d=P(g):"m"===n?d=E(g):"d"===n?(o=P(g),d=R(g)):(o=N(g),d=l(t,n))}return d+(o?"\n"+o:"")};var j=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var a=g(t,y);if(t=Math.round(t-a),n)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(n),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+n)}var s=new Date(t+j);return s.setUTCMonth(s.getUTCMonth()+e)+a-j},n.findExactDates=function(t,e){for(var n,a,o=0,i=0,l=0,s=0,c=r(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u0&&(a.push(o),o=[])}return o.length>0&&a.push(o),a},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.simpleMap=function(t,e,n,r){for(var a=t.length,o=new Array(a),i=0;i-1||1/0!==u&&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)<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.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":130,"./coerce":131,"./dates":132,"./ensure_array":133,"./extend":135,"./filter_unique":136,"./filter_visible":137,"./identity":140,"./is_array":142,"./is_plain_object":143,"./loggers":144,"./matrix":145,"./mod":146,"./nested_property":147,"./noop":148,"./notifier":149,"./push_unique":152,"./relink_private":154,"./search":155,"./stats":157,"./to_log_range":159,d3:8}],142:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],143:[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}},{}],144:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){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][0],o=t[e][1],s=!1,h(r))for(n=r.length-1;n>=0;n--)a(r[n],i(o,n))?s?r[n]=void 0:r.pop():s=!0;else if("object"==typeof r&&null!==r)for(l=Object.keys(r),s=!1,n=l.length-1;n>=0;n--)a(r[l[n]],i(o,l[n]))?delete r[l[n]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){if(d(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(".");l/g),l=0;li||r===a||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],c=t[1];if(n===a||ni||c===a||cs)return!1;var u,f,d,h,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(r(i,d))>a)return!0;return!1};o.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(o+1);for(var c=s+1;c1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":124,"./matrix":145}],152:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;no.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}],158:[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-"+h.randstr([],64),o=d.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=d.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())h.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":"")+(m[r]||"");if("br"===r)return"
";var o,i=e[4];if("a"===r){var l=i&&i.match(T),c=l&&(l[3]||l[4]);if(o="':o+">"}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,d=t("d3"),h=t("../lib"),p=t("../constants/xmlns_namespaces"),g=t("../constants/string_mappings");n.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},d.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=n.getDOMParser(),a=r.parseFromString(e,"application/xml"),o=a.documentElement.firstChild;o;)this.node().appendChild(this.node().ownerDocument.importNode(o,!0)),o=o.nextSibling;return a.querySelector("parsererror")?(h.log(a.querySelector("parsererror div").textContent),null):d.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=d.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=l.attr("class")+"-math",f.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,f=d.select(l.node().parentNode);if(!f.empty()){var p=l.attr("class")?l.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=h.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){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var s=a&&a.select("svg");if(!s||!s.node())return n(),void t();var c=f.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 d=r(s,"width"),h=r(s,"height"),g=+l.attr("x")-d*{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("+[-d/2,m-h/2]+")"}),s.attr({x:+l.attr("x"),y:+l.attr("y")})):"l"===p[0]?s.attr({x:l.attr("x"),y:m-h/2}):"a"===p[0]?s.attr({x:0,y:m}):s.attr({x:g,y:+l.attr("y")+m-h/2}),e&&e.call(l,c),t(c)})}))}else n();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},m={sup:'',sub:''},y=["http:","https:","mailto:"],x=new RegExp("]*)?/?>","g"),b=Object.keys(g.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:g.entityToUnicode[t]}}),_=Object.keys(g.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+g.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,k=/(<[^<>]*>)/,M=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,L=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(x," ")},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]")&&d.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=h.getPlotDiv(i.node()),e=d.select(t),r=e.select(".svg-container"),o=r.append("div");o.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,r,n)).on("blur",function(){t._editing=!1,i.text(this.textContent).style({opacity:1});var e,n=d.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&d.select(i.node().parentNode).select(e).style({opacity:0});var r=this.textContent;d.select(this).transition().duration(0).remove(),d.select(document).on("mouseup",null),l.edit.call(i,r)}).on("focus",function(){var e=this;t._editing=!0,d.select(document).on("mouseup",function(){if(d.event.target===e)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===d.event.which?(t._editing=!1,i.style({opacity:1}),d.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(i,this.textContent)):(l.input.call(i,this.textContent),d.select(this).call(u(i,r,n)))}).on("keydown",function(){13===d.event.which&&this.blur()}).call(a)}n||(n={});var i=this,l=d.dispatch("edit","input","cancel"),s=d.select(this.node()).style({"pointer-events":"all"}),c=e||s;return e&&s.style({"pointer-events":"none"}),n.immediate?r():c.on("click",r),d.rebind(this,l,"on")}},{"../constants/string_mappings":125,"../constants/xmlns_namespaces":126,"../lib":141,d3:8}],159:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":11}],160:[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":203,"topojson-client":15}],161:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,a=r.layoutArrayContainers,o=r.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(n).map(Number).sort(l),L=e.get(),C=L||[],S=r(m,f).get(),z=[],O=-1,D=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),O===-1&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var P;if(O===-1)P=T;else{for(D=Math.max(C.length,D),P=[],x=0;x=O);x++)P.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&l(t,n,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sF.range[0]?[1,2]:[2,1]);else{var H=F.range[0],V=F.range[1];B?(H<=0&&V<=0&&n(N+".autorange",!0),H<=0?H=V/1e6:V<=0&&(V=H/1e6),n(N+".range[0]",Math.log(H)/Math.LN10),n(N+".range[1]",Math.log(V)/Math.LN10)):(n(N+".range[0]",Math.pow(10,H)),n(N+".range[1]",Math.pow(10,V)))}else n(N+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,I,T,n),w.getComponentMethod("images","convertCoords")(t,I,T,n)}else n(N+".autorange",!0)}else if(D.match(P.AX_NAME_PATTERN)){var U=x.nestedProperty(c,M).get(),G=(T||{}).type;G&&"-"!==G||(G="linear"),w.getComponentMethod("annotations","convertCoords")(t,U,G,n),w.getComponentMethod("images","convertCoords")(t,U,G,n)}var Y=z.containerArrayMatch(M);if(Y){o=Y.array,i=Y.index;var X=Y.property,Z=x.nestedProperty(s,o),W=(Z||[])[i]||{};if(""===i)M.indexOf("updatemenus")===-1&&(v.docalc=!0);else if(""===X){var Q=T;z.isAddVal(T)?b[M]=null:z.isRemoveVal(T)?(b[M]=W,Q=W):x.warn("unrecognized full object value",e),(r(Q,"x")||r(Q,"y")&&M.indexOf("updatemenus")===-1)&&(v.docalc=!0)}else!r(W,"x")&&!r(W,"y")||x.containsAny(M,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);d[o]||(d[o]={});var $=d[o][i];$||($=d[o][i]={}),$[X]=T,delete e[M]}else if("reverse"===D)j.range?j.range.reverse():(n(N+".autorange",!0),j.range=[1,0]),I.autorange?v.docalc=!0:v.doplot=!0;else{var J=String(A.parts[1]||"");0===S.indexOf("scene")?"camera"===A.parts[1]?v.docamera=!0:v.doplot=!0:0===S.indexOf("geo")?v.doplot=!0:0===S.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===M?v.doplot=!0:"margin"===S||"autorange"===J||"rangemode"===J||"type"===J||"domain"===J||"fixedrange"===J||"scaleanchor"===J||"scaleratio"===J||M.indexOf("calendar")!==-1||M.match(/^(bar|box|font)/)?v.docalc=!0:!c._has("gl2d")||M.indexOf("axis")===-1&&"plot_bgcolor"!==M?"hiddenlabels"===M?v.docalc=!0:S.indexOf("legend")!==-1?v.dolegend=!0:M.indexOf("title")!==-1?v.doticks=!0:S.indexOf("bgcolor")!==-1?v.dolayoutstyle=!0:L>1&&x.containsAny(J,["tick","exponent","grid","zeroline"])?v.doticks=!0:M.indexOf(".linewidth")!==-1&&M.indexOf("axis")!==-1?v.doticks=v.dolayoutstyle=!0:L>1&&J.indexOf("line")!==-1?v.dolayoutstyle=!0:L>1&&"mirror"===J?v.doticks=v.dolayoutstyle=!0:"margin.pad"===M?v.doticks=v.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(M)!==-1||M.indexOf("spike")!==-1?v.domodebar=!0:["height","width","autosize"].indexOf(M)===-1&&(v.doplot=!0):v.doplot=!0,A.set(T)}}}for(o in d){z.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],v)||(v.doplot=!0)}var K=c._axisConstraintGroups;for(var tt in _)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&MM)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(r++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:n&&void 0!==n[a]&&null!==n[a]?n[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":51,"../components/errorbars":57,"../constants/xmlns_namespaces":126,"../lib":141,"../lib/events":134,"../lib/queue":153,"../lib/svg_text_utils":158,"../plotly":172,"../plots/cartesian/axis_ids":180,"../plots/cartesian/constants":182,"../plots/cartesian/constraints":184,"../plots/cartesian/graph_interact":186,"../plots/plots":217,"../plots/polar":220,"../registry":225,"./helpers":162,"./manage_arrays":163,"./subroutines":169,d3:8,"fast-isnumeric":11}],165:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],166:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,w(r,g),w(r,e.attributes),n.attributes&&w(r,n.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){d(r,n.schema.traces[t][e],e)})}),r.type=t;var a={meta:e.meta||{},attributes:l(r)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){d(t,n.schema.layout[e],e)}):d(t,n.layoutAttributes,n.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],n=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){d(n,r.schema.transforms[t][e],e)})}),{attributes:l(n)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function c(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:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),a=w({},e.layoutAttributes);a[k]=!0,r.set(a)}function d(t,e,n){var r=p.nestedProperty(t,n);r.set(w(r.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=k,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED="_deprecated",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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},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)||p.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){if(o=o.slice(0,l).concat([n]),e&&("data_array"===e.valType||e.arrayOk===!0)){var s=r(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}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;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");n.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,n.lsInner],t)},n.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":141,"../plotly":172,"../snapshot/cloneplot":226,"../snapshot/helpers":229,"../snapshot/svgtoimg":231,"../snapshot/tosvg":233,"fast-isnumeric":11}],171:[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;m.3*f||o(r)||o(a))){var d=n.dtick/2;t+=t+d.8){var i=Number(n.substr(1));o.exactYears>.8&&i%12==0?t=R.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=R.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=R.tickIncrement(t,n);if(l<=r)return l}return t}function o(t){var e,n,r=t.tickvals,a=t.ticktext,o=new Array(r.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),n=0;nu&&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>=D&&a<=16||e>=O)t._tickround="M";else if(e>=P&&a<=19||e>=D)t._tickround="S";else{var o=t.l2r(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 s(t,e,n){var r=t.tickfont||{};return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function c(t,e,n,r){var a=t._tickround,o=n&&t.hoverformat||t.tickformat;r&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");s!==-1&&(i=l.substr(s+1),l=l.substr(0,s)),r&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(n?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function d(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,r)}function h(t,e,n,r){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=U[s/3+5])}return a?"\u2212"+t:t}function p(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},R.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(),_.simpleMap(n,t.l2r||Number)},R.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=R.getAutoRange(t);var n=t._input;n.range=t.range.slice(),n.autorange=t.autorange}},R.saveRangeInitial=function(t,e){for(var n=R.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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),w=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),k=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},R.autoBin=function(t,e,n,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(n)c=(s-l)/n;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},R.setConvert(h),R.autoTicks(h,c);var p,g=R.tickIncrement(R.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=r(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=R.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},R.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var n,r=t.nticks;r||("category"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/n):(n="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/n,4,9)+1)),"array"===t.tickmode&&(r*=100),R.autoTicks(t,Math.abs(e[1]-e[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=R.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=R.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fC?(e/=C,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,I)):r>S?(e/=S,t.dtick="M"+i(e,1,F)):r>z?(t.dtick=i(e,z,q),t.tick0=_.dateTick0(t.calendar,!0)):r>O?t.dtick=i(e,O,F):r>D?t.dtick=i(e,D,B):r>P?t.dtick=i(e,P,B):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,I))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,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,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=i(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)}},R.tickIncrement=function(t,e,n,r){var a=n?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,r);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?V:H,s=t+.01*a,c=_.roundUp(_.mod(s,1),l,n);return Math.floor(s)+Math.log(y.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},R.tickFirst=function(t){var e=t.r2l||Number,n=_.simpleMap(t.range,e),r=n[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":124,"../../lib":141,"fast-isnumeric":11}],179:[function(t,e,n){"use strict";var r=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,n,p,g){function v(n,r){return o.coerce2(t,e,l,n,r)}var m=p.letter,y=p.font||{},x="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",b=n("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),n("autorange",!e.isValidRange(t.range))&&n("rangemode"),n("range"),e.cleanRange(),f(t,e,n),e._initialCategories="category"===_?h(m,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=n("color"),k=w===t.color?w:y.color;n("title",x),o.coerceFont(n,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,n,_),u(t,e,n,_,p),c(t,e,n,p);var M=v("linecolor",w),A=v("linewidth"),T=n("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&n("mirror");var L=v("gridcolor",r(w,p.bgColor,i).toRgbString()),C=v("gridwidth");n("showgrid",p.showGrid||!!L||!!C)||(delete e.gridcolor,delete e.gridwidth);var S=v("zerolinecolor",w),z=v("zerolinewidth");return n("zeroline",p.showGrid||!!S||!!z)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":26,"../../lib":141,"../../registry":225,"./category_order_defaults":181,"./layout_attributes":188,"./ordered_categories":190,"./set_convert":194,"./tick_label_defaults":195,"./tick_mark_defaults":196,"./tick_value_defaults":197,tinycolor2:14}],180:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],182:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],183:[function(t,e,n){"use strict";function r(t,e,n,r){var a,o,l,s,c=r[i(e)].type,u=[];for(o=0;oo*p))for(n=0;n=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,n,r,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+n+", "+r+")").attr("d",a+"Z")}function f(t,e,n){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+n+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,n,r,a,o){t.attr("d",r+"M"+n.l+","+n.t+"v"+n.h+"h"+n.w+"v-"+n.h+"h-"+n.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return["lasso","select"].indexOf(t)!==-1}function v(t,e){return"M"+(t.l-.5)+","+(e-N-.5)+"h-3v"+(2*N+1)+"h3ZM"+(t.r+.5)+","+(e-N-.5)+"h3v"+(2*N+1)+"h-3Z"}function m(t,e){return"M"+(e-N-.5)+","+(t.t-.5)+"v-3h"+(2*N+1)+"v3ZM"+(e-N-.5)+","+(t.b+.5)+"v3h"+(2*N+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,N)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,n){var r,a,o,i,l,s,c=!1,u={},f={};for(r=0;rN||l>N?(wt="xy",i/rt>l/at?(l=i*at/rt,mt>o?yt.t=mt-l:yt.b=mt+l):(i=l*rt/at,vt>a?yt.l=vt-i:yt.r=vt+i),Mt.attr("d",y(yt))):r():!it||lzoom back out","long"),j=!1)}function G(e,n){var r=1===(F+B).length;if(e)Q();else if(2!==n||r){if(1===n&&r){var a=F?tt[0]:K[0],i="s"===F||"w"===B?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;F?(u="n"===F?"top":"bottom","right"===a.side&&(c="right")):"e"===B&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(pt).call(A.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var n=a.d2r(e);void 0!==n&&w.relayout(t,l,n)})}}else W()}function Y(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var r=t.querySelector(".plotly");if(q(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(Tt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ct.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(B||st){for(B||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":141,"fast-isnumeric":11}],192:[function(t,e,n){"use strict";e.exports=function(t,e,n){void 0===n&&(n=.5);var r=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=r[0]+(r[1]-r[0])*n,o=(a-r[0])*e;t.range=t._input.range=[t.l2r(a-o),t.l2r(a+o)]}},{}],193:[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,D,P,E,R=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"),N=[],j=a.gd,I=[];for(z=0;zd?h:i(t)?Number(t):h):h}var o=t("d3"),i=t("fast-isnumeric"),l=t("../../lib"),s=l.cleanNumber,c=l.ms2DateTime,u=l.dateTime2ms,f=t("../../constants/numerical"),d=f.FP_SAFE,h=f.BADNUM,p=t("./constants"),g=t("./axis_ids");e.exports=function(t,e){function n(e,n){if(e>0)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*w*Math.abs(r-a))}return h}function f(e,n,r){var a=u(e,r||t.calendar);if(a===h){if(!i(e))return h;a=u(new Date(+e))}return a}function v(e,n,r){return c(e,n,r||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var n=t._categories.length-1;return t._categoriesMap[e]=n,n}return h}function x(e){if(t._categoriesMap){var n=t._categoriesMap[e];if(void 0!==n)return n}if("number"==typeof e)return e}function b(e){return i(e)?o.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?n:a,t.l2c="log"===t.type?r:a,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(n(t,e))}:b,t.p2c="log"===t.type?function(t){return r(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=a,t.d2p=t.r2p=function(t){return b(s(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return n(s(t),e)},t.r2d=t.r2c=function(t){return r(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=a,t.c2r=n,t.l2d=r,t.d2p=function(e,n){return b(t.d2r(e,n))},t.p2d=function(t){return r(_(t))},t.r2p=function(t){return b(s(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=l.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(t,e,n){return b(f(t,0,n))},t.p2d=t.p2r=function(t,e,n){return v(_(t),e,n)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2l_noadd=x,t.r2l=t.l2r=t.r2c=t.c2r=a,t.d2p=function(t){return b(x(t))},t.p2d=function(t){return m(_(t))},t.r2p=b,t.p2r=_),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.cleanRange=function(e){e||(e="range");var n,r,a=l.nestedProperty(t,e).get(),o=(t._id||"x").charAt(0);if(r="date"===t.type?l.dfltRange(t.calendar):"y"===o?p.DFLTRANGEY:p.DFLTRANGEX,r=r.slice(),!a||2!==a.length)return void l.nestedProperty(t,e).set(r);for("date"===t.type&&(a[0]=l.cleanDate(a[0],h,t.calendar),a[1]=l.cleanDate(a[1],h,t.calendar)),n=0;n<2;n++)if("date"===t.type){if(!l.isDateTime(a[n],t.calendar)){t[e]=r;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=l.constrain(t.r2l(a[0]),l.MIN_MS+1e3,l.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!i(a[n])){if(!i(a[1-n])){t[e]=r;break}a[n]=a[1-n]*(n?10:.1)}if(a[n]<-d?a[n]=-d:a[n]>d&&(a[n]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(n){var r=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var i=n&&t._r?"_r":"range",s=t.calendar;t.cleanRange(i);var c=t.r2l(t[i][0],s),u=t.r2l(t[i][1],s);if("y"===a?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw l.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,n){var r,a,o,i="date"===t.type&&e[n+"calendar"];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?a.dateTick0(e.calendar):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":124,"../../lib":141,"fast-isnumeric":11}],198:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(e,n){function r(e,n){for(a=0;an.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(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}(v,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":51,"../../plotly":172,"../../registry":225,"./axes":177,d3:8}],199:[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 c=a(e,n,r);if(c){if("histogram"===c.type&&r==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=r+"calendar",f=c[u];if(i(c,r)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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;fe*Math.PI/180},w.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":27,"../../components/drawing":51,"../../components/fx":68,"../../lib/topojson_utils":160,"../cartesian/axes":177,"../plots":217,"./constants":203,"./projections":211,"./set_scale":212,"./zoom":213,"./zoom_reset":214,d3:8,"topojson-client":15}],205:[function(t,e,n){"use strict";var r=t("./geo"),a=t("../../plots/plots");n.name="geo",n.attr="geo",n.idRoot="geo",n.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){var e=t._fullLayout,n=t.calcdata,o=a.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var i=0;ir^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?O:t<-1?-O:Math.asin(t)}function s(t){return t>1?0:t<-1?z:Math.acos(t)}function c(t,e){var n=(2+O)*Math.sin(e);e/=2;for(var r=0,a=1/0;r<10&&Math.abs(a)>C;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(z*(4+z))*t*(1+Math.cos(e)),2*Math.sqrt(z/(4+z))*Math.sin(e)]}function u(t,e){function n(n,r){var a=N(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?N:1/0===e?d:(n.invert=function(n,r){var a=N.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*z)*Math.sqrt(z*z/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(z/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)>C&&--a>0);return e/2}}function v(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function m(t,e){var n,r=Math.min(18,36*Math.abs(e)/z),a=Math.floor(r),o=r-a,i=(n=I[a])[0],l=n[1],s=(n=I[++a])[0],c=n[1],u=(n=I[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?O:-O)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function y(t,e){return[t*Math.cos(e),e]}function x(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 b(t,e){var n=x(t,e);return[(n[0]+t/O)/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&&_.hasOwnProperty(t.type)?_[t.type]:n)(t,r)};var _={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},w=[],k=[],M={point:function(t,e){w.push([t,e])},result:function(){var t=w.length?w.length<2?{type:"Point",coordinates:w[0]}:{type:"MultiPoint",coordinates:w}:null;return w=[],t}},A={lineStart:r,point:function(t,e){w.push([t,e])},lineEnd:function(){w.length&&(k.push(w),w=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},T={polygonStart:r,lineStart:r,point:function(t,e){w.push([t,e])},lineEnd:function(){var t=w.length;if(t){do{w.push(w[0].slice())}while(++t<4);k.push(w),w=[]}},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}},L={Point:M,MultiPoint:M,LineString:A,MultiLineString:A,Polygon:T,MultiPolygon:T,Sphere:T},C=1e-6,S=C*C,z=Math.PI,O=z/2,D=(Math.sqrt(z),z/180),P=180/z,E=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]/z,c=180*i[0][1]/z,u=180*i[1][1]/z,f=180*i[2][0]/z,d=180*i[2][1]/z;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=[];++oC&&--a>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},(t.geo.naturalEarth=function(){return E(v)}).raw=v;var I=[[.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]];I.forEach(function(t){t[1]*=1.0144}),m.invert=function(t,e){var n=e/O,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=I[o][1],l=I[o+1][1],s=I[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=I[o][1],l=I[o+1][1],s=I[Math.min(19,o+2)][1],r-=(p=(e>=0?O:-O)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*P}while(Math.abs(p)>S&&--g>0);break}}while(--o>=0);var v=I[o][0],m=I[o+1][0],y=I[Math.min(19,o+2)][0];return[t/(m+h*(y-v)/2+h*h*(y-2*m+v)/2),r*D]},(t.geo.robinson=function(){return E(m)}).raw=m,y.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return E(y)}).raw=y,x.invert=function(t,e){if(!(t*t+4*e*e>z*z+C)){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,v=1-p*c*c,m=v?s(f*c)*Math.sqrt(o=1/v):o=0,y=2*m*f*l-t,x=m*u-e,b=o*(p*g+m*f*c*h),_=o*(.5*i*d-2*m*u*l),w=.25*o*(d*l-m*u*p*i),k=o*(h*c+m*g*f),M=_*w-k*b;if(!M)break;var A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>C||Math.abs(T)>C)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return E(x)}).raw=x,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,v=1-f*h*h,m=v?s(i*h)*Math.sqrt(o=1/v):o=0,y=.5*(2*m*i*p+n/O)-t,x=.5*(m*l+r)-e,b=.5*o*(f*g+m*i*h*u)+.5/O,_=o*(d*c/4-m*l*p),w=.125*o*(c*p-m*l*f*d),k=.5*o*(u*h+m*g*i)+.5,M=_*w-k*b,A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>C||Math.abs(T)>C)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return E(b)}).raw=b}e.exports=r},{}],212:[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,v=r._fullRange[0]+l,m=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],k=n._rotate;return n._center=[w[0]+k[0],w[1]+k[1]],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,k=a(d,p,h,g),M=a(v,y,m,x);s=o(e,k),i=r(s),b=o(e,M),n._fullScale=r(b),e.scale(i),s=o(e,k),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,k),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}}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":203,d3:8}],213:[function(t,e,n){"use strict";function r(t,e){return(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(M)}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 v.invert(t)}function r(t){var e=v(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(M),s=_.mouse(this),c=v.rotate(),u=v.translate(),f=c,d=n(s)}function i(){if(h=_.mouse(this),r(s))return m.scale(v.scale()),void m.translate(v.translate());v.scale(_.event.scale),v.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],v.rotate(p),f=p):(s=h,d=n(s)),t.render()}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,v=t.projection,m=a(v,e),y=2;return m.on("zoomstart",o).on("zoom",i).on("zoomend",l),m}function l(t,e){function n(t){m++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--m||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"),m=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(M);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),m=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=v(u(m,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])&&m(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)*k,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*k-d,a=Math.sqrt(p*p-u*u));var v=180-o-2*d,m=(Math.atan2(f,c)-Math.atan2(s,a))*k,y=(Math.atan2(f,c)-Math.atan2(s,-a))*k;return h(n[0],n[1],o,m)<=h(n[0],n[1],v,y)?[o,m,n[2]]:[v,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 v(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*k,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*k,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*k]}function m(t){var e=t[0]*w,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"),s=n.select(".js-link-spacer"),c=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,i),s.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=l.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return r.append("input").attr({type:"text",name:"data"}).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||[],i=t._fullData=[],l=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var s=n.width,u=n.height;p.supplyLayoutGlobalDefaults(a,r),a.width||(r.width=s),a.height||(r.height=u)}else{p.supplyLayoutGlobalDefaults(a,r);var f=!a.width||!a.height,d=r.autosize,h=t._context&&t._context.autosizable;f&&(d||h)?p.plotAutoSize(t,a,r):f&&p.sanitizeMargins(t),!d&&f&&(a.width=r.width,a.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=l.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(l,i,a,r),r._has=p._hasPlotType.bind(r);var g=r._modules;for(e=0;e0){ -var u=o(t._boundingBoxMargins),d=u.left+u.right,h=u.bottom+u.top,g=1-2*l,v=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(g*(v.width-d)),a=Math.round(g*(v.height-h))}else{var m=c?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;c.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];r._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),u=e._pushmargin;if(e.margin.autoexpand!==!1){u.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(u),d=0;dv){var M=(m*w+(k-e.width)*v)/(w-v),A=(k*(1-v)+(m-e.width)*(1-w))/(w-v);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(s(x)&&u[_].t){var T=u[_].t.val,L=u[_].t.size;if(T>y){var C=(x*T+(L-e.height)*y)/(T-y),S=(L*(1-y)+(x-e.height)*(1-T))/(T-y);C>=0&&S>=0&&C+S>l+i&&(l=C,i=S)}}}}if(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,!e._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return c.plot(t)},p.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(f.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&["_","["].indexOf(e.charAt(0))===-1){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if("string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&"string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):f.isJSDate(t)?f.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===r?c:JSON.stringify(c)},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 c.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var i,l,s=0,u=0,h=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,C=L?f.angularAxis.domain:r.extent(k),S=Math.abs(k[1]-k[0]);A&&!M&&(S=0);var z=C.slice();T&&M&&(z[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(z[1]-z[0])/O);var D=f.angularAxis.ticksStep||(z[1]-z[0])/(O*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),z[2]||(z[2]=D);var P=r.range.apply(this,z);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(z.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?S:0,void 0===(e=r.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),R=this.appendChild(this.ownerDocument.importNode(E.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 N,j=e.select(".chart-group"),I={fill:"none",stroke:f.tickColor},F={"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){N=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:N,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=N.node().getBBox();x=Math.min(f.width-q.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(),N.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else N=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 H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(F).text(f.title),U=V.node().getBBox();V.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(I),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(I);var X=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Z=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(I),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(F).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,F["font-size"]]+")":"translate("+[0,F["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.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(I),Q.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(F);var $=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(F);f.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=r.max(j.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=tt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,et.push({data:t,geometryConfig:n})});var nt=r.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),rt=[];nt.forEach(function(t,e){"unstacked"===t.key?rt=rt.concat(t.values.map(function(t,e){return[t]})):rt.push(t.values)}),rt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.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(X).angle;ft.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;at=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});j.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(X).radius;dt.attr({r:n}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(X).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=r.event.which)return!1;r.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}}},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;return r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180;return[e,t(r)]})},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(void 0===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;return[t*Math.cos(n),t*Math.sin(n)]},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 a[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return void 0===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=[i.PolyChart.defaultConfig()],n=r.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,n){e[n]||(e[n]={}),o(e[n],i.PolyChart.defaultConfig()),o(e[n],t)}),this):e},t.getColorScale=function(){},r.rebind(t,n,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return n.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[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"]]].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);if([[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"]]].forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};r.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":141,d3:8}],222:[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":27,"../../lib":141,"./micropolar":221,"./undo_manager":223,d3:8}],223:[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)),d=t._context||{};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;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"}),l("hoverinfo",1===i._dataLength?"location+z+text":void 0)}},{"../../components/colorscale/defaults":36,"../../lib":141,"./attributes":234}],237:[function(t,e,n){"use strict";e.exports=function(t,e){return t.location=e.location,t.z=e.z,t}},{}],238:[function(t,e,n){"use strict";function r(t,e,n,r){var i=e.hoverinfo,l="all"===i?o.hoverinfo.flags:i.split("+"),s=l.indexOf("name")!==-1,c=l.indexOf("location")!==-1,u=l.indexOf("z")!==-1,f=l.indexOf("text")!==-1,d=!s&&c,h=[];d?t.nameOverride=n.id:(s&&(t.nameOverride=e.name),c&&h.push(n.id)),u&&h.push(function(t){return a.tickText(r,r.c2l(t),"hover").text}(n.z)),f&&h.push(n.tx),t.extraText=h.join("
")}var a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t){var e=t.cd,n=e[0].trace,a=t.subplot,o=a.choroplethHoverPt;if(o){var i=a.projection(o.properties.ct);return t.x0=t.x1=i[0],t.y0=t.y1=i[1],t.index=o.index,t.location=o.id,t.z=o.z,r(t,n,o,a.mockAxis),[t]}}},{"../../plots/cartesian/axes":177,"./attributes":234}],239:[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"),r.hoverPoints=t("./hover"),r.eventData=t("./event_data"),r.moduleType="trace",r.name="choropleth",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","noOpacity"],r.meta={},e.exports=r},{"../../plots/geo":205,"../heatmap/colorbar":241,"./attributes":234,"./calc":235,"./defaults":236,"./event_data":237,"./hover":238,"./plot":240}],240:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=t.locations,o=a.length,i=c(t,e),l=(t.marker||{}).line||{},s=0;s0&&(r[0].trace=t),r}function a(t){t.framework.selectAll("g.trace.choropleth").each(function(t){var e=t[0].trace,n=o.select(this),r=e.marker||{},a=r.line||{},c=s.makeColorScaleFunc(s.extractScale(e.colorscale,e.zmin,e.zmax));n.selectAll("path.choroplethlocation").each(function(t){o.select(this).attr("fill",function(t){return c(t.z)}).call(i.stroke,t.mlc||a.color).call(l.dashLine,"",t.mlw||a.width||0)})})}var o=t("d3"),i=t("../../components/color"),l=t("../../components/drawing"),s=t("../../components/colorscale"),c=t("../../lib/topojson_utils").getTopojsonFeatures,u=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),d=t("../../plots/geo/constants");e.exports=function(t,e,n){function i(t){return t[0].trace.uid}var l,s=t.framework,c=s.select("g.choroplethlayer"),u=s.select("g.baselayer"),f=s.select("g.baselayeroverchoropleth"),h=d.baseLayersOverChoropleth,p=c.selectAll("g.trace.choropleth").data(e,i);p.enter().append("g").attr("class","trace choropleth"),p.exit().remove(),p.each(function(e){var n=e[0].trace,a=r(n,t.topojson),i=o.select(this).selectAll("path.choroplethlocation").data(a);i.enter().append("path").classed("choroplethlocation",!0).on("mouseover",function(e){t.choroplethHoverPt=e}).on("mouseout",function(){t.choroplethHoverPt=null}),i.exit().remove()}),f.selectAll("*").remove();for(var g=0;gg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,c=n.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(i.hasMarkers(e)||i.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,a.expand(f,h,v),a.expand(d,p,m);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],247:[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":30,"../../components/colorscale":41,"../../lib":141,"../../plots/plots":217,"fast-isnumeric":11}],248:[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":264}],249:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],250:[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,p,g),m=vq!=P>=q&&(z=C[T-1][0],O=C[T][0],S=z+(O-z)*(q-D)/(P-D),j=Math.min(j,S),I=Math.max(I,S));j=Math.max(j,0),I=Math.min(I,d._length);var H=l.defaultLine;return l.opacity(f.fillcolor)?H=f.fillcolor:l.opacity((f.line||{}).color)&&(H=f.line.color),r.extendFlat(t,{distance:s+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":27,"../../components/errorbars":57,"../../components/fx":68,"../../lib":141,"./get_trace_color":252}],254:[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":187,"./arrays_to_calcdata":243,"./attributes":244,"./calc":245,"./clean_data":246,"./colorbar":247,"./defaults":250,"./hover":253,"./plot":261,"./select":262,"./style":263,"./subtypes":264}],255:[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,l){var s=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||n)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40}],256:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=_.c2p(t[e].x),a=w.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/_._length,n=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}var o,i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],C=.2,S=new Array(t.length),z=0;for(k||(A=C=-1),o=0;oa(u))break;l=u,m=p[0]*h[0]+p[1]*h[1],m>g?(g=m,s=u,d=!1):m=t.length||!u)break;S[z++]=u,i=u}}else S[z++]=s}L.push(S.slice(0,z))}return L}},{"../../constants/numerical":124}],257:[function(t,e,n){"use strict";e.exports=function(t,e,n){"spline"===n("line.shape")&&n("line.smoothing")}},{}],258:[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}],260:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(n=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?r.background:r.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":27,"../../components/colorscale/defaults":36,"../../components/colorscale/has_colorscale":40,"./subtypes":264}],261:[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,d,p){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function x(){return!1}function b(e){var n,r,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,m=x;f&&(p=o.marker.maxdisplayed||o._needsCull?v:l.identity),d&&(m=o.marker.maxdisplayed||o._needsCull?v:l.identity),r=c.selectAll("path.point"),n=r.data(p,h);var b=n.enter().append("path").classed("point",!0);b.call(s.pointStyle,o).call(s.translatePoints,M,A,o),k&&b.style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");n.each(function(e){var n=i.select(this),r=g(n);(a=s.translatePoint(e,r,M,A))&&(s.singlePointStyle(e,r,o,_,w,t),o.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),k?n.exit().transition().style("opacity",0).remove():n.exit().remove(),r=c.selectAll("g"),n=r.data(m,h),n.enter().append("g").classed("textpoint",!0).append("text"),n.each(function(t){var e=i.select(this),n=g(e.select("text"));(a=s.translatePoint(t,n,M,A))||e.remove()}),n.selectAll("text").call(s.textPointStyle,o).each(function(t){var e=t.xp||M.c2p(t.x),n=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:n})})}),n.exit().remove()}var _,w;o(t,e,n,r,a);var k=!!p&&p.duration>0,M=n.xaxis,A=n.yaxis,T=r[0].trace,L=T.line,C=i.select(d);if(C.call(c.plot,n,p),T.visible===!0){g(C).style("opacity",T.opacity);var S,z,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),r[0].node3=C;var D="",P=[],E=T._prevtrace;E&&(D=E._prevRevpath||"",z=E._nextFill,P=E._polygons);var R,N,j,I,F,B,q,H,V,U="",G="",Y=[],X=[],Z=l.noop;if(S=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(z&&z.datum(r),["hv","vh","hvh","vhv"].indexOf(L.shape)!==-1?(j=s.steps(L.shape),I=s.steps(L.shape.split("").reverse().join(""))):j=I="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},F=function(t){return I(t.reverse())},Y=f(r,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(Y.length),w=0;w1}),Z=function(t){return function(e){if(R=j(e),N=F(e),U?O?(U+="L"+R.substr(1),G=N+"L"+G.substr(1)):(U+="Z"+R,G=N+"Z"+G):(U=R,G=N),u.hasLines(T)&&e.length>1){var n=i.select(this);if(n.datum(r),t)g(n.style("opacity",0).attr("d",R).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(n);a.attr("d",R),s.singleLineStyle(r,a)}}}}}var W=C.selectAll(".js-line").data(X);g(W.exit()).style("opacity",0).remove(),W.each(Z(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),Y.length&&(S?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(S).attr("d","M"+H+"L"+B+"L"+U.substr(1))):g(S).attr("d",U+"Z")):"tonext"===T.fill.substr(0,6)&&U&&D&&("tonext"===T.fill?g(z).attr("d",U+"Z"+D+"Z"):g(z).attr("d",U+"L"+D.substr(1)+"Z"),T._polygons=T._polygons.concat(P)),T._prevRevpath=G,T._prevPolygons=V);var Q=C.selectAll(".points");_=Q.data([r]),Q.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,s=n.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=r[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=r.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),v=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),d(t,e,n),r(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),v){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":51,"../../components/errorbars":57,"../../lib":141,"../../lib/polygon":151,"./line_points":256,"./link_traces":258,"./subtypes":264,d3:8}],262:[function(t,e,n){"use strict";var r=t("./subtypes");e.exports=function(t,e){var n,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.index,h=f.marker,p=!r.hasMarkers(f)&&!r.hasText(f);if(f.visible===!0&&!p){var g=Array.isArray(h.opacity)?1:h.opacity;if(e===!1)for(n=0;n")}var a=t("../../components/fx"),o=t("../../plots/cartesian/axes"),i=t("../../constants/numerical").BADNUM,l=t("../scatter/get_trace_color"),s=t("./attributes");e.exports=function(t){function e(t){return f.projection(t)}function n(t){var n=t.lonlat;if(n[0]===i)return 1/0;if(f.isLonLatOverEdges(n))return 1/0;var r=e(n),a=c.c2p(),o=u.c2p(),l=Math.abs(a-r[0]),s=Math.abs(o-r[1]),d=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+s*s)-d,1-3/d)}var o=t.cd,s=o[0].trace,c=t.xa,u=t.ya,f=t.subplot;if(a.getClosest(o,n,t),t.index!==!1){var d=o[t.index],h=d.lonlat,p=e(h),g=d.mrc||1;return t.x0=p[0]-g,t.x1=p[0]+g,t.y0=p[1]-g,t.y1=p[1]+g,t.loc=d.loc,t.lat=h[0],t.lon=h[1],t.color=l(s,d),t.extraText=r(s,d,f.mockAxis),[t]}}},{"../../components/fx":68,"../../constants/numerical":124,"../../plots/cartesian/axes":177,"../scatter/get_trace_color":252,"./attributes":267}],272:[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":205,"../scatter/colorbar":247,"./attributes":267,"./calc":268,"./defaults":269,"./event_data":270,"./hover":271,"./plot":273}],273:[function(t,e,n){"use strict";function r(t,e){var n=t[0].trace;if(Array.isArray(n.locations))for(var r=u(n,e),a=n.locationmode,o=0;oe?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(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):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)*Ji,r=vt(r)*Ki,o=vt(o)*tl,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 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=rl.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)/Ji),a=mt((.2126729*t+.7151522*e+.072175*n)/Ki);return ht(116*a-16,500*(r-a),200*(a-mt((.0193339*t+.119192*e+.9503041*n)/tl)))}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 ol?ol.n=o:al=o,ol=o,il||(ll=clearTimeout(ll),il=1,sl(Et)),o}function Et(){var t=Nt(),e=Rt()-t;e>24?(isFinite(e)&&(clearTimeout(ll),ll=setTimeout(Et,e)),il=0):(il=1,sl(Et))}function Nt(){for(var t=Date.now(),e=al;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Rt(){for(var t,e=al,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=ul.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=fl.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(37===(a=e.charCodeAt(l++))){if(i=e.charAt(l++),!(o=S[i in gl?e.charAt(l++):i])||(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{hl=qt;var e=new hl;return e._=t,r(e)}finally{hl=Date}}var r=e(t);return n.parse=function(t){try{hl=qt;var e=r.parse(t);return e&&e._}finally{hl=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ue;var x=ui.map(),b=Yt(g),_=Xt(g),w=Yt(v),k=Xt(v),M=Yt(m),A=Xt(m),T=Yt(y),L=Xt(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 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+dl.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(dl.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(dl.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:Zt,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){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ae(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function oe(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ie(t,e,n){vl.lastIndex=0;var r=vl.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function le(t,e,n){vl.lastIndex=0;var r=vl.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){ml.lastIndex=0;var r=ml.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);kl.add(Math.atan2(d,f)),r=t,a=s,o=c}var e,n,r,a,o;Ml.point=function(i,l){Ml.point=t,r=(e=i)*Vi,a=Math.cos(l=(n=l)*Vi/2+Fi/4),o=Math.sin(l)},Ml.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(Re))}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=Ie(),b=e(x),_=!1;return y}}function Re(t){return t.length>1}function Ie(){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-Ii:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-Ii: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)Ii?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])>Ii){var o=t[0]=0?1:-1,k=w*_,M=k>Fi,A=p*x;if(kl.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<-Ii||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]+=Ii,p[1]+=Ii,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);be(p,_e(l,d));var g=h,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(g,(-v-x)/m);if(be(b,p),b=ke(b),!n)return b;var _,w=t[0],k=e[0],M=t[1],A=e[1];k0^b[1]<(bi(b[0]-w)Fi^(w<=b[0]&&b[0]<=k)){var S=_e(g,(-v+x)/m);return be(S,p),[b,ke(S)]}}}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)>Ii;return Ne(e,n,mn(t,6*Vi),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=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(-jl,Math.min(jl,t)),e=Math.max(-jl,Math.min(jl,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=Ie(),C=Ue(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 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 Xe(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 Ze(){function t(t,e){Bl+=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){tVl&&(Vl=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){Ll+=t,Cl+=e,++Sl}function Ke(){function t(t,r){var a=t-e,o=r-n,i=Math.sqrt(a*a+o*o);zl+=i*(e+t)/2,Ol+=i*(n+r)/2,Pl+=i,Je(e=t,n=r)}var e,n;Xl.point=function(r,a){Xl.point=t,Je(e=r,n=a)}}function tn(){Xl.point=Je}function en(){function t(t,e){var n=t-r,o=e-a,i=Math.sqrt(n*n+o*o);zl+=i*(r+t)/2,Ol+=i*(a+e)/2,Pl+=i,i=a*t-r*e,Dl+=i*(r+t),El+=i*(a+e),Nl+=3*i,Je(r=t,a=e)}var e,n,r,a;Xl.point=function(o,i){Xl.point=t,Je(e=r=o,n=a=i)},Xl.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*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[0]*Ui,t[1]*Ui]}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,_=Il,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,Il):Ve((k=+t)*Vi),a()):k},e.clipExtent=function(t){return arguments.length?(M=t,w=t?Ge(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*Ui,v*Ui]},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*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),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+Ii&&(e=-Hi+Ii):e>Hi-Ii&&(e=Hi-Ii);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 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 In(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=ls.pop()||new jn;return e.site=t,e}function Bn(t){Qn(t),as.remove(t),ls.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)Ii)l=l.L;else{if(!((a=o-Un(l,i))>Ii)){r>-Ii?(e=l.P,n=l):a>-Ii?(e=l,n=l.N):e=n=l;break}if(!l.R){e=l;break}l=l.R}var s=Fn(t);if(as.insert(e,s),e||n){if(e===n)return Qn(e),n=Fn(e.site),as.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 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=rs,v=g.length;v--;)if((o=g[v])&&o.prepare())for(l=o.edges,s=l.length,i=0;iIi||bi(a-n)>Ii)&&(l.splice(i,0,new rr(er(o.site,u,bi(r-f)Ii?{x:f,y:bi(e-f)Ii?{x:bi(n-p)Ii?{x:d,y:bi(e-d)Ii?{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=ss.pop()||new Zn;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=is._;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=fs.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 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 Ir(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(Ur(n)+"rotate(",null,")")-2,x:xr(t,e)})):e&&n.push(Ur(n)+"rotate("+e+")")}function Xr(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 Zr(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),Xr(t.skew,e.skew,n,r),Zr(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 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:Xa,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 Za(t,Wa(to(t,e)[2])),Za(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=ul.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 ks?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=Za(r.map(a),n?Math:As);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 Ms;arguments.length<2?n=Ms:"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(Qs,a);return o==Qs.length?[e.year,to(t.map(function(t){return t/31536e6}),n)[2]]:o?e[a/Qs[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,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=0,n=t.length-1,r=t[0],a=new Array(n<0?0:n);e=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=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-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);Bs.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);Bs.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,fl=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,It(t,e))).toFixed(Math.max(0,Math.min(20,It(t*(1+1e-15),e))))}}),dl=ui.time={},hl=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(){pl.setUTCDate.apply(this._,arguments)},setDay:function(){pl.setUTCDay.apply(this._,arguments)},setFullYear:function(){pl.setUTCFullYear.apply(this._,arguments)},setHours:function(){pl.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){pl.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){pl.setUTCMinutes.apply(this._,arguments)},setMonth:function(){pl.setUTCMonth.apply(this._,arguments)},setSeconds:function(){pl.setUTCSeconds.apply(this._,arguments)},setTime:function(){pl.setTime.apply(this._,arguments)}};var pl=Date.prototype;dl.year=Ht(function(t){return t=dl.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),dl.years=dl.year.range,dl.years.utc=dl.year.utc.range,dl.day=Ht(function(t){var e=new hl(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}),dl.days=dl.day.range,dl.days.utc=dl.day.utc.range,dl.dayOfYear=function(t){var e=dl.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=dl[t]=Ht(function(t){return(t=dl.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=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});dl[t+"s"]=n.range,dl[t+"s"].utc=n.utc.range,dl[t+"OfYear"]=function(t){var n=dl.year(t).getDay();return Math.floor((dl.dayOfYear(t)+(n+e)%7)/7)}}),dl.week=dl.sunday,dl.weeks=dl.sunday.range,dl.weeks.utc=dl.sunday.utc.range,dl.weekOfYear=dl.sundayOfYear;var gl={"-":"",_:" ",0:"0"},vl=/^\s*\d+/,ml=/^%/;ui.locale=function(t){return{numberFormat:Ft(t),timeFormat:Ut(t)}};var yl=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=yl.numberFormat,ui.geo={},fe.prototype={s:0,t:0,add:function(t){de(t,this.t,xl),de(xl.s,this.s,this),this.s?this.t+=xl.t:this.s=xl.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xl=new fe;ui.geo.stream=function(t,e){t&&bl.hasOwnProperty(t.type)?bl[t.type](t,e):he(t,e)};var bl={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]*Ui*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;Ml.point(t,n),e(t,n)}function o(){Ml.lineStart()}function i(){a(g,v),Ml.lineEnd(),bi(y)>Ii&&(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]:tIi?h=90:y<-Ii&&(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){Al=Tl=Ll=Cl=Sl=zl=Ol=Pl=Dl=El=Nl=0,ui.geo.stream(t,Rl);var e=Dl,n=El,r=Nl,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+Ii,f+.12*c+Ii],[u-.214*c-Ii,f+.234*c-Ii]]).stream(s).point,a=l.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+Ii,f+.166*c+Ii],[u-.115*c-Ii,f+.234*c-Ii]]).stream(s).point,t},t.scale(1070)};var Fl,Bl,ql,Hl,Vl,Ul,Gl={point:k,lineStart:k,lineEnd:k,polygonStart:function(){Bl=0,Gl.lineStart=Ze},polygonEnd:function(){Gl.lineStart=Gl.lineEnd=Gl.point=k,Fl+=bi(Bl/2)}},Yl={point:We,lineStart:k,lineEnd:k,polygonStart:k,polygonEnd:k},Xl={point:Je,lineStart:Ke,lineEnd:tn,polygonStart:function(){Xl.lineStart=en},polygonEnd:function(){Xl.point=Je,Xl.lineStart=Ke,Xl.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 Fl=0,ui.geo.stream(t,a(Gl)),Fl},t.centroid=function(t){return Ll=Cl=Sl=zl=Ol=Pl=Dl=El=Nl=0,ui.geo.stream(t,a(Xl)),Nl?[Dl/Nl,El/Nl]:Pl?[zl/Pl,Ol/Pl]:Sl?[Ll/Sl,Cl/Sl]:[NaN,NaN]},t.bounds=function(t){return Vl=Ul=-(ql=Hl=1/0),ui.geo.stream(t,a(Yl)),[[ql,Hl],[Vl,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]*=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=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)>Ii}).map(u)).concat(ui.range(Math.ceil(l/g)*g,i,g).filter(function(t){return bi(t%m)>Ii}).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+Ii],[180,90-Ii]]).minorExtent([[-180,-80-Ii],[180,80+Ii]])},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 Zl=0,ui.geo.stream(t,Wl),Zl};var Zl,Wl={sphere:k,point:k,lineStart:Mn,lineEnd:k,polygonStart:k,polygonEnd:k},Ql=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(ui.geo.azimuthalEqualArea=function(){return sn(Ql)}).raw=Ql;var $l=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(ui.geo.azimuthalEquidistant=function(){return sn($l)}).raw=$l,(ui.geo.conicConformal=function(){return Ye(Tn)}).raw=Tn,(ui.geo.conicEquidistant=function(){return Ye(Ln)}).raw=Ln;var Jl=An(function(t){return 1/t},Math.atan);(ui.geo.gnomonic=function(){return sn(Jl)}).raw=Jl,Cn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Hi]},(ui.geo.mercator=function(){return Sn(Cn)}).raw=Cn;var Kl=An(function(){return 1},Math.asin);(ui.geo.orthographic=function(){return sn(Kl)}).raw=Kl;var ts=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(ui.geo.stereographic=function(){return sn(ts)}).raw=ts,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]]:[]).point=t[l]}),e}function n(t){return t.map(function(t,e){return{x:Math.round(o(t,e)/Ii)*Ii,y:Math.round(i(t,e)/Ii)*Ii,i:e}})}var r=On,a=Pn,o=r,i=a,l=cs;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=n.site,i=n.edges.sort(Xn),l=-1,s=i.length,c=i[s-1].edge,u=c.l===o?c.r:c.l;++l=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=hs.get(n)||ds,r=ps.get(r)||b,kr(r(n.apply(null,fi.call(arguments,1))))},ui.interpolateHcl=Rr,ui.interpolateHsl=Ir,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:gs)})(t)},Br.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gs={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&&(Ra(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===zs?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>Ii&&(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=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=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(Xo(e=t)):e},t},ui.svg.symbol=function(){function t(t,r){return(Ns.get(e.call(this,t,r))||Qo)(n.call(this,t,r))}var e=Wo,n=Zo;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 Ns=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*Is)),n=e*Is;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/Rs),n=e*Rs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Rs),n=e*Rs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});ui.svg.symbolTypes=Ns.keys();var Rs=Math.sqrt(3),Is=Math.tan(30*Vi);Si.transition=function(t){for(var e,n,r=js||++Hs,a=ei(t),o=[],i=Fs||{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){return 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(0===(t=+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,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},{}],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(){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=L(t,360),e=L(e,100),n=L(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=L(t,255),e=L(e,255),n=L(n,255);var r,a,o=U(t,e,n),i=V(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,n){z(t)&&(t="100%");var r=O(t);return t=V(n,U(0,parseFloat(t))),r&&(t=parseInt(t*n,10)/100),e.abs(t-n)<1e-6?1:t%n/parseFloat(n)}function C(t){return V(1,U(0,t))}function S(t){return parseInt(t,16)}function z(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function P(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function E(t){return e.round(255*parseFloat(t)).toString(16)}function N(t){return S(t)/255}function R(t){return!!Z.CSS_UNIT.exec(t)}function I(t){t=t.replace(F,"").replace(B,"").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 n;return(n=Z.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=Z.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Z.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=Z.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Z.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=Z.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Z.hex8.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),a:N(n[4]),format:e?"name":"hex8"}:(n=Z.hex6.exec(t))?{r:S(n[1]),g:S(n[2]),b:S(n[3]),format:e?"name":"hex"}:(n=Z.hex4.exec(t))?{r:S(n[1]+""+n[1]),g:S(n[2]+""+n[2]),b:S(n[3]+""+n[3]),a:N(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=Z.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 F=/^\s+/,B=/\s+$/,q=0,H=e.round,V=e.min,U=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,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=T(t),this._roundA=H(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=H(360*t.h),n=H(100*t.s),r=H(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=H(360*t.h),n=H(100*t.s),r=H(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: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)&&(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;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("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()):"name"===t&&0===this._a?this.toName():this.toRgbString()},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)&&(n[a]="a"===a?t[a]:D(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:G(),g:G(),b:G()})},r.mix=function(t,e,n){n=0===n?0:n||50;var a=r(t).toRgb(),o=r(e).toRgb(),i=n/100;return r({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})},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 Y=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=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(Y),Z=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==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&&void 0!==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);a0||n.explicitOff.length>0}function a(t,e){var n,r=o(t,e),a=r.on,i=r.off.concat(r.explicitOff),s={};if(a.length||i.length){for(n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var l=R.selectAll("a");if(1===l.size()&&l.text()===R.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":l.attr("xlink:href"),"xlink:xlink:show":l.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(P.node())}var c=C.select(".annotation-text-math-group"),f=!c.empty(),p=h.bBox((f?c:R).node()),x=p.width,z=p.height,N=e.width||x,I=e.height||z,j=Math.round(N+2*O),F=Math.round(I+2*O);e._w=N,e._h=I;for(var B=!1,q=["x","y"],H=0;H1)&&(Q===W?((ot=$.r2fraction(e["a"+Z]))<0||ot>1)&&(B=!0):B=!0,B))continue;V=$._offset+$.r2p(e[Z]),Y=.5}else"x"===Z?(G=e[Z],V=w.l+w.w*G):(G=1-e[Z],V=w.t+w.h*G),Y=e.showarrow?.5:G;if(e.showarrow){at.head=V;var it=e["a"+Z];X=K*n(.5,e.xanchor)-tt*n(.5,e.yanchor),Q===W?(at.tail=$._offset+$.r2p(it),U=X):(at.tail=V+it,U=X+it),at.text=at.tail+X;var lt=_["x"===Z?"width":"height"];if("paper"===W&&(at.head=u.constrain(at.head,1,lt-1)),"pixel"===Q){var st=-Math.max(at.tail-3,at.text),ct=Math.min(at.tail+3,at.text)-lt;st>0?(at.tail+=st,at.text+=st):ct>0&&(at.tail-=ct,at.text-=ct)}at.tail+=rt,at.head+=rt}else X=et*n(Y,nt),U=X,at.text=V+X;at.text+=rt,X+=rt,U+=rt,e["_"+Z+"padplus"]=et/2+U,e["_"+Z+"padminus"]=et/2-U,e["_"+Z+"size"]=et,e["_"+Z+"shift"]=X}if(B)return void C.remove();var ut=0,ft=0;if("left"!==e.align&&(ut=(N-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(I-z)*("middle"===e.valign?.5:1)),f)c.select("svg").attr({x:O+ut-1,y:O+ft}).call(h.setClipUrl,D?k:null);else{var dt=O+ft-p.top,ht=O+ut-p.left;R.call(g.positionText,ht,dt).call(h.setClipUrl,D?k:null)}E.select("rect").call(h.setRect,O,O,N,I),P.call(h.setRect,S/2,S/2,j-S,F-S),C.call(h.setTranslate,Math.round(M.x.text-j/2),Math.round(M.y.text-F/2)),L.attr({transform:"rotate("+A+","+M.x.text+","+M.y.text+")"});var pt=function(n,l){T.selectAll(".annotation-arrow-g").remove();var c=M.x.head,f=M.y.head,p=M.x.tail+n,g=M.y.tail+l,v=M.x.text+n,x=M.y.text+l,_=u.rotationXYMatrix(A,v,x),k=u.apply2DTransform(_),S=u.apply2DTransform2(_),z=+P.attr("width"),O=+P.attr("height"),D=v-.5*z,E=D+z,N=x-.5*O,R=N+O,I=[[D,N,D,R],[D,R,E,R],[E,R,E,N],[E,N,D,N]].map(S);if(!I.reduce(function(t,e){return t^!!i(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){I.forEach(function(t){var e=i(p,g,c,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,g=e.y)});var j=e.arrowwidth,F=e.arrowcolor,B=T.append("g").style({opacity:d.opacity(F)}).classed("annotation-arrow-g",!0),q=B.append("path").attr("d","M"+p+","+g+"L"+c+","+f).style("stroke-width",j+"px").call(d.stroke,d.rgb(F));if(y(q,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&q.node().parentNode&&!r){var H=c,V=f;if(e.standoff){var U=Math.sqrt(Math.pow(c-p,2)+Math.pow(f-g,2));H+=e.standoff*(p-c)/U,V+=e.standoff*(g-f)/U}var G,Y,X,Z=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-H)+","+(g-V),transform:"translate("+H+","+V+")"}).style("stroke-width",j+6+"px").call(d.stroke,"rgba(0,0,0,0)").call(d.fill,"rgba(0,0,0,0)");m.init({element:Z.node(),gd:t,prepFn:function(){var t=h.getTranslate(C);Y=t.x,X=t.y,G={},a&&a.autorange&&(G[a._name+".autorange"]=!0),o&&o.autorange&&(G[o._name+".autorange"]=!0)},moveFn:function(t,n){var r=k(Y,X),i=r[0]+t,l=r[1]+n;C.call(h.setTranslate,i,l),G[b+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/w.w,G[b+".y"]=o?o.p2r(o.r2p(e.y)+n):e.y-n/w.h,e.axref===e.xref&&(G[b+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(G[b+".ay"]=o.p2r(o.r2p(e.ay)+n)),B.attr("transform","translate("+t+","+n+")"),L.attr({transform:"rotate("+A+","+i+","+l+")"})},doneFn:function(e){if(e){s.relayout(t,G);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var gt,vt;m.init({element:C.node(),gd:t,prepFn:function(){vt=L.attr("transform"),gt={}},moveFn:function(t,n){var i="pointer";if(e.showarrow)e.axref===e.xref?gt[b+".ax"]=a.p2r(a.r2p(e.ax)+t):gt[b+".ax"]=e.ax+t,e.ayref===e.yref?gt[b+".ay"]=o.p2r(o.r2p(e.ay)+n):gt[b+".ay"]=e.ay+n,pt(t,n);else{if(r)return;if(a)gt[b+".x"]=e.x+t/a._m;else{var l=e._xsize/w.w,s=e.x+(e._xshift-e.xshift)/w.w-l/2;gt[b+".x"]=m.align(s+t/w.w,l,0,1,e.xanchor)}if(o)gt[b+".y"]=e.y+n/o._m;else{var c=e._ysize/w.h,u=e.y-(e._yshift+e.yshift)/w.h-c/2;gt[b+".y"]=m.align(u-n/w.h,c,0,1,e.yanchor)}a&&o||(i=m.getCursor(a?.5:gt[b+".x"],o?.5:gt[b+".y"],e.xanchor,e.yanchor))}L.attr({transform:"translate("+t+","+n+")"+vt}),v(C,i)},doneFn:function(e){if(v(C),e){s.relayout(t,gt);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,b,_=t._fullLayout,w=t._fullLayout._size;r?(x="annotation-"+r,b=r+".annotations["+n+"]"):(x="annotation",b="annotations["+n+"]"),_._infolayer.selectAll("."+x+'[data-index="'+n+'"]').remove();var k="clip"+_._uid+"_ann"+n;if(!e._input||!1===e.visible)return void l.selectAll("#"+k).remove();var M={x:{},y:{}},A=+e.textangle||0,T=_._infolayer.append("g").classed(x,!0).attr("data-index",String(n)).style("opacity",e.opacity),L=T.append("g").classed("annotation-text-g",!0),C=L.append("g").style("pointer-events",e.captureevents?"all":null).call(v,"default").on("click",function(){t._dragging=!1;var a={index:n,annotation:e._input,fullAnnotation:e,event:l.event};r&&(a.subplotId=r),t.emit("plotly_clickannotation",a)});e.hovertext&&C.on("mouseover",function(){var n=e.hoverlabel,r=n.font,a=this.getBoundingClientRect(),o=t.getBoundingClientRect();p.loneHover({x0:a.left-o.left,x1:a.right-o.left,y:(a.top+a.bottom)/2-o.top,text:e.hovertext,color:n.bgcolor,borderColor:n.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var S=e.borderwidth,z=e.borderpad,O=S+z,P=C.append("rect").attr("class","bg").style("stroke-width",S+"px").call(d.stroke,e.bordercolor).call(d.fill,e.bgcolor),D=e.width||e.height,E=_._defs.select(".clips").selectAll("#"+k).data(D?[0]:[]);E.enter().append("clipPath").classed("annclip",!0).attr("id",k).append("rect"),E.exit().remove();var N=e.font,R=C.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?R.call(g.makeEditable,{delegate:C,gd:t}).call(c).on("edit",function(n){e.text=n,this.call(c);var r={};r[b+".text"]=e.text,a&&a.autorange&&(r[a._name+".autorange"]=!0),o&&o.autorange&&(r[o._name+".autorange"]=!0),s.relayout(t,r)}):R.call(c)}function i(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 l=t("d3"),s=t("../../plotly"),c=t("../../plots/plots"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../fx"),g=t("../../lib/svg_text_utils"),v=t("../../lib/setcursor"),m=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:r,drawOne:a,drawRaw:o}},{"../../lib":148,"../../lib/setcursor":163,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/cartesian/axes":184,"../../plots/plots":225,"../color":33,"../dragelement":54,"../drawing":57,"../fx":74,"./draw_arrow_head":25,d3:8}],25:[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,c){function u(){t.style("stroke-dasharray","0px,100px")}function f(n,a){h.path&&(e>5&&(a=0),r.select(d.parentNode).append("path").attr({class:t.attr("class"),d:h.path,transform:"translate("+n.x+","+n.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}a(s)||(s=1);var d=t.node(),h=l[e||0];"string"==typeof n&&n||(n="end");var p,g,v,m,y=(i.getPx(t,"stroke-width")||1)*s,x=t.style("stroke")||o.defaultLine,b=t.style("stroke-opacity")||1,_=n.indexOf("start")>=0,w=n.indexOf("end")>=0,k=h.backoff*y+c;if("line"===d.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var M=p.x-g.x,A=p.y-g.y;if(v=Math.atan2(A,M),m=v+Math.PI,k){if(k*k>M*M+A*A)return void u();var T=k*Math.cos(v),L=k*Math.sin(v);_&&(p.x-=T,p.y-=L,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=L,t.attr({x2:g.x,y2:g.y}))}}else if("path"===d.nodeName){var C=d.getTotalLength(),S="";if(C1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+l+'"]').remove():(s.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(s.x)*n[0],e.yaxis.r2l(s.y)*n[1],e.zaxis.r2l(s.z)*n[2]]),r(t.graphDiv,s,l,t.id,s._xa,s._ya))}}},{"../../plots/gl3d/project":222,"../annotations/draw":24}],31:[function(t,e,n){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":27,"./convert":28,"./defaults":29,"./draw":30}],32:[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},{}],33:[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;var s=i.defaultLine=l.defaultLine;i.lightLine=l.lightLine;var c=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||c).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},i={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(i).toRgbString()},i.contrast=function(t,e,n){var r=a(t);return 1!==r.getAlpha()&&(r=a(i.combine(t,c))),(r.isDark()?e?r.lighten(e):c:n?r.darken(n):s).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]-=(ct-l)/2):n.node()&&!n.classed("js-placeholder")&&(ct=h.bBox(n.node()).height),ct){if(ct+=5,"top"===k.titleside)et.domain[1]-=ct/C.h,o[1]*=-1;else{et.domain[0]+=ct/C.h;var c=v.lineCount(n);o[1]+=(1-c)*l}e.attr("transform","translate("+o+")"),et.setScale()}}lt.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(C.h*(1-et.domain[1]))+")");var f=lt.select(".cbfills").selectAll("rect.cbfill").data(P);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?z[0]:(P[e]+P[e-1])/2,e===P.length-1?z[1]:(P[e]+P[e+1])/2].map(et.c2p).map(Math.round);e!==P.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:W,width:Math.max(H,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:i})});var d=lt.select(".cblines").selectAll("path.cbline").data(k.line.color&&k.line.width?O:[]);return d.enter().append("path").classed("cbline",!0),d.exit().remove(),d.each(function(t){r.select(this).attr("d","M"+W+","+(Math.round(et.c2p(t))+k.line.width/2%1)+"h"+H).call(h.lineGroupStyle,k.line.width,D(t),k.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=W+H+(k.outlinewidth||0)/2-("outside"===k.ticks?1:0),et.side="right",u.syncOrAsync([function(){return s.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(k.titleside)){var e=et.titlefont.size,n=et._offset+et._length/2,a=C.l+(et.position||0)*C.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));A("h"+et._id+"title",{avoid:{selection:r.select(t).selectAll("g."+et._id+"tick"),side:k.titleside,offsetLeft:C.l,offsetTop:C.t,maxShift:L.width},attributes:{x:a,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,n){var r,a=w();r=l.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var o={propContainer:et,propName:r,traceIndex:a.index,dfltName:"colorscale",containerGroup:lt.select(".cbtitle")},i="h"===e.charAt(0)?e.substr(1):"h"+e;lt.selectAll("."+i+",."+i+"-math-group").remove(),g.draw(t,e,f(o,n||{}))}function T(){var n=H+k.outlinewidth/2+h.bBox(et._axislayer.node()).width;if(F=st.select("text"),F.node()&&!F.classed("js-placeholder")){var r,a=st.select(".h"+et._id+"title-math-group").node();r=a&&-1!==["top","bottom"].indexOf(k.titleside)?h.bBox(a).width:h.bBox(st.node()).right-W-C.l,n=Math.max(n,r)}var o=2*k.xpad+n+k.borderwidth+k.outlinewidth/2,l=J-K;lt.select(".cbbg").attr({x:W-k.xpad-(k.borderwidth+k.outlinewidth)/2,y:K-X,width:Math.max(o,2),height:Math.max(l+2*X,2)}).call(p.fill,k.bgcolor).call(p.stroke,k.bordercolor).style({"stroke-width":k.borderwidth}),lt.selectAll(".cboutline").attr({x:W,y:K+k.ypad+("top"===k.titleside?ct:0),width:Math.max(H,2),height:Math.max(l-2*k.ypad-ct,2)}).call(p.stroke,k.outlinecolor).style({fill:"None","stroke-width":k.outlinewidth});var s=({center:.5,right:1}[k.xanchor]||0)*o;lt.attr("transform","translate("+(C.l-s)+","+C.t+")"),i.autoMargin(t,e,{x:k.x,y:k.y,l:o*({right:1,center:.5}[k.xanchor]||0),r:o*({left:1,center:.5}[k.xanchor]||0),t:l*({bottom:1,middle:.5}[k.yanchor]||0),b:l*({top:1,middle:.5}[k.yanchor]||0)})}var L=t._fullLayout,C=L._size;if("function"!=typeof k.fillcolor&&"function"!=typeof k.line.color)return void L._infolayer.selectAll("g."+e).remove();var S,z=r.extent(("function"==typeof k.fillcolor?k.fillcolor:k.line.color).domain()),O=[],P=[],D="function"==typeof k.line.color?k.line.color:function(){return k.line.color},E="function"==typeof k.fillcolor?k.fillcolor:function(){return k.fillcolor},N=k.levels.end+k.levels.size/100,R=k.levels.size,I=1.001*z[0]-.001*z[1],j=1.001*z[1]-.001*z[0];for(S=k.levels.start;(S-N)*R<0;S+=R)S>I&&Sz[0]&&S1){var it=Math.pow(10,Math.floor(Math.log(ot)/Math.LN10));rt*=it*u.roundUp(ot/it,[2,5,10]),(Math.abs(k.levels.start)/k.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=rt}et.domain=[$+Z,$+G-Z],et.setScale();var lt=L._infolayer.selectAll("g."+e).data([0]);lt.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)}),lt.attr("transform","translate("+Math.round(C.l)+","+Math.round(C.t)+")");var st=lt.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(C.l)+",-"+Math.round(C.t)+")");et._axislayer=lt.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(k.titleside)){var ut,ft=C.l+(k.x+Y)*C.w,dt=et.titlefont.size;ut="top"===k.titleside?(1-($+G-Z))*C.h+C.t+3+.75*dt:(1-($+Z))*C.h+C.t-3-.25*dt,A(et._id+"title",{attributes:{x:ft,y:ut,"text-anchor":"start"}})}var ht=u.syncOrAsync([i.previousPromises,M,i.previousPromises,T],t);if(ht&&ht.then&&(t._promises||[]).push(ht),t._context.editable){var pt,gt,vt;c.init({element:lt.node(),gd:t,prepFn:function(){pt=lt.attr("transform"),d(lt)},moveFn:function(t,e){lt.attr("transform",pt+" translate("+t+","+e+")"),gt=c.align(Q+t/C.w,V,0,1,k.xanchor),vt=c.align($-e/C.h,G,0,1,k.yanchor);var n=c.getCursor(gt,vt,k.xanchor,k.yanchor);d(lt,n)},doneFn:function(e){d(lt),e&&void 0!==gt&&void 0!==vt&&o.restyle(t,{"colorbar.x":gt,"colorbar.y":vt},w().index)}})}return ht}function w(){var n,r,a=e.substr(2);for(n=0;n=0?a.Reds:a.Blues,s.colorscale=g,l.reversescale&&(g=o(g)),l.colorscale=g)}},{"../../lib":148,"./flip_scale":44,"./scales":51}],40:[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":142,"./attributes":38,"./scales.js":51}],41:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":51}],42:[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;c(f+d+"auto",!(r(v)&&r(m)&&v=0;a--,o++)e=t[a],r[o]=[1-e[0],e[1]];return r}},{}],45:[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":41,"./is_valid_scale_array":49,"./scales":51}],46:[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}},{}],53:[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":148}],54:[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=t("../../constants/interactions"),c=e.exports={};c.align=t("./align"),c.getCursor=t("./cursor");var u=t("./unhover");c.unhover=u.wrapped,c.unhoverRaw=u.raw,c.init=function(t){function e(e){return g._dragged=!1,g._dragging=!0,u=e.clientX,f=e.clientY,p=e.target,d=(new Date).getTime(),d-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v,e),!g._dragged){var n;try{n=new MouseEvent("click",e)}catch(t){n=document.createEvent("MouseEvents"),n.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(n)}return a(g),g._dragged=!1,i.pauseEvent(e)}var u,f,d,h,p,g=t.gd,v=1,m=s.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},c.coverSlip=r},{"../../constants/interactions":130,"../../lib":148,"../../plotly":179,"../../plots/cartesian/constants":189,"./align":52,"./cursor":53,"./unhover":55}],55:[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,a=t._hoverdata;e||(e={}),e.target&&!1===r.triggerHandler(t,"plotly_beforehover",e)||(n._hoverlayer.selectAll("g").remove(),n._hoverlayer.selectAll("line").remove(),n._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":141}],56:[function(t,e,n){"use strict";n.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],57:[function(t,e,n){"use strict";function r(t,e,n,r,a,o,i,l){if(c.traceIs(n,"symbols")){var s=y(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:m.isBubble(n)?s(t.ms):(o.size||6)/2,t.mrc=e;var r=x.symbolNumber(t.mx||o.symbol)||0,a=r%100;return t.om=r%200>=100,x.symbolFuncs[a](e)+(r>=200?w:"")}).style("opacity",function(t){return(t.mo+1||o.opacity+1)-1})}var f,d,h,p=!1;if(t.so?(h=i.outlierwidth,d=i.outliercolor,f=o.outliercolor):(h=(t.mlw+1||i.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(i.color)?u.defaultLine:i.color,Array.isArray(o.color)&&(f=u.defaultLine,p=!0),f="mc"in t?t.mcc=r(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var g=o.gradient,v=t.mgt;if(v?p=!0:v=g&&g.type,v&&"none"!==v){var b=t.mgc;b?p=!0:b=g.color;var _="g"+l._fullLayout._uid+"-"+n.uid;p&&(_+="-"+t.i),e.call(x.gradient,l,_,v,f,b)}else e.call(u.fill,f);h&&e.call(u.stroke,d)}}function a(t,e,n,r){var a=t[0]-e[0],o=t[1]-e[1],l=n[0]-e[0],s=n[1]-e[1],c=Math.pow(a*a+o*o,T/2),u=Math.pow(l*l+s*s,T/2),f=(u*u*a-c*c*l)*r,d=(u*u*o-c*c*s)*r,h=3*u*(c+u),p=3*c*(c+u);return[[i.round(e[0]+(h&&f/h),2),i.round(e[1]+(h&&d/h),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&d/p),2)]]}function o(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var i=t("d3"),l=t("fast-isnumeric"),s=t("tinycolor2"),c=t("../../registry"),u=t("../color"),f=t("../colorscale"),d=t("../../lib"),h=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),v=g.LINE_SPACING,m=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),x=e.exports={};x.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(u.fill,r)},x.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},x.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},x.setRect=function(t,e,n,r,a){t.call(x.setPosition,e,n).call(x.setSize,r,a)},x.translatePoint=function(t,e,n,r){var a=t.xp||n.c2p(t.x),o=t.yp||r.c2p(t.y);return!!(l(a)&&l(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},x.translatePoints=function(t,e,n,r){t.each(function(t){var a=i.select(this);x.translatePoint(t,a,e,n,r)})},x.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},x.crispRound=function(t,e,n){return e&&l(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},x.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||"";u.stroke(e,r||o.color),x.dashLine(e,l,i)},x.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=r||a.dash||"";i.select(this).call(u.stroke,n||a.color).call(x.dashLine,l,o)})},x.dashLine=function(t,e,n){n=+n||0,e=x.dashStyle(e,n),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},x.dashStyle=function(t,e){e=+e||1;var n=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=n+"px,"+n+"px":"dash"===t?t=3*n+"px,"+3*n+"px":"longdash"===t?t=5*n+"px,"+5*n+"px":"dashdot"===t?t=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===t&&(t=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t},x.singleFillStyle=function(t){var e=i.select(t.node()),n=e.data(),r=(((n[0]||[])[0]||{}).trace||{}).fillcolor;r&&t.call(u.fill,r)},x.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=i.select(this);try{n.call(u.fill,e[0].trace.fillcolor)}catch(e){d.error(e,t),n.remove()}})};var b=t("./symbol_defs");x.symbolNames=[],x.symbolFuncs=[],x.symbolNeedLines={},x.symbolNoDot={},x.symbolList=[],Object.keys(b).forEach(function(t){var e=b[t];x.symbolList=x.symbolList.concat([e.n,t,e.n+100,t+"-open"]),x.symbolNames[e.n]=t,x.symbolFuncs[e.n]=e.f,e.needLine&&(x.symbolNeedLines[e.n]=!0),e.noDot?x.symbolNoDot[e.n]=!0:x.symbolList=x.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=x.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";x.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=x.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var k={x1:1,x2:0,y1:0,y2:0},M={x1:0,x2:0,y1:1,y2:0};x.gradient=function(t,e,n,r,a,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+n).data([r+a+o],d.identity);l.exit().remove(),l.enter().append("radial"===r?"radialGradient":"linearGradient").each(function(){var t=i.select(this);"horizontal"===r?t.attr(k):"vertical"===r&&t.attr(M),t.attr("id",n);var e=s(a),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+n+")","fill-opacity":null})},x.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},x.singlePointStyle=function(t,e,n,a,o,i){var l=n.marker;r(t,e,n,a,o,l,l.line,i)},x.pointStyle=function(t,e,n){if(t.size()){ +var r=e.marker,a=x.tryColorscale(r,""),o=x.tryColorscale(r,"line");t.each(function(t){x.singlePointStyle(t,i.select(this),e,a,o,n)})}},x.tryColorscale=function(t,e){var n=e?d.nestedProperty(t,e).get():t,r=n.colorscale,a=n.color;return r&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(r,n.cmin,n.cmax)):d.identity};var A={start:1,end:-1,middle:0,bottom:1,top:-1};x.textPointStyle=function(t,e,n){t.each(function(t){var r=i.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void r.remove();var o=t.tp||e.textposition,s=-1!==o.indexOf("top")?"top":-1!==o.indexOf("bottom")?"bottom":"middle",c=-1!==o.indexOf("left")?"end":-1!==o.indexOf("right")?"start":"middle",u=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;u=l(u)&&u>0?u:0,r.call(x.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",c).text(a).call(h.convertToTspans,n);var d=i.select(this.parentNode),p=(h.lineCount(r)-1)*v+1,g=A[c]*f,m=.75*u+A[s]*f+(A[s]-1)*p*u/2;d.attr("transform","translate("+g+","+m+")")})};var T=.5;x.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],o=[];for(n=1;n=1e4&&(x.savedBBoxes={},S=0),e&&(x.savedBBoxes[e]=v),S++,d.extendFlat({},v)},x.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var n="#"+e,r=i.select("base");r.size()&&r.attr("href")&&(n=window.location.href.split("#")[0]+n),t.attr("clip-path","url("+n+")")},x.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,n=t.attr?"attr":"getAttribute",r=t[n]("transform")||"",a=r.replace(e,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},x.setTranslate=function(t,e,n){var r=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||0,n=n||0,i=i.replace(r,"").trim(),i+=" translate("+e+", "+n+")",i=i.trim(),t[o]("transform",i),i},x.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,n=t.attr?"attr":"getAttribute",r=t[n]("transform")||"",a=r.replace(e,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},x.setScale=function(t,e,n){var r=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",o=t.attr?"attr":"setAttribute",i=t[a]("transform")||"";return e=e||1,n=n||1,i=i.replace(r,"").trim(),i+=" scale("+e+", "+n+")",i=i.trim(),t[o]("transform",i),i},x.setPointGroupScale=function(t,e,n){var r,a,o;return e=e||1,n=n||1,a=1===e&&1===n?"":" scale("+e+","+n+")",o=/\s*sc.*/,t.each(function(){r=(this.getAttribute("transform")||"").replace(o,""),r+=a,r=r.trim(),this.setAttribute("transform",r)}),a};var z=/translate\([^)]*\)\s*$/;x.setTextPointsScale=function(t,e,n){t.each(function(){var t,r=i.select(this),a=r.select("text"),o=parseFloat(a.attr("x")||0),l=parseFloat(a.attr("y")||0),s=(r.attr("transform")||"").match(z);t=1===e&&1===n?[]:["translate("+o+","+l+")","scale("+e+","+n+")","translate("+-o+","+-l+")"],s&&t.push(s),r.attr("transform",t.join(" "))})}},{"../../constants/alignment":129,"../../constants/xmlns_namespaces":133,"../../lib":148,"../../lib/svg_text_utils":165,"../../registry":233,"../../traces/scatter/make_bubble_size_func":267,"../../traces/scatter/subtypes":272,"../color":33,"../colorscale":47,"./symbol_defs":58,d3:8,"fast-isnumeric":11,tinycolor2:14}],58:[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);return"M-"+e+","+r.round(t/2,2)+"H"+e+"L0,-"+r.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+r.round(t/2,2)+"H"+e+"L0,"+r.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M"+r.round(t/2,2)+",-"+e+"V"+e+"L-"+r.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+r.round(t/2,2)+",-"+e+"V"+e+"L"+r.round(t,2)+",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(-.309*t,2);return"M"+e+","+o+"L"+n+","+r.round(.809*t,2)+"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(-.309*e,2),c=r.round(.118*e,2),u=r.round(.809*e,2);return"M"+n+","+s+"H"+a+"L"+o+","+c+"L"+i+","+u+"L0,"+r.round(.382*e,2)+"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}],59:[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"}}}},{}],60:[function(t,e,n){"use strict";function r(t,e,n,r){var o=e["error_"+r]||{},s=o.visible&&-1!==["linear","log"].indexOf(n.type),c=[];if(s){for(var u=l(o),f=0;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":272,d3:8,"fast-isnumeric":11}],65:[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":33,d3:8}],66:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},a.family,{arrayOk:!0}),size:r({},a.size,{arrayOk:!0}),color:r({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":142,"../../plots/font_attributes":208}],67:[function(t,e,n){"use strict";function r(t,e,n,r){r=r||a.identity,Array.isArray(t)&&(e[0][n]=r(t))}var a=t("../../lib"),o=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=t._fullLayout,i=0;i=0&&n.indexJ.width||Q<0||Q>J.height)return x.unhoverRaw(t,e)}if(E="xval"in e?w.flat(d,e.xval):w.p2c(L,W),N="yval"in e?w.flat(d,e.yval):w.p2c(C,Q),!f(E[0])||!f(N[0]))return h.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(I=0;IY&&(X.splice(0,Y),K=X[0].distance)}if(0===X.length)return x.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,ot=[];for(R=0;R1,ct=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ut={hovermode:D,rotateLabels:st,bgColor:ct,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(X,ut,t);if(o(X,st?"xa":"ya"),i(ft,st),e.target&&e.target.tagName){var dt=_.getComponentMethod("annotations","hasClickToShow")(t,ot);v(u.select(e.target),dt?"pointer":"")}e.target&&!r&&c(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:L,yaxes:C,xvals:E,yvals:N}))}function a(t,e,n){var r,a,o=e.hovermode,i=e.rotateLabels,l=e.bgColor,s=e.container,c=e.outerContainer,f=e.commonLabelOpts||{},d=e.fontFamily||k.HOVERFONT,h=e.fontSize||k.HOVERFONTSIZE,p=t[0],v=p.xa,x=p.ya,b="y"===o?"yLabel":"xLabel",_=p[b],w=(String(_)||"").split(" ")[0],A=c.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,O=p.distance<=k.MAXDIST&&("x"===o||"y"===o);for(r=0;r15&&(r=r.substr(0,12)+"...")),void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[o+"Label"]===_?a=t[("x"===o?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===r&&e.remove(),a=r);var p=e.select("text.nums").call(m.font,t.fontFamily||d,t.fontSize||h,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,n),v=e.select("text.name"),x=0;r&&r!==a?(v.call(m.font,t.fontFamily||d,t.fontSize||h,c).text(r).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,n),x=v.node().getBoundingClientRect().width+2*z):(v.remove(),e.select("rect").remove()),e.select("path").style({fill:c,stroke:f});var b,w,k=p.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,P=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),E=Math.abs(t.y1-t.y0),N=k.width+S+z+x;t.ty0=T-k.top,t.bx=k.width+2*z,t.by=k.height+2*z,t.anchor="start",t.txwidth=k.width,t.tx2width=x,t.offset=0,i?(t.pos=A,b=P+E/2+N<=C,w=P-E/2-N>=0,"top"!==t.idealAlign&&b||!w?b?(P+=E/2,t.anchor="start"):t.anchor="middle":(P-=E/2,t.anchor="end")):(t.pos=P,b=A+D/2+N<=L,w=A-D/2-N>=0,"left"!==t.idealAlign&&b||!w?b?(A+=D/2,t.anchor="start"):t.anchor="middle":(A-=D/2,t.anchor="end")),p.attr("text-anchor",t.anchor),x&&v.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+P+")"+(i?"rotate("+M+")":""))}),E}function o(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)?T: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 i(t,e){t.each(function(t){var n=u.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*(S+z),l=i+o*(t.txwidth+z),s=0,c=t.offset;"middle"===t.anchor&&(i-=t.tx2width/2,l-=t.tx2width/2),e&&(c*=-C,s=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*S+s)+","+(S+c)+"v"+(t.by/2-S)+"h"+r*t.bx+"v-"+t.by+"H"+(r*S+s)+"V"+(c-S)+"Z"),a.call(g.positionText,i+s,c+t.ty0-t.by/2+z),t.tx2width&&(n.select("text.name").call(g.positionText,l+o*z+s,c+t.ty0-t.by/2+z),n.select("rect").call(m.setRect,l+(o-1)*t.tx2width/2+s,c-t.by/2-1,t.tx2width,t.by+2))})}function l(t,e){function n(e,n,i){var l;if(o[n])l=o[n];else if(a[n]){var s=a[n];Array.isArray(s)&&Array.isArray(s[t.index[0]])&&(l=s[t.index[0]][t.index[1]])}else l=h.nestedProperty(r,i).get();l&&(t[e]=l)}var r=t.trace||{},a=t.cd[0],o=t.cd[t.index]||{};n("hoverinfo","hi","hoverinfo"),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=h.constrain(t.x0,0,t.xa._length),t.x1=h.constrain(t.x1,0,t.xa._length),t.y0=h.constrain(t.y0,0,t.ya._length),t.y1=h.constrain(t.y1,0,t.ya._length);var i;if(void 0!==t.xLabelVal){i="log"===t.xa.type&&t.xLabelVal<=0;var l=b.tickText(t.xa,t.xa.c2l(i?-t.xLabelVal:t.xLabelVal),"hover");i?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+l.text:t.xLabel=l.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){i="log"===t.ya.type&&t.yLabelVal<=0;var s=b.tickText(t.ya,t.ya.c2l(i?-t.yLabelVal:t.yLabelVal),"hover");i?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+s.text:t.yLabel=s.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text +;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function s(t,e){var n=e.hovermode,r=e.container,a=t[0],o=a.xa,i=a.ya,l=o.showspikes,s=i.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(l||s)){var c=e.fullLayout,u=o._offset+(a.x0+a.x1)/2,f=i._offset+(a.y0+a.y1)/2,h=y.combine(c.plot_bgcolor,c.paper_bgcolor),p=d.readability(a.color,h)<1.5?y.contrast(h):a.color;if(s){var g=i.spikemode,v=i.spikethickness,x=i.spikecolor||p,b=i._boundingBox,_=(b.left+b.right)/2=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 u=t("d3"),f=t("fast-isnumeric"),d=t("tinycolor2"),h=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),k=t("./constants"),M=k.YANGLE,A=Math.PI*M/180,T=1/Math.sin(A),L=Math.cos(A),C=Math.sin(A),S=k.HOVERARROWSIZE,z=k.HOVERTEXTPAD;n.hover=function(t,e,n,a){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+k.HOVERMINTIME)return r(t,e,n,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},k.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=u.select(e.container),o=e.outerContainer?u.select(e.outerContainer):r,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:o},s=a([n],l,e.gd);return i(s,l.rotateLabels),s.node()}},{"../../lib":148,"../../lib/events":141,"../../lib/override_cursor":157,"../../lib/svg_text_utils":165,"../../plots/cartesian/axes":184,"../../registry":233,"../color":33,"../dragelement":54,"../drawing":57,"./constants":69,"./helpers":71,d3:8,"fast-isnumeric":11,tinycolor2:14}],73:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,a){a=a||{},n("hoverlabel.bgcolor",a.bgcolor),n("hoverlabel.bordercolor",a.bordercolor),r.coerceFont(n,"hoverlabel.font",a.font)}},{"../../lib":148}],74:[function(t,e,n){"use strict";function r(t){var e=l.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,n){return l.castOption(t,e,"hoverlabel."+n)}function o(t,e,n){function r(n){return l.coerceHoverinfo({hoverinfo:n},{_module:t._module},e)}return l.castOption(t,n,"hoverinfo",r)}var i=t("d3"),l=t("../../lib"),s=t("../dragelement"),c=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:c.getDistanceFunction,getClosest:c.getClosest,inbox:c.inbox,appendArrayPointValue:c.appendArrayPointValue,castHoverOption:a,castHoverinfo:o,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":148,"../dragelement":54,"./attributes":66,"./calc":67,"./click":68,"./constants":69,"./defaults":70,"./helpers":71,"./hover":72,"./layout_attributes":75,"./layout_defaults":76,"./layout_global_defaults":77,d3:8}],75:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),o=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},a.family,{dflt:o.HOVERFONT}),size:r({},a.size,{dflt:o.HOVERFONTSIZE}),color:r({},a.color)}}}},{"../../lib/extend":142,"../../plots/font_attributes":208,"./constants":69}],76:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],84:[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":142,"../../plots/font_attributes":208,"../color/attributes":32}],85:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],86:[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(s("bgcolor",e.paper_bgcolor),s("bordercolor"),s("borderwidth"),a.coerceFont(s,"font",e.font),s("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.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":148,"../../plots/layout_attributes":223,"../../registry":233,"./attributes":84,"./helpers":89}],87:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,e,function(){i(t,e)})}var r=t.data()[0][0],a=e._fullLayout,o=r.trace,l=p.traceIs(o,"pie"),s=o.index,c=l?r.label:o.name,u=t.selectAll("text.legendtext").data([0]);u.enter().append("text").classed("legendtext",!0),u.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,a.legend.font).text(c),e._context.editable&&!l?u.call(y.makeEditable,{gd:e}).call(n).on("edit",function(t){this.text(t).call(n),this.text()||(t=" ");var a,o=r.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(o.type)){var i=r.trace.transforms;a=i[i.length-1].direction+".name"}else a="name";f.restyle(e,a,t,s)}):u.call(n)}function a(t,e){var n,r=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeL&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){o(t,e,r)},L):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,o(t,e,r))}})}function o(t,e,n){if(!e._dragged&&!e._editing){var r,a,o=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],i=t.data()[0][0],l=e._fullData,s=i.trace,c=s.legendgroup,u=[];if(1===n&&T&&e.data&&e._context.showTips?(d.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(s,"pie")){var h=i.label,g=o.indexOf(h);1===n?-1===g?o.push(h):o.splice(g,1):2===n&&(o=[],e.calcdata[0].forEach(function(t){h!==t.label&&o.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===o.length&&-1===g&&(o=[])),f.relayout(e,"hiddenlabels",o)}else{var v,m=[],y=[];for(v=0;vr.width-(r.margin.r+r.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),v.setTranslate(this,o+y,5+o+e.height/2+p),a.width+=i+n,a.height=Math.max(a.height,e.height),y+=i+n,g=Math.max(e.height,g)}),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];u.select(this).select(".legendtoggle").call(v.setRect,0,-n.height/2,t._context.editable?0:a.width,n.height)})}}function s(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.isCenterAnchor(n)&&(r="center");var a="top";A.isBottomAnchor(n)?a="bottom":A.isMiddleAnchor(n)&&(a="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}[a]||0),t:n.height*({bottom:1,middle:.5}[a]||0)})}function c(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.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"),f=t("../../plotly"),d=t("../../lib"),h=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),k=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),T=!0,L=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(v.setTranslate,0,e),z.call(v.setRect,F,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,i="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,b=n.showlegend&&w(t.calcdata,y),_=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+i).remove(),void h.autoMargin(t,"legend");var M=n._infolayer.selectAll("g.legend").data([0]);M.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=n._topdefs.selectAll("#"+i).data([0]);T.enter().append("clipPath").attr("id",i).append("rect");var C=M.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.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 O=S.selectAll("g.groups").data(b);O.enter().append("g").attr("class","groups"),O.exit().remove();var P=O.selectAll("g.traces").data(d.identity);P.enter().append("g").attr("class","traces"),P.exit().remove(),P.call(k,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){u.select(this).call(r,t).call(a,t)});var D=0!==M.enter().size();D&&(l(t,O,P),s(t));var E=n.width,N=n.height;l(t,O,P),y.height>N?c(t):s(t);var R=n._size,I=R.l+R.w*y.x,j=R.t+R.h*(1-y.y);A.isRightAnchor(y)?I-=y.width:A.isCenterAnchor(y)&&(I-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var F=y.width,B=R.w;F>B?(I=R.l,F=B):(I+F>E&&(I=E-F),I<0&&(I=0),F=Math.min(E-I,y.width));var q=y.height,H=R.h;q>H?(j=R.t,q=H):(j+q>N&&(j=N-q),j<0&&(j=0),q=Math.min(N-j,y.height)),v.setTranslate(M,I,j);var V,U,G=q-x.scrollBarHeight-2*x.scrollBarMargin,Y=y.height-q;if(y.height<=q||t._context.staticPlot)C.attr({width:F-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(S,0,0),T.select("rect").attr({width:F-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(v.setClipUrl,i);else{V=x.scrollBarMargin,U=S.attr("data-scroll")||0,C.attr({width:F-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:F-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-U}),S.call(v.setClipUrl,i),D&&e(V,U),M.on("wheel",null),M.on("wheel",function(){U=d.constrain(S.attr("data-scroll")-u.event.deltaY/G*Y,-Y,0),V=x.scrollBarMargin-U/Y*G,e(V,U),0!==U&&U!==-Y&&u.event.preventDefault()}),z.on(".drag",null),S.on(".drag",null);var X=u.behavior.drag().on("drag",function(){V=d.constrain(u.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),U=-(V-x.scrollBarMargin)/G*Y,e(V,U)});z.call(X),S.call(X)}if(t._context.editable){var Z,W,Q,$;M.classed("cursor-move",!0),g.init({element:M.node(),gd:t,prepFn:function(){var t=v.getTranslate(M);Q=t.x,$=t.y},moveFn:function(t,e){var n=Q+t,r=$+e;v.setTranslate(M,n,r),Z=g.align(n,0,R.l,R.l+R.w,y.xanchor),W=g.align(r,0,R.t+R.h,R.t,y.yanchor)},doneFn:function(e,r,a){if(e&&void 0!==Z&&void 0!==W)f.relayout(t,{"legend.x":Z,"legend.y":W});else{var i=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});i.size()>0&&(1===r?M._clickTimeout=setTimeout(function(){o(i,t,r)},L):2===r&&(M._clickTimeout&&clearTimeout(M._clickTimeout),o(i,t,r)))}}})}}}},{"../../constants/alignment":129,"../../constants/interactions":130,"../../lib":148,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/plots":225,"../../registry":233,"../color":33,"../dragelement":54,"../drawing":57,"./anchor_utils":83,"./constants":85,"./get_legend_data":88,"./helpers":89,"./style":91,d3:8}],88:[function(t,e,n){"use strict";var r=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&a.isGrouped(e))-1===s.indexOf(t)?(s.push(t),c=!0,l[t]=[[n]]):l[t].push([n]);else{var r="~~i"+f;s.push(r),l[r]=[[n]],f++}}var o,i,l={},s=[],c=!1,u={},f=0;for(o=0;on[1])return n[1]}return a}function a(t){return t[0]}var l,c,u=t[0],f=u.trace,d=s.hasMarkers(f),h=s.hasText(f),p=s.hasLines(f);if(d||h||p){var g={},v={};d&&(g.mc=n("marker.color",a),g.mo=n("marker.opacity",o.mean,[.2,1]),g.ms=n("marker.size",o.mean,[2,16]),g.mlc=n("marker.line.color",a),g.mlw=n("marker.line.width",o.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:n("line.width",a,[0,10])}),h&&(g.tx="Aa",g.tp=n("textposition",a),g.ts=10,g.tc=n("textfont.color",a),g.tf=n("textfont.family",a)),l=[o.minExtend(u,g)],c=o.minExtend(f,v)}var m=r.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(d?l:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(i.pointStyle,c,e),d&&(l[0].mrc=3);var x=m.selectAll("g.pointtext").data(h?l:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(i.textPointStyle,c,e)}function f(t){var e=t[0].trace,n=e.marker||{},o=n.line||{},i=r.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.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=r.select(this),a=t[0],i=(a.mlw+1||o.width+1)-1;e.style("stroke-width",i+"px").call(l.fill,a.mc||n.color),i&&e.call(l.stroke,a.mlc||o.color)})}function d(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,n=r.select(this);n.style("stroke-width",t+"px").call(l.fill,e.fillcolor),t&&n.call(l.stroke,e.line.color)})}function h(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.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(c,t[0],e)}t.each(function(t){var e=r.select(this),n=e.selectAll("g.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=n.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(d).each(h).each(n).each(u)}},{"../../lib":148,"../../registry":233,"../../traces/pie/style_one":250,"../../traces/scatter/subtypes":272,"../color":33,"../drawing":57,d3:8}],92:[function(t,e,n){"use strict";function r(t,e){var n,r,a=e.currentTarget,o=a.getAttribute("data-attr"),i=a.getAttribute("data-val")||!0,l=t._fullLayout,s={},c=d.list(t,null,!0),f="on";if("zoom"===o){var h,p="in"===i?.5:2,g=(1+p)/2,v=(1-p)/2;for(r=0;r1)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||p)&&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(["toggleSpikelines","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)){var p=a(e,n,s);f("x",p[0]),f("y",p[1]),o.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),o.coerceFont(f,"font",n.font);var g=f("bgcolor");f("activecolor",i.contrast(g,c.lightAmount,c.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":148,"../color":33,"./attributes":96,"./button_attributes":97,"./constants":98}],100:[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;lY&&r>X&&!t.shiftKey?p.getCursor(a/n,1-o/r):"move";g(e,i),G=i.split("-")[0]}function o(e){F=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),q=m.getDataToPixel(t,F),H=m.getDataToPixel(t,B,!0),V=m.getPixelToData(t,F),U=m.getPixelToData(t,B,!0);var o="shapes["+r+"]";"path"===n.type?(I=n.path,j=o+".path"):(v=q(n.x0),y=H(n.y0),x=q(n.x1),b=H(n.y1),_=o+".x0",w=o+".y0",k=o+".x1",M=o+".y1"),vX&&(h[S]=n[D]=U(c),h[z]=n[E]=U(u)),d-f>Y&&(h[O]=n[N]=V(f),h[P]=n[R]=V(d))}e.attr("d",i(t,n))}var h,v,y,x,b,_,w,k,M,A,T,L,C,S,z,O,P,D,E,N,R,I,j,F,B,q,H,V,U,G,Y=10,X=10,Z={element:e.node(),gd:t,prepFn:o,doneFn:l},W=Z.element.getBoundingClientRect();p.init(Z),e.node().onmousemove=a}function i(t,e){ +var n,r,a,o,i=e.type,s=f.getFromId(t,e.xref),c=f.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(n=m.shapePositionToRange(s),r=function(t){return s._offset+s.r2p(n(t,!0))}):r=function(t){return u.l+u.w*t},c?(a=m.shapePositionToRange(c),o=function(t){return c._offset+c.r2p(a(t,!0))}):o=function(t){return u.t+u.h*(1-t)},"path"===i)return s&&"date"===s.type&&(r=m.decodeDate(r)),c&&"date"===c.type&&(o=m.decodeDate(o)),l(e.path,r,o);var d=r(e.x0),h=r(e.x1),p=o(e.y0),g=o(e.y1);if("line"===i)return"M"+d+","+p+"L"+h+","+g;if("rect"===i)return"M"+d+","+p+"H"+h+"V"+g+"H"+d+"Z";var v=(d+h)/2,y=(p+g)/2,x=Math.abs(v-d),b=Math.abs(y-p),_="A"+x+","+b,w=v+x+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-b)+_+" 0 0,1 "+w+"Z"}function l(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a],s=t.substr(1).replace(v.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.*/,""),u.log("Ignoring extra params in segment "+t)),a+s})}function s(t,e,n){return t.replace(v.segmentRE,function(t){var r=0,a=t.charAt(0),o=v.paramIsX[a],i=v.paramIsY[a],l=v.numParams[a];return a+t.substr(1).replace(v.paramRE,function(t){return r>=l?t:(o[r]?t=e(t):i[r]&&(t=n(t)),r++,t)})})}var c=t("../../plotly"),u=t("../../lib"),f=t("../../plots/cartesian/axes"),d=t("../color"),h=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:r,drawOne:a}},{"../../lib":148,"../../lib/setcursor":163,"../../plotly":179,"../../plots/cartesian/axes":184,"../color":33,"../dragelement":54,"../drawing":57,"./constants":111,"./helpers":114}],114:[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}},{}],115:[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":109,"./calc_autorange":110,"./defaults":112,"./draw":113}],116:[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)}if(l=l||{},s=s||{},!c("visible",!s.itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=t.path?"path":"rect",f=c("type",u),d=["x","y"],h=0;h<2;h++){var p=d[h],g={_fullLayout:n},v=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,x;"paper"!==v?(m=a.getFromId(g,v),x=i.rangeToShapePosition(m),y=i.shapePositionToRange(m)):y=x=r.identity;var b=p+"0",_=p+"1",w=t[b],k=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,c,v,b,.25),a.coercePosition(e,g,c,v,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=k}}return"path"===f?c("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":148,"../../plots/cartesian/axes":184,"./attributes":109,"./helpers":114}],117:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":142,"../../plots/animation_attributes":180,"../../plots/font_attributes":208,"../../plots/pad_attributes":224,"./constants":118}],118:[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,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}},{}],119:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(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),r("currentvalue.visible")&&(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;s=n.steps.length&&(n.active=0),e.call(l,n).call(b,n).call(u,n).call(p,n).call(x,t,n).call(s,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(v,n,n.active/(n.steps.length-1),!1),e.call(l,n)}function l(t,e,n){if(e.currentvalue.visible){var r,a,o=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":r=.5*e.inputAreaLength,a="middle";break;default:r=C.currentValueInset,a="left"}o.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var i=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)i+=n;else{i+=e.steps[e.active].label}e.currentvalue.suffix&&(i+=e.currentvalue.suffix),o.call(A.font,e.currentvalue.font).text(i).call(T.convertToTspans,e.gd);var l=T.lineCount(o),s=(e.currentValueMaxLines+1-l)*e.currentvalue.font.size*S;return T.positionText(o,r,s),o}}function s(t,e,n){var r=t.selectAll("rect."+C.gripRectClass).data([0]);r.enter().append("rect").classed(C.gripRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(M.stroke,n.bordercolor).call(M.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function c(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(T.convertToTspans,n.gd),r}function u(t,e){var n=t.selectAll("g."+C.labelsClass).data([0]);n.enter().append("g").classed(C.labelsClass,!0);var r=n.selectAll("g."+C.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(C.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(c,t,e),A.setTranslate(n,m(e,t.fraction),C.tickOffset+e.ticklen+e.font.size*S+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,a){var o=Math.round(r*(n.steps.length-1));o!==n.active&&d(t,e,n,o,!0,a)}function d(t,e,n,r,a,o){var i=n.active;n._input.active=n.active=r;var s=n.steps[n.active];e.call(v,n,n.active/(n.steps.length-1),o),e.call(l,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:a,previousActive:i}),s&&s.method&&a&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:s,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&k.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function h(t,e,n){function r(){return n.data()[0]}var a=n.node(),o=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var i=n.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),i.call(M.fill,t.activebgcolor);var l=y(t,w.mouse(a)[0]);f(e,n,t,l,!0),t._dragging=!0,o.on("mousemove",function(){var t=r(),o=y(t,w.mouse(a)[0]);f(e,n,t,o,!1)}),o.on("mouseup",function(){var t=r();t._dragging=!1,i.call(M.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+C.tickRectClass).data(e.steps);n.enter().append("rect").classed(C.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,a=w.select(this);a.attr({height:r?e.ticklen:e.minorticklen}).call(M.fill,e.tickcolor),A.setTranslate(a,m(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,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 m(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,n){var r=t.selectAll("rect."+C.railTouchRectClass).data([0]);r.enter().append("rect").classed(C.railTouchRectClass,!0).call(h,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,C.tickOffset+n.ticklen+n.labelHeight)}).call(M.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function b(t,e){var n=t.selectAll("rect."+C.railRectClass).data([0]);n.enter().append("rect").classed(C.railRectClass,!0);var r=e.inputAreaLength-2*C.railInset;n.attr({width:r,height:C.railWidth,rx:C.railRadius,ry:C.railRadius,"shape-rendering":"crispEdges"}).call(M.stroke,e.bordercolor).call(M.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,C.railInset,.5*(e.inputAreaWidth-C.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(C.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&_(t),0!==n.length){var s=l.selectAll("g."+C.groupClassName).data(n,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 g={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[b.side];e.attr("transform","translate("+g+")")}}}var v=n.propContainer,m=n.propName,y=n.traceIndex,x=n.dfltName,b=n.avoid||{},_=n.attributes,w=n.transform,k=n.containerGroup,M=t._fullLayout,A=v.titlefont.family,T=v.titlefont.size,L=v.titlefont.color,C=1,S=!1,z=v.title.trim(),O=t._context.editable;""===z&&(C=0),z.match(d)&&(C=.2,S=!0,O||(z=""));var P=z||O;k||(k=M._infolayer.selectAll(".g-"+e).data([0]),k.enter().append("g").classed("g-"+e,!0));var D=k.selectAll("text").data(P?[0]:[]);if(D.enter().append("text"),D.text(z).attr("class",e),D.exit().remove(),P){D.call(h);var E="Click to enter "+x+" title";O&&(z?D.on(".opacity",null):function(){C=0,S=!0,z=E,D.text(z).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),D.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?o.restyle(t,m,e,y):o.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).on("input",function(t){this.text(t||" ").call(u.positionText,_.x,_.y)})),D.classed("js-placeholder",S)}}},{"../../constants/interactions":130,"../../lib":148,"../../lib/svg_text_utils":165,"../../plotly":179,"../../plots/plots":225,"../color":33,"../drawing":57,d3:8,"fast-isnumeric":11}],123:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":142,"../../plots/font_attributes":208,"../../plots/pad_attributes":224,"../color/attributes":32}],124:[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,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],125:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return o.coerce(t,e,l,n,r)}r("visible",a(t,e).length>0)&&(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(o.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),o.exit().remove(),o.exit().size()&&_(t),0!==n.length){var u=o.selectAll("g."+S.headerGroupClassName).data(n,a);u.enter().append("g").classed(S.headerGroupClassName,!0);var f=o.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var d=0;dk,T=r.barLength+2*r.barPad,L=r.barWidth+2*r.barPad,C=p,S=v+m;S+L>c&&(S=c-L);var z=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-horizontal",!0).call(o.fill,r.barColor),A?(this.hbar=z.attr({rx:r.barRadius,ry:r.barRadius,x:C,y:S,width:T,height:L}),this._hbarXMin=C+T/2,this._hbarTranslateMax=k-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=m>M,P=r.barWidth+2*r.barPad,D=r.barLength+2*r.barPad,E=p+g,N=v;E+P>s&&(E=s-P);var R=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);R.exit().on(".drag",null).remove(),R.enter().append("rect").classed("scrollbar-vertical",!0).call(o.fill,r.barColor),O?(this.vbar=R.attr({rx:r.barRadius,ry:r.barRadius,x:E,y:N,width:P,height:D}),this._vbarYMin=N+D/2,this._vbarTranslateMax=M-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,j=u-.5,F=O?f+P+.5:f+.5,B=d-.5,q=A?h+L+.5:h+.5,H=l._topdefs.selectAll("#"+I).data(A||O?[0]:[]);if(H.exit().remove(),H.enter().append("clipPath").attr("id",I).append("rect"),A||O?(this._clipRect=H.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(F)-Math.floor(j),height:Math.ceil(q)-Math.floor(B)}),this.container.call(i.setClipUrl,I),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),A||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var U=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(U),O&&this.vbar.on(".drag",null).call(U)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(l.constrain(a.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var o=e+this._vbarYMin,i=o+this._vbarTranslateMax;e=(l.constrain(a.event.y,o,i)-o)/(i-o)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=l.constrain(t||0,0,n),e=l.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(i.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/n;this.hbar.call(i.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var o=e/r;this.vbar.call(i.setTranslate,t,e+o*this._vbarTranslateMax)}}},{"../../lib":148,"../color":33,"../drawing":57,d3:8}],129:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],130:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],131:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],132:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],133:[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}},{}],134:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":26,"./components/annotations3d":31,"./components/fx":74,"./components/images":82,"./components/legend":90,"./components/rangeselector":102,"./components/rangeslider":108,"./components/shapes":115,"./components/sliders":121,"./components/updatemenus":127,"./fonts/mathjax_config":135,"./lib/queue":160,"./plot_api/plot_schema":173,"./plot_api/register":174,"./plot_api/set_plot_config":175,"./plot_api/to_image":177,"./plot_api/validate":178,"./plotly":179,"./snapshot":238,"./snapshot/download":235,"./traces/scatter":262,d3:8,"es6-promise":9}],135:[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},{}],136:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){Array.isArray(t)&&(e[n]=t[r])}},{}],137:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(o,"")),r(t)?Number(t):a}},{"../constants/numerical":131,"fast-isnumeric":11}],138:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../plots/attributes"),i=t("../components/colorscale/get_scale"),l=(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),-1===r.values.indexOf(t)?e.set(n):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ra.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;!0!==r.strict&&a?e.set(String(t)):e.set(n)}else r.noBlank&&!t?e.set(n):e.set(t)}},color:{coerceFunction:function(t,e,n){a(t).isValid()?e.set(t):e.set(n)}},colorscale:{coerceFunction:function(t,e,n){e.set(i(t,n))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,n){var r=n.length;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);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(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),o=0;o0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+i}return r}function s(t){return t.formatDate("yyyy")}function c(t){return t.formatDate("M yyyy")}function u(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var d=t("d3"),h=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,x=v.ONEHOUR,b=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,k=t("../registry"),M=d.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,L=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?k.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:k.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?k.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var C,S;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=C&&t<=S?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var a=r(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var i=a&&"chinese"===e.substr(0,7),l=t.match(i?T:A);if(!l)return m;var s=l[1],c=l[3]||"1",u=Number(l[5]||1),f=Number(l[7]||0),d=Number(l[9]||0),h=Number(l[11]||0);if(a){if(2===s.length)return m;s=Number(s);var p;try{var g=k.getComponentMethod("calendars","getCal")(e);if(i){var v="i"===c.charAt(c.length-1);c=parseInt(c,10),p=g.newDate(s,g.toMonthIndex(s,c,v),u)}else p=g.newDate(s,Number(c),u)}catch(t){return m}return p?(p.toJD()-w)*y+f*x+d*b+h*_:m}s=2===s.length?(Number(s)+2e3-L)%100+L:Number(s),c-=1;var M=new Date(Date.UTC(2e3,c,u,f,d));return M.setUTCFullYear(s),M.getUTCMonth()!==c?m:M.getUTCDate()!==u?m:M.getTime()+h*_},C=n.MIN_MS=n.dateTime2ms("-9999"),S=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==m};var z=90*y,O=3*x,P=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=C&&t<=S))return m;e||(e=0);var a,i,l,s,c,u,f=Math.floor(10*g(t+.05,1)),d=Math.round(t-f/10);if(r(n)){var h=Math.floor(d/y)+w,p=Math.floor(g(t,y));try{a=k.getComponentMethod("calendars","getCal")(n).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){a=M("G%Y-%m-%d")(new Date(d))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;i=e=C+y&&t<=S-y))return m;var e=Math.floor(10*g(t+.05,1)),n=new Date(Math.round(t-e/10));return o(d.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,a){if(n.isJSDate(t)||"number"==typeof t){if(r(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,a))return p("unrecognized date",t),e;return t};var D=/%\d?f/g,E=[59,59.9,59.99,59.999,59.9999],N=M("%Y"),R=M("%b %Y"),I=M("%b %-d"),j=M("%b %-d, %Y");n.formatDate=function(t,e,n,a){var o,d;if(a=r(a)&&a,e)return i(e,t,a);if(a)try{var h=Math.floor((t+.05)/y)+w,p=k.getComponentMethod("calendars","getCal")(a).fromJD(h);"y"===n?d=s(p):"m"===n?d=c(p):"d"===n?(o=s(p),d=u(p)):(o=f(p),d=l(t,n))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===n?d=N(g):"m"===n?d=R(g):"d"===n?(o=N(g),d=I(g)):(o=j(g),d=l(t,n))}return d+(o?"\n"+o:"")};var F=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var a=g(t,y);if(t=Math.round(t-a),n)try{var o=Math.round(t/y)+w,i=k.getComponentMethod("calendars","getCal")(n),l=i.fromJD(o);return e%12?i.add(l,e,"m"):i.add(l,e/12,"y"),(l.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+n)}var s=new Date(t+F);return s.setUTCMonth(s.getUTCMonth()+e)+a-F},n.findExactDates=function(t,e){for(var n,a,o=0,i=0,l=0,s=0,c=r(e)&&k.getComponentMethod("calendars","getCal")(e),u=0;u0&&(a.push(o),o=[])}return o.length>0&&a.push(o),a},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;ai?l:a(t)?Number(t):l):l},s.noop=t("./noop"),s.identity=t("./identity"),s.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var a=0;an?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},s.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},s.simpleMap=function(t,e,n,r){for(var a=t.length,o=new Array(a),i=0;i-1||u!==1/0&&u>=Math.pow(2,n)?t(e,n,r):s},s.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},s.smooth=function(t,e){if((e=Math.round(e)||0)<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},s.syncOrAsync=function(t,e,n){function r(){return s.syncOrAsync(t,e,n)}for(var a,o;t.length;)if(o=t.splice(0,1)[0],(a=o(e))&&a.then)return a.then(r).then(void 0,s.promiseError);return n&&n(e)},s.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},s.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}},{"../constants/numerical":131,"./clean_number":137,"./coerce":138,"./dates":139,"./ensure_array":140,"./extend":142,"./filter_unique":143,"./filter_visible":144,"./identity":147,"./is_array":149,"./is_plain_object":150,"./loggers":151,"./matrix":152,"./mod":153,"./nested_property":154,"./noop":155,"./notifier":156,"./push_unique":159,"./relink_private":161,"./search":162,"./stats":164,"./to_log_range":166,d3:8,"fast-isnumeric":11}],149:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],150:[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}},{}],151:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){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][0],o=t[e][1],s=!1,h(r))for(n=r.length-1;n>=0;n--)a(r[n],i(o,n))?s?r[n]=void 0:r.pop():s=!0;else if("object"==typeof r&&null!==r)for(l=Object.keys(r),s=!1,n=l.length-1;n>=0;n--)a(r[l[n]],i(o,l[n]))?delete r[l[n]]:s=!0;if(s)return}}function u(t){return void 0===t||null===t||"object"==typeof t&&(h(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var d=t("fast-isnumeric"),h=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");e.exports=function(t,e){ +if(d(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(".");l/g),l=0;li||r===a||rs)&&(!e||!u(t))}function n(t,e){var n=t[0],c=t[1];if(n===a||ni||c===a||cs)return!1;var u,f,d,h,p,g=r.length,v=r[0][0],m=r[0][1],y=0;for(u=1;uMath.max(f,v)||c>Math.max(d,m)))if(cu||Math.abs(r(i,d))>a)return!0;return!1};o.filter=function(t,e){function n(n){t.push(n);var l=r.length,s=a;r.splice(o+1);for(var c=s+1;c1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":131,"./matrix":152}],159:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;no.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}],165:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var n=t.match(e);return n&&(n[3]||n[4])}function l(t,e){if(!t)return"";for(var n=0;n1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}(M);else{var N=y[4],R={type:M},I=i(N,z);if(I?(I=I.replace(E,"$1 fill:"),A&&(I+=";"+A)):A&&(I=A),I&&(R.style=I),"a"===M){l=!0;var j=i(N,O);if(j){var F=document.createElement("a");F.href=j,-1!==k.indexOf(F.protocol)&&(R.href=j,R.target=i(N,P)||"_blank",R.popup=i(N,D))}}r(R)}}return l}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(t,e,a){function i(){u.empty()||(d=t.attr("class")+"-math",u.select("svg."+d).remove()),t.text("").style("white-space","pre"),c(t.node(),l)&&t.style("pointer-events","all"),n.positionText(t),a&&a.call(t)}var l=t.text(),s=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&l.match(v),u=f.select(t.node().parentNode);if(!u.empty()){var d=t.attr("class")?t.attr("class").split(" ")[0]:"text";return d+="-math",u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove(),t.style("display",null).attr({"data-unformatted":l,"data-math":"N"}),s?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var n={fontSize:parseInt(t.style("font-size"),10)};o(s[2],n,function(n,o,s){u.selectAll("svg."+d).remove(),u.selectAll("g."+d+"-group").remove();var c=n&&n.select("svg");if(!c||!c.node())return i(),void e();var f=u.append("g").classed(d+"-group",!0).attr({"pointer-events":"none","data-unformatted":l,"data-math":"Y"});f.node().appendChild(c.node()),o&&o.node()&&c.node().insertBefore(o.node().cloneNode(!0),c.node().firstChild),c.attr({class:d,height:s.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var h=t.style("fill")||"black";c.select("g").attr({fill:h,stroke:h});var p=r(c,"width"),g=r(c,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||r(t,"height"),y=-m/4;"y"===d[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),c.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===d[0]?c.attr({x:t.attr("x"),y:y-g/2}):"a"===d[0]?c.attr({x:0,y:y}):c.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):i(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},b={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",k=["http:","https:","mailto:","",void 0,":"],M=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,L=/(<[^<>]*>)/,C=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,z=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,P=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,D=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,E=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(M," ")},n.lineCount=function(t){return t.selectAll("tspan.line").size()||1},n.positionText=function(t,e,n){return t.each(function(){function t(t,e){return void 0===e?null===(e=r.attr(t))&&(r.attr(t,0),e=0):r.attr(t,e),e}var r=f.select(this),a=t("x",e),o=t("y",n);"text"===this.nodeName&&r.selectAll("tspan.line").attr({x:a,y:o})})},n.makeEditable=function(t,e){function n(){a(),t.style({opacity:0});var e,n=s.attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function r(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 n=f.select(o),a=n.select(".svg-container"),i=a.append("div");i.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(u(t,a,e)).on("blur",function(){o._editing=!1,t.text(this.textContent).style({opacity:1});var e,n=f.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),l.edit.call(t,r)}).on("focus",function(){var t=this;o._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===f.event.which?(o._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),l.cancel.call(t,this.textContent)):(l.input.call(t,this.textContent),f.select(this).call(u(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(r)}var o=e.gd,i=e.delegate,l=f.dispatch("edit","input","cancel"),s=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?n():s.on("click",n),f.rebind(t,l,"on")}},{"../constants/alignment":129,"../constants/string_mappings":132,"../constants/xmlns_namespaces":133,"../lib":148,d3:8}],166:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":11}],167:[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":210,"topojson-client":15}],168:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,a=r.layoutArrayContainers,o=r.layoutArrayRegexes,i=t.split("[")[0],l=0;l0)return t.substr(0,e)}var l=t("fast-isnumeric"),s=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),d=t("../plots/cartesian/axes"),h=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 a=d.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&i.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return i.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(d(v,m),h(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(n).map(Number).sort(l),L=e.get(),C=L||[],S=r(m,f).get(),z=[],O=-1,P=C.length;for(x=0;xC.length-(A?0:1))i.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&i.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?z.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),S&&S.splice(_,0,{})):i.warn("Unrecognized full object edit value",f,_,M),-1===O&&(O=_);else for(b=0;b=0;x--)C.splice(z[x],1),S&&S.splice(z[x],1);if(C.length?L||e.set(C):e.set(null),g)return!1;if(d(v,m),p!==o){var D;if(-1===O)D=T;else{for(P=Math.max(C.length,P),D=[],x=0;x=O);x++)D.push(_);for(x=O;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),l(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&l(t,n,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&sH.range[0]?[1,2]:[2,1]);else{var G=H.range[0],Y=H.range[1];V?(G<=0&&Y<=0&&n(R+".autorange",!0),G<=0?G=Y/1e6:Y<=0&&(Y=G/1e6),n(R+".range[0]",Math.log(G)/Math.LN10),n(R+".range[1]",Math.log(Y)/Math.LN10)):(n(R+".range[0]",Math.pow(10,G)),n(R+".range[1]",Math.pow(10,Y)))}else n(R+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,F,L,n),w.getComponentMethod("images","convertCoords")(t,F,L,n)}else n(R+".autorange",!0);x.nestedProperty(c,R+"._inputRange").set(null)}else if(E.match(D.AX_NAME_PATTERN)){var X=x.nestedProperty(c,A).get(),Z=(L||{}).type;Z&&"-"!==Z||(Z="linear"),w.getComponentMethod("annotations","convertCoords")(t,X,Z,n),w.getComponentMethod("images","convertCoords")(t,X,Z,n)}var W=z.containerArrayMatch(A);if(W){o=W.array,i=W.index;var Q=W.property,$=x.nestedProperty(s,o),J=($||[])[i]||{};if(""===i)-1===A.indexOf("updatemenus")&&(m.docalc=!0);else if(""===Q){var K=L;z.isAddVal(L)?_[A]=null:z.isRemoveVal(L)?(_[A]=J,K=J):x.warn("unrecognized full object value",e),(r(K,"x")||r(K,"y")&&-1===A.indexOf("updatemenus"))&&(m.docalc=!0)}else!r(J,"x")&&!r(J,"y")||x.containsAny(A,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);d[o]||(d[o]={});var tt=d[o][i];tt||(tt=d[o][i]={}),tt[Q]=L,delete e[A]}else if("reverse"===E)j.range?j.range.reverse():(n(R+".autorange",!0),j.range=[1,0]),F.autorange?m.docalc=!0:m.doplot=!0;else{var et=String(T.parts[1]||"");0===P.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===P.indexOf("geo")?m.doplot=!0:0===P.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===A?m.doplot=!0:"margin"===P||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?m.docalc=!0:!c._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!c._has("gl2d")||"dragmode"!==A||"lasso"!==L&&"select"!==L||"lasso"===B||"select"===B?"hiddenlabels"===A?m.docalc=!0:-1!==P.indexOf("legend")?m.dolegend=!0:-1!==A.indexOf("title")?m.doticks=!0:-1!==P.indexOf("bgcolor")?m.dolayoutstyle=!0:C>1&&x.containsAny(et,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:C>1&&-1!==et.indexOf("line")?m.dolayoutstyle=!0:C>1&&"mirror"===et?m.doticks=m.dolayoutstyle=!0:"margin.pad"===A?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(L)}}}for(o in d){z.applyContainerArrayChanges(t,x.nestedProperty(s,o),d[o],m)||(m.doplot=!0)}var nt=c._axisConstraintGroups;for(v in M)for(i=0;i=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=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(i._animationRaf),i._animationRaf=null}function f(){i._currentFrame&&i._currentFrame.onComplete&&i._currentFrame.onComplete();var e=i._currentFrame=i._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,i._lastFrameAt=Date.now(),i._timeToNext=e.frameOpts.duration,k.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else u()}function d(){t.emit("plotly_animating"),i._lastFrameAt=-1/0,i._timeToNext=0,i._runningTransitions=0,i._currentFrame=null;var e=function(){i._animationRaf=window.requestAnimationFrame(e),Date.now()-i._lastFrameAt>i._timeToNext&&f()};e()}function h(t){return Array.isArray(l)?v>=l.length?t.transitionOpts=l[v]:t.transitionOpts=l[0]:t.transitionOpts=l,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&MM)&&A.push(g);m=A}}m.length>0?function(e){if(0!==e.length){for(var l=0;l=0;a--)if(x.isPlainObject(e[a])){var d=(c[e[a].name]||{}).name,h=e[a].name;d&&h&&"number"==typeof h&&c[d]&&(r++,x.warn('addFrames: overwriting frame "'+c[d].name+'" with a frame whose name of type "number" also equates to "'+d+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:k.supplyFrameDefaults(e[a]),index:n&&void 0!==n[a]&&null!==n[a]?n[a]:u+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(o=f[a].frame,"number"==typeof o.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!o.name)for(;c[o.name="frame "+t._transitionData._counter++];);if(c[o.name]){for(i=0;i=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=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":57,"../components/errorbars":63,"../constants/xmlns_namespaces":133,"../lib":148,"../lib/events":141,"../lib/queue":160,"../lib/svg_text_utils":165,"../plotly":179,"../plots/cartesian/axis_ids":187,"../plots/cartesian/constants":189,"../plots/cartesian/constraints":191,"../plots/cartesian/graph_interact":193,"../plots/plots":225,"../plots/polar":228,"../registry":233,"./helpers":169,"./manage_arrays":170,"./subroutines":176,d3:8,"fast-isnumeric":11}],172:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],173:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=h.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,w(r,g),w(r,e.attributes),n.attributes&&w(r,n.attributes),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){ +d(r,n.schema.traces[t][e],e)})}),r.type=t;var a={meta:e.meta||{},attributes:l(r)};if(e.layoutAttributes){var o={};w(o,e.layoutAttributes),a.layoutAttributes=l(o)}return a}function a(){var t={};return w(t,v),Object.keys(h.subplotsRegistry).forEach(function(e){var n=h.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=u(t),Object.keys(h.componentsRegistry).forEach(function(e){var n=h.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){d(t,n.schema.layout[e],e)}):d(t,n.layoutAttributes,n.name))}),{layoutAttributes:l(t)}}function o(t){var e=h.transformsRegistry[t],n=w({},e.attributes);return Object.keys(h.componentsRegistry).forEach(function(e){var r=h.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){d(n,r.schema.transforms[t][e],e)})}),{attributes:l(n)}}function i(){var t={frames:p.extendDeep({},m)};return l(t),t.frames}function l(t){return s(t),c(t),t}function s(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)):!0===t.arrayOk&&(a[r+"src"]=e(r)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function c(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:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),a=w({},e.layoutAttributes);a[k]=!0,r.set(a)}function d(t,e,n){var r=p.nestedProperty(t,n);r.set(w(r.get()||{},e))}var h=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,k="_isSubplotObj",M="_isLinkedToArray",A=[k,M,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=k,n.IS_LINKED_TO_ARRAY=M,n.DEPRECATED="_deprecated",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]=o(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:i(),animation:l(y)}},n.crawl=function(t,e,r){var a=r||0;Object.keys(t).forEach(function(r){var o=t[r];-1===A.indexOf(r)&&(e(o,r,t,a),n.isValObject(o)||p.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){if(o=o.slice(0,l).concat([n]),e&&("data_array"===e.valType||!0===e.arrayOk)){var s=r(o),c=p.nestedProperty(t,s).get();Array.isArray(c)&&a.push(s)}}function r(t){return t.join(".")}var a=[],o=[];if(n.crawl(g,e),t._module&&t._module.attributes&&n.crawl(t._module.attributes,e),t.transforms)for(var i=t.transforms,l=0;l=t[1]||a[1]<=t[0])&&(o[0]e[0]))return!0}return!1}var a=t("d3"),o=t("../plotly"),i=t("../registry"),l=t("../plots/plots"),s=t("../lib"),c=t("../components/color"),u=t("../components/drawing"),f=t("../components/titles"),d=t("../components/modebar"),h=t("../plots/cartesian/graph_interact");n.layoutStyles=function(t){return s.syncOrAsync([l.doAutoMargin,n.lsInner],t)},n.lsInner=function(t){var e,i=t._fullLayout,l=i._size,s=o.Axes.list(t);for(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.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)})})}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":148,"../plotly":179,"../snapshot/cloneplot":234,"../snapshot/helpers":237,"../snapshot/svgtoimg":239,"../snapshot/tosvg":241,"fast-isnumeric":11}],178:[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;m.3*f||o(r)||o(a))){var d=n.dtick/2;t+=t+d.8){var i=Number(n.substr(1));o.exactYears>.8&&i%12==0?t=E.tickIncrement(t,"M6","reverse")+1.5*z:o.exactMonths>.8?t=E.tickIncrement(t,"M1","reverse")+15.5*z:t-=z/2;var l=E.tickIncrement(t,n);if(l<=r)return l}return t}function o(t){var e,n,r=t.tickvals,a=t.ticktext,o=new Array(r.length),i=_.simpleMap(t.range,t.r2l),l=1.0001*i[0]-1e-4*i[1],c=1.0001*i[1]-1e-4*i[0],u=Math.min(l,c),f=Math.max(l,c),d=0;Array.isArray(a)||(a=[]);var h="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),n=0;nu&&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=t.l2r(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 s(t,e,n){var r=t.tickfont||{};return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function c(t,e,n,r){var a=t._tickround,o=n&&t.hoverformat||t.tickformat;r&&(a=x(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var i,l=_.formatDate(e.x,o,a,t.calendar),s=l.indexOf("\n");-1!==s&&(i=l.substr(s+1),l=l.substr(0,s)),r&&("00:00:00"===l||"00:00"===l?(l=i,i=""):8===l.length&&(l=l.replace(/:00$/,""))),i&&(n?"d"===a?l+=", "+i:l=i+(l?", "+l:""):t._inCalcTicks&&i===t._prevDateHead||(l+="
"+i,t._prevDateHead=i)),e.text=l}function u(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=h(Math.pow(10,i),t,a,r);else if(x(o)||"D"===o.charAt(0)&&_.mod(i+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var l=Math.round(i);e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10\u2212"+-l+"",e.fontSize*=1.25}else e.text=h(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,_.mod(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 f(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function d(t,e,n,r,a){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(a="hide"),e.text=h(e.x,t,a,r)}function h(t,e,n,r){var a=t<0,o=e._tickround,i=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]};l(f),o=(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,-o)/2;if("none"===i&&(s=0),(t=Math.abs(t))12||s<-15)?t+="e"+g:"E"===i?t+="E"+g:"power"===i?t+="\xd710"+g+"":"B"===i&&9===s?t+="B":"SI"!==i&&"B"!==i||(t+=V[s/3+5])}return a?"\u2212"+t:t}function p(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,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(),_.simpleMap(n,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var n=t._input;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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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);m&&"domain"===t.constrain&&t._inputDomain&&(m*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),w=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),k=r(n.vpadplus||n.vpad),M=r(n.vpadminus||n.vpad);for(o=0;o<6;o++)a(o);for(o=v-1;o>5;o--)a(o)}},E.autoBin=function(t,e,n,o,i){var l=_.aggNums(Math.min,null,t),s=_.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:l-.5,end:s+.5,size:1};var c;if(n)c=(s-l)/n;else{var u=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(u.minDiff)/Math.LN10)),d=f*_.roundUp(u.minDiff/f,[.9,1.9,4.9,9.9],!0);c=Math.max(d,2*_.stdev(t)/Math.pow(t.length,o?.25:.4)),x(c)||(c=1)}var h;h="log"===e.type?{type:"linear",range:[l,s]}:{type:e.type,range:_.simpleMap([l,s],e.c2r,0,i),calendar:i},E.setConvert(h),E.autoTicks(h,c);var p,g=E.tickIncrement(E.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick){g=r(g,t,h,l,s);p=g+(1+Math.floor((s-g)/h.dtick))*h.dtick}else for("M"===h.dtick.charAt(0)&&(g=a(g,t,h.dtick,l,i)),p=g;p<=s;)p=E.tickIncrement(p,h.dtick,!1,i);return{start:e.c2r(g,0,i),end:e.c2r(p,0,i),size:h.dtick}},E.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var n,r=t.nticks;r||("category"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/n):(n="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/n,4,9)+1)),"array"===t.tickmode&&(r*=100),E.autoTicks(t,Math.abs(e[1]-e[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),l(t),"array"===t.tickmode)return o(t);t._tmin=E.tickFirst(t);var a=e[1]=s:c<=s)&&(i.push(c),!(i.length>1e3));c=E.tickIncrement(c,t.dtick,a,t.calendar));t._tmax=i[i.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(i.length),f=0;fC?(e/=C, +n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*i(e,n,I)):r>S?(e/=S,t.dtick="M"+i(e,1,j)):r>z?(t.dtick=i(e,z,B),t.tick0=_.dateTick0(t.calendar,!0)):r>O?t.dtick=i(e,O,j):r>P?t.dtick=i(e,P,F):r>D?t.dtick=i(e,D,F):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=i(e,n,I))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,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,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=i(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)}},E.tickIncrement=function(t,e,n,r){var a=n?-1:1;if(x(e))return t+a*e;var o=e.charAt(0),i=a*Number(e.substr(1));if("M"===o)return _.incrementMonth(t,i,r);if("L"===o)return Math.log(Math.pow(10,t)+i)/Math.LN10;if("D"===o){var l="D2"===e?H:q,s=t+.01*a,c=_.roundUp(_.mod(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=_.simpleMap(t.range,e),r=n[1]1&&e2*a}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,e){return a(t,e)?"date":o(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":131,"../../lib":148,"fast-isnumeric":11}],186:[function(t,e,n){"use strict";var r=t("tinycolor2").mix,a=t("../../registry"),o=t("../../lib"),i=t("../../components/color/attributes").lightFraction,l=t("./layout_attributes"),s=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),f=t("./category_order_defaults"),d=t("./set_convert"),h=t("./ordered_categories");e.exports=function(t,e,n,p,g){function v(n,r){return o.coerce2(t,e,l,n,r)}var m=p.letter,y=p.font||{},x="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",b=n("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(d(e,g),n("autorange",!e.isValidRange(t.range))&&n("rangemode"),n("range"),e.cleanRange(),f(t,e,n),e._initialCategories="category"===_?h(m,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=n("color"),k=w===t.color?w:y.color;n("title",x),o.coerceFont(n,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:k}),s(t,e,n,_),u(t,e,n,_,p),c(t,e,n,p);var M=v("linecolor",w),A=v("linewidth"),T=n("showline",!!M||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&n("mirror");var L=v("gridcolor",r(w,p.bgColor,i).toRgbString()),C=v("gridwidth");n("showgrid",p.showGrid||!!L||!!C)||(delete e.gridcolor,delete e.gridwidth);var S=v("zerolinecolor",w),z=v("zerolinewidth");return n("zeroline",p.showGrid||!!S||!!z)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":32,"../../lib":148,"../../registry":233,"./category_order_defaults":188,"./layout_attributes":195,"./ordered_categories":197,"./set_convert":201,"./tick_label_defaults":202,"./tick_mark_defaults":203,"./tick_value_defaults":204,tinycolor2:14}],187:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),a=/^[xyz]axis[0-9]*/,o=[],i=0;i0;o&&(r="array");var i=n("categoryorder",r);"array"===i&&n("categoryarray"),o||"array"!==i||(e.categoryorder="trace")}}},{}],189:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],190:[function(t,e,n){"use strict";function r(t,e,n,r){var a,o,l,s,c=r[i(e)].type,u=[];for(o=0;oi*m)||_)for(n=0;nO&&DS&&(S=D);var R=(S-C)/(2*z);f/=R,C=s.l2r(C),S=s.l2r(S),s.range=s._input.range=A=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function c(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function u(t,e,n,r,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+n+", "+r+")").attr("d",a+"Z")}function f(t,e,n){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+n+")").attr("d","M0,0Z")}function d(t){t.selectAll(".select-outline").remove()}function h(t,e,n,r,a,o){t.attr("d",r+"M"+n.l+","+n.t+"v"+n.h+"h"+n.w+"v-"+n.h+"h-"+n.w+"Z"),a||(t.transition().style("fill",o>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function v(t,e){return"M"+(t.l-.5)+","+(e-j-.5)+"h-3v"+(2*j+1)+"h3ZM"+(t.r+.5)+","+(e-j-.5)+"h3v"+(2*j+1)+"h-3Z"}function m(t,e){return"M"+(e-j-.5)+","+(t.t-.5)+"v-3h"+(2*j+1)+"v3ZM"+(e-j-.5)+","+(t.b+.5)+"v3h"+(2*j+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,j)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,n){var r,a,o,i,l,s,c=!1,u={},f={};for(r=0;rj||l>j?(Mt="xy",i/ot>l/it?(l=i*it/ot,xt>o?bt.t=xt-l:bt.b=xt+l):(i=l*ot/it,yt>a?bt.l=yt-i:bt.r=yt+i),Tt.attr("d",y(bt))):r():!st||lzoom back out","long"),F=!1)}function X(e,n){var r=1===(q+H).length;if(e)J();else if(2!==n||r){if(1===n&&r){var a=q?nt[0]:et[0],i="s"===q||"w"===H?0:1,l=a._name+".range["+i+"]",s=o(a,i),c="left",u="middle";if(a.fixedrange)return;q?(u="n"===q?"top":"bottom","right"===a.side&&(c="right")):"e"===H&&(c="right"),t._context.showAxisRangeEntryBoxes&&b.select(vt).call(A.makeEditable,{gd:t,immediate:!0,background:ht.paper_bgcolor,text:String(s),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:c,verticalAlign:u}).on("edit",function(e){var n=a.d2r(e);void 0!==n&&w.relayout(t,l,n)})}}else $()}function Z(e){function n(t,e,n){function r(e){return t.l2r(o+(e-o)*n)}if(!t.fixedrange){var a=M.simpleMap(t.range,t.r2l),o=a[0]+(a[1]-a[0])*e;t.range=a.map(r)}}if(t._context.scrollZoom||ht._enablescrollzoom){if(t._transitioningWithDuration)return M.pauseEvent(e);var r=t.querySelector(".plotly");if(V(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(St);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void M.log("Did not find wheel motion attributes: ",e);var o,i=Math.exp(-Math.min(Math.max(a,-20),20)/100),l=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-l.left)/l.width,c=(l.bottom-e.clientY)/l.height;if(H||ut){for(H||(s=.5),o=0;ou[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":148,"fast-isnumeric":11}],199:[function(t,e,n){"use strict";var r=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,n){void 0===n&&(n=r[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],o=a[0]+(a[1]-a[0])*n;t.range=t._input.range=[t.l2r(o+(a[0]-o)*e),t.l2r(o+(a[1]-o)*e)]}},{"../../constants/alignment":129}],200:[function(t,e,n){"use strict";function r(t){return t._id}function a(t,e){if(Array.isArray(t))for(var n=e.cd[0].trace,r=0;r0)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*w*Math.abs(r-a))}return h}function f(e,n,r){var a=c(e,r||t.calendar);if(a===h){if(!o(e))return h;a=c(new Date(+e))}return a}function v(e,n,r){return s(e,n,r||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var n=t._categories.length-1;return t._categoriesMap[e]=n,n}return h}function x(e){if(t._categoriesMap){var n=t._categoriesMap[e];if(void 0!==n)return n}if(o(e))return+e}function b(e){return o(e)?a.round(t._b+t._m*e,2):h}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?n:u,t.l2c="log"===t.type?r:u,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(n(t,e))}:b,t.p2c="log"===t.type?function(t){return r(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=u,t.d2p=t.r2p=function(e){return t.l2p(l(e))},t.p2d=t.p2r=_,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return n(l(t),e)},t.r2d=t.r2c=function(t){return r(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=u,t.c2r=n,t.l2d=r,t.d2p=function(e,n){return t.l2p(t.d2r(e,n))},t.p2d=function(t){return r(_(t))},t.r2p=function(e){return t.l2p(l(e))},t.p2r=_,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=i.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(e,n,r){return t.l2p(f(e,0,r))},t.p2d=t.p2r=function(t,e,n){return v(_(t),e,n)},t.cleanPos=function(e){return i.cleanDate(e,h,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2r=t.d2l_noadd=x,t.r2c=function(e){var n=x(e);return void 0!==n?n:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return m(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}),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.cleanRange=function(e){e||(e="range");var n,r,a=i.nestedProperty(t,e).get(),l=(t._id||"x").charAt(0);if(r="date"===t.type?i.dfltRange(t.calendar):"y"===l?p.DFLTRANGEY:p.DFLTRANGEX,r=r.slice(),!a||2!==a.length)return void i.nestedProperty(t,e).set(r);for("date"===t.type&&(a[0]=i.cleanDate(a[0],h,t.calendar),a[1]=i.cleanDate(a[1],h,t.calendar)),n=0;n<2;n++)if("date"===t.type){if(!i.isDateTime(a[n],t.calendar)){t[e]=r;break}if(t.r2l(a[0])===t.r2l(a[1])){var s=i.constrain(t.r2l(a[0]),i.MIN_MS+1e3,i.MAX_MS-1e3);a[0]=t.l2r(s-1e3),a[1]=t.l2r(s+1e3);break}}else{if(!o(a[n])){if(!o(a[1-n])){t[e]=r;break}a[n]=a[1-n]*(n?10:.1)}if(a[n]<-d?a[n]=-d:a[n]>d&&(a[n]=d),a[0]===a[1]){var c=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=c,a[1]+=c}}},t.setScale=function(n){var r=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var o=g.getFromId({_fullLayout:e},t.overlaying);t.domain=o.domain}var l=n&&t._r?"_r":"range",s=t.calendar;t.cleanRange(l);var c=t.r2l(t[l][0],s),u=t.r2l(t[l][1],s);if("y"===a?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c),!isFinite(t._m)||!isFinite(t._b))throw i.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,n){var r,a,o,i="date"===t.type&&e[n+"calendar"];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?a.dateTick0(e.calendar):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":131,"../../lib":148,"fast-isnumeric":11}],205:[function(t,e,n){"use strict";var r=t("d3"),a=t("../../plotly"),o=t("../../registry"),i=t("../../components/drawing"),l=t("./axes"),s=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,c){function u(e,n){function r(e,n){for(a=0;an.duration?(h(),M=window.cancelAnimationFrame(g)):M=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(l),i[l]=o}return i}(e),x=Object.keys(y),b=function(t,e,n){var r,a,o,i=t._plots,l=[];for(r in i){var s=i[r];if(-1===l.indexOf(s)){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]||-1===e.indexOf(c)&&-1===e.indexOf(u)||l.push(s)}}return l}(v,x,y);if(!b.length)return!1;var _;c&&(_=c());var w,k,M,A=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(M),M=null,p()}),w=Date.now(),M=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":57,"../../plotly":179,"../../registry":233,"./axes":184,d3:8}],206:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);-1!==n.indexOf("scene")&&(n=r);var c=a(e,n,r);if(c){if("histogram"===c.type&&r==={v:"y",h:"x"}[c.orientation||"v"])return void(t.type="linear");var u=r+"calendar",f=c[u];if(i(c,r)){for(var d,h=o(c),p=[],g=0;g0?".":"")+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;fe*Math.PI/180},w.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":33,"../../components/drawing":57,"../../components/fx":74,"../../lib/topojson_utils":167,"../cartesian/axes":184,"../plots":225,"./constants":210,"./projections":218,"./set_scale":219,"./zoom":220,"./zoom_reset":221,d3:8,"topojson-client":15}],212:[function(t,e,n){"use strict";var r=t("./geo"),a=t("../../plots/plots");n.name="geo",n.attr="geo",n.idRoot="geo",n.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,n.attributes=t("./layout/attributes"),n.layoutAttributes=t("./layout/layout_attributes"),n.supplyLayoutDefaults=t("./layout/defaults"),n.plot=function(t){var e=t._fullLayout,n=t.calcdata,o=a.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var i=0;ir^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?O:t<-1?-O:Math.asin(t)}function s(t){return t>1?0:t<-1?z:Math.acos(t)}function c(t,e){var n=(2+O)*Math.sin(e);e/=2;for(var r=0,a=1/0;r<10&&Math.abs(a)>C;r++){var o=Math.cos(e);e-=a=(e+Math.sin(e)*(o+2)-n)/(2*o*(1+o))}return[2/Math.sqrt(z*(4+z))*t*(1+Math.cos(e)),2*Math.sqrt(z/(4+z))*Math.sin(e)]}function u(t,e){function n(n,r){var a=R(n/e,r);return a[0]*=t,a}return arguments.length<2&&(e=t),1===e?R:e===1/0?d:(n.invert=function(n,r){var a=R.invert(n/t,r);return a[0]*=e,a},n)}function f(){var t=2,e=N(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*z)*Math.sqrt(z*z/3-e*e),e]}function p(t,e){return[t,1.25*Math.log(Math.tan(z/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)>C&&--a>0);return e/2}}function v(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function m(t,e){var n,r=Math.min(18,36*Math.abs(e)/z),a=Math.floor(r),o=r-a,i=(n=j[a])[0],l=n[1],s=(n=j[++a])[0],c=n[1],u=(n=j[Math.min(19,++a)])[0],f=n[1];return[t*(s+o*(u-i)/2+o*o*(u-2*s+i)/2),(e>0?O:-O)*(c+o*(f-l)/2+o*o*(f-2*c+l)/2)]}function y(t,e){return[t*Math.cos(e),e]}function x(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 b(t,e){var n=x(t,e);return[(n[0]+t/O)/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&&_.hasOwnProperty(t.type)?_[t.type]:n)(t,r)};var _={Feature:e,FeatureCollection:function(t,n){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,n)})}}},w=[],k=[],M={point:function(t,e){w.push([t,e])},result:function(){var t=w.length?w.length<2?{type:"Point",coordinates:w[0]}:{type:"MultiPoint",coordinates:w}:null;return w=[],t}},A={lineStart:r,point:function(t,e){w.push([t,e])},lineEnd:function(){w.length&&(k.push(w),w=[])},result:function(){var t=k.length?k.length<2?{type:"LineString",coordinates:k[0]}:{type:"MultiLineString",coordinates:k}:null;return k=[],t}},T={polygonStart:r,lineStart:r,point:function(t,e){w.push([t,e])},lineEnd:function(){var t=w.length;if(t){do{w.push(w[0].slice())}while(++t<4);k.push(w),w=[]}},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}},L={Point:M,MultiPoint:M,LineString:A,MultiLineString:A,Polygon:T,MultiPolygon:T,Sphere:T},C=1e-6,S=C*C,z=Math.PI,O=z/2,P=(Math.sqrt(z),z/180),D=180/z,E=t.geo.projection,N=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]/z,c=180*i[0][1]/z,u=180*i[1][1]/z,f=180*i[2][0]/z,d=180*i[2][1]/z;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=[];++oC&&--a>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},(t.geo.naturalEarth=function(){return E(v)}).raw=v;var j=[[.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]];j.forEach(function(t){t[1]*=1.0144}),m.invert=function(t,e){var n=e/O,r=90*n,a=Math.min(18,Math.abs(r/5)),o=Math.max(0,Math.floor(a));do{var i=j[o][1],l=j[o+1][1],s=j[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=j[o][1],l=j[o+1][1],s=j[Math.min(19,o+2)][1],r-=(p=(e>=0?O:-O)*(l+h*(s-i)/2+h*h*(s-2*l+i)/2)-e)*D}while(Math.abs(p)>S&&--g>0);break}}while(--o>=0);var v=j[o][0],m=j[o+1][0],y=j[Math.min(19,o+2)][0];return[t/(m+h*(y-v)/2+h*h*(y-2*m+v)/2),r*P]},(t.geo.robinson=function(){return E(m)}).raw=m,y.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return E(y)}).raw=y,x.invert=function(t,e){if(!(t*t+4*e*e>z*z+C)){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,v=1-p*c*c,m=v?s(f*c)*Math.sqrt(o=1/v):o=0,y=2*m*f*l-t,x=m*u-e,b=o*(p*g+m*f*c*h),_=o*(.5*i*d-2*m*u*l),w=.25*o*(d*l-m*u*p*i),k=o*(h*c+m*g*f),M=_*w-k*b;if(!M)break;var A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>C||Math.abs(T)>C)&&--a>0);return[n,r]}},(t.geo.aitoff=function(){return E(x)}).raw=x,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,v=1-f*h*h,m=v?s(i*h)*Math.sqrt(o=1/v):o=0,y=.5*(2*m*i*p+n/O)-t,x=.5*(m*l+r)-e,b=.5*o*(f*g+m*i*h*u)+.5/O,_=o*(d*c/4-m*l*p),w=.125*o*(c*p-m*l*f*d),k=.5*o*(u*h+m*g*i)+.5,M=_*w-k*b,A=(x*_-y*k)/M,T=(y*w-x*b)/M;n-=A,r-=T}while((Math.abs(A)>C||Math.abs(T)>C)&&--a>0);return[n,r]},(t.geo.winkel3=function(){return E(b)}).raw=b}e.exports=r},{}],219:[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,v=r._fullRange[0]+l,m=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],k=n._rotate;return n._center=[w[0]+k[0],w[1]+k[1]],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,k=a(d,p,h,g),M=a(v,y,m,x);s=o(e,k),i=r(s),b=o(e,M),n._fullScale=r(b),e.scale(i),s=o(e,k),l=[w[0]-s[0][0]+c,w[1]-s[0][1]+c],n._translate=l,e.translate(l),s=o(e,k),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}}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":210,d3:8}],220:[function(t,e,n){"use strict";function r(t,e){return(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(M)}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 v.invert(t)}function r(t){var e=v(n(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function o(){_.select(this).style(M),s=_.mouse(this),c=v.rotate(),u=v.translate(),f=c,d=n(s)}function i(){if(h=_.mouse(this),r(s))return m.scale(v.scale()),void m.translate(v.translate());v.scale(_.event.scale),v.translate([u[0],_.event.translate[1]]),d?n(h)&&(g=n(h),p=[f[0]+(g[0]-d[0]),c[1],c[2]],v.rotate(p),f=p):(s=h,d=n(s)),t.render()}function l(){_.select(this).style(A)}var s,c,u,f,d,h,p,g,v=t.projection,m=a(v,e),y=2;return m.on("zoomstart",o).on("zoom",i).on("zoomend",l),m}function l(t,e){function n(t){m++||t({type:"zoomstart"})}function r(t){t({type:"zoom"})}function o(t){--m||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"),m=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(M);var t=_.mouse(this),e=l.rotate(),a=e,o=l.translate(),m=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=v(u(m,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])&&m(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)*k,p=Math.sqrt(i*i+l*l);Math.abs(u)>p?(o=(u>0?90:-90)-d,a=0):(o=Math.asin(u/p)*k-d,a=Math.sqrt(p*p-u*u));var v=180-o-2*d,m=(Math.atan2(f,c)-Math.atan2(s,a))*k,y=(Math.atan2(f,c)-Math.atan2(s,-a))*k;return h(n[0],n[1],o,m)<=h(n[0],n[1],v,y)?[o,m,n[2]]:[v,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 v(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*k,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*k,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*k]}function m(t){var e=t[0]*w,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()?" - ":"")}},v.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"});return r.append("input").attr({type:"text",name:"data"}).node().value=v.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},v.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||v.createTransitionData(t),n._initialAutoSizeIsDone){var c=n.width,f=n.height;v.supplyLayoutGlobalDefaults(o,r),o.width||(r.width=c),o.height||(r.height=f)}else{v.supplyLayoutGlobalDefaults(o,r);var d=!o.width||!o.height,h=r.autosize,p=t._context&&t._context.autosizable;d&&(h||p)?v.plotAutoSize(t,o,r):d&&v.sanitizeMargins(t),!h&&d&&(o.width=r.width,o.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,v.supplyDataDefaults(s,l,o,r),r._has=v._hasPlotType.bind(r);var g=r._modules;for(e=0;e0){var u=i(t._boundingBoxMargins),f=u.left+u.right,d=u.bottom+u.top,p=1-2*l,g=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-d))}else{var m=s?window.getComputedStyle(t):{};r=parseFloat(m.width)||n.width,a=parseFloat(m.height)||n.height}var y=v.layoutAttributes.width.min,x=v.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}),v.sanitizeMargins(n)},v.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];r._replotting||v.doAutoMargin(t)}},v.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(!1!==e.margin.autoexpand){s.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:i},b:{val:0,size:l}};for(var f=Object.keys(s),d=0;dv){var M=(m*w+(k-e.width)*v)/(w-v),A=(k*(1-v)+(m-e.width)*(1-w))/(w-v);M>=0&&A>=0&&M+A>a+o&&(a=M,o=A)}}if(c(x)&&s[_].t){var T=s[_].t.val,L=s[_].t.size;if(T>y){var C=(x*T+(L-e.height)*y)/(T-y),S=(L*(1-y)+(x-e.height)*(1-T))/(T-y);C>=0&&S>=0&&C+S>l+i&&(l=C,i=S)}}}}if(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,!e._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},v.graphJson=function(t,e,n,r,a){function o(t){if("function"==typeof t)return null;if(h.isPlainObject(t)){var e,r,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if("string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==n&&"string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0)continue;a[e]=o(t[e])}return a}return Array.isArray(t)?t.map(o):h.isJSDate(t)?h.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&v.supplyDefaults(t);var i=a?t._fullData:t.data,l=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames,c={data:(i||[]).map(function(t){var n=o(t);return e&&delete n.fit,n})};return e||(c.layout=o(l)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),s&&(c.frames=o(s)),"object"===r?c:JSON.stringify(c)},v.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(){b=!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,d=t._fullLayout._basePlotModules,p=!1;if(n)for(l=0;l=0,C=L?f.angularAxis.domain:r.extent(k),S=Math.abs(k[1]-k[0]);A&&!M&&(S=0);var z=C.slice();T&&M&&(z[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(z[1]-z[0])/O);var P=f.angularAxis.ticksStep||(z[1]-z[0])/(O*(f.minorTicks+1));w&&(P=Math.max(Math.round(P),1)),z[2]||(z[2]=P);var D=r.range.apply(this,z);if(D=D.map(function(t,e){return parseFloat(t.toPrecision(12))}),l=r.scale.linear().domain(z.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=l.domain(),u.layout.angularAxis.endPadding=T?S:0,void 0===(e=r.select(this).select("svg.chart-root"))||e.empty()){var E=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),N=this.appendChild(this.ownerDocument.importNode(E.documentElement,!0));e=r.select(N)}e.select(".guides-group").style({"pointer-events":"none"}),e.select(".angular.axis-group").style({"pointer-events":"none"}),e.select(".radial.axis-group").style({"pointer-events":"none"});var R,I=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},F={"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){R=e.select(".legend-group").attr({transform:"translate("+[x,f.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:R,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=R.node().getBBox();x=Math.min(f.width-q.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(),R.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else R=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),I.attr("transform","translate("+_+")").style({cursor:"crosshair"});var H=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.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 V=e.select("g.title-group text").style(F).text(f.title),U=V.node().getBBox();V.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(j),Y.attr("r",a),Y.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(j);var X=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Z=r.svg.axis().scale(a).ticks(5).tickSize(5);G.call(Z).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(j),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(F).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,F["font-size"]]+")":"translate("+[0,F["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+s(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.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),Q.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(F);var $=W.select("text.axis-text").attr({x:x+f.labelOffset,dy:".35em",transform:function(t,e){var n=s(t,e),r=x+f.labelOffset,a=f.angularAxis.tickOrientation;return"horizontal"==a?"rotate("+-n+" "+r+" 0)":"radial"==a?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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(F);f.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var J=r.max(I.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));R.attr({transform:"translate("+[x+J,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(h);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),h[0]||K){var et=[];h.forEach(function(t,e){var n={};n.radialScale=a,n.angularScale=l,n.container=tt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,et.push({data:t,geometryConfig:n})});var nt=r.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),rt=[];nt.forEach(function(t,e){"unstacked"===t.key?rt=rt.concat(t.values.map(function(t,e){return[t]})):rt.push(t.values)}),rt.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 at,ot,it=e.select(".guides-group"),lt=e.select(".tooltips-group"),st=i.tooltipPanel().config({container:lt,fontSize:8})(),ct=i.tooltipPanel().config({container:lt,fontSize:8})(),ut=i.tooltipPanel().config({container:lt,hasTick:!0})();if(!M){var ft=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",function(t,e){var n=i.util.getMousePos(X).angle;ft.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5}) +;var r=(n+180+360-f.orientation)%360;at=l.invert(r);var a=i.util.convertToCartesian(x+12,n+180);st.text(i.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var dt=it.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",function(t,e){var n=i.util.getMousePos(X).radius;dt.attr({r:n}).style({opacity:.5}),ot=a.invert(i.util.getMousePos(X).radius);var r=i.util.convertToCartesian(n,f.radialAxis.orientation);ct.text(i.util.round(ot)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){dt.style({opacity:0}),ut.hide(),st.hide(),ct.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])};M&&(c.t=w[t[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),d=e.node().getBoundingClientRect(),h=[f.left+f.width/2-H[0]-d.left,f.top+f.height/2-H[1]-d.top];ut.config({color:l}).text(u),ut.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){if(0!=r.event.which)return!1;r.select(this).attr("data-fill")&&ut.show()}).on("mouseout.tooltip",function(t,e){ut.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}}},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;return r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180;return[e,t(r)]})},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(void 0===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-2===n},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;return[t*Math.cos(n),t*Math.sin(n)]},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 a[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return void 0===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=[i.PolyChart.defaultConfig()],n=r.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,n){e[n]||(e[n]={}),o(e[n],i.PolyChart.defaultConfig()),o(e[n],t)}),this):e},t.getColorScale=function(){},r.rebind(t,n,"on"),t},i.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}}},i.BarChart=function(){return i.PolyChart()},i.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},i.AreaChart=function(){return i.PolyChart()},i.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},i.DotPlot=function(){return i.PolyChart()},i.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},i.LinePlot=function(){return i.PolyChart()},i.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},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||void 0===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":-1!=r.svg.symbolTypes.indexOf(t)?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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},i.tooltipPanel=function(){var t,e,n,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},l="tooltip-"+i.tooltipPanel.uid++,s=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+10,dy:.3*+a.fontSize}),s};return s.text=function(o){var i=r.hsl(a.color).l,l=i>=.5?"#aaa":"white",c=i>=.5?"black":"white",u=o||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(u);var f=a.padding,d=e.node().getBBox(),h={fill:a.color,stroke:l,"stroke-width":"2px"},p=d.width+2*f+10,g=d.height+2*f;return n.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(h),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return o(a,t),s},s},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);return[[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"]]].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",!0===r.dotVisible?(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);-1!=r&&(n.data[e].groupId=r)})}if(t.layout){var l=o({},t.layout);if([[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"]]].forEach(function(t,n){i.util.translator.apply(null,t.concat(e))}),e?(void 0!==l.tickLength&&(l.angularaxis.ticklen=l.tickLength,delete l.tickLength),l.tickColor&&(l.angularaxis.tickcolor=l.tickColor,delete l.tickColor)):(l.angularAxis&&void 0!==l.angularAxis.ticklen&&(l.tickLength=l.angularAxis.ticklen),l.angularAxis&&void 0!==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&&void 0!==l.margin.t){var s=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};r.entries(l.margin).forEach(function(t,e){u[c[s.indexOf(t.key)]]=t.value}),l.margin=u}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":148,d3:8}],230:[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":33,"../../lib":148,"./micropolar":229,"./undo_manager":231,d3:8}],231:[function(t,e,n){"use strict";e.exports=function(){function t(t,e){return t?(a=!0,t[e](),a=!1,this):this}var e,n=[],r=-1,a=!1;return{add:function(t){return a?this:(n.splice(r+1,n.length-r),n.push(t),r=n.length-1,this)},setCallback:function(t){e=t},undo:function(){var a=n[r];return a?(t(a,"undo"),r-=1,e&&e(a.undo),this):this},redo:function(){var a=n[r+1];return a?(t(a,"redo"),r+=1,e&&e(a.redo),this):this},clear:function(){n=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return 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)),d=t._context||{};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;n")?"":e.html(t).text()});return e.remove(),n}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var o=t("d3"),i=t("../components/drawing"),l=t("../components/color"),s=t("../constants/xmlns_namespaces"),c=/"/g,u=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var n,f=t._fullLayout,d=f._paper,h=f._toppaper;d.insert("rect",":first-child").call(i.setRect,0,0,f.width,f.height).call(l.fill,f.paper_bgcolor);var p=f._basePlotModules||[];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"})}},{"../../components/colorscale/defaults":42,"../../lib":148,"./attributes":242}],245:[function(t,e,n){"use strict";e.exports=function(t,e){return t.location=e.location,t.z=e.z,t}},{}],246:[function(t,e,n){"use strict";function r(t,e,n,r){var i=e.hoverinfo,l="all"===i?o.hoverinfo.flags:i.split("+"),s=-1!==l.indexOf("name"),c=-1!==l.indexOf("location"),u=-1!==l.indexOf("z"),f=-1!==l.indexOf("text"),d=!s&&c,h=[];d?t.nameOverride=n.id:(s&&(t.nameOverride=e.name),c&&h.push(n.id)),u&&h.push(function(t){return a.tickText(r,r.c2l(t),"hover").text}(n.z)),f&&h.push(n.tx),t.extraText=h.join("
")}var a=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t){var e=t.cd,n=e[0].trace,a=t.subplot,o=a.choroplethHoverPt;if(o){var i=a.projection(o.properties.ct);return t.x0=t.x1=i[0],t.y0=t.y1=i[1],t.index=o.index,t.location=o.id,t.z=o.z,r(t,n,o,a.mockAxis),[t]}}},{"../../plots/cartesian/axes":184,"./attributes":242}],247:[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"), +r.hoverPoints=t("./hover"),r.eventData=t("./event_data"),r.moduleType="trace",r.name="choropleth",r.basePlotModule=t("../../plots/geo"),r.categories=["geo","noOpacity"],r.meta={},e.exports=r},{"../../plots/geo":212,"../heatmap/colorbar":249,"./attributes":242,"./calc":243,"./defaults":244,"./event_data":245,"./hover":246,"./plot":248}],248:[function(t,e,n){"use strict";function r(t,e){for(var n,r=[],a=t.locations,o=a.length,i=c(t,e),l=(t.marker||{}).line||{},s=0;s0&&(r[0].trace=t),r}function a(t){t.framework.selectAll("g.trace.choropleth").each(function(t){var e=t[0].trace,n=o.select(this),r=e.marker||{},a=r.line||{},c=s.makeColorScaleFunc(s.extractScale(e.colorscale,e.zmin,e.zmax));n.selectAll("path.choroplethlocation").each(function(t){o.select(this).attr("fill",function(t){return c(t.z)}).call(i.stroke,t.mlc||a.color).call(l.dashLine,"",t.mlw||a.width||0)})})}var o=t("d3"),i=t("../../components/color"),l=t("../../components/drawing"),s=t("../../components/colorscale"),c=t("../../lib/topojson_utils").getTopojsonFeatures,u=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),d=t("../../plots/geo/constants");e.exports=function(t,e,n){function i(t){return t[0].trace.uid}var l,s=t.framework,c=s.select("g.choroplethlayer"),u=s.select("g.baselayer"),f=s.select("g.baselayeroverchoropleth"),h=d.baseLayersOverChoropleth,p=c.selectAll("g.trace.choropleth").data(e,i);p.enter().append("g").attr("class","trace choropleth"),p.exit().remove(),p.each(function(e){var n=e[0].trace,a=r(n,t.topojson),i=o.select(this).selectAll("path.choroplethlocation").data(a);i.enter().append("path").classed("choroplethlocation",!0).on("mouseover",function(e){t.choroplethHoverPt=e}).on("mouseout",function(){t.choroplethHoverPt=null}),i.exit().remove()}),f.selectAll("*").remove();for(var g=0;gg&&h.splice(g,h.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(i.hasMarkers(e)){if(n=e.marker,c=n.size,Array.isArray(c)){var y={type:"linear"};a.setConvert(y),c=y.makeCalcdata(e.marker,"size"),c.length>g&&c.splice(g,c.length-g)}var x,b=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(c)?c.map(x):x(c)}l(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(i.hasMarkers(e)||i.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,a.expand(f,h,v),a.expand(d,p,m);var _=new Array(g);for(u=0;u=0;a--){var o=t[a];if("scatter"===o.type&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=void 0;break}}}}}},{}],255:[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":36,"../../components/colorscale":47,"../../lib":148,"../../plots/plots":225,"fast-isnumeric":11}],256:[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":39,"../../components/colorscale/has_colorscale":46,"./subtypes":272}],257:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],258:[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,p,g),m=vH!=E>=H&&(O=S[L-1][0],P=S[L][0],z=O+(P-O)*(H-D)/(E-D),j=Math.min(j,z),F=Math.max(F,z));j=Math.max(j,0),F=Math.min(F,d._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:s+10,x0:j,x1:F,y0:H,y1:H,color:V}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":33,"../../components/errorbars":63,"../../components/fx":74,"../../lib":148,"./get_trace_color":260}],262:[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":194,"./arrays_to_calcdata":251,"./attributes":252,"./calc":253,"./clean_data":254,"./colorbar":255,"./defaults":258,"./hover":261,"./plot":269,"./select":270,"./style":271,"./subtypes":272}],263:[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,l){var s=(t.marker||{}).color;if(i("line.color",n),r(t,"line"))a(t,e,o,i,{prefix:"line.",cLetter:"c"});else{i("line.color",!Array.isArray(s)&&s||n)}i("line.width"),(l||{}).noDash||i("line.dash")}},{"../../components/colorscale/defaults":42,"../../components/colorscale/has_colorscale":46}],264:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=_.c2p(t[e].x),a=w.c2p(t[e].y);return n!==r&&a!==r&&[n,a]}function a(t){var e=t[0]/_._length,n=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}var o,i,l,s,c,u,f,d,h,p,g,v,m,y,x,b,_=e.xaxis,w=e.yaxis,k=e.simplify,M=e.connectGaps,A=e.baseTolerance,T=e.linear,L=[],C=.2,S=new Array(t.length),z=0;for(k||(A=C=-1),o=0;oa(u))break;l=u,m=p[0]*h[0]+p[1]*h[1],m>g?(g=m,s=u,d=!1):m=t.length||!u)break;S[z++]=u,i=u}}else S[z++]=s}L.push(S.slice(0,z))}return L}},{"../../constants/numerical":131}],265:[function(t,e,n){"use strict";e.exports=function(t,e,n){"spline"===n("line.shape")&&n("line.smoothing")}},{}],266:[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}],268:[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,c){var u,f=i.isBubble(t),d=(t.line||{}).color;if(c=c||{},d&&(n=d),s("marker.symbol"),s("marker.opacity",f?.7:1),s("marker.size"),s("marker.color",n),a(t,"marker")&&o(t,e,l,s,{prefix:"marker.",cLetter:"c"}),c.noLine||(u=d&&!Array.isArray(d)&&e.marker.color!==d?d:f?r.background:r.defaultLine,s("marker.line.color",u),a(t,"marker.line")&&o(t,e,l,s,{prefix:"marker.line.",cLetter:"c"}),s("marker.line.width",f?1:0)),f&&(s("marker.sizeref"),s("marker.sizemin"),s("marker.sizemode")),c.gradient){"none"!==s("marker.gradient.type")&&s("marker.gradient.color")}}},{"../../components/color":33,"../../components/colorscale/defaults":42,"../../components/colorscale/has_colorscale":46,"./subtypes":272}],269:[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,d,p){function g(t){return k?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function x(){return!1}function b(e){var n,r,a,o=e[0].trace,c=i.select(this),f=u.hasMarkers(o),d=u.hasText(o),h=y(o),p=x,m=x;f&&(p=o.marker.maxdisplayed||o._needsCull?v:l.identity),d&&(m=o.marker.maxdisplayed||o._needsCull?v:l.identity),r=c.selectAll("path.point"),n=r.data(p,h);var b=n.enter().append("path").classed("point",!0);k&&b.call(s.pointStyle,o,t).call(s.translatePoints,M,A,o).style("opacity",0).transition().style("opacity",1);var _=f&&s.tryColorscale(o.marker,""),w=f&&s.tryColorscale(o.marker,"line");n.order(),n.each(function(e){var n=i.select(this),r=g(n);a=s.translatePoint(e,r,M,A),a?(s.singlePointStyle(e,r,o,_,w,t),o.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):r.remove()}),k?n.exit().transition().style("opacity",0).remove():n.exit().remove(),r=c.selectAll("g"),n=r.data(m,h),n.enter().append("g").classed("textpoint",!0).append("text"),n.order(),n.each(function(t){var e=i.select(this),n=g(e.select("text"));(a=s.translatePoint(t,n,M,A))||e.remove()}),n.selectAll("text").call(s.textPointStyle,o,t).each(function(t){var e=t.xp||M.c2p(t.x),n=t.yp||A.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){g(i.select(this)).attr({x:e,y:n})})}),n.exit().remove()}var _,w;o(t,e,n,r,a);var k=!!p&&p.duration>0,M=n.xaxis,A=n.yaxis,T=r[0].trace,L=T.line,C=i.select(d);if(C.call(c.plot,n,p),!0===T.visible){g(C).style("opacity",T.opacity);var S,z,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),r[0].node3=C;var P="",D=[],E=T._prevtrace;E&&(P=E._prevRevpath||"",z=E._nextFill,D=E._polygons);var N,R,I,j,F,B,q,H,V,U="",G="",Y=[],X=[],Z=l.noop;if(S=T._ownFill,u.hasLines(T)||"none"!==T.fill){for(z&&z.datum(r),-1!==["hv","vh","hvh","vhv"].indexOf(L.shape)?(I=s.steps(L.shape),j=s.steps(L.shape.split("").reverse().join(""))):I=j="spline"===L.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),L.smoothing):s.smoothopen(t,L.smoothing)}:function(t){return"M"+t.join("L")},F=function(t){return j(t.reverse())},Y=f(r,{xaxis:M,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(L.width||1,3)/4,linear:"linear"===L.shape,simplify:L.simplify}),V=T._polygons=new Array(Y.length),w=0;w1}),Z=function(t){return function(e){if(N=I(e),R=F(e),U?O?(U+="L"+N.substr(1),G=R+"L"+G.substr(1)):(U+="Z"+N,G=R+"Z"+G):(U=N,G=R),u.hasLines(T)&&e.length>1){var n=i.select(this);if(n.datum(r),t)g(n.style("opacity",0).attr("d",N).call(s.lineGroupStyle)).style("opacity",1);else{var a=g(n);a.attr("d",N),s.singleLineStyle(r,a)}}}}}var W=C.selectAll(".js-line").data(X);g(W.exit()).style("opacity",0).remove(),W.each(Z(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(s.lineGroupStyle).each(Z(!0)),Y.length&&(S?B&&H&&(O?("y"===O?B[1]=H[1]=A.c2p(0,!0):"x"===O&&(B[0]=H[0]=M.c2p(0,!0)),g(S).attr("d","M"+H+"L"+B+"L"+U.substr(1)).call(s.singleFillStyle)):g(S).attr("d",U+"Z").call(s.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&U&&P&&("tonext"===T.fill?g(z).attr("d",U+"Z"+P+"Z").call(s.singleFillStyle):g(z).attr("d",U+"L"+P.substr(1)+"Z").call(s.singleFillStyle),T._polygons=T._polygons.concat(D)),T._prevRevpath=G,T._prevPolygons=V);var Q=C.selectAll(".points");_=Q.data([r]),Q.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function o(t,e,n,r,a){var o=n.xaxis,s=n.yaxis,c=i.extent(l.simpleMap(o.range,o.r2c)),f=i.extent(l.simpleMap(s.range,s.r2c)),d=r[0].trace;if(u.hasMarkers(d)){var h=d.marker.maxdisplayed;if(0!==h){var p=r.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/h),v=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),d(t,e,n),r(t,p),s=0,c={};sc[e[0].trace.uid]?1:-1}),v){l&&(h=l());i.transition().duration(o.duration).ease(o.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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":57,"../../components/errorbars":63,"../../lib":148,"../../lib/polygon":158,"./line_points":264,"./link_traces":266,"./subtypes":272,d3:8}],270:[function(t,e,n){"use strict";var r=t("./subtypes");e.exports=function(t,e){var n,a,o,i,l=t.cd,s=t.xaxis,c=t.yaxis,u=[],f=l[0].trace,d=f.marker,h=!r.hasMarkers(f)&&!r.hasText(f);if(!0===f.visible&&!h){var p=Array.isArray(d.opacity)?1:d.opacity;if(!1===e)for(n=0;n")}var a=t("../../components/fx"),o=t("../../plots/cartesian/axes"),i=t("../../constants/numerical").BADNUM,l=t("../scatter/get_trace_color"),s=t("./attributes");e.exports=function(t){function e(t){return f.projection(t)}function n(t){var n=t.lonlat;if(n[0]===i)return 1/0;if(f.isLonLatOverEdges(n))return 1/0;var r=e(n),a=c.c2p(),o=u.c2p(),l=Math.abs(a-r[0]),s=Math.abs(o-r[1]),d=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+s*s)-d,1-3/d)}var o=t.cd,s=o[0].trace,c=t.xa,u=t.ya,f=t.subplot;if(a.getClosest(o,n,t),!1!==t.index){var d=o[t.index],h=d.lonlat,p=e(h),g=d.mrc||1;return t.x0=p[0]-g,t.x1=p[0]+g,t.y0=p[1]-g,t.y1=p[1]+g,t.loc=d.loc,t.lat=h[0],t.lon=h[1],t.color=l(s,d),t.extraText=r(s,d,f.mockAxis),[t]}}},{"../../components/fx":74,"../../constants/numerical":131,"../../plots/cartesian/axes":184,"../scatter/get_trace_color":260,"./attributes":275}],280:[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":212,"../scatter/colorbar":255,"./attributes":275,"./calc":276,"./defaults":277,"./event_data":278,"./hover":279,"./plot":281}],281:[function(t,e,n){"use strict";function r(t,e){var n=t[0].trace;if(Array.isArray(n.locations))for(var r=u(n,e),a=n.locationmode,o=0;o max) max = arr[i]; + if (arr[i] < min) min = arr[i]; + } + + bounds[offset] = min + bounds[dim + offset] = max + } + + return bounds; +} + +},{}],12:[function(require,module,exports){ +'use strict' + +var getBounds = require('array-bounds') + +module.exports = normalize; + +function normalize (arr, dim, bounds) { + if (!arr || arr.length == null) throw Error('Argument should be an array') + + if (dim == null) dim = 1 + if (bounds == null) bounds = getBounds(arr, dim) + + for (var offset = 0; offset < dim; offset++) { + var max = bounds[dim + offset], min = bounds[offset], i = offset, l = arr.length; + + if (max === Infinity && min === -Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === max ? 1 : arr[i] === min ? 0 : .5 + } + } + else if (max === Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === max ? 1 : 0 + } + } + else if (min === -Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === min ? 0 : 1 + } + } + else { + var range = max - min + for (i = offset; i < l; i+=dim) { + arr[i] = (arr[i] - min) / range + } + } + } + + return arr; +} + +},{"array-bounds":11}],13:[function(require,module,exports){ module.exports = function _atob(str) { return atob(str) } -},{}],12:[function(require,module,exports){ +},{}],14:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -332,7 +402,7 @@ function add(a, b) { a[1].mul(b[1])) } -},{"./lib/rationalize":22}],13:[function(require,module,exports){ +},{"./lib/rationalize":24}],15:[function(require,module,exports){ 'use strict' module.exports = cmp @@ -341,7 +411,7 @@ function cmp(a, b) { return a[0].mul(b[1]).cmp(b[0].mul(a[1])) } -},{}],14:[function(require,module,exports){ +},{}],16:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -352,7 +422,7 @@ function div(a, b) { return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) } -},{"./lib/rationalize":22}],15:[function(require,module,exports){ +},{"./lib/rationalize":24}],17:[function(require,module,exports){ 'use strict' var isRat = require('./is-rat') @@ -414,7 +484,7 @@ function makeRational(numer, denom) { return rationalize(a, b) } -},{"./div":14,"./is-rat":16,"./lib/is-bn":20,"./lib/num-to-bn":21,"./lib/rationalize":22,"./lib/str-to-bn":23}],16:[function(require,module,exports){ +},{"./div":16,"./is-rat":18,"./lib/is-bn":22,"./lib/num-to-bn":23,"./lib/rationalize":24,"./lib/str-to-bn":25}],18:[function(require,module,exports){ 'use strict' var isBN = require('./lib/is-bn') @@ -425,7 +495,7 @@ function isRat(x) { return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) } -},{"./lib/is-bn":20}],17:[function(require,module,exports){ +},{"./lib/is-bn":22}],19:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -436,7 +506,7 @@ function sign (x) { return x.cmp(new BN(0)) } -},{"bn.js":30}],18:[function(require,module,exports){ +},{"bn.js":32}],20:[function(require,module,exports){ 'use strict' var sign = require('./bn-sign') @@ -461,7 +531,7 @@ function bn2num(b) { return sign(b) * out } -},{"./bn-sign":17}],19:[function(require,module,exports){ +},{"./bn-sign":19}],21:[function(require,module,exports){ 'use strict' var db = require('double-bits') @@ -482,7 +552,7 @@ function ctzNumber(x) { return h + 32 } -},{"bit-twiddle":29,"double-bits":61}],20:[function(require,module,exports){ +},{"bit-twiddle":31,"double-bits":63}],22:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -495,7 +565,7 @@ function isBN(x) { return x && typeof x === 'object' && Boolean(x.words) } -},{"bn.js":30}],21:[function(require,module,exports){ +},{"bn.js":32}],23:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -512,7 +582,7 @@ function num2bn(x) { } } -},{"bn.js":30,"double-bits":61}],22:[function(require,module,exports){ +},{"bn.js":32,"double-bits":63}],24:[function(require,module,exports){ 'use strict' var num2bn = require('./num-to-bn') @@ -540,7 +610,7 @@ function rationalize(numer, denom) { return [ numer, denom ] } -},{"./bn-sign":17,"./num-to-bn":21}],23:[function(require,module,exports){ +},{"./bn-sign":19,"./num-to-bn":23}],25:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -551,7 +621,7 @@ function str2BN(x) { return new BN(x) } -},{"bn.js":30}],24:[function(require,module,exports){ +},{"bn.js":32}],26:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -562,7 +632,7 @@ function mul(a, b) { return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) } -},{"./lib/rationalize":22}],25:[function(require,module,exports){ +},{"./lib/rationalize":24}],27:[function(require,module,exports){ 'use strict' var bnsign = require('./lib/bn-sign') @@ -573,7 +643,7 @@ function sign(x) { return bnsign(x[0]) * bnsign(x[1]) } -},{"./lib/bn-sign":17}],26:[function(require,module,exports){ +},{"./lib/bn-sign":19}],28:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -584,7 +654,7 @@ function sub(a, b) { return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) } -},{"./lib/rationalize":22}],27:[function(require,module,exports){ +},{"./lib/rationalize":24}],29:[function(require,module,exports){ 'use strict' var bn2num = require('./lib/bn-to-num') @@ -622,7 +692,7 @@ function roundRat (f) { } } -},{"./lib/bn-to-num":18,"./lib/ctz":19}],28:[function(require,module,exports){ +},{"./lib/bn-to-num":20,"./lib/ctz":21}],30:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, useNdarray, earlyOut) { @@ -684,7 +754,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],29:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ /** * Bit twiddling hacks for JavaScript. * @@ -890,7 +960,7 @@ exports.nextCombination = function(v) { } -},{}],30:[function(require,module,exports){ +},{}],32:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -4319,7 +4389,7 @@ exports.nextCombination = function(v) { }; })(typeof module === 'undefined' || module, this); -},{}],31:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ 'use strict' module.exports = boxIntersectWrapper @@ -4458,7 +4528,7 @@ function boxIntersectWrapper(arg0, arg1, arg2) { throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":33,"./lib/sweep":37,"typedarray-pool":199}],32:[function(require,module,exports){ +},{"./lib/intersect":35,"./lib/sweep":39,"typedarray-pool":202}],34:[function(require,module,exports){ 'use strict' var DIMENSION = 'd' @@ -4603,7 +4673,7 @@ function bruteForcePlanner(full) { exports.partial = bruteForcePlanner(false) exports.full = bruteForcePlanner(true) -},{}],33:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ 'use strict' module.exports = boxIntersectIter @@ -5098,7 +5168,7 @@ function boxIntersectIter( } } } -},{"./brute":32,"./median":34,"./partition":35,"./sweep":37,"bit-twiddle":29,"typedarray-pool":199}],34:[function(require,module,exports){ +},{"./brute":34,"./median":36,"./partition":37,"./sweep":39,"bit-twiddle":31,"typedarray-pool":202}],36:[function(require,module,exports){ 'use strict' module.exports = findMedian @@ -5241,7 +5311,7 @@ function findMedian(d, axis, start, end, boxes, ids) { start, mid, boxes, ids, boxes[elemSize*mid+axis]) } -},{"./partition":35}],35:[function(require,module,exports){ +},{"./partition":37}],37:[function(require,module,exports){ 'use strict' module.exports = genPartition @@ -5262,7 +5332,7 @@ function genPartition(predicate, args) { .replace('$', predicate)) return Function.apply(void 0, fargs) } -},{}],36:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ 'use strict'; //This code is extracted from ndarray-sort @@ -5499,7 +5569,7 @@ function quickSort(left, right, data) { quickSort(less, great, data); } } -},{}],37:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ 'use strict' module.exports = { @@ -5934,7 +6004,7 @@ red_loop: } } } -},{"./sort":36,"bit-twiddle":29,"typedarray-pool":199}],38:[function(require,module,exports){ +},{"./sort":38,"bit-twiddle":31,"typedarray-pool":202}],40:[function(require,module,exports){ /*! * The buffer module from node.js, for the browser. * @@ -7642,7 +7712,7 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -},{"base64-js":39,"ieee754":147}],39:[function(require,module,exports){ +},{"base64-js":41,"ieee754":149}],41:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -7758,7 +7828,7 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],40:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ 'use strict' var monotoneTriangulate = require('./lib/monotone') @@ -7842,7 +7912,7 @@ function cdt2d(points, edges, options) { } } -},{"./lib/delaunay":41,"./lib/filter":42,"./lib/monotone":43,"./lib/triangulation":44}],41:[function(require,module,exports){ +},{"./lib/delaunay":43,"./lib/filter":44,"./lib/monotone":45,"./lib/triangulation":46}],43:[function(require,module,exports){ 'use strict' var inCircle = require('robust-in-sphere')[4] @@ -7959,7 +8029,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":45,"robust-in-sphere":175}],42:[function(require,module,exports){ +},{"binary-search-bounds":47,"robust-in-sphere":178}],44:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -8141,7 +8211,7 @@ function classifyFaces(triangulation, target, infinity) { return result } -},{"binary-search-bounds":45}],43:[function(require,module,exports){ +},{"binary-search-bounds":47}],45:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -8330,7 +8400,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":45,"robust-orientation":176}],44:[function(require,module,exports){ +},{"binary-search-bounds":47,"robust-orientation":179}],46:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -8436,7 +8506,7 @@ function createTriangulation(numVerts, edges) { return new Triangulation(stars, edges) } -},{"binary-search-bounds":45}],45:[function(require,module,exports){ +},{"binary-search-bounds":47}],47:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, earlyOut) { @@ -8490,7 +8560,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],46:[function(require,module,exports){ +},{}],48:[function(require,module,exports){ module.exports = clamp function clamp(value, min, max) { @@ -8499,7 +8569,7 @@ function clamp(value, min, max) { : (value < max ? max : value > min ? min : value) } -},{}],47:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ 'use strict' module.exports = cleanPSLG @@ -8882,7 +8952,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":48,"big-rat":15,"big-rat/cmp":13,"big-rat/to-float":27,"box-intersect":31,"nextafter":159,"rat-vec":170,"robust-segment-intersect":179,"union-find":200}],48:[function(require,module,exports){ +},{"./lib/rat-seg-intersect":50,"big-rat":17,"big-rat/cmp":15,"big-rat/to-float":29,"box-intersect":33,"nextafter":161,"rat-vec":173,"robust-segment-intersect":182,"union-find":203}],50:[function(require,module,exports){ 'use strict' module.exports = solveIntersection @@ -8926,14 +8996,16 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":14,"big-rat/mul":24,"big-rat/sign":25,"big-rat/sub":26,"rat-vec/add":169,"rat-vec/muls":171,"rat-vec/sub":172}],49:[function(require,module,exports){ -/** @module color-number */ +},{"big-rat/div":16,"big-rat/mul":26,"big-rat/sign":27,"big-rat/sub":28,"rat-vec/add":172,"rat-vec/muls":174,"rat-vec/sub":175}],51:[function(require,module,exports){ +/** @module color-id */ 'use strict' var clamp = require('clamp') module.exports = toNumber +module.exports.to = toNumber +module.exports.from = fromNumber function toNumber (rgba, normalized) { if(normalized == null) normalized = true @@ -8959,8 +9031,21 @@ function toNumber (rgba, normalized) { return n } + +function fromNumber (n, normalized) { + n = +n + + var r = n >>> 24 + var g = (n & 0x00ff0000) >>> 16 + var b = (n & 0x0000ff00) >>> 8 + var a = n & 0x000000ff + + if (normalized === false) return [r, g, b, a] + + return [r/255, g/255, b/255, a/255] +} -},{"clamp":46}],50:[function(require,module,exports){ +},{"clamp":48}],52:[function(require,module,exports){ module.exports = { "aliceblue": [240, 248, 255], "antiquewhite": [250, 235, 215], @@ -9111,7 +9196,7 @@ module.exports = { "yellow": [255, 255, 0], "yellowgreen": [154, 205, 50] }; -},{}],51:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ /** * @module color-parse */ @@ -9288,7 +9373,7 @@ function parse (cstr) { }; } -},{"color-name":50,"is-plain-obj":152}],52:[function(require,module,exports){ +},{"color-name":52,"is-plain-obj":154}],54:[function(require,module,exports){ /** @module color-rgba */ 'use strict' @@ -9327,7 +9412,7 @@ module.exports = function rgba (color, normalize) { } -},{"clamp":46,"color-parse":51,"color-space/hsl":53}],53:[function(require,module,exports){ +},{"clamp":48,"color-parse":53,"color-space/hsl":55}],55:[function(require,module,exports){ /** * @module color-space/hsl */ @@ -9436,7 +9521,7 @@ rgb.hsl = function(rgb) { return [h, s * 100, l * 100]; }; -},{"./rgb":54}],54:[function(require,module,exports){ +},{"./rgb":56}],56:[function(require,module,exports){ /** * RGB space. * @@ -9452,7 +9537,7 @@ module.exports = { alias: ['RGB'] }; -},{}],55:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ "use strict" module.exports = compareAngle @@ -9538,564 +9623,568 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":176,"robust-product":177,"robust-sum":181,"signum":182,"two-sum":198}],56:[function(require,module,exports){ -"use strict" - -var createThunk = require("./lib/thunk.js") - -function Procedure() { - this.argTypes = [] - this.shimArgs = [] - this.arrayArgs = [] - this.arrayBlockIndices = [] - this.scalarArgs = [] - this.offsetArgs = [] - this.offsetArgIndex = [] - this.indexArgs = [] - this.shapeArgs = [] - this.funcName = "" - this.pre = null - this.body = null - this.post = null - this.debug = false -} - -function compileCwise(user_args) { - //Create procedure - var proc = new Procedure() - - //Parse blocks - proc.pre = user_args.pre - proc.body = user_args.body - proc.post = user_args.post - - //Parse arguments - var proc_args = user_args.args.slice(0) - proc.argTypes = proc_args - for(var i=0; i0) { - throw new Error("cwise: pre() block may not reference array args") - } - if(i < proc.post.args.length && proc.post.args[i].count>0) { - throw new Error("cwise: post() block may not reference array args") - } - } else if(arg_type === "scalar") { - proc.scalarArgs.push(i) - proc.shimArgs.push("scalar" + i) - } else if(arg_type === "index") { - proc.indexArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { - throw new Error("cwise: pre() block may not reference array index") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array index") - } - if(i < proc.post.args.length && proc.post.args[i].count > 0) { - throw new Error("cwise: post() block may not reference array index") - } - } else if(arg_type === "shape") { - proc.shapeArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { - throw new Error("cwise: pre() block may not write to array shape") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array shape") - } - if(i < proc.post.args.length && proc.post.args[i].lvalue) { - throw new Error("cwise: post() block may not write to array shape") - } - } else if(typeof arg_type === "object" && arg_type.offset) { - proc.argTypes[i] = "offset" - proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) - proc.offsetArgIndex.push(i) - } else { - throw new Error("cwise: Unknown argument type " + proc_args[i]) - } - } - - //Make sure at least one array argument was specified - if(proc.arrayArgs.length <= 0) { - throw new Error("cwise: No array arguments specified") - } - - //Make sure arguments are correct - if(proc.pre.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in pre() block") - } - if(proc.body.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in body() block") - } - if(proc.post.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in post() block") - } - - //Check debug flag - proc.debug = !!user_args.printCode || !!user_args.debug - - //Retrieve name - proc.funcName = user_args.funcName || "cwise" - - //Read in block size - proc.blockSize = user_args.blockSize || 64 - - return createThunk(proc) -} - -module.exports = compileCwise +},{"robust-orientation":179,"robust-product":180,"robust-sum":184,"signum":185,"two-sum":201}],58:[function(require,module,exports){ +"use strict" -},{"./lib/thunk.js":58}],57:[function(require,module,exports){ -"use strict" - -var uniq = require("uniq") - -// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) -// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. -function innerFill(order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , has_index = proc.indexArgs.length>0 - , code = [] - , vars = [] - , idx=0, pidx=0, i, j - for(i=0; i=0; --i) { // Start at largest stride and work your way inwards - idx = order[i] - code.push(["for(i",i,"=0;i",i," 0) { - code.push(["index[",pidx,"]-=s",pidx].join("")) - } - code.push(["++index[",idx,"]"].join("")) - } - code.push("}") - } - return code.join("\n") -} - -// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. -// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. -// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. -function outerFill(matched, order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , blockSize = proc.blockSize - , has_index = proc.indexArgs.length > 0 - , code = [] - for(var i=0; i0;){"].join("")) // Iterate back to front - code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). - code.push(["s",order[i],"=j",i].join("")) - code.push(["j",i,"=0"].join("")) - code.push(["}else{s",order[i],"=",blockSize].join("")) - code.push(["j",i,"-=",blockSize,"}"].join("")) - if(has_index) { - code.push(["index[",order[i],"]=j",i].join("")) - } - } - for(var i=0; i 0) { - allEqual = allEqual && summary[i] === summary[i-1] - } - } - if(allEqual) { - return summary[0] - } - return summary.join("") -} - -//Generates a cwise operator -function generateCWiseOp(proc, typesig) { - - //Compute dimension - // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. - var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 - var orders = new Array(proc.arrayArgs.length) - var dtypes = new Array(proc.arrayArgs.length) - for(var i=0; i 0) { - vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) - } - if(proc.indexArgs.length > 0) { - // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. - var zeros = new Array(dimension) - for(var i=0; i 3) { - code.push(processBlock(proc.pre, proc, dtypes)) - } - - //Process body - var body = processBlock(proc.body, proc, dtypes) - var matched = countMatches(loopOrders) - if(matched < dimension) { - code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. - } else { - code.push(innerFill(loopOrders[0], proc, body)) - } - - //Inline epilog - if(proc.post.body.length > 3) { - code.push(processBlock(proc.post, proc, dtypes)) - } - - if(proc.debug) { - console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") - } - - var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") - var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) - return f() -} -module.exports = generateCWiseOp +var createThunk = require("./lib/thunk.js") + +function Procedure() { + this.argTypes = [] + this.shimArgs = [] + this.arrayArgs = [] + this.arrayBlockIndices = [] + this.scalarArgs = [] + this.offsetArgs = [] + this.offsetArgIndex = [] + this.indexArgs = [] + this.shapeArgs = [] + this.funcName = "" + this.pre = null + this.body = null + this.post = null + this.debug = false +} + +function compileCwise(user_args) { + //Create procedure + var proc = new Procedure() + + //Parse blocks + proc.pre = user_args.pre + proc.body = user_args.body + proc.post = user_args.post + + //Parse arguments + var proc_args = user_args.args.slice(0) + proc.argTypes = proc_args + for(var i=0; i0) { + throw new Error("cwise: pre() block may not reference array args") + } + if(i < proc.post.args.length && proc.post.args[i].count>0) { + throw new Error("cwise: post() block may not reference array args") + } + } else if(arg_type === "scalar") { + proc.scalarArgs.push(i) + proc.shimArgs.push("scalar" + i) + } else if(arg_type === "index") { + proc.indexArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { + throw new Error("cwise: pre() block may not reference array index") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array index") + } + if(i < proc.post.args.length && proc.post.args[i].count > 0) { + throw new Error("cwise: post() block may not reference array index") + } + } else if(arg_type === "shape") { + proc.shapeArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { + throw new Error("cwise: pre() block may not write to array shape") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array shape") + } + if(i < proc.post.args.length && proc.post.args[i].lvalue) { + throw new Error("cwise: post() block may not write to array shape") + } + } else if(typeof arg_type === "object" && arg_type.offset) { + proc.argTypes[i] = "offset" + proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) + proc.offsetArgIndex.push(i) + } else { + throw new Error("cwise: Unknown argument type " + proc_args[i]) + } + } + + //Make sure at least one array argument was specified + if(proc.arrayArgs.length <= 0) { + throw new Error("cwise: No array arguments specified") + } + + //Make sure arguments are correct + if(proc.pre.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in pre() block") + } + if(proc.body.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in body() block") + } + if(proc.post.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in post() block") + } -},{"uniq":201}],58:[function(require,module,exports){ -"use strict" - -// The function below is called when constructing a cwise function object, and does the following: -// A function object is constructed which accepts as argument a compilation function and returns another function. -// It is this other function that is eventually returned by createThunk, and this function is the one that actually -// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. -// The compilation passed to the first function object is used for compiling new functions. -// Once this function object is created, it is called with compile as argument, where the first argument of compile -// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). -// So createThunk roughly works like this: -// function createThunk(proc) { -// var thunk = function(compileBound) { -// var CACHED = {} -// return function(arrays and scalars) { -// if (dtype and order of arrays in CACHED) { -// var func = CACHED[dtype and order of arrays] -// } else { -// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) -// } -// return func(arrays and scalars) -// } -// } -// return thunk(compile.bind1(proc)) -// } - -var compile = require("./compile.js") - -function createThunk(proc) { - var code = ["'use strict'", "var CACHED={}"] - var vars = [] - var thunkName = proc.funcName + "_cwise_thunk" - - //Build thunk - code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) - var typesig = [] - var string_typesig = [] - var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). - Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] - var shapeLengthConditions = [], shapeConditions = [] - // Process array arguments - for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) - shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) - shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") - } - } - // Check for shape equality - if (proc.arrayArgs.length > 1) { - code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") - code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") - code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") - code.push("}") - } - // Process scalar arguments - for(var i=0; i0 + , code = [] + , vars = [] + , idx=0, pidx=0, i, j + for(i=0; i 0) { + code.push("var " + vars.join(",")) + } + //Scan loop + for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards + idx = order[i] + code.push(["for(i",i,"=0;i",i," 0) { + code.push(["index[",pidx,"]-=s",pidx].join("")) + } + code.push(["++index[",idx,"]"].join("")) + } + code.push("}") + } + return code.join("\n") +} + +// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. +// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. +// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. +function outerFill(matched, order, proc, body) { + var dimension = order.length + , nargs = proc.arrayArgs.length + , blockSize = proc.blockSize + , has_index = proc.indexArgs.length > 0 + , code = [] + for(var i=0; i0;){"].join("")) // Iterate back to front + code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). + code.push(["s",order[i],"=j",i].join("")) + code.push(["j",i,"=0"].join("")) + code.push(["}else{s",order[i],"=",blockSize].join("")) + code.push(["j",i,"-=",blockSize,"}"].join("")) + if(has_index) { + code.push(["index[",order[i],"]=j",i].join("")) + } + } + for(var i=0; i 0) { + allEqual = allEqual && summary[i] === summary[i-1] + } + } + if(allEqual) { + return summary[0] + } + return summary.join("") +} + +//Generates a cwise operator +function generateCWiseOp(proc, typesig) { + + //Compute dimension + // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. + var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 + var orders = new Array(proc.arrayArgs.length) + var dtypes = new Array(proc.arrayArgs.length) + for(var i=0; i 0) { + vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) + } + if(proc.indexArgs.length > 0) { + // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. + var zeros = new Array(dimension) + for(var i=0; i 0) { + code.push("var " + vars.join(",")) + } + for(var i=0; i 3) { + code.push(processBlock(proc.pre, proc, dtypes)) + } + + //Process body + var body = processBlock(proc.body, proc, dtypes) + var matched = countMatches(loopOrders) + if(matched < dimension) { + code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. + } else { + code.push(innerFill(loopOrders[0], proc, body)) + } + + //Inline epilog + if(proc.post.body.length > 3) { + code.push(processBlock(proc.post, proc, dtypes)) + } + + if(proc.debug) { + console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") + } + + var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") + var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) + return f() +} +module.exports = generateCWiseOp + +},{"uniq":204}],60:[function(require,module,exports){ +"use strict" + +// The function below is called when constructing a cwise function object, and does the following: +// A function object is constructed which accepts as argument a compilation function and returns another function. +// It is this other function that is eventually returned by createThunk, and this function is the one that actually +// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. +// The compilation passed to the first function object is used for compiling new functions. +// Once this function object is created, it is called with compile as argument, where the first argument of compile +// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). +// So createThunk roughly works like this: +// function createThunk(proc) { +// var thunk = function(compileBound) { +// var CACHED = {} +// return function(arrays and scalars) { +// if (dtype and order of arrays in CACHED) { +// var func = CACHED[dtype and order of arrays] +// } else { +// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) +// } +// return func(arrays and scalars) +// } +// } +// return thunk(compile.bind1(proc)) +// } + +var compile = require("./compile.js") + +function createThunk(proc) { + var code = ["'use strict'", "var CACHED={}"] + var vars = [] + var thunkName = proc.funcName + "_cwise_thunk" + + //Build thunk + code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) + var typesig = [] + var string_typesig = [] + var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). + Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] + var shapeLengthConditions = [], shapeConditions = [] + // Process array arguments + for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) + shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) + shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") + } + } + // Check for shape equality + if (proc.arrayArgs.length > 1) { + code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") + code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") + code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") + code.push("}") + } + // Process scalar arguments + for(var i=0; i * but significantly simplified and sped up by ignoring number and string constructors @@ -21356,32 +21445,35 @@ module.exports = function(n) { return n - n < 1; }; -},{}],67:[function(require,module,exports){ +},{}],69:[function(require,module,exports){ +/** + * @module font-atlas-sdf + */ + 'use strict' var SDF = require('tiny-sdf') +var optical = require('optical-properties') module.exports = atlas + function atlas(options) { options = options || {} var canvas = options.canvas || document.createElement('canvas') - var family = options.family || 'monospace' + var family = options.family || 'sans-serif' var shape = options.shape || [512, 512] var step = options.step || [32, 32] - var size = options.size || 16 + var size = parseFloat(options.size) || 16 var chars = options.chars || [32, 126] var bufferSize = Math.floor((step[0] - size)/2) var radius = options.radius || bufferSize*1.5 var sdf = new SDF(size, bufferSize, radius, 0, family) - var vAlign = options.align || true + var vAlign = options.align == null ? 'optical' : options.align + var fit = options.fit == null || options.fit == true ? .5 : options.fit var i, j - if (typeof size === 'number') { - size = size + 'px' - } - if (!Array.isArray(chars)) { chars = String(chars).split('') } @@ -21407,28 +21499,69 @@ function atlas(options) { ctx.fillStyle = '#000' ctx.fillRect(0, 0, canvas.width, canvas.height) - ctx.font = size + ' ' + family ctx.textBaseline = 'middle' + var w = step[0], h = step[1] var x = 0 var y = 0 - var len = Math.min(chars.length, Math.floor(shape[0]/step[0]) * Math.ceil(shape[1]/step[1])) + var ratio = size/h + var len = Math.min(chars.length, Math.floor(shape[0]/w) * Math.ceil(shape[1]/h)) // hack tiny-sdf to render centered //FIXME: get rif of it by [possibly] PR to tiny-sdf var align = sdf.ctx.textAlign var buffer = sdf.buffer + var middle = sdf.middle sdf.ctx.textAlign = 'center' sdf.buffer = sdf.size/2 for (i = 0; i < len; i++) { - var data = sdf.draw(chars[i]) + if (!chars[i]) continue; - var offY = 0 - if (vAlign) offY = getAlignOffset(data) + var props = getProps(chars[i], family, ratio) + var scale = 1, diff = [0, 0] - ctx.putImageData(data, x, y - offY) + //hack tinysdf char-draw method + if (fit) { + var fitRatio = fit + if (Array.isArray(fit)) { + fitRatio = fit[i] + } + var vert = (props.bounds[3]-props.bounds[1])*.5 + var horiz = (props.bounds[2]-props.bounds[0])*.5 + var maxSide = Math.max( vert , horiz ) + var diag = Math.sqrt(vert*vert + horiz*horiz) + var maxDist = props.radius*.333 + maxSide*.333 + diag*.333 + + scale = h*fitRatio / (maxDist*h*2) + sdf.ctx.font = size*scale + 'px ' + family; + } + else { + sdf.ctx.font = size + 'px ' + family; + } + + if (vAlign) { + if (vAlign === 'optical' || vAlign === true) { + diff = [ + w*.5 - w*props.center[0], + h*.5 - h*props.center[1] + ] + } + else { + diff = [ + w*.5 - w*(props.bounds[2] + props.bounds[0])*.5, + h*.5 - h*(props.bounds[3] + props.bounds[1])*.5 + ] + } + sdf.middle = middle + diff[1]*scale + } + + //calc sdf + var data = sdf.draw(chars[i]) + + // ctx.putImageData(data, x + diff[0]*scale, y + diff[1]*scale, 0, -diff[1]*scale, data.width, data.height) + ctx.putImageData(data, x + diff[0]*scale, y) x += step[0] if (x > shape[0] - step[0]) { @@ -21440,49 +21573,38 @@ function atlas(options) { // unhack tiny-sdf sdf.ctx.textAlign = align sdf.buffer = buffer + sdf.middle = middle return canvas +} +var cache = {} +function getProps(char, family, ratio) { + if (cache[family] && cache[family][char]) return cache[family][char] - function getAlignOffset (data) { - var buf = data.data, w = data.width, h = data.height - - var top = 0, bottom = 0, x, y, r, line - - //find top boundary - for (y = 0; y < h; y++) { - line = y * w * 4 - for (x = 0; x < w; x++) { - r = buf[line + x * 4] + var propsSize = 200 + var propsFs = propsSize * ratio + var props = optical(char, {size: propsSize, fontSize: propsFs, fontFamily: family}) - if (r > 0) { - top = y - break - } - } - if (top) break - } + if (!cache[family]) cache[family] = {} - //find bottom boundary - for (y = h; y--;) { - line = y * w * 4 - for (x = 0; x < w; x++) { - r = buf[line + x * 4] + var relProps = { + center: [ + props.center[0]/propsSize, + props.center[1]/propsSize + ], + bounds: props.bounds.map(function (v) { + return v/propsSize + }), + radius: props.radius/propsSize + } - if (r > 0) { - bottom = y - break - } - } - if (bottom) break - } + cache[family][char] = relProps - return top - .5 * (top + (h - bottom)) - } + return relProps } - -},{"tiny-sdf":193}],68:[function(require,module,exports){ +},{"optical-properties":162,"tiny-sdf":196}],70:[function(require,module,exports){ "use strict" module.exports = createRBTree @@ -22479,7 +22601,7 @@ function defaultCompare(a, b) { function createRBTree(compare) { return new RedBlackTree(compare || defaultCompare, null) } -},{}],69:[function(require,module,exports){ +},{}],71:[function(require,module,exports){ // transliterated from the python snippet here: // http://en.wikipedia.org/wiki/Lanczos_approximation @@ -22548,7 +22670,7 @@ module.exports = function gamma (z) { module.exports.log = lngamma; -},{}],70:[function(require,module,exports){ +},{}],72:[function(require,module,exports){ module.exports = getCanvasContext function getCanvasContext (type, opts) { if (typeof type !== 'string') { @@ -22588,7 +22710,7 @@ function getCanvasContext (type, opts) { return (gl || null) // ensure null on fail } -},{}],71:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -22742,7 +22864,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":158,"ndarray-ops":157,"typedarray-pool":199}],72:[function(require,module,exports){ +},{"ndarray":160,"ndarray-ops":159,"typedarray-pool":202}],74:[function(require,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -23042,14 +23164,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],73:[function(require,module,exports){ +},{}],75:[function(require,module,exports){ var gl10 = require('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":72}],74:[function(require,module,exports){ +},{"./1.0/numbers":74}],76:[function(require,module,exports){ 'use strict' module.exports = createContour2D @@ -23472,7 +23594,7 @@ function createContour2D (plot, options) { return contours } -},{"./lib/shaders":75,"binary-search-bounds":76,"cdt2d":40,"clean-pslg":47,"gl-buffer":71,"gl-shader":130,"iota-array":150,"ndarray":158,"surface-nets":191}],75:[function(require,module,exports){ +},{"./lib/shaders":77,"binary-search-bounds":78,"cdt2d":42,"clean-pslg":49,"gl-buffer":73,"gl-shader":132,"iota-array":152,"ndarray":160,"surface-nets":194}],77:[function(require,module,exports){ 'use strict' @@ -23483,9 +23605,9 @@ module.exports = { fillVertex: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\n\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n fragColor = color;\n vec3 vPosition = viewTransform * vec3(position, 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n" } -},{}],76:[function(require,module,exports){ -arguments[4][45][0].apply(exports,arguments) -},{"dup":45}],77:[function(require,module,exports){ +},{}],78:[function(require,module,exports){ +arguments[4][47][0].apply(exports,arguments) +},{"dup":47}],79:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -23750,7 +23872,7 @@ function createError2D (plot, options) { return errorBars } -},{"./lib/shaders":78,"gl-buffer":71,"gl-shader":130,"typedarray-pool":199}],78:[function(require,module,exports){ +},{"./lib/shaders":80,"gl-buffer":73,"gl-shader":132,"typedarray-pool":202}],80:[function(require,module,exports){ module.exports = { @@ -23758,7 +23880,7 @@ module.exports = { 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" } -},{}],79:[function(require,module,exports){ +},{}],81:[function(require,module,exports){ 'use strict' var createTexture = require('gl-texture2d') @@ -24225,7 +24347,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":138}],80:[function(require,module,exports){ +},{"gl-texture2d":140}],82:[function(require,module,exports){ var sprintf = require('sprintf-js').sprintf; var glConstants = require('gl-constants/lookup'); @@ -24280,7 +24402,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":10,"gl-constants/lookup":73,"glsl-shader-name":139,"sprintf-js":189}],81:[function(require,module,exports){ +},{"add-line-numbers":10,"gl-constants/lookup":75,"glsl-shader-name":141,"sprintf-js":192}],83:[function(require,module,exports){ 'use strict' module.exports = createHeatmap2D @@ -24598,7 +24720,7 @@ function createHeatmap2D (plot, options) { return heatmap } -},{"./lib/shaders":82,"binary-search-bounds":83,"gl-buffer":71,"gl-shader":130,"iota-array":150,"typedarray-pool":199}],82:[function(require,module,exports){ +},{"./lib/shaders":84,"binary-search-bounds":85,"gl-buffer":73,"gl-shader":132,"iota-array":152,"typedarray-pool":202}],84:[function(require,module,exports){ 'use strict' @@ -24610,9 +24732,9 @@ module.exports = { pickVertex: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n" } -},{}],83:[function(require,module,exports){ -arguments[4][45][0].apply(exports,arguments) -},{"dup":45}],84:[function(require,module,exports){ +},{}],85:[function(require,module,exports){ +arguments[4][47][0].apply(exports,arguments) +},{"dup":47}],86:[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 (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}" @@ -24623,7 +24745,7 @@ exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute 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 (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}" -},{}],85:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -25136,7 +25258,7 @@ function createLinePlot(plot, options) { linePlot.update(options) return linePlot } -},{"./lib/shaders":84,"gl-buffer":71,"gl-shader":130,"gl-texture2d":138,"ndarray":158,"typedarray-pool":199}],86:[function(require,module,exports){ +},{"./lib/shaders":86,"gl-buffer":73,"gl-shader":132,"gl-texture2d":140,"ndarray":160,"typedarray-pool":202}],88:[function(require,module,exports){ module.exports = fromQuat; /** @@ -25184,7 +25306,7 @@ function fromQuat(out, q) { return out; }; -},{}],87:[function(require,module,exports){ +},{}],89:[function(require,module,exports){ 'use strict' module.exports = createBoxes @@ -25247,7 +25369,7 @@ function createBoxes(plot) { return new Boxes(plot, vbo, shader) } -},{"./shaders":90,"gl-buffer":71,"gl-shader":93}],88:[function(require,module,exports){ +},{"./shaders":92,"gl-buffer":73,"gl-shader":95}],90:[function(require,module,exports){ 'use strict' module.exports = createGrid @@ -25494,7 +25616,7 @@ function createGrid(plot) { return grid } -},{"./shaders":90,"binary-search-bounds":92,"gl-buffer":71,"gl-shader":93}],89:[function(require,module,exports){ +},{"./shaders":92,"binary-search-bounds":94,"gl-buffer":73,"gl-shader":95}],91:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -25559,7 +25681,7 @@ function createLines(plot) { return lines } -},{"./shaders":90,"gl-buffer":71,"gl-shader":93}],90:[function(require,module,exports){ +},{"./shaders":92,"gl-buffer":73,"gl-shader":95}],92:[function(require,module,exports){ 'use strict' @@ -25577,7 +25699,7 @@ module.exports = { tickVert: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale, screenOffset, tickScale;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n gl_Position = vec4(pos + tickScale*dataCoord.yz + screenOffset, 0, 1);\n}\n" } -},{}],91:[function(require,module,exports){ +},{}],93:[function(require,module,exports){ 'use strict' module.exports = createTextElements @@ -25855,9 +25977,9 @@ function createTextElements(plot) { return text } -},{"./shaders":90,"binary-search-bounds":92,"gl-buffer":71,"gl-shader":93,"text-cache":192}],92:[function(require,module,exports){ -arguments[4][45][0].apply(exports,arguments) -},{"dup":45}],93:[function(require,module,exports){ +},{"./shaders":92,"binary-search-bounds":94,"gl-buffer":73,"gl-shader":95,"text-cache":195}],94:[function(require,module,exports){ +arguments[4][47][0].apply(exports,arguments) +},{"dup":47}],95:[function(require,module,exports){ 'use strict' var createUniformWrapper = require('./lib/create-uniforms') @@ -26123,7 +26245,7 @@ function createShader( module.exports = createShader -},{"./lib/GLError":94,"./lib/create-attributes":95,"./lib/create-uniforms":96,"./lib/reflect":97,"./lib/runtime-reflect":98,"./lib/shader-cache":99}],94:[function(require,module,exports){ +},{"./lib/GLError":96,"./lib/create-attributes":97,"./lib/create-uniforms":98,"./lib/reflect":99,"./lib/runtime-reflect":100,"./lib/shader-cache":101}],96:[function(require,module,exports){ function GLError (rawError, shortMessage, longMessage) { this.shortMessage = shortMessage || '' this.longMessage = longMessage || '' @@ -26138,7 +26260,7 @@ GLError.prototype.name = 'GLError' GLError.prototype.constructor = GLError module.exports = GLError -},{}],95:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ 'use strict' module.exports = createAttributeWrapper @@ -26403,7 +26525,7 @@ function createAttributeWrapper( return obj } -},{"./GLError":94}],96:[function(require,module,exports){ +},{"./GLError":96}],98:[function(require,module,exports){ 'use strict' var coallesceUniforms = require('./reflect') @@ -26596,7 +26718,7 @@ function createUniformWrapper(gl, wrapper, uniforms, locations) { } } -},{"./GLError":94,"./reflect":97}],97:[function(require,module,exports){ +},{"./GLError":96,"./reflect":99}],99:[function(require,module,exports){ 'use strict' module.exports = makeReflectTypes @@ -26654,7 +26776,7 @@ function makeReflectTypes(uniforms, useIndex) { } return obj } -},{}],98:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ 'use strict' exports.uniforms = runtimeUniforms @@ -26734,7 +26856,7 @@ function runtimeAttributes(gl, program) { return result } -},{}],99:[function(require,module,exports){ +},{}],101:[function(require,module,exports){ 'use strict' exports.shader = getShaderReference @@ -26872,7 +26994,7 @@ function createProgram(gl, vref, fref, attribs, locations) { return getCache(gl).getProgram(vref, fref, attribs, locations) } -},{"./GLError":94,"gl-format-compiler-error":80,"weakmap-shim":206}],100:[function(require,module,exports){ +},{"./GLError":96,"gl-format-compiler-error":82,"weakmap-shim":209}],102:[function(require,module,exports){ 'use strict' module.exports = createGLPlot2D @@ -27453,7 +27575,7 @@ function createGLPlot2D(options) { return plot } -},{"./lib/box":87,"./lib/grid":88,"./lib/line":89,"./lib/text":91,"gl-select-static":129}],101:[function(require,module,exports){ +},{"./lib/box":89,"./lib/grid":90,"./lib/line":91,"./lib/text":93,"gl-select-static":131}],103:[function(require,module,exports){ exports.pointVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}" @@ -27461,21 +27583,21 @@ exports.pointFragment = "precision mediump float;\n#define GLSLIFY 1\n\nunif exports.pickVertex = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n gl_PointSize = pointSize;\n\n vec4 id = pickId + pickOffset;\n id.y += floor(id.x / 256.0);\n id.x -= floor(id.x / 256.0) * 256.0;\n\n id.z += floor(id.y / 256.0);\n id.y -= floor(id.y / 256.0) * 256.0;\n\n id.w += floor(id.z / 256.0);\n id.z -= floor(id.z / 256.0) * 256.0;\n\n fragId = id;\n}\n" 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}\n" -},{}],102:[function(require,module,exports){ -arguments[4][93][0].apply(exports,arguments) -},{"./lib/GLError":103,"./lib/create-attributes":104,"./lib/create-uniforms":105,"./lib/reflect":106,"./lib/runtime-reflect":107,"./lib/shader-cache":108,"dup":93}],103:[function(require,module,exports){ -arguments[4][94][0].apply(exports,arguments) -},{"dup":94}],104:[function(require,module,exports){ +},{}],104:[function(require,module,exports){ arguments[4][95][0].apply(exports,arguments) -},{"./GLError":103,"dup":95}],105:[function(require,module,exports){ +},{"./lib/GLError":105,"./lib/create-attributes":106,"./lib/create-uniforms":107,"./lib/reflect":108,"./lib/runtime-reflect":109,"./lib/shader-cache":110,"dup":95}],105:[function(require,module,exports){ arguments[4][96][0].apply(exports,arguments) -},{"./GLError":103,"./reflect":106,"dup":96}],106:[function(require,module,exports){ +},{"dup":96}],106:[function(require,module,exports){ arguments[4][97][0].apply(exports,arguments) -},{"dup":97}],107:[function(require,module,exports){ +},{"./GLError":105,"dup":97}],107:[function(require,module,exports){ arguments[4][98][0].apply(exports,arguments) -},{"dup":98}],108:[function(require,module,exports){ +},{"./GLError":105,"./reflect":108,"dup":98}],108:[function(require,module,exports){ arguments[4][99][0].apply(exports,arguments) -},{"./GLError":103,"dup":99,"gl-format-compiler-error":80,"weakmap-shim":206}],109:[function(require,module,exports){ +},{"dup":99}],109:[function(require,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],110:[function(require,module,exports){ +arguments[4][101][0].apply(exports,arguments) +},{"./GLError":105,"dup":101,"gl-format-compiler-error":82,"weakmap-shim":209}],111:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -27695,7 +27817,7 @@ function createPointcloud2D(plot, options) { return result } -},{"./lib/shader":101,"gl-buffer":71,"gl-shader":102,"typedarray-pool":199}],110:[function(require,module,exports){ +},{"./lib/shader":103,"gl-buffer":73,"gl-shader":104,"typedarray-pool":202}],112:[function(require,module,exports){ 'use strict' @@ -27707,23 +27829,23 @@ module.exports = { pickFragment: "precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n" } -},{}],111:[function(require,module,exports){ -arguments[4][45][0].apply(exports,arguments) -},{"dup":45}],112:[function(require,module,exports){ -arguments[4][93][0].apply(exports,arguments) -},{"./lib/GLError":113,"./lib/create-attributes":114,"./lib/create-uniforms":115,"./lib/reflect":116,"./lib/runtime-reflect":117,"./lib/shader-cache":118,"dup":93}],113:[function(require,module,exports){ -arguments[4][94][0].apply(exports,arguments) -},{"dup":94}],114:[function(require,module,exports){ +},{}],113:[function(require,module,exports){ +arguments[4][47][0].apply(exports,arguments) +},{"dup":47}],114:[function(require,module,exports){ arguments[4][95][0].apply(exports,arguments) -},{"./GLError":113,"dup":95}],115:[function(require,module,exports){ +},{"./lib/GLError":115,"./lib/create-attributes":116,"./lib/create-uniforms":117,"./lib/reflect":118,"./lib/runtime-reflect":119,"./lib/shader-cache":120,"dup":95}],115:[function(require,module,exports){ arguments[4][96][0].apply(exports,arguments) -},{"./GLError":113,"./reflect":116,"dup":96}],116:[function(require,module,exports){ +},{"dup":96}],116:[function(require,module,exports){ arguments[4][97][0].apply(exports,arguments) -},{"dup":97}],117:[function(require,module,exports){ +},{"./GLError":115,"dup":97}],117:[function(require,module,exports){ arguments[4][98][0].apply(exports,arguments) -},{"dup":98}],118:[function(require,module,exports){ +},{"./GLError":115,"./reflect":118,"dup":98}],118:[function(require,module,exports){ arguments[4][99][0].apply(exports,arguments) -},{"./GLError":113,"dup":99,"gl-format-compiler-error":80,"weakmap-shim":206}],119:[function(require,module,exports){ +},{"dup":99}],119:[function(require,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],120:[function(require,module,exports){ +arguments[4][101][0].apply(exports,arguments) +},{"./GLError":115,"dup":101,"gl-format-compiler-error":82,"weakmap-shim":209}],121:[function(require,module,exports){ 'use strict' module.exports = sortLevels @@ -28021,7 +28143,7 @@ function quickSort(left, right, data_levels, data_points, data_ids, data_weights } } -},{}],120:[function(require,module,exports){ +},{}],122:[function(require,module,exports){ 'use strict' var pool = require('typedarray-pool') @@ -28161,7 +28283,7 @@ function snapPoints(points, ids, weights, bounds) { return lod } -},{"./lib/sort":119,"typedarray-pool":199}],121:[function(require,module,exports){ +},{"./lib/sort":121,"typedarray-pool":202}],123:[function(require,module,exports){ 'use strict' module.exports = createFancyScatter2D @@ -28196,7 +28318,7 @@ function GLScatterFancy( this.sizeBuffer = sizeBuffer this.colorBuffer = colorBuffer this.idBuffer = idBuffer - this.charBuffer = charBuffer + this.charBuffer = charBuffer this.pointCount = 0 this.pickOffset = 0 @@ -28212,6 +28334,7 @@ function GLScatterFancy( this.charCanvas = document.createElement('canvas') this.charTexture = createTexture(this.plot.gl, this.charCanvas) this.charStep = 400 + this.charFit = .255 //snapping loses points sorting, so disable snapping on small number of points this.snapThreshold = 1e4 @@ -28222,152 +28345,151 @@ function GLScatterFancy( var proto = GLScatterFancy.prototype -;(function() { - var SCALE_HI = new Float32Array([0, 0]) - var SCALE_LO = new Float32Array([0, 0]) - var TRANSLATE_HI = new Float32Array([0, 0]) - var TRANSLATE_LO = new Float32Array([0, 0]) +var SCALE_HI = new Float32Array([0, 0]) +var SCALE_LO = new Float32Array([0, 0]) +var TRANSLATE_HI = new Float32Array([0, 0]) +var TRANSLATE_LO = new Float32Array([0, 0]) - var PIXEL_SCALE = [0, 0] +var PIXEL_SCALE = [0, 0] - var pixelSize, xStart, xEnd +var pixelSize, xStart, xEnd - function calcScales() { - var plot = this.plot +function calcScales() { + var plot = this.plot - var viewBox = plot.viewBox - var dataBox = plot.dataBox - var pixelRatio = plot.pixelRatio + var viewBox = plot.viewBox + var dataBox = plot.dataBox + var pixelRatio = plot.pixelRatio - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] - var scaleX = 2 / dataX - var scaleY = 2 / dataY - var translateX = (- dataBox[0] - 0.5 * dataX) - var translateY = (- dataBox[1] - 0.5 * dataY) + var scaleX = 2 / dataX + var scaleY = 2 / dataY + var translateX = (- dataBox[0] - 0.5 * dataX) + var translateY = (- dataBox[1] - 0.5 * dataY) - SCALE_HI[0] = scaleX - SCALE_LO[0] = scaleX - SCALE_HI[0] - SCALE_HI[1] = scaleY - SCALE_LO[1] = scaleY - SCALE_HI[1] + SCALE_HI[0] = scaleX + SCALE_LO[0] = scaleX - SCALE_HI[0] + SCALE_HI[1] = scaleY + SCALE_LO[1] = scaleY - SCALE_HI[1] - TRANSLATE_HI[0] = translateX - TRANSLATE_LO[0] = translateX - TRANSLATE_HI[0] - TRANSLATE_HI[1] = translateY - TRANSLATE_LO[1] = translateY - TRANSLATE_HI[1] + TRANSLATE_HI[0] = translateX + TRANSLATE_LO[0] = translateX - TRANSLATE_HI[0] + TRANSLATE_HI[1] = translateY + TRANSLATE_LO[1] = translateY - TRANSLATE_HI[1] - var screenX = viewBox[2] - viewBox[0] - var screenY = viewBox[3] - viewBox[1] + var screenX = viewBox[2] - viewBox[0] + var screenY = viewBox[3] - viewBox[1] - pixelSize = Math.min(dataX / screenX, dataY / screenY) + pixelSize = Math.min(dataX / screenX, dataY / screenY) - //FIXME: why twice? - PIXEL_SCALE[0] = 2 * pixelRatio / screenX - PIXEL_SCALE[1] = 2 * pixelRatio / screenY + //FIXME: why twice? + PIXEL_SCALE[0] = 2 * pixelRatio / screenX + PIXEL_SCALE[1] = 2 * pixelRatio / screenY - xStart = dataBox[0] - xEnd = dataBox[2] - } + xStart = dataBox[0] + xEnd = dataBox[2] +} - var PICK_OFFSET = [0, 0, 0, 0] +var PICK_OFFSET = [0, 0, 0, 0] - proto.drawPick = function(offset) { - var pick = offset !== undefined - var plot = this.plot - var pointCount = this.pointCount - var snap = pointCount > this.snapThreshold +proto.drawPick = function(offset) { + var pick = offset !== undefined + var plot = this.plot + var pointCount = this.pointCount + var snap = pointCount > this.snapThreshold - if(!pointCount) { - return offset - } + if(!pointCount) { + return offset + } - calcScales.call(this) + calcScales.call(this) - var gl = plot.gl - var shader = pick ? this.pickShader : this.shader - var blend = gl.isEnabled(gl.BLEND) + var gl = plot.gl + var shader = pick ? this.pickShader : this.shader + var blend = gl.isEnabled(gl.BLEND) - shader.bind() + shader.bind() - if(pick) { - this.pickOffset = offset + if(pick) { + this.pickOffset = offset - for (var i = 0; i < 4; ++i) { - PICK_OFFSET[i] = (offset >> (i * 8)) & 0xff - } + for (var i = 0; i < 4; ++i) { + PICK_OFFSET[i] = (offset >> (i * 8)) & 0xff + } - shader.uniforms.pickOffset = PICK_OFFSET + shader.uniforms.pickOffset = PICK_OFFSET - this.idBuffer.bind() - shader.attributes.id.pointer(gl.UNSIGNED_BYTE, false) + this.idBuffer.bind() + shader.attributes.id.pointer(gl.UNSIGNED_BYTE, false) - } else { - gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.blendColor(0,0,0,1); - if (!blend) gl.enable(gl.BLEND) + } else { + gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + gl.blendColor(0,0,0,1); + if (!blend) gl.enable(gl.BLEND) - this.colorBuffer.bind() - shader.attributes.color.pointer(gl.UNSIGNED_BYTE, false) + this.colorBuffer.bind() + shader.attributes.color.pointer(gl.UNSIGNED_BYTE, false) - this.charBuffer.bind() - shader.attributes.char.pointer(gl.UNSIGNED_BYTE, false) + this.charBuffer.bind() + shader.attributes.char.pointer(gl.UNSIGNED_BYTE, false) - shader.uniforms.chars = this.charTexture.bind(0) - shader.uniforms.charsShape = [this.charCanvas.width, this.charCanvas.height] - shader.uniforms.charsStep = this.charStep - shader.uniforms.palette = this.paletteTexture.bind(1) - } + shader.uniforms.chars = this.charTexture.bind(0) + shader.uniforms.charsShape = [this.charCanvas.width, this.charCanvas.height] + shader.uniforms.charsStep = this.charStep + shader.uniforms.palette = this.paletteTexture.bind(1) + } - this.sizeBuffer.bind() - shader.attributes.size.pointer(gl.FLOAT, false, 8, 0) - if (!pick) shader.attributes.border.pointer(gl.FLOAT, false, 8, 4) + this.sizeBuffer.bind() + shader.attributes.size.pointer(gl.FLOAT, false, 8, 0) + if (!pick) shader.attributes.border.pointer(gl.FLOAT, false, 8, 4) - this.positionBuffer.bind() - shader.attributes.positionHi.pointer(gl.FLOAT, false, 16, 0) - shader.attributes.positionLo.pointer(gl.FLOAT, false, 16, 8) + this.positionBuffer.bind() + shader.attributes.positionHi.pointer(gl.FLOAT, false, 16, 0) + shader.attributes.positionLo.pointer(gl.FLOAT, false, 16, 8) - shader.uniforms.pixelRatio = plot.pixelRatio - shader.uniforms.scaleHi = SCALE_HI - shader.uniforms.scaleLo = SCALE_LO - shader.uniforms.translateHi = TRANSLATE_HI - shader.uniforms.translateLo = TRANSLATE_LO - shader.uniforms.viewBox = plot.viewBox + shader.uniforms.pixelRatio = plot.pixelRatio + shader.uniforms.scaleHi = SCALE_HI + shader.uniforms.scaleLo = SCALE_LO + shader.uniforms.translateHi = TRANSLATE_HI + shader.uniforms.translateLo = TRANSLATE_LO + shader.uniforms.viewBox = plot.viewBox - var scales = this.scales + var scales = this.scales - if (snap) { - for (var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { - var lod = scales[scaleNum] - if(lod.pixelSize && (lod.pixelSize < pixelSize * 1.25) && scaleNum > 1) { - continue - } + if (snap) { + for (var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { + var lod = scales[scaleNum] + if(lod.pixelSize && (lod.pixelSize < pixelSize * 1.25) && scaleNum > 1) { + continue + } - var intervalStart = lod.offset - var intervalEnd = lod.count + intervalStart + var intervalStart = lod.offset + var intervalEnd = lod.count + intervalStart - var startOffset = search.ge(this.xCoords, xStart, intervalStart, intervalEnd - 1) - var endOffset = search.lt(this.xCoords, xEnd, startOffset, intervalEnd - 1) + 1 + var startOffset = search.ge(this.xCoords, xStart, intervalStart, intervalEnd - 1) + var endOffset = search.lt(this.xCoords, xEnd, startOffset, intervalEnd - 1) + 1 - if (endOffset > startOffset) { - gl.drawArrays(gl.POINTS, startOffset, (endOffset - startOffset)) - } - } - } - else { - gl.drawArrays(gl.POINTS, 0, pointCount) + if (endOffset > startOffset) { + gl.drawArrays(gl.POINTS, startOffset, (endOffset - startOffset)) + } } + } + else { + gl.drawArrays(gl.POINTS, 0, pointCount) + } - if (pick) return offset + pointCount + if (pick) return offset + pointCount + else { + if (!blend) gl.disable(gl.BLEND) else { - if (!blend) gl.disable(gl.BLEND) - else { - gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) - } + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) } } -})() + +} proto.draw = proto.drawPick @@ -28389,36 +28511,69 @@ proto.pick = function(x, y, value) { proto.update = function(options) { options = options || {} - var positions = options.positions || [] + var positions = options.positions || [] var colors = options.colors || [] var glyphs = options.glyphs || [] var sizes = options.sizes || [] var borderWidths = options.borderWidths || [] var borderColors = options.borderColors || [] var gl = this.plot.gl + var pointCount = this.pointCount + var snap = pointCount > this.snapThreshold - this.points = positions + //update positions + if (options.positions != null) { + this.points = positions - //create packed positions here - var pointCount = this.points.length / 2 - var packedId = pool.mallocInt32(pointCount) - var packedW = pool.mallocFloat32(2 * pointCount) - var packed = pool.mallocFloat64(2 * pointCount) - packed.set(this.points) + pointCount = this.points.length / 2 - this.pointCount = pointCount + snap = pointCount > this.snapThreshold - var snap = pointCount > this.snapThreshold + //create packed positions here + var packedW = pool.mallocFloat32(2 * pointCount) + var packed = pool.mallocFloat64(2 * pointCount) + var v_ids = pool.mallocUint32(pointCount) + var v_position = pool.mallocFloat32(4 * pointCount) - if (snap) { - this.scales = snapPoints(packed, packedId, packedW) + packed.set(this.points) + + if (snap) { + if (this.i2idx) pool.free(this.i2idx) + this.i2idx = pool.mallocInt32(pointCount) + this.scales = snapPoints(packed, this.i2idx, packedW) + } + + this.pointCount = pointCount + + + for(var i = 0; i < pointCount; ++i) { + var id = snap ? this.i2idx[i] : i + + v_ids[i] = id + + //collect buffers data + var x = positions[2 * id] + var y = positions[2 * id + 1] + + //write hi- and lo- position parts + v_position[4 * i] = x + v_position[4 * i + 1] = y + v_position[4 * i + 2] = x - v_position[4 * i] + v_position[4 * i + 3] = y - v_position[4 * i + 1] + + this.xCoords[i] = x + } + + this.idBuffer.update(v_ids) + this.positionBuffer.update(v_position) + pool.free(v_position) + pool.free(v_ids) + pool.free(packed) + pool.free(packedW) } - //v_position contains normalized positions to the available range of positions - var v_position = pool.mallocFloat32(4 * pointCount) var v_sizeWidth = pool.mallocFloat32(2 * pointCount) var v_color = pool.mallocUint8(2 * pointCount) - var v_ids = pool.mallocUint32(pointCount) var v_chars = pool.mallocUint8(2 * pointCount) //aggregate colors @@ -28487,31 +28642,21 @@ proto.update = function(options) { shape: [atlasW, atlasH], step: [step, step], chars: chars, - align: true + align: true, + fit: this.charFit }) this.chars = chars } - //collect buffers data for(var i = 0; i < pointCount; ++i) { - var id = snap ? packedId[i] : i - var x = positions[2 * id] - var y = positions[2 * id + 1] + var id = snap ? this.i2idx[i] : i + var s = sizes[id] var w = borderWidths[id] - //write hi- and lo- position parts - v_position[4 * i] = x - v_position[4 * i + 1] = y - v_position[4 * i + 2] = x - v_position[4 * i] - v_position[4 * i + 3] = y - v_position[4 * i + 1] - - this.xCoords[i] = x - //size is doubled bc character SDF is twice less than character step v_sizeWidth[2 * i] = s*2 v_sizeWidth[2 * i + 1] = w - v_ids[i] = id //color/bufferColor indexes var cId = colorIds[id] @@ -28528,13 +28673,9 @@ proto.update = function(options) { v_chars[2 * i] = charId % cols } - // if (!v_color.length) return - //fill buffes - this.positionBuffer.update(v_position) this.sizeBuffer.update(v_sizeWidth) this.colorBuffer.update(v_color) - this.idBuffer.update(v_ids) this.charBuffer.update(v_chars) //update char/color textures @@ -28544,14 +28685,9 @@ proto.update = function(options) { } this.paletteTexture.setPixels(ndarray(paletteColors.slice(0, 256*4), [256, 1, 4])) - pool.free(v_position) pool.free(v_sizeWidth) pool.free(v_color) - pool.free(v_ids) pool.free(v_chars) - pool.free(packed) - pool.free(packedId) - pool.free(packedW) } proto.dispose = function() { @@ -28594,257 +28730,308 @@ function createFancyScatter2D(plot, options) { return scatter } -},{"./lib/shaders":110,"binary-search-bounds":111,"clamp":46,"color-id":49,"font-atlas-sdf":67,"gl-buffer":71,"gl-shader":112,"gl-texture2d":138,"ndarray":158,"snap-points-2d":120,"typedarray-pool":199}],122:[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((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((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}" +},{"./lib/shaders":112,"binary-search-bounds":113,"clamp":48,"color-id":51,"font-atlas-sdf":69,"gl-buffer":73,"gl-shader":114,"gl-texture2d":140,"ndarray":160,"snap-points-2d":122,"typedarray-pool":202}],124:[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((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((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}" -},{}],123:[function(require,module,exports){ -arguments[4][45][0].apply(exports,arguments) -},{"dup":45}],124:[function(require,module,exports){ -arguments[4][119][0].apply(exports,arguments) -},{"dup":119}],125:[function(require,module,exports){ -arguments[4][120][0].apply(exports,arguments) -},{"./lib/sort":124,"dup":120,"typedarray-pool":199}],126:[function(require,module,exports){ -'use strict' - -var createShader = require('gl-shader') -var createBuffer = require('gl-buffer') -var search = require('binary-search-bounds') -var snapPoints = require('snap-points-2d') -var pool = require('typedarray-pool') -var SHADERS = require('./lib/shader') - -module.exports = createScatter2D - -function Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) { - this.plot = plot - this.positionBufferHi = positionBufferHi - this.positionBufferLo = positionBufferLo - this.pickBuffer = pickBuffer - this.weightBuffer = weightBuffer - this.shader = shader - this.pickShader = pickShader - this.scales = [] - this.size = 12.0 - this.borderSize = 1.0 - this.pointCount = 0 - this.color = [1, 0, 0, 1] - this.borderColor = [0, 0, 0, 1] - this.bounds = [Infinity, Infinity, -Infinity, -Infinity] - this.pickOffset = 0 - this.points = null - this.xCoords = null -} - -var proto = Scatter2D.prototype -var scaleHi = new Float32Array(2) -var scaleLo = new Float32Array(2) -var translateHi = new Float32Array(2) -var translateLo = new Float32Array(2) -var PICK_VEC4 = [0, 0, 0, 0] - -proto.dispose = function() { - this.shader.dispose() - this.pickShader.dispose() - this.positionBufferHi.dispose() - this.positionBufferLo.dispose() - this.pickBuffer.dispose() - if(this.xCoords) pool.free(this.xCoords) - this.plot.removeObject(this) -} - -proto.update = function(options) { - options = options || {} - - function dflt(opt, value) { - return opt in options ? options[opt] : value - } - - this.size = dflt('size', 12) - this.color = dflt('color', [1, 0, 0, 1]).slice() - this.borderSize = dflt('borderSize', 1) - this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() - - if(this.xCoords) pool.free(this.xCoords) - - this.points = options.positions - var pointCount = this.points.length >>> 1 - var packedId = pool.mallocInt32(pointCount) - var packedW = pool.mallocFloat32(2 * pointCount) - var packed = pool.mallocFloat64(2 * pointCount) - packed.set(this.points) - this.scales = snapPoints(packed, packedId, packedW, this.bounds) - - var xCoords = pool.mallocFloat64(pointCount) - var packedHi = pool.mallocFloat32(2 * pointCount) - var packedLo = pool.mallocFloat32(2 * pointCount) - packedHi.set(packed) - for(var i = 0, j = 0; i < pointCount; i++, j += 2) { - packedLo[j] = packed[j] - packedHi[j] - packedLo[j + 1] = packed[j + 1] - packedHi[j + 1] - xCoords[i] = packed[j] - } - this.positionBufferHi.update(packedHi) - this.positionBufferLo.update(packedLo) - this.pickBuffer.update(packedId) - this.weightBuffer.update(packedW) - - pool.free(packedId) - pool.free(packed) - pool.free(packedHi) - pool.free(packedLo) - pool.free(packedW) - - this.xCoords = xCoords - this.pointCount = pointCount - this.pickOffset = 0 -} - -proto.draw = function(pickOffset) { - - var pick = pickOffset !== void(0) - - var plot = this.plot - var shader = pick ? this.pickShader : this.shader - var scales = this.scales - var positionBufferHi = this.positionBufferHi - var positionBufferLo = this.positionBufferLo - var pickBuffer = this.pickBuffer - var bounds = this.bounds - var size = this.size - var borderSize = this.borderSize - var gl = plot.gl - var pixelRatio = pick ? plot.pickPixelRatio : plot.pixelRatio - var viewBox = plot.viewBox - var dataBox = plot.dataBox - - if(this.pointCount === 0) - return pickOffset - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - var screenX = (viewBox[2] - viewBox[0]) * pixelRatio / plot.pixelRatio - var screenY = (viewBox[3] - viewBox[1]) * pixelRatio / plot.pixelRatio - - var pixelSize = Math.min(dataX / screenX, dataY / screenY) - - var scaleX = 2 * boundX / dataX - var scaleY = 2 * boundY / dataY - - scaleHi[0] = scaleX - scaleHi[1] = scaleY - - scaleLo[0] = scaleX - scaleHi[0] - scaleLo[1] = scaleY - scaleHi[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 - - translateLo[0] = translateX - translateHi[0] - translateLo[1] = translateY - translateHi[1] - - shader.bind() - shader.uniforms.scaleHi = scaleHi - shader.uniforms.scaleLo = scaleLo - shader.uniforms.translateHi = translateHi - shader.uniforms.translateLo = translateLo - shader.uniforms.color = this.color - shader.uniforms.borderColor = this.borderColor - shader.uniforms.pointSize = pixelRatio * (size + borderSize) - shader.uniforms.centerFraction = this.borderSize === 0 ? 2 : size / (size + borderSize + 1.25) - - positionBufferHi.bind() - shader.attributes.positionHi.pointer() - - positionBufferLo.bind() - shader.attributes.positionLo.pointer() - - if(pick) { - - this.pickOffset = pickOffset - PICK_VEC4[0] = ( pickOffset & 0xff) - PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) - PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) - PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) - shader.uniforms.pickOffset = PICK_VEC4 - - pickBuffer.bind() - shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) - - } else { - - shader.uniforms.useWeight = 1 - this.weightBuffer.bind() - shader.attributes.weight.pointer() - - } - - var xCoords = this.xCoords - var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX - var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX - - var firstLevel = true - - for(var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { - var lod = scales[scaleNum] - if(lod.pixelSize < pixelSize && scaleNum > 1) - continue - - var intervalStart = lod.offset - var intervalEnd = lod.count + intervalStart - - var startOffset = search.ge(xCoords, xStart, intervalStart, intervalEnd - 1) - var endOffset = search.lt(xCoords, xEnd, startOffset, intervalEnd - 1) + 1 - - if(endOffset > startOffset) - gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset) - - if(!pick && firstLevel) { - firstLevel = false - shader.uniforms.useWeight = 0 - } - } - - return pickOffset + this.pointCount -} - -proto.drawPick = proto.draw - -proto.pick = function(x, y, value) { - var pointId = value - this.pickOffset - return pointId < 0 || pointId >= this.pointCount - ? null : { - object: this, - pointId: pointId, - dataCoord: [ this.points[2 * pointId], this.points[2 * pointId + 1] ] - } -} - -function createScatter2D(plot, options) { - var gl = plot.gl - var positionBufferHi = createBuffer(gl) - var positionBufferLo = createBuffer(gl) - var pickBuffer = createBuffer(gl) - var weightBuffer = createBuffer(gl) - var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) - var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) - - var result = new Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) - result.update(options) - - plot.addObject(result) // register with plot +},{}],125:[function(require,module,exports){ +arguments[4][47][0].apply(exports,arguments) +},{"dup":47}],126:[function(require,module,exports){ +arguments[4][121][0].apply(exports,arguments) +},{"dup":121}],127:[function(require,module,exports){ +arguments[4][122][0].apply(exports,arguments) +},{"./lib/sort":126,"dup":122,"typedarray-pool":202}],128:[function(require,module,exports){ +'use strict' + +var createShader = require('gl-shader') +var createBuffer = require('gl-buffer') +var search = require('binary-search-bounds') +var snapPoints = require('snap-points-2d') +var pool = require('typedarray-pool') +var SHADERS = require('./lib/shader') +var normalize = require('array-normalize') +var getBounds = require('array-bounds') + +module.exports = createScatter2D + +function Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) { + this.plot = plot + this.positionBufferHi = positionBufferHi + this.positionBufferLo = positionBufferLo + this.pickBuffer = pickBuffer + this.weightBuffer = weightBuffer + this.shader = shader + this.pickShader = pickShader + this.scales = [] + this.size = 12.0 + this.borderSize = 1.0 + this.pointCount = 0 + this.color = [1, 0, 0, 1] + this.borderColor = [0, 0, 0, 1] + this.bounds = [Infinity, Infinity, -Infinity, -Infinity] + this.pickOffset = 0 + this.points = null + this.xCoords = null + this.snapPoints = true +} + +var proto = Scatter2D.prototype +var scaleHi = new Float32Array(2) +var scaleLo = new Float32Array(2) +var translateHi = new Float32Array(2) +var translateLo = new Float32Array(2) +var PICK_VEC4 = [0, 0, 0, 0] + +proto.dispose = function() { + this.shader.dispose() + this.pickShader.dispose() + this.positionBufferHi.dispose() + this.positionBufferLo.dispose() + this.pickBuffer.dispose() + if(this.xCoords) pool.free(this.xCoords) + this.plot.removeObject(this) +} + +proto.update = function(options) { + options = options || {} + + function dflt(opt, value) { + return opt in options ? options[opt] : value + } + + this.size = dflt('size', 12) + this.color = dflt('color', [1, 0, 0, 1]).slice() + this.borderSize = dflt('borderSize', 1) + this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() + this.snapPoints = dflt('snapPoints', true) + + if(this.xCoords) pool.free(this.xCoords) + + //do not recalc points if there is no positions + if (options.positions != null) { + this.points = options.positions + var pointCount = this.points.length >>> 1 + + var packedId = pool.mallocInt32(pointCount) + var packedW = pool.mallocFloat32(pointCount) + var packed = pool.mallocFloat64(2 * pointCount) + packed.set(this.points) + + if (this.snapPoints) { + this.scales = snapPoints(packed, packedId, packedW, this.bounds) + } + else { + //get bounds + this.bounds = getBounds(packed, 2) + + // rescale packed to unit box + normalize(packed, 2, this.bounds) + + // generate fake ids + for (var i = 0; i < pointCount; i++) { + packedId[i] = i + packedW[i] = 1 + } + } + + var xCoords = pool.mallocFloat64(pointCount) + var packedHi = pool.mallocFloat32(2 * pointCount) + var packedLo = pool.mallocFloat32(2 * pointCount) + packedHi.set(packed) + for(var i = 0, j = 0; i < pointCount; i++, j += 2) { + packedLo[j] = packed[j] - packedHi[j] + packedLo[j + 1] = packed[j + 1] - packedHi[j + 1] + xCoords[i] = packed[j] + } + this.positionBufferHi.update(packedHi) + this.positionBufferLo.update(packedLo) + this.pickBuffer.update(packedId) + this.weightBuffer.update(packedW) + + pool.free(packedHi) + pool.free(packedLo) + pool.free(packedW) + pool.free(packed) + pool.free(packedId) + + this.xCoords = xCoords + this.pointCount = pointCount + this.pickOffset = 0 + } +} + +proto.draw = function(pickOffset) { + var pick = pickOffset !== void(0) + + var plot = this.plot + var shader = pick ? this.pickShader : this.shader + var scales = this.scales + var positionBufferHi = this.positionBufferHi + var positionBufferLo = this.positionBufferLo + var pickBuffer = this.pickBuffer + var bounds = this.bounds + var size = this.size + var borderSize = this.borderSize + var gl = plot.gl + var pixelRatio = pick ? plot.pickPixelRatio : plot.pixelRatio + var viewBox = plot.viewBox + var dataBox = plot.dataBox + + if(this.pointCount === 0) + return pickOffset + + var boundX = bounds[2] - bounds[0] + var boundY = bounds[3] - bounds[1] + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] + var screenX = (viewBox[2] - viewBox[0]) * pixelRatio / plot.pixelRatio + var screenY = (viewBox[3] - viewBox[1]) * pixelRatio / plot.pixelRatio + + var pixelSize = this.pixelSize = Math.min(dataX / screenX, dataY / screenY) + + var scaleX = 2 * boundX / dataX + var scaleY = 2 * boundY / dataY + + scaleHi[0] = scaleX + scaleHi[1] = scaleY + + scaleLo[0] = scaleX - scaleHi[0] + scaleLo[1] = scaleY - scaleHi[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 + + translateLo[0] = translateX - translateHi[0] + translateLo[1] = translateY - translateHi[1] + + shader.bind() + shader.uniforms.scaleHi = scaleHi + shader.uniforms.scaleLo = scaleLo + shader.uniforms.translateHi = translateHi + shader.uniforms.translateLo = translateLo + shader.uniforms.color = this.color + shader.uniforms.borderColor = this.borderColor + shader.uniforms.pointSize = pixelRatio * (size + borderSize) + shader.uniforms.centerFraction = this.borderSize === 0 ? 2 : size / (size + borderSize + 1.25) + + positionBufferHi.bind() + shader.attributes.positionHi.pointer() + + positionBufferLo.bind() + shader.attributes.positionLo.pointer() + + if(pick) { + this.pickOffset = pickOffset + PICK_VEC4[0] = ( pickOffset & 0xff) + PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) + PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) + PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) + shader.uniforms.pickOffset = PICK_VEC4 + + pickBuffer.bind() + shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) + + } else { + + shader.uniforms.useWeight = 1 + this.weightBuffer.bind() + shader.attributes.weight.pointer() + + } + + + var firstLevel = true + + if (this.snapPoints) { + for(var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { + var lod = scales[scaleNum] + if(lod.pixelSize < pixelSize && scaleNum > 1) + continue + + var range = this.getVisibleRange(lod) + var startOffset = range[0], endOffset = range[1] + + if(endOffset > startOffset) + gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset) + + if(!pick && firstLevel) { + firstLevel = false + shader.uniforms.useWeight = 0 + } + } + } + else { + gl.drawArrays(gl.POINTS, 0, this.pointCount) + } + + return pickOffset + this.pointCount +} + +proto.getVisibleRange = function (lod) { + var dataBox = this.plot.dataBox, + bounds = this.bounds, + pixelSize = this.pixelSize, + size = this.size, + pixelRatio = this.plot.pixelRatio, + boundX = bounds[2] - bounds[0], + boundY = bounds[3] - bounds[1] + + if (!lod) { + for(var scaleNum = this.scales.length - 1, lod; scaleNum >= 0; scaleNum--) { + lod = this.scales[scaleNum]; + if(!(lod.pixelSize < pixelSize && scaleNum > 1)) break; + } + } + + var xCoords = this.xCoords + var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX + var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX + + var intervalStart = lod.offset + var intervalEnd = lod.count + intervalStart + + var startOffset = search.ge(xCoords, xStart, intervalStart, intervalEnd - 1) + var endOffset = search.lt(xCoords, xEnd, startOffset, intervalEnd - 1) + 1 + + return [startOffset, endOffset] +} + +proto.drawPick = proto.draw + +proto.pick = function(x, y, value) { + var pointId = value - this.pickOffset + return pointId < 0 || pointId >= this.pointCount + ? null : { + object: this, + pointId: pointId, + dataCoord: [ this.points[2 * pointId], this.points[2 * pointId + 1] ] + } +} + +function createScatter2D(plot, options) { + var gl = plot.gl + var positionBufferHi = createBuffer(gl) + var positionBufferLo = createBuffer(gl) + var pickBuffer = createBuffer(gl) + var weightBuffer = createBuffer(gl) + var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) + var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) + + var result = new Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) + result.update(options) + + plot.addObject(result) // register with plot + + return result +} - return result -} -},{"./lib/shader":122,"binary-search-bounds":123,"gl-buffer":71,"gl-shader":130,"snap-points-2d":125,"typedarray-pool":199}],127:[function(require,module,exports){ +},{"./lib/shader":124,"array-bounds":11,"array-normalize":12,"binary-search-bounds":125,"gl-buffer":73,"gl-shader":132,"snap-points-2d":127,"typedarray-pool":202}],129:[function(require,module,exports){ 'use strict' @@ -28852,7 +29039,7 @@ function createScatter2D(plot, options) { exports.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" exports.boxFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n" -},{}],128:[function(require,module,exports){ +},{}],130:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -28978,7 +29165,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":127,"gl-buffer":71,"gl-shader":130}],129:[function(require,module,exports){ +},{"./lib/shaders":129,"gl-buffer":73,"gl-shader":132}],131:[function(require,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -29133,7 +29320,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":29,"cwise/lib/wrapper":59,"gl-fbo":79,"ndarray":158,"typedarray-pool":199}],130:[function(require,module,exports){ +},{"bit-twiddle":31,"cwise/lib/wrapper":61,"gl-fbo":81,"ndarray":160,"typedarray-pool":202}],132:[function(require,module,exports){ 'use strict' var createUniformWrapper = require('./lib/create-uniforms') @@ -29369,19 +29556,19 @@ function createShader( module.exports = createShader -},{"./lib/GLError":131,"./lib/create-attributes":132,"./lib/create-uniforms":133,"./lib/reflect":134,"./lib/runtime-reflect":135,"./lib/shader-cache":136}],131:[function(require,module,exports){ -arguments[4][94][0].apply(exports,arguments) -},{"dup":94}],132:[function(require,module,exports){ -arguments[4][95][0].apply(exports,arguments) -},{"./GLError":131,"dup":95}],133:[function(require,module,exports){ +},{"./lib/GLError":133,"./lib/create-attributes":134,"./lib/create-uniforms":135,"./lib/reflect":136,"./lib/runtime-reflect":137,"./lib/shader-cache":138}],133:[function(require,module,exports){ arguments[4][96][0].apply(exports,arguments) -},{"./GLError":131,"./reflect":134,"dup":96}],134:[function(require,module,exports){ +},{"dup":96}],134:[function(require,module,exports){ arguments[4][97][0].apply(exports,arguments) -},{"dup":97}],135:[function(require,module,exports){ +},{"./GLError":133,"dup":97}],135:[function(require,module,exports){ arguments[4][98][0].apply(exports,arguments) -},{"dup":98}],136:[function(require,module,exports){ +},{"./GLError":133,"./reflect":136,"dup":98}],136:[function(require,module,exports){ arguments[4][99][0].apply(exports,arguments) -},{"./GLError":131,"dup":99,"gl-format-compiler-error":80,"weakmap-shim":206}],137:[function(require,module,exports){ +},{"dup":99}],137:[function(require,module,exports){ +arguments[4][100][0].apply(exports,arguments) +},{"dup":100}],138:[function(require,module,exports){ +arguments[4][101][0].apply(exports,arguments) +},{"./GLError":133,"dup":101,"gl-format-compiler-error":82,"weakmap-shim":209}],139:[function(require,module,exports){ 'use strict' module.exports = createSpikes2D @@ -29469,7 +29656,7 @@ function createSpikes2D(plot, options) { return spikes } -},{}],138:[function(require,module,exports){ +},{}],140:[function(require,module,exports){ 'use strict' var ndarray = require('ndarray') @@ -30032,7 +30219,7 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":158,"ndarray-ops":157,"typedarray-pool":199}],139:[function(require,module,exports){ +},{"ndarray":160,"ndarray-ops":159,"typedarray-pool":202}],141:[function(require,module,exports){ var tokenize = require('glsl-tokenizer') var atob = require('atob-lite') @@ -30057,7 +30244,7 @@ function getName(src) { } } -},{"atob-lite":11,"glsl-tokenizer":146}],140:[function(require,module,exports){ +},{"atob-lite":13,"glsl-tokenizer":148}],142:[function(require,module,exports){ module.exports = tokenize var literals100 = require('./lib/literals') @@ -30421,7 +30608,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":142,"./lib/builtins-300es":141,"./lib/literals":144,"./lib/literals-300es":143,"./lib/operators":145}],141:[function(require,module,exports){ +},{"./lib/builtins":144,"./lib/builtins-300es":143,"./lib/literals":146,"./lib/literals-300es":145,"./lib/operators":147}],143:[function(require,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = require('./builtins') @@ -30492,7 +30679,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":142}],142:[function(require,module,exports){ +},{"./builtins":144}],144:[function(require,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -30644,7 +30831,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],143:[function(require,module,exports){ +},{}],145:[function(require,module,exports){ var v100 = require('./literals') module.exports = v100.slice().concat([ @@ -30734,7 +30921,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":144}],144:[function(require,module,exports){ +},{"./literals":146}],146:[function(require,module,exports){ module.exports = [ // current 'precision' @@ -30829,7 +31016,7 @@ module.exports = [ , 'using' ] -},{}],145:[function(require,module,exports){ +},{}],147:[function(require,module,exports){ module.exports = [ '<<=' , '>>=' @@ -30878,7 +31065,7 @@ module.exports = [ , '}' ] -},{}],146:[function(require,module,exports){ +},{}],148:[function(require,module,exports){ var tokenize = require('./index') module.exports = tokenizeString @@ -30893,7 +31080,7 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":140}],147:[function(require,module,exports){ +},{"./index":142}],149:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -30979,7 +31166,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],148:[function(require,module,exports){ +},{}],150:[function(require,module,exports){ "use strict" var bounds = require("binary-search-bounds") @@ -31346,7 +31533,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":28}],149:[function(require,module,exports){ +},{"binary-search-bounds":30}],151:[function(require,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -31358,7 +31545,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],150:[function(require,module,exports){ +},{}],152:[function(require,module,exports){ "use strict" function iota(n) { @@ -31370,7 +31557,7 @@ function iota(n) { } module.exports = iota -},{}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -31393,7 +31580,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],152:[function(require,module,exports){ +},{}],154:[function(require,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -31402,7 +31589,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],153:[function(require,module,exports){ +},{}],155:[function(require,module,exports){ 'use strict' module.exports = mouseListen @@ -31609,7 +31796,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":154}],154:[function(require,module,exports){ +},{"mouse-event":156}],156:[function(require,module,exports){ 'use strict' function mouseButtons(ev) { @@ -31671,7 +31858,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],155:[function(require,module,exports){ +},{}],157:[function(require,module,exports){ 'use strict' var toPX = require('to-px') @@ -31713,7 +31900,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":195}],156:[function(require,module,exports){ +},{"to-px":198}],158:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -32129,7 +32316,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":199}],157:[function(require,module,exports){ +},{"typedarray-pool":202}],159:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -32592,7 +32779,7 @@ exports.equals = compile({ -},{"cwise-compiler":56}],158:[function(require,module,exports){ +},{"cwise-compiler":58}],160:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -32937,7 +33124,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":150,"is-buffer":151}],159:[function(require,module,exports){ +},{"iota-array":152,"is-buffer":153}],161:[function(require,module,exports){ "use strict" var doubleBits = require("double-bits") @@ -32980,7 +33167,167 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":61}],160:[function(require,module,exports){ +},{"double-bits":63}],162:[function(require,module,exports){ +/** + * @module optical-properties + */ +'use strict' + +module.exports = measure + +var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d') + +canvas.width = 200, canvas.height = 200 + +measure.canvas = canvas + +//returns character [x, y, scale] optical params +function measure (char, options) { + var data, w, h, params + + //figure out argument imageData + if (typeof char === 'string') { + data = getCharImageData(char, options) + w = data.width, h = data.height + } + else if (char instanceof HTMLCanvasElement) { + w = char.width, h = char.height + char = char.getContext('2d') + data = char.getImageData(0, 0, w, h) + } + else if (char instanceof ImageData) { + w = char.width, h = char.height + data = char + } + + params = getOpticalParams(data) + + return params +} + +//draw character in canvas and get it's imagedata +function getCharImageData (char, options) { + if (!options) options = {} + var family = options.family || 'sans-serif' + var w = canvas.width, h = canvas.height + + var size = options.width || options.height || options.size + if (size && size != w) { + w = h = canvas.width = canvas.height = size + } + + var fs = options.fontSize || w/2 + + ctx.fillStyle = '#000' + ctx.fillRect(0, 0, w, h) + + ctx.font = fs + 'px ' + family + ctx.textBaseline = 'middle' + ctx.textAlign = 'center' + ctx.fillStyle = 'white' + ctx.fillText(char, w/2, h/2) + + return ctx.getImageData(0, 0, w, h) +} + + +//walks over imagedata, returns params +function getOpticalParams (data) { + var buf = data.data, w = data.width, h = data.height + + var x, y, r, i, j, sum, xSum, ySum, rowAvg = Array(h), rowAvgX = Array(h), cx, cy, bounds, avg, top = 0, bottom = 0, left = w, right = 0, maxR = 0, rowBounds = Array(h), r2 + + for (y = 0; y < h; y++) { + sum = 0, xSum = 0, j = y*4*w + + bounds = getBounds(buf.subarray(j, j + 4*w), 4) + + if (bounds[0] === bounds[1]) { + continue + } + else { + if (!top) top = y + bottom = y + } + + for (x = bounds[0]; x < bounds[1]; x++) { + i = x*4 + r = buf[j + i] + sum += r + xSum += x*r + } + + rowAvg[y] = sum === 0 ? 0 : sum/w + rowAvgX[y] = sum === 0 ? 0 : xSum/sum + + if (bounds[0] < left) left = bounds[0] + if (bounds[1] > right) right = bounds[1] + + rowBounds[y] = bounds + } + + sum = 0, ySum = 0, xSum = 0 + for (y = 0; y < h; y++) { + avg = rowAvg[y] + if (!avg) continue; + + ySum += avg*y + sum += avg + xSum += rowAvgX[y]*avg + } + + cy = ySum/sum + cx = xSum/sum + + maxR = 0, r2 = 0 + for (y = 0; y < h; y++) { + bounds = rowBounds[y] + if (!bounds) continue + + r2 = Math.max( + dist2(cx - bounds[0], cy - y), + dist2(cx - bounds[1], cy - y) + ) + if (r2 > maxR) { + maxR = r2 + } + } + + return { + center: [cx, cy], + bounds: [left, top, right, bottom+1], + radius: Math.sqrt(maxR) + } +} + +//get [leftId, rightId] pair of bounding values for an array +function getBounds (arr, stride) { + var left = 0, right = arr.length, i = 0 + + if (!stride) stride = 4 + + //find left non-zero value + while (!arr[i] && i < right) { + i+=stride + } + left = i + + //find right non-zero value + i = arr.length + while (!arr[i] && i > left) { + i-=stride + } + right = i + + return [left/stride, right/stride] +} + +function dist2 (x, y) { + return x*x + y*y +} + +},{}],163:[function(require,module,exports){ /*! * pad-left * @@ -32996,7 +33343,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":174}],161:[function(require,module,exports){ +},{"repeat-string":177}],164:[function(require,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -33007,7 +33354,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],162:[function(require,module,exports){ +},{}],165:[function(require,module,exports){ "use strict" module.exports = permutationSign @@ -33059,7 +33406,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":199}],163:[function(require,module,exports){ +},{"typedarray-pool":202}],166:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -33146,7 +33493,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":149,"typedarray-pool":199}],164:[function(require,module,exports){ +},{"invert-permutation":151,"typedarray-pool":202}],167:[function(require,module,exports){ "use strict" module.exports = planarDual @@ -33277,7 +33624,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":55}],165:[function(require,module,exports){ +},{"compare-angle":57}],168:[function(require,module,exports){ 'use strict' module.exports = trimLeaves @@ -33333,7 +33680,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":63}],166:[function(require,module,exports){ +},{"edges-to-adjacency-list":65}],169:[function(require,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -33538,7 +33885,7 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":165,"edges-to-adjacency-list":63,"planar-dual":164,"point-in-big-polygon":167,"robust-sum":181,"two-product":197,"uniq":201}],167:[function(require,module,exports){ +},{"./lib/trim-leaves":168,"edges-to-adjacency-list":65,"planar-dual":167,"point-in-big-polygon":170,"robust-sum":184,"two-product":200,"uniq":204}],170:[function(require,module,exports){ module.exports = preprocessPolygon var orient = require('robust-orientation')[3] @@ -33690,7 +34037,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":28,"interval-tree-1d":148,"robust-orientation":176,"slab-decomposition":188}],168:[function(require,module,exports){ +},{"binary-search-bounds":30,"interval-tree-1d":150,"robust-orientation":179,"slab-decomposition":191}],171:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -33861,6 +34208,10 @@ process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -33872,7 +34223,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],169:[function(require,module,exports){ +},{}],172:[function(require,module,exports){ 'use strict' var bnadd = require('big-rat/add') @@ -33888,7 +34239,7 @@ function add (a, b) { return r } -},{"big-rat/add":12}],170:[function(require,module,exports){ +},{"big-rat/add":14}],173:[function(require,module,exports){ 'use strict' module.exports = float2rat @@ -33903,7 +34254,7 @@ function float2rat(v) { return result } -},{"big-rat":15}],171:[function(require,module,exports){ +},{"big-rat":17}],174:[function(require,module,exports){ 'use strict' var rat = require('big-rat') @@ -33921,7 +34272,7 @@ function muls(a, x) { return r } -},{"big-rat":15,"big-rat/mul":24}],172:[function(require,module,exports){ +},{"big-rat":17,"big-rat/mul":26}],175:[function(require,module,exports){ 'use strict' var bnsub = require('big-rat/sub') @@ -33937,7 +34288,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":26}],173:[function(require,module,exports){ +},{"big-rat/sub":28}],176:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -43442,7 +43793,7 @@ return wrapREGL; }))); -},{}],174:[function(require,module,exports){ +},{}],177:[function(require,module,exports){ /*! * repeat-string * @@ -43514,7 +43865,7 @@ function repeat(str, num) { return res; } -},{}],175:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -43682,7 +44033,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":178,"robust-subtract":180,"robust-sum":181,"two-product":197}],176:[function(require,module,exports){ +},{"robust-scale":181,"robust-subtract":183,"robust-sum":184,"two-product":200}],179:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -43873,7 +44224,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":178,"robust-subtract":180,"robust-sum":181,"two-product":197}],177:[function(require,module,exports){ +},{"robust-scale":181,"robust-subtract":183,"robust-sum":184,"two-product":200}],180:[function(require,module,exports){ "use strict" var robustSum = require("robust-sum") @@ -43903,7 +44254,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":178,"robust-sum":181}],178:[function(require,module,exports){ +},{"robust-scale":181,"robust-sum":184}],181:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -43954,7 +44305,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":197,"two-sum":198}],179:[function(require,module,exports){ +},{"two-product":200,"two-sum":201}],182:[function(require,module,exports){ "use strict" module.exports = segmentsIntersect @@ -44002,7 +44353,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":176}],180:[function(require,module,exports){ +},{"robust-orientation":179}],183:[function(require,module,exports){ "use strict" module.exports = robustSubtract @@ -44159,7 +44510,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],181:[function(require,module,exports){ +},{}],184:[function(require,module,exports){ "use strict" module.exports = linearExpansionSum @@ -44316,7 +44667,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],182:[function(require,module,exports){ +},{}],185:[function(require,module,exports){ "use strict" module.exports = function signum(x) { @@ -44324,9 +44675,9 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],183:[function(require,module,exports){ -arguments[4][29][0].apply(exports,arguments) -},{"dup":29}],184:[function(require,module,exports){ +},{}],186:[function(require,module,exports){ +arguments[4][31][0].apply(exports,arguments) +},{"dup":31}],187:[function(require,module,exports){ "use strict"; "use restrict"; var bits = require("bit-twiddle") @@ -44670,7 +45021,7 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":183,"union-find":185}],185:[function(require,module,exports){ +},{"bit-twiddle":186,"union-find":188}],188:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -44727,7 +45078,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],186:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ "use strict" module.exports = simplifyPolygon @@ -44999,7 +45350,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":176,"simplicial-complex":184}],187:[function(require,module,exports){ +},{"robust-orientation":179,"simplicial-complex":187}],190:[function(require,module,exports){ "use strict" module.exports = orderSegments @@ -45095,7 +45446,7 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":176}],188:[function(require,module,exports){ +},{"robust-orientation":179}],191:[function(require,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -45326,44 +45677,52 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":187,"binary-search-bounds":28,"functional-red-black-tree":68,"robust-orientation":176}],189:[function(require,module,exports){ -(function(window) { +},{"./lib/order-segments":190,"binary-search-bounds":30,"functional-red-black-tree":70,"robust-orientation":179}],192:[function(require,module,exports){ +/* global window, exports, define */ + +!function() { + 'use strict' + var re = { not_string: /[^s]/, + not_bool: /[^t]/, + not_type: /[^T]/, + not_primitive: /[^v]/, number: /[diefg]/, + numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[\+\-]/ } - function sprintf() { - var key = arguments[0], cache = sprintf.cache - if (!(cache[key] && cache.hasOwnProperty(key))) { - cache[key] = sprintf.parse(key) - } - return sprintf.format.call(null, cache[key], arguments) + function sprintf(key) { + // `arguments` is not an array, but should be fine for this call + return sprintf_format(sprintf_parse(key), arguments) + } + + function vsprintf(fmt, argv) { + return sprintf.apply(null, [fmt].concat(argv || [])) } - sprintf.format = function(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + function sprintf_format(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign for (i = 0; i < tree_length; i++) { - node_type = get_type(parse_tree[i]) - if (node_type === "string") { - output[output.length] = parse_tree[i] + if (typeof parse_tree[i] === 'string') { + output += parse_tree[i] } - else if (node_type === "array") { + else if (Array.isArray(parse_tree[i])) { match = parse_tree[i] // convenience purposes only if (match[2]) { // keyword argument arg = argv[cursor] for (k = 0; k < match[2].length; k++) { if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) } arg = arg[match[2][k]] } @@ -45375,12 +45734,12 @@ function createSlabDecomposition(segments) { arg = argv[cursor++] } - if (get_type(arg) == "function") { + if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) { arg = arg() } - if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { - throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) { + throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) } if (re.number.test(match[8])) { @@ -45388,96 +45747,113 @@ function createSlabDecomposition(segments) { } switch (match[8]) { - case "b": - arg = arg.toString(2) - break - case "c": - arg = String.fromCharCode(arg) - break - case "d": - case "i": + case 'b': + arg = parseInt(arg, 10).toString(2) + break + case 'c': + arg = String.fromCharCode(parseInt(arg, 10)) + break + case 'd': + case 'i': arg = parseInt(arg, 10) - break - case "j": + break + case 'j': arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) - break - case "e": - arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() - break - case "f": + break + case 'e': + arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() + break + case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) - break - case "g": - arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) - break - case "o": - arg = arg.toString(8) - break - case "s": - arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) - break - case "u": - arg = arg >>> 0 - break - case "x": - arg = arg.toString(16) - break - case "X": - arg = arg.toString(16).toUpperCase() - break + break + case 'g': + arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg) + break + case 'o': + arg = (parseInt(arg, 10) >>> 0).toString(8) + break + case 's': + arg = String(arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 't': + arg = String(!!arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'T': + arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'u': + arg = parseInt(arg, 10) >>> 0 + break + case 'v': + arg = arg.valueOf() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'x': + arg = (parseInt(arg, 10) >>> 0).toString(16) + break + case 'X': + arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() + break } if (re.json.test(match[8])) { - output[output.length] = arg + output += arg } else { if (re.number.test(match[8]) && (!is_positive || match[3])) { - sign = is_positive ? "+" : "-" - arg = arg.toString().replace(re.sign, "") + sign = is_positive ? '+' : '-' + arg = arg.toString().replace(re.sign, '') } else { - sign = "" + sign = '' } - pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' pad_length = match[6] - (sign + arg).length - pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" - output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' + output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) } } } - return output.join("") + return output } - sprintf.cache = {} + var sprintf_cache = Object.create(null) + + function sprintf_parse(fmt) { + if (sprintf_cache[fmt]) { + return sprintf_cache[fmt] + } - sprintf.parse = function(fmt) { - var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + var _fmt = fmt, match, parse_tree = [], arg_names = 0 while (_fmt) { if ((match = re.text.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = match[0] + parse_tree.push(match[0]) } else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = "%" + parse_tree.push('%') } else if ((match = re.placeholder.exec(_fmt)) !== null) { if (match[2]) { arg_names |= 1 var field_list = [], replacement_field = match[2], field_match = [] if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + field_list.push(field_match[1]) + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } } } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } match[2] = field_list } @@ -45485,58 +45861,43 @@ function createSlabDecomposition(segments) { arg_names |= 2 } if (arg_names === 3) { - throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') } - parse_tree[parse_tree.length] = match + parse_tree.push(match) } else { - throw new SyntaxError("[sprintf] unexpected placeholder") + throw new SyntaxError('[sprintf] unexpected placeholder') } _fmt = _fmt.substring(match[0].length) } - return parse_tree - } - - var vsprintf = function(fmt, argv, _argv) { - _argv = (argv || []).slice(0) - _argv.splice(0, 0, fmt) - return sprintf.apply(null, _argv) - } - - /** - * helpers - */ - function get_type(variable) { - return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() - } - - function str_repeat(input, multiplier) { - return Array(multiplier + 1).join(input) + return sprintf_cache[fmt] = parse_tree } /** * export to either browser or node.js */ - if (typeof exports !== "undefined") { - exports.sprintf = sprintf - exports.vsprintf = vsprintf + /* eslint-disable quote-props */ + if (typeof exports !== 'undefined') { + exports['sprintf'] = sprintf + exports['vsprintf'] = vsprintf } - else { - window.sprintf = sprintf - window.vsprintf = vsprintf + if (typeof window !== 'undefined') { + window['sprintf'] = sprintf + window['vsprintf'] = vsprintf - if (typeof define === "function" && define.amd) { + if (typeof define === 'function' && define['amd']) { define(function() { return { - sprintf: sprintf, - vsprintf: vsprintf + 'sprintf': sprintf, + 'vsprintf': vsprintf } }) } } -})(typeof window === "undefined" ? this : window); + /* eslint-enable quote-props */ +}() -},{}],190:[function(require,module,exports){ +},{}],193:[function(require,module,exports){ 'use strict' module.exports = toSuperScript @@ -45591,7 +45952,7 @@ function toSuperScript(x) { }).join('') } -},{}],191:[function(require,module,exports){ +},{}],194:[function(require,module,exports){ "use strict" module.exports = surfaceNets @@ -45799,7 +46160,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":156,"triangulate-hypercube":196,"zero-crossings":209}],192:[function(require,module,exports){ +},{"ndarray-extract-contour":158,"triangulate-hypercube":199,"zero-crossings":212}],195:[function(require,module,exports){ (function (process){ 'use strict' @@ -45889,7 +46250,7 @@ function textGet(font, text, opts) { } }).call(this,require('_process')) -},{"_process":168,"vectorize-text":202}],193:[function(require,module,exports){ +},{"_process":171,"vectorize-text":205}],196:[function(require,module,exports){ 'use strict'; module.exports = TinySDF; @@ -45998,7 +46359,7 @@ function edt1d(f, d, v, z, n) { } } -},{}],194:[function(require,module,exports){ +},{}],197:[function(require,module,exports){ // TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -47195,7 +47556,7 @@ else { })(Math); -},{}],195:[function(require,module,exports){ +},{}],198:[function(require,module,exports){ 'use strict' var parseUnit = require('parse-unit') @@ -47256,7 +47617,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":161}],196:[function(require,module,exports){ +},{"parse-unit":164}],199:[function(require,module,exports){ "use strict" module.exports = triangulateCube @@ -47290,7 +47651,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":69,"permutation-parity":162,"permutation-rank":163}],197:[function(require,module,exports){ +},{"gamma":71,"permutation-parity":165,"permutation-rank":166}],200:[function(require,module,exports){ "use strict" module.exports = twoProduct @@ -47324,7 +47685,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],198:[function(require,module,exports){ +},{}],201:[function(require,module,exports){ "use strict" module.exports = fastTwoSum @@ -47342,7 +47703,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],199:[function(require,module,exports){ +},{}],202:[function(require,module,exports){ (function (global,Buffer){ 'use strict' @@ -47559,7 +47920,7 @@ exports.clearCache = function clearCache() { } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bit-twiddle":29,"buffer":38,"dup":62}],200:[function(require,module,exports){ +},{"bit-twiddle":31,"buffer":40,"dup":64}],203:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -47622,7 +47983,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],201:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -47681,7 +48042,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],202:[function(require,module,exports){ +},{}],205:[function(require,module,exports){ "use strict" module.exports = createText @@ -47708,7 +48069,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":203}],203:[function(require,module,exports){ +},{"./lib/vtext":206}],206:[function(require,module,exports){ "use strict" module.exports = vectorizeText @@ -47914,7 +48275,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":40,"clean-pslg":47,"ndarray":158,"planar-graph-to-polyline":166,"simplify-planar-graph":186,"surface-nets":191}],204:[function(require,module,exports){ +},{"cdt2d":42,"clean-pslg":49,"ndarray":160,"planar-graph-to-polyline":169,"simplify-planar-graph":189,"surface-nets":194}],207:[function(require,module,exports){ var hiddenStore = require('./hidden-store.js'); module.exports = createStore; @@ -47935,7 +48296,7 @@ function createStore() { }; } -},{"./hidden-store.js":205}],205:[function(require,module,exports){ +},{"./hidden-store.js":208}],208:[function(require,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -47953,7 +48314,7 @@ function hiddenStore(obj, key) { return store; } -},{}],206:[function(require,module,exports){ +},{}],209:[function(require,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -47984,14 +48345,14 @@ function weakMap() { } } -},{"./create-store.js":204}],207:[function(require,module,exports){ +},{"./create-store.js":207}],210:[function(require,module,exports){ var getContext = require('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":70}],208:[function(require,module,exports){ +},{"get-canvas-context":72}],211:[function(require,module,exports){ module.exports = require('cwise-compiler')({ args: ['array', { offset: [1], @@ -48043,7 +48404,7 @@ module.exports = require('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":56}],209:[function(require,module,exports){ +},{"cwise-compiler":58}],212:[function(require,module,exports){ "use strict" module.exports = findZeroCrossings @@ -48056,7 +48417,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":208}],210:[function(require,module,exports){ +},{"./lib/zc-core":211}],213:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48069,9 +48430,8 @@ function findZeroCrossings(array, level) { 'use strict'; var Lib = require('../../lib'); -var Color = require('../color'); var Axes = require('../../plots/cartesian/axes'); - +var handleAnnotationCommonDefaults = require('./common_defaults'); var attributes = require('./attributes'); @@ -48088,26 +48448,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op if(!(visible || clickToShow)) return annOut; - coerce('opacity'); - var bgColor = coerce('bgcolor'); + handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); - var borderColor = coerce('bordercolor'), - borderOpacity = Color.opacity(borderColor); - - coerce('borderpad'); - - var borderWidth = coerce('borderwidth'); - var showArrow = coerce('showarrow'); - - coerce('text', showArrow ? ' ' : 'new text'); - coerce('textangle'); - Lib.coerceFont(coerce, 'font', fullLayout.font); - - coerce('width'); - coerce('align'); - - var h = coerce('height'); - if(h) coerce('valign'); + var showArrow = annOut.showarrow; // positioning var axLetters = ['x', 'y'], @@ -48149,14 +48492,8 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + // if you have one part of arrow length you should have both if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('standoff'); - - // if you have one part of arrow length you should have both Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); } @@ -48166,34 +48503,18 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // put the actual click data to bind to into private attributes // so we don't have to do this little bit of logic on every hover event - annOut._xclick = (xClick === undefined) ? annOut.x : xClick; - annOut._yclick = (yClick === undefined) ? annOut.y : yClick; - } - - var hoverText = coerce('hovertext'); - var globalHoverLabel = fullLayout.hoverlabel || {}; - - if(hoverText) { - var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || - (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) - ); - - var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || - Color.contrast(hoverBG) - ); - - Lib.coerceFont(coerce, 'hoverlabel.font', { - family: globalHoverLabel.font.family, - size: globalHoverLabel.font.size, - color: globalHoverLabel.font.color || hoverBorder - }); + annOut._xclick = (xClick === undefined) ? + annOut.x : + Axes.cleanPosition(xClick, gdMock, annOut.xref); + annOut._yclick = (yClick === undefined) ? + annOut.y : + Axes.cleanPosition(yClick, gdMock, annOut.yref); } - coerce('captureevents', !!hoverText); return annOut; }; -},{"../../lib":336,"../../plots/cartesian/axes":374,"../color":221,"./attributes":212}],211:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/axes":384,"./attributes":215,"./common_defaults":218}],214:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48258,7 +48579,7 @@ module.exports = [ } ]; -},{}],212:[function(require,module,exports){ +},{}],215:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48538,7 +48859,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/cartesian/constants":379,"../../plots/font_attributes":398,"./arrow_paths":211}],213:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/cartesian/constants":389,"../../plots/font_attributes":408,"./arrow_paths":214}],216:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48641,7 +48962,7 @@ function annAutorange(gd) { }); } -},{"../../lib":336,"../../plots/cartesian/axes":374,"./draw":217}],214:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/axes":384,"./draw":221}],217:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48727,18 +49048,22 @@ function getToggleSets(gd, hoverData) { explicitOffSet = [], hoverLen = (hoverData || []).length; - var i, j, anni, showMode, pointj, toggleType; + var i, j, anni, showMode, pointj, xa, ya, toggleType; for(i = 0; i < annotations.length; i++) { anni = annotations[i]; showMode = anni.clicktoshow; + if(showMode) { for(j = 0; j < hoverLen; j++) { pointj = hoverData[j]; - if(pointj.xaxis._id === anni.xref && - pointj.yaxis._id === anni.yref && - pointj.xaxis.d2r(pointj.x) === anni._xclick && - pointj.yaxis.d2r(pointj.y) === anni._yclick + xa = pointj.xaxis; + ya = pointj.yaxis; + + if(xa._id === anni.xref && + ya._id === anni.yref && + xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && + ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) ) { // match! toggle this annotation // regardless of its clicktoshow mode @@ -48766,7 +49091,80 @@ function getToggleSets(gd, hoverData) { return {on: onSet, off: offSet, explicitOff: explicitOffSet}; } -},{"../../plotly":369}],215:[function(require,module,exports){ +// to handle log axes until v2 +function clickData2r(d, ax) { + return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); +} + +},{"../../plotly":379}],218:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Color = require('../color'); + +// defaults common to 'annotations' and 'annotations3d' +module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { + coerce('opacity'); + var bgColor = coerce('bgcolor'); + + var borderColor = coerce('bordercolor'); + var borderOpacity = Color.opacity(borderColor); + + coerce('borderpad'); + + var borderWidth = coerce('borderwidth'); + var showArrow = coerce('showarrow'); + + coerce('text', showArrow ? ' ' : 'new text'); + coerce('textangle'); + Lib.coerceFont(coerce, 'font', fullLayout.font); + + coerce('width'); + coerce('align'); + + var h = coerce('height'); + if(h) coerce('valign'); + + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + coerce('standoff'); + + } + + var hoverText = coerce('hovertext'); + var globalHoverLabel = fullLayout.hoverlabel || {}; + + if(hoverText) { + var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || + (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) + ); + + var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || + Color.contrast(hoverBG) + ); + + Lib.coerceFont(coerce, 'hoverlabel.font', { + family: globalHoverLabel.font.family, + size: globalHoverLabel.font.size, + color: globalHoverLabel.font.color || hoverBorder + }); + } + + coerce('captureevents', !!hoverText); +}; + +},{"../../lib":346,"../color":230}],219:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48829,7 +49227,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":356,"fast-isnumeric":66}],216:[function(require,module,exports){ +},{"../../lib/to_log_range":366,"fast-isnumeric":68}],220:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48854,7 +49252,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":371,"./annotation_defaults":210}],217:[function(require,module,exports){ +},{"../../plots/array_container_defaults":381,"./annotation_defaults":213}],221:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48893,7 +49291,8 @@ var drawArrowHead = require('./draw_arrow_head'); module.exports = { draw: draw, - drawOne: drawOne + drawOne: drawOne, + drawRaw: drawRaw }; /* @@ -48914,37 +49313,61 @@ function draw(gd) { } /* - * drawOne: draw a single annotation, potentially with modifications + * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications * * index (int): the annotation to draw */ function drawOne(gd, index) { - var layout = gd.layout, - fullLayout = gd._fullLayout, - gs = gd._fullLayout._size; + var fullLayout = gd._fullLayout; + var options = fullLayout.annotations[index] || {}; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); - // remove the existing annotation if there is one - fullLayout._infolayer.selectAll('.annotation[data-index="' + index + '"]').remove(); + drawRaw(gd, options, index, false, xa, ya); +} - // remember a few things about what was already there, - var optionsIn = (layout.annotations || [])[index], - options = fullLayout.annotations[index]; +/** + * drawRaw: draw a single annotation, potentially with modifications + * + * @param {DOM element} gd + * @param {object} options : this annotation's fullLayout options + * @param {integer} index : index in 'annotations' container of the annotation to draw + * @param {string} subplotId : id of the annotation's subplot + * - use false for 2d (i.e. cartesian or paper-ref) annotations + * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px + * @param {object | undefined} ya : ... y-axis + */ +function drawRaw(gd, options, index, subplotId, xa, ya) { + var fullLayout = gd._fullLayout; + var gs = gd._fullLayout._size; + var className; + var annbase; + + if(subplotId) { + className = 'annotation-' + subplotId; + annbase = subplotId + '.annotations[' + index + ']'; + } else { + className = 'annotation'; + annbase = 'annotations[' + index + ']'; + } + + // remove the existing annotation if there is one + fullLayout._infolayer + .selectAll('.' + className + '[data-index="' + index + '"]') + .remove(); var annClipID = 'clip' + fullLayout._uid + '_ann' + index; // this annotation is gone - quit now after deleting it // TODO: use d3 idioms instead of deleting and redrawing every time - if(!optionsIn || options.visible === false) { + if(!options._input || options.visible === false) { d3.selectAll('#' + annClipID).remove(); return; } - var xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - - // calculated pixel positions - // x & y each will get text, head, and tail as appropriate - annPosPx = {x: {}, y: {}}, + // calculated pixel positions + // x & y each will get text, head, and tail as appropriate + var annPosPx = {x: {}, y: {}}, textangle = +options.textangle || 0; // create the components @@ -48952,26 +49375,32 @@ function drawOne(gd, index) { // with border/arrow together this could handle a whole bunch of // cleanup at this point, but works for now var annGroup = fullLayout._infolayer.append('g') - .classed('annotation', true) + .classed(className, true) .attr('data-index', String(index)) .style('opacity', options.opacity); // another group for text+background so that they can rotate together var annTextGroup = annGroup.append('g') - .classed('annotation-text-g', true) - .attr('data-index', String(index)); + .classed('annotation-text-g', true); var annTextGroupInner = annTextGroup.append('g') .style('pointer-events', options.captureevents ? 'all' : null) .call(setCursor, 'default') .on('click', function() { gd._dragging = false; - gd.emit('plotly_clickannotation', { + + var eventData = { index: index, - annotation: optionsIn, + annotation: options._input, fullAnnotation: options, event: d3.event - }); + }; + + if(subplotId) { + eventData.subplotId = subplotId; + } + + gd.emit('plotly_clickannotation', eventData); }); if(options.hovertext) { @@ -48994,7 +49423,8 @@ function drawOne(gd, index) { fontColor: hoverFont.color }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); }) .on('mouseout', function() { @@ -49027,8 +49457,7 @@ function drawOne(gd, index) { var font = options.font; var annText = annTextGroupInner.append('text') - .classed('annotation', true) - .attr('data-unformatted', options.text) + .classed('annotation-text', true) .text(options.text); function textLayout(s) { @@ -49040,29 +49469,24 @@ function drawOne(gd, index) { }[options.align] || 'middle' }); - svgTextUtils.convertToTspans(s, drawGraphicalElements); + svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); return s; } function drawGraphicalElements() { // if the text has *only* a link, make the whole box into a link - var anchor = annText.selectAll('a'); - if(anchor.size() === 1 && anchor.text() === annText.text()) { + var anchor3 = annText.selectAll('a'); + if(anchor3.size() === 1 && anchor3.text() === annText.text()) { var wholeLink = annTextGroupInner.insert('a', ':first-child').attr({ - 'xlink:xlink:href': anchor.attr('xlink:href'), - 'xlink:xlink:show': anchor.attr('xlink:show') + 'xlink:xlink:href': anchor3.attr('xlink:href'), + 'xlink:xlink:show': anchor3.attr('xlink:show') }) .style({cursor: 'pointer'}); wholeLink.node().appendChild(annTextBG.node()); } - - // make sure lines are aligned the way they will be - // at the end, even if their position changes - annText.selectAll('tspan.line').attr({y: 0, x: 0}); - - var mathjaxGroup = annTextGroupInner.select('.annotation-math-group'); + var mathjaxGroup = annTextGroupInner.select('.annotation-text-math-group'); var hasMathjax = !mathjaxGroup.empty(); var anntextBB = Drawing.bBox( (hasMathjax ? mathjaxGroup : annText).node()); @@ -49095,10 +49519,13 @@ function drawOne(gd, index) { } var annotationIsOffscreen = false; - ['x', 'y'].forEach(function(axLetter) { - var axRef = options[axLetter + 'ref'] || axLetter, + var letters = ['x', 'y']; + + for(var i = 0; i < letters.length; i++) { + var axLetter = letters[i], + axRef = options[axLetter + 'ref'] || axLetter, tailRef = options['a' + axLetter + 'ref'], - ax = Axes.getFromId(gd, axRef), + ax = {x: xa, y: ya}[axLetter], dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, // note that these two can be either positive or negative annSizeFromWidth = outerWidth * Math.cos(dimAngle), @@ -49138,7 +49565,7 @@ function drawOne(gd, index) { annotationIsOffscreen = true; } - if(annotationIsOffscreen) return; + if(annotationIsOffscreen) continue; } basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; @@ -49220,7 +49647,7 @@ function drawOne(gd, index) { // size/shift are used during dragging options['_' + axLetter + 'size'] = annSize; options['_' + axLetter + 'shift'] = textShift; - }); + } if(annotationIsOffscreen) { annTextGroupInner.remove(); @@ -49245,14 +49672,11 @@ function drawOne(gd, index) { .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } else { - var texty = borderfull + yShift - anntextBB.top, - textx = borderfull + xShift - anntextBB.left; - annText.attr({ - x: textx, - y: texty - }) - .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); - annText.selectAll('tspan.line').attr({y: texty, x: textx}); + var texty = borderfull + yShift - anntextBB.top; + var textx = borderfull + xShift - anntextBB.left; + + annText.call(svgTextUtils.positionText, textx, texty) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } annTextClip.select('rect').call(Drawing.setRect, borderfull, borderfull, @@ -49274,8 +49698,6 @@ function drawOne(gd, index) { annTextGroup.attr({transform: 'rotate(' + textangle + ',' + annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - var annbase = 'annotations[' + index + ']'; - /* * add the arrow * uses options[arrowwidth,arrowcolor,arrowhead] for styling @@ -49283,8 +49705,8 @@ function drawOne(gd, index) { * while the head stays put, dx and dy are the pixel offsets */ var drawArrow = function(dx, dy) { - d3.select(gd) - .selectAll('.annotation-arrow-g[data-index="' + index + '"]') + annGroup + .selectAll('.annotation-arrow-g') .remove(); var headX = annPosPx.x.head, @@ -49341,8 +49763,7 @@ function drawOne(gd, index) { var arrowGroup = annGroup.append('g') .style({opacity: Color.opacity(arrowColor)}) - .classed('annotation-arrow-g', true) - .attr('data-index', String(index)); + .classed('annotation-arrow-g', true); var arrow = arrowGroup.append('path') .attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) @@ -49353,7 +49774,7 @@ function drawOne(gd, index) { // the arrow dragger is a small square right at the head, then a line to the tail, // all expanded by a stroke width of 6px plus the arrow line width - if(gd._context.editable && arrow.node().parentNode) { + if(gd._context.editable && arrow.node().parentNode && !subplotId) { var arrowDragHeadX = headX; var arrowDragHeadY = headY; if(options.standoff) { @@ -49362,10 +49783,9 @@ function drawOne(gd, index) { arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; } var arrowDrag = arrowGroup.append('path') - .classed('annotation', true) + .classed('annotation-arrow', true) .classed('anndrag', true) .attr({ - 'data-index': String(index), d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' }) @@ -49381,6 +49801,7 @@ function drawOne(gd, index) { // (head/tail/text) all together dragElement.init({ element: arrowDrag.node(), + gd: gd, prepFn: function() { var pos = Drawing.getTranslate(annTextGroupInner); @@ -49443,6 +49864,7 @@ function drawOne(gd, index) { // textbox and tail, leave the head untouched dragElement.init({ element: annTextGroupInner.node(), + gd: gd, prepFn: function() { baseTextTransform = annTextGroup.attr('transform'); update = {}; @@ -49464,7 +49886,7 @@ function drawOne(gd, index) { drawArrow(dx, dy); } - else { + else if(!subplotId) { if(xa) update[annbase + '.x'] = options.x + dx / xa._m; else { var widthFraction = options._xsize / gs.w, @@ -49492,6 +49914,7 @@ function drawOne(gd, index) { ); } } + else return; annTextGroup.attr({ transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform @@ -49512,20 +49935,22 @@ function drawOne(gd, index) { } if(gd._context.editable) { - annText.call(svgTextUtils.makeEditable, annTextGroupInner) + annText.call(svgTextUtils.makeEditable, {delegate: annTextGroupInner, gd: gd}) .call(textLayout) .on('edit', function(_text) { options.text = _text; - this.attr({'data-unformatted': options.text}); this.call(textLayout); + var update = {}; - update['annotations[' + index + '].text'] = options.text; + update[annbase + '.text'] = options.text; + if(xa && xa.autorange) { update[xa._name + '.autorange'] = true; } if(ya && ya.autorange) { update[ya._name + '.autorange'] = true; } + Plotly.relayout(gd, update); }); } @@ -49553,7 +49978,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":336,"../../lib/setcursor":351,"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/cartesian/axes":374,"../../plots/plots":406,"../color":221,"../dragelement":242,"../drawing":245,"../fx":262,"./draw_arrow_head":218,"d3":60}],218:[function(require,module,exports){ +},{"../../lib":346,"../../lib/setcursor":361,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/cartesian/axes":384,"../../plots/plots":417,"../color":230,"../dragelement":251,"../drawing":254,"../fx":271,"./draw_arrow_head":222,"d3":62}],222:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49667,7 +50092,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { function drawhead(p, rot) { if(!headStyle.path) return; if(style > 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -49687,7 +50112,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":221,"../drawing":245,"./arrow_paths":211,"d3":60,"fast-isnumeric":66}],219:[function(require,module,exports){ +},{"../color":230,"../drawing":254,"./arrow_paths":214,"d3":62,"fast-isnumeric":68}],223:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49712,6 +50137,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -49719,7 +50145,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":212,"./calc_autorange":213,"./click":214,"./convert_coords":215,"./defaults":216,"./draw":217}],220:[function(require,module,exports){ +},{"./attributes":215,"./calc_autorange":216,"./click":217,"./convert_coords":219,"./defaults":220,"./draw":221}],224:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":215}],225:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":346,"../../plots/cartesian/axes":384}],226:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":346,"../../plots/array_container_defaults":381,"../../plots/cartesian/axes":384,"../annotations/common_defaults":218,"./attributes":224}],227:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":414,"../annotations/draw":221}],228:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":224,"./convert":225,"./defaults":226,"./draw":227}],229:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49759,7 +50492,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],221:[function(require,module,exports){ +},{}],230:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49930,7 +50663,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":220,"fast-isnumeric":66,"tinycolor2":194}],222:[function(require,module,exports){ +},{"./attributes":229,"fast-isnumeric":68,"tinycolor2":197}],231:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50086,7 +50819,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/cartesian/layout_attributes":385,"../../plots/font_attributes":398}],223:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/cartesian/layout_attributes":395,"../../plots/font_attributes":408}],232:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50153,7 +50886,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":336,"../../plots/cartesian/tick_label_defaults":392,"../../plots/cartesian/tick_mark_defaults":393,"../../plots/cartesian/tick_value_defaults":394,"./attributes":222}],224:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/tick_label_defaults":402,"../../plots/cartesian/tick_mark_defaults":403,"../../plots/cartesian/tick_value_defaults":404,"./attributes":231}],233:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50179,6 +50912,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -50452,7 +51187,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -50464,8 +51199,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -50478,8 +51212,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -50712,6 +51445,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -50786,7 +51520,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":336,"../../lib/extend":330,"../../lib/setcursor":351,"../../plotly":369,"../../plots/cartesian/axes":374,"../../plots/cartesian/axis_defaults":376,"../../plots/cartesian/layout_attributes":385,"../../plots/cartesian/position_defaults":388,"../../plots/plots":406,"../../registry":413,"../color":221,"../dragelement":242,"../drawing":245,"../titles":310,"./attributes":222,"d3":60,"tinycolor2":194}],225:[function(require,module,exports){ +},{"../../constants/alignment":326,"../../lib":346,"../../lib/extend":340,"../../lib/setcursor":361,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/cartesian/axes":384,"../../plots/cartesian/axis_defaults":386,"../../plots/cartesian/layout_attributes":395,"../../plots/cartesian/position_defaults":398,"../../plots/plots":417,"../../registry":424,"../color":230,"../dragelement":251,"../drawing":254,"../titles":319,"./attributes":231,"d3":62,"tinycolor2":197}],234:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50805,7 +51539,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":336}],226:[function(require,module,exports){ +},{"../../lib":346}],235:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50860,7 +51594,7 @@ module.exports = { } }; -},{}],227:[function(require,module,exports){ +},{}],236:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50939,7 +51673,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":336,"./flip_scale":232,"./scales":239}],228:[function(require,module,exports){ +},{"../../lib":346,"./flip_scale":241,"./scales":248}],237:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50983,7 +51717,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":330,"./attributes":226,"./scales.js":239}],229:[function(require,module,exports){ +},{"../../lib/extend":340,"./attributes":235,"./scales.js":248}],238:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50999,7 +51733,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":239}],230:[function(require,module,exports){ +},{"./scales":248}],239:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51063,7 +51797,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":336,"../colorbar/defaults":223,"../colorbar/has_colorbar":225,"./flip_scale":232,"./is_valid_scale":236,"fast-isnumeric":66}],231:[function(require,module,exports){ +},{"../../lib":346,"../colorbar/defaults":232,"../colorbar/has_colorbar":234,"./flip_scale":241,"./is_valid_scale":245,"fast-isnumeric":68}],240:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51100,7 +51834,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],232:[function(require,module,exports){ +},{}],241:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51125,7 +51859,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],233:[function(require,module,exports){ +},{}],242:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51165,7 +51899,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":229,"./is_valid_scale_array":237,"./scales":239}],234:[function(require,module,exports){ +},{"./default_scale":238,"./is_valid_scale_array":246,"./scales":248}],243:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51211,7 +51945,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":336,"./is_valid_scale":236,"fast-isnumeric":66}],235:[function(require,module,exports){ +},{"../../lib":346,"./is_valid_scale":245,"fast-isnumeric":68}],244:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51245,7 +51979,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":226,"./calc":227,"./default_scale":229,"./defaults":230,"./extract_scale":231,"./flip_scale":232,"./get_scale":233,"./has_colorscale":234,"./is_valid_scale":236,"./make_color_scale_func":238,"./scales":239}],236:[function(require,module,exports){ +},{"./attributes":235,"./calc":236,"./default_scale":238,"./defaults":239,"./extract_scale":240,"./flip_scale":241,"./get_scale":242,"./has_colorscale":243,"./is_valid_scale":245,"./make_color_scale_func":247,"./scales":248}],245:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51266,7 +52000,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":237,"./scales":239}],237:[function(require,module,exports){ +},{"./is_valid_scale_array":246,"./scales":248}],246:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51303,7 +52037,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":194}],238:[function(require,module,exports){ +},{"tinycolor2":197}],247:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51399,7 +52133,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":221,"d3":60,"fast-isnumeric":66,"tinycolor2":194}],239:[function(require,module,exports){ +},{"../color":230,"d3":62,"fast-isnumeric":68,"tinycolor2":197}],248:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51530,7 +52264,7 @@ module.exports = { ] }; -},{}],240:[function(require,module,exports){ +},{}],249:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51563,7 +52297,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],241:[function(require,module,exports){ +},{}],250:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51601,7 +52335,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":336}],242:[function(require,module,exports){ +},{"../../lib":346}],251:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51630,6 +52364,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -51648,28 +52391,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -51720,10 +52455,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -51770,10 +52501,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -51803,7 +52530,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":319,"../../lib":336,"../../plotly":369,"../../plots/cartesian/constants":379,"./align":240,"./cursor":241,"./unhover":243}],243:[function(require,module,exports){ +},{"../../constants/interactions":329,"../../lib":346,"../../plotly":379,"../../plots/cartesian/constants":389,"./align":249,"./cursor":250,"./unhover":252}],252:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51859,7 +52586,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":329}],244:[function(require,module,exports){ +},{"../../lib/events":339}],253:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51883,7 +52610,7 @@ exports.dash = { }; -},{}],245:[function(require,module,exports){ +},{}],254:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51906,6 +52633,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -51927,13 +52657,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -51942,7 +52678,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -51957,7 +52693,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -52043,6 +52778,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -52269,7 +53014,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -52277,7 +53022,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -52298,9 +53042,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -52331,21 +53074,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -52484,34 +53222,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -52532,18 +53323,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -52698,17 +53500,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":322,"../../lib":336,"../../lib/svg_text_utils":355,"../../registry":413,"../../traces/scatter/make_bubble_size_func":483,"../../traces/scatter/subtypes":488,"../color":221,"../colorscale":235,"./symbol_defs":246,"d3":60,"fast-isnumeric":66,"tinycolor2":194}],246:[function(require,module,exports){ +},{"../../constants/alignment":326,"../../constants/xmlns_namespaces":332,"../../lib":346,"../../lib/svg_text_utils":365,"../../registry":424,"../../traces/scatter/make_bubble_size_func":494,"../../traces/scatter/subtypes":499,"../color":230,"../colorscale":244,"./symbol_defs":255,"d3":62,"fast-isnumeric":68,"tinycolor2":197}],255:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53184,7 +53976,7 @@ module.exports = { } }; -},{"d3":60}],247:[function(require,module,exports){ +},{"d3":62}],256:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53283,7 +54075,7 @@ module.exports = { } }; -},{}],248:[function(require,module,exports){ +},{}],257:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53346,7 +54138,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":374,"../../registry":413,"./compute_error":249,"fast-isnumeric":66}],249:[function(require,module,exports){ +},{"../../plots/cartesian/axes":384,"../../registry":424,"./compute_error":258,"fast-isnumeric":68}],258:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53442,7 +54234,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],250:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53519,7 +54311,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":336,"../../registry":413,"./attributes":247,"fast-isnumeric":66}],251:[function(require,module,exports){ +},{"../../lib":346,"../../registry":424,"./attributes":256,"fast-isnumeric":68}],260:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53578,7 +54370,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":247,"./calc":248,"./defaults":250,"./plot":252,"./style":253}],252:[function(require,module,exports){ +},{"./attributes":256,"./calc":257,"./defaults":259,"./plot":261,"./style":262}],261:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53742,7 +54534,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":488,"d3":60,"fast-isnumeric":66}],253:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":499,"d3":62,"fast-isnumeric":68}],262:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53779,7 +54571,7 @@ module.exports = function style(traces) { }); }; -},{"../color":221,"d3":60}],254:[function(require,module,exports){ +},{"../color":230,"d3":62}],263:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53815,7 +54607,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/font_attributes":398}],255:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/font_attributes":408}],264:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53831,30 +54623,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; + + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":336,"../../registry":413}],256:[function(require,module,exports){ +},{"../../lib":346,"../../registry":424}],265:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53866,10 +54674,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -53883,7 +54700,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":413}],257:[function(require,module,exports){ +},{"../../registry":424,"./hover":269}],266:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53915,7 +54732,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],258:[function(require,module,exports){ +},{}],267:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53938,7 +54755,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":336,"./attributes":254,"./hoverlabel_defaults":261}],259:[function(require,module,exports){ +},{"../../lib":346,"./attributes":263,"./hoverlabel_defaults":270}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53949,6 +54766,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -54025,7 +54843,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":257}],260:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":346,"./constants":266}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54094,7 +54938,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -54106,13 +54950,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -54189,15 +55033,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -54382,11 +55226,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -54485,6 +55329,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -54518,7 +55363,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -54532,7 +55377,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -54551,7 +55396,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -54586,7 +55431,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -54623,23 +55468,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -54655,14 +55493,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -54752,7 +55585,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -54768,12 +55603,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -54785,11 +55618,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -55057,17 +55888,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -55084,6 +55910,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -55151,7 +56001,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -55161,29 +56011,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -55335,7 +56162,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":336,"../../lib/events":329,"../../lib/override_cursor":345,"../../lib/svg_text_utils":355,"../../plots/cartesian/axes":374,"../../registry":413,"../color":221,"../dragelement":242,"../drawing":245,"./constants":257,"./helpers":259,"d3":60,"fast-isnumeric":66,"tinycolor2":194}],261:[function(require,module,exports){ +},{"../../lib":346,"../../lib/events":339,"../../lib/override_cursor":355,"../../lib/svg_text_utils":365,"../../plots/cartesian/axes":384,"../../registry":424,"../color":230,"../dragelement":251,"../drawing":254,"./constants":266,"./helpers":268,"d3":62,"fast-isnumeric":68,"tinycolor2":197}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55356,7 +56183,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":336}],262:[function(require,module,exports){ +},{"../../lib":346}],271:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55394,7 +56221,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -55416,23 +56246,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":336,"../dragelement":242,"./attributes":254,"./calc":255,"./click":256,"./constants":257,"./defaults":258,"./helpers":259,"./hover":260,"./layout_attributes":263,"./layout_defaults":264,"./layout_global_defaults":265,"d3":60}],263:[function(require,module,exports){ +},{"../../lib":346,"../dragelement":251,"./attributes":263,"./calc":264,"./click":265,"./constants":266,"./defaults":267,"./helpers":268,"./hover":269,"./layout_attributes":272,"./layout_defaults":273,"./layout_global_defaults":274,"d3":62}],272:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55485,7 +56313,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/font_attributes":398,"./constants":257}],264:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/font_attributes":408,"./constants":266}],273:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55533,7 +56361,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":336,"./layout_attributes":263}],265:[function(require,module,exports){ +},{"../../lib":346,"./layout_attributes":272}],274:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55556,7 +56384,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":336,"./hoverlabel_defaults":261,"./layout_attributes":263}],266:[function(require,module,exports){ +},{"../../lib":346,"./hoverlabel_defaults":270,"./layout_attributes":272}],275:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55678,7 +56506,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":379}],267:[function(require,module,exports){ +},{"../../plots/cartesian/constants":389}],276:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55761,7 +56589,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":356,"fast-isnumeric":66}],268:[function(require,module,exports){ +},{"../../lib/to_log_range":366,"fast-isnumeric":68}],277:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55822,7 +56650,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":336,"../../plots/array_container_defaults":371,"../../plots/cartesian/axes":374,"./attributes":266}],269:[function(require,module,exports){ +},{"../../lib":346,"../../plots/array_container_defaults":381,"../../plots/cartesian/axes":384,"./attributes":275}],278:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56043,7 +56871,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":322,"../../plots/cartesian/axes":374,"../drawing":245,"d3":60}],270:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":332,"../../plots/cartesian/axes":384,"../drawing":254,"d3":62}],279:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56066,7 +56894,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":266,"./convert_coords":267,"./defaults":268,"./draw":269}],271:[function(require,module,exports){ +},{"./attributes":275,"./convert_coords":276,"./defaults":277,"./draw":278}],280:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56115,7 +56943,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],272:[function(require,module,exports){ +},{}],281:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56206,7 +57034,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/font_attributes":398,"../color/attributes":220}],273:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/font_attributes":408,"../color/attributes":229}],282:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56224,7 +57052,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],274:[function(require,module,exports){ +},{}],283:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56317,7 +57145,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":336,"../../plots/layout_attributes":404,"../../registry":413,"./attributes":272,"./helpers":277}],275:[function(require,module,exports){ +},{"../../lib":346,"../../plots/layout_attributes":415,"../../registry":424,"./attributes":281,"./helpers":286}],284:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56342,6 +57170,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -56431,7 +57261,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -56637,6 +57467,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -56688,30 +57519,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -56876,20 +57701,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -56897,18 +57723,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -57143,7 +57970,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":319,"../../lib":336,"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/plots":406,"../../registry":413,"../color":221,"../dragelement":242,"../drawing":245,"./anchor_utils":271,"./constants":273,"./get_legend_data":276,"./helpers":277,"./style":279,"d3":60}],276:[function(require,module,exports){ +},{"../../constants/alignment":326,"../../constants/interactions":329,"../../lib":346,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":417,"../../registry":424,"../color":230,"../dragelement":251,"../drawing":254,"./anchor_utils":280,"./constants":282,"./get_legend_data":285,"./helpers":286,"./style":288,"d3":62}],285:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57248,7 +58075,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":413,"./helpers":277}],277:[function(require,module,exports){ +},{"../../registry":424,"./helpers":286}],286:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57279,7 +58106,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":413}],278:[function(require,module,exports){ +},{"../../registry":424}],287:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57303,7 +58130,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":272,"./defaults":274,"./draw":275,"./style":279}],279:[function(require,module,exports){ +},{"./attributes":281,"./defaults":283,"./draw":284,"./style":288}],288:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57326,7 +58153,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -57364,179 +58191,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); + + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); + + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; -},{"../../lib":336,"../../registry":413,"../../traces/pie/style_one":462,"../../traces/scatter/subtypes":488,"../color":221,"../drawing":245,"d3":60}],280:[function(require,module,exports){ +},{"../../lib":346,"../../registry":424,"../../traces/pie/style_one":473,"../../traces/scatter/subtypes":499,"../color":230,"../drawing":254,"d3":62}],289:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58114,7 +58941,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":336,"../../plotly":369,"../../plots/cartesian/axes":374,"../../plots/plots":406,"../../snapshot/download":415}],281:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":346,"../../plotly":379,"../../plots/cartesian/axes":384,"../../plots/plots":417,"../../snapshot/download":426}],290:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58128,7 +58955,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":282}],282:[function(require,module,exports){ +},{"./manage":291}],291:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58252,7 +59079,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -58304,7 +59131,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -58356,7 +59183,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":374,"../../traces/scatter/subtypes":488,"./buttons":280,"./modebar":283}],283:[function(require,module,exports){ +},{"../../plots/cartesian/axes":384,"../../traces/scatter/subtypes":499,"./buttons":289,"./modebar":292}],292:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58650,7 +59477,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":336,"d3":60}],284:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":346,"d3":62}],293:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58740,7 +59567,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/font_attributes":398,"../color/attributes":220,"./button_attributes":285}],285:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/font_attributes":408,"../color/attributes":229,"./button_attributes":294}],294:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58781,7 +59608,7 @@ module.exports = { } }; -},{}],286:[function(require,module,exports){ +},{}],295:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58810,7 +59637,7 @@ module.exports = { darkAmount: 10 }; -},{}],287:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58909,7 +59736,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":336,"../color":221,"./attributes":284,"./button_attributes":285,"./constants":286}],288:[function(require,module,exports){ +},{"../../lib":346,"../color":230,"./attributes":293,"./button_attributes":294,"./constants":295}],297:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58931,6 +59758,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -58971,7 +59800,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -59058,11 +59887,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -59094,26 +59921,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -59132,13 +59956,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -59184,7 +60003,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/cartesian/axis_ids":377,"../../plots/plots":406,"../color":221,"../drawing":245,"../legend/anchor_utils":271,"./constants":286,"./get_update_object":289,"d3":60}],289:[function(require,module,exports){ +},{"../../constants/alignment":326,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/cartesian/axis_ids":387,"../../plots/plots":417,"../color":230,"../drawing":254,"../legend/anchor_utils":280,"./constants":295,"./get_update_object":298,"d3":62}],298:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59241,7 +60060,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":60}],290:[function(require,module,exports){ +},{"d3":62}],299:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59268,7 +60087,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":284,"./defaults":287,"./draw":288}],291:[function(require,module,exports){ +},{"./attributes":293,"./defaults":296,"./draw":297}],300:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59332,7 +60151,7 @@ module.exports = { } }; -},{"../color/attributes":220}],292:[function(require,module,exports){ +},{"../color/attributes":229}],301:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59368,7 +60187,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":374,"./constants":293}],293:[function(require,module,exports){ +},{"../../plots/cartesian/axes":384,"./constants":302}],302:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59420,7 +60239,7 @@ module.exports = { extraPad: 15 }; -},{}],294:[function(require,module,exports){ +},{}],303:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59477,7 +60296,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":336,"./attributes":291}],295:[function(require,module,exports){ +},{"../../lib":346,"./attributes":300}],304:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60028,7 +60847,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":336,"../../lib/setcursor":351,"../../plotly":369,"../../plots/cartesian":384,"../../plots/cartesian/axes":374,"../../plots/plots":406,"../color":221,"../dragelement":242,"../drawing":245,"./constants":293,"d3":60}],296:[function(require,module,exports){ +},{"../../lib":346,"../../lib/setcursor":361,"../../plotly":379,"../../plots/cartesian":394,"../../plots/cartesian/axes":384,"../../plots/plots":417,"../color":230,"../dragelement":251,"../drawing":254,"./constants":302,"d3":62}],305:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60055,7 +60874,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":291,"./calc_autorange":292,"./defaults":294,"./draw":295}],297:[function(require,module,exports){ +},{"./attributes":300,"./calc_autorange":301,"./defaults":303,"./draw":304}],306:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60152,7 +60971,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../traces/scatter/attributes":468,"../annotations/attributes":212,"../drawing/attributes":244}],298:[function(require,module,exports){ +},{"../../lib/extend":340,"../../traces/scatter/attributes":479,"../annotations/attributes":215,"../drawing/attributes":253}],307:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60198,7 +61017,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -60229,7 +61048,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":336,"../../plots/cartesian/axes":374,"./constants":299,"./helpers":302}],299:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/axes":384,"./constants":308,"./helpers":311}],308:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60293,7 +61112,7 @@ module.exports = { } }; -},{}],300:[function(require,module,exports){ +},{}],309:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60318,7 +61137,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":371,"./shape_defaults":304}],301:[function(require,module,exports){ +},{"../../plots/array_container_defaults":381,"./shape_defaults":313}],310:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60451,8 +61270,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -60461,6 +61280,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -60693,7 +61514,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":336,"../../lib/setcursor":351,"../../plotly":369,"../../plots/cartesian/axes":374,"../color":221,"../dragelement":242,"../drawing":245,"./constants":299,"./helpers":302}],302:[function(require,module,exports){ +},{"../../lib":346,"../../lib/setcursor":361,"../../plotly":379,"../../plots/cartesian/axes":384,"../color":230,"../dragelement":251,"../drawing":254,"./constants":308,"./helpers":311}],311:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60774,7 +61595,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],303:[function(require,module,exports){ +},{}],312:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60800,7 +61621,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":297,"./calc_autorange":298,"./defaults":300,"./draw":301}],304:[function(require,module,exports){ +},{"./attributes":306,"./calc_autorange":307,"./defaults":309,"./draw":310}],313:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60899,7 +61720,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":336,"../../plots/cartesian/axes":374,"./attributes":297,"./helpers":302}],305:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/axes":384,"./attributes":306,"./helpers":311}],314:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60922,7 +61743,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -60947,6 +61768,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -61133,7 +61960,7 @@ module.exports = { }, }; -},{"../../lib/extend":330,"../../plots/animation_attributes":370,"../../plots/font_attributes":398,"../../plots/pad_attributes":405,"./constants":306}],306:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/animation_attributes":380,"../../plots/font_attributes":408,"../../plots/pad_attributes":416,"./constants":315}],315:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61181,9 +62008,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -61230,7 +62054,7 @@ module.exports = { currentValueInset: 0, }; -},{}],307:[function(require,module,exports){ +},{}],316:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61328,14 +62152,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -61343,7 +62169,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":336,"../../plots/array_container_defaults":371,"./attributes":305,"./constants":306}],308:[function(require,module,exports){ +},{"../../lib":346,"../../plots/array_container_defaults":381,"./attributes":314,"./constants":315}],317:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61364,11 +62190,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -61432,24 +62259,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -61477,14 +62298,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -61494,26 +62313,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -61540,6 +62341,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -61631,7 +62457,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -61648,9 +62477,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; + + svgTextUtils.positionText(text, x0, y0); return text; } @@ -61682,11 +62516,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -61713,7 +62550,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -61755,7 +62598,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -61945,7 +62790,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":355,"../../plots/plots":406,"../color":221,"../drawing":245,"../legend/anchor_utils":271,"./constants":306,"d3":60}],309:[function(require,module,exports){ +},{"../../constants/alignment":326,"../../lib/svg_text_utils":365,"../../plots/plots":417,"../color":230,"../drawing":254,"../legend/anchor_utils":280,"./constants":315,"d3":62}],318:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61968,7 +62813,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":305,"./constants":306,"./defaults":307,"./draw":308}],310:[function(require,module,exports){ +},{"./attributes":314,"./constants":315,"./defaults":316,"./draw":317}],319:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61991,6 +62836,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -62023,29 +62869,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -62054,7 +62905,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -62063,6 +62914,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -62082,11 +62936,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -62098,33 +62949,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -62155,8 +63006,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -62164,8 +63014,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -62176,11 +63025,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -62190,18 +63039,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":319,"../../lib":336,"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/plots":406,"../color":221,"../drawing":245,"d3":60,"fast-isnumeric":66}],311:[function(require,module,exports){ +},{"../../constants/interactions":329,"../../lib":346,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":417,"../color":230,"../drawing":254,"d3":62,"fast-isnumeric":68}],320:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62222,7 +63067,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -62243,6 +63088,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -62348,7 +63199,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../../plots/font_attributes":398,"../../plots/pad_attributes":405,"../color/attributes":220}],312:[function(require,module,exports){ +},{"../../lib/extend":340,"../../plots/font_attributes":408,"../../plots/pad_attributes":416,"../color/attributes":229}],321:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62395,9 +63246,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -62421,10 +63269,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],313:[function(require,module,exports){ +},{}],322:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62503,13 +63359,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -62518,7 +63376,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":336,"../../plots/array_container_defaults":371,"./attributes":311,"./constants":312}],314:[function(require,module,exports){ +},{"../../lib":346,"../../plots/array_container_defaults":381,"./attributes":320,"./constants":321}],323:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62538,6 +63396,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -62723,7 +63583,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -62735,7 +63595,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -62843,7 +63703,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -62852,7 +63712,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -62953,9 +63815,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -62975,18 +63837,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -63037,19 +63902,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -63143,34 +64007,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -63186,8 +64045,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -63198,9 +64057,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":355,"../../plots/plots":406,"../color":221,"../drawing":245,"../legend/anchor_utils":271,"./constants":312,"./scrollbox":316,"d3":60}],315:[function(require,module,exports){ -arguments[4][309][0].apply(exports,arguments) -},{"./attributes":311,"./constants":312,"./defaults":313,"./draw":314,"dup":309}],316:[function(require,module,exports){ +},{"../../constants/alignment":326,"../../lib/svg_text_utils":365,"../../plots/plots":417,"../color":230,"../drawing":254,"../legend/anchor_utils":280,"./constants":321,"./scrollbox":325,"d3":62}],324:[function(require,module,exports){ +arguments[4][318][0].apply(exports,arguments) +},{"./attributes":320,"./constants":321,"./defaults":322,"./draw":323,"dup":318}],325:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63671,7 +64530,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":336,"../color":221,"../drawing":245,"d3":60}],317:[function(require,module,exports){ +},{"../../lib":346,"../color":230,"../drawing":254,"d3":62}],326:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],327:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63692,7 +64587,7 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],318:[function(require,module,exports){ +},{}],328:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63704,18 +64599,129 @@ module.exports = { 'use strict'; -module.exports = { - circle: '●', - 'circle-open': '○', - square: '■', - 'square-open': '□', - diamond: '◆', - 'diamond-open': '◇', - cross: '+', - x: '❌' +var extendFlat = require('../lib/extend').extendFlat; + +var symbolsWithOpenSupport = { + 'circle': { + unicode: '●' + }, + 'square': { + unicode: '■' + }, + 'diamond': { + unicode: '◆' + }, + 'cross': { + unicode: '✚' + }, + 'x': { + unicode: '❌' + }, + 'triangle-up': { + unicode: '▲' + }, + 'triangle-down': { + unicode: '▼' + }, + 'triangle-left': { + unicode: '◄' + }, + 'triangle-right': { + unicode: '►' + }, + 'triangle-ne': { + unicode: '◥' + }, + 'triangle-nw': { + unicode: '◤' + }, + 'triangle-se': { + unicode: '◢' + }, + 'triangle-sw': { + unicode: '◣' + }, + 'pentagon': { + unicode: '⬟' + }, + 'hexagon': { + unicode: '⬢' + }, + 'hexagon2': { + unicode: '⬣' + }, + 'star': { + unicode: '★' + }, + 'diamond-tall': { + unicode: '♦' + }, + 'bowtie': { + unicode: '⧓' + }, + 'diamond-x': { + unicode: '❖' + }, + 'cross-thin': { + unicode: '+', + noBorder: true + }, + 'asterisk': { + unicode: '✳', + noBorder: true + }, + 'y-up': { + unicode: '⅄', + noBorder: true + }, + 'y-down': { + unicode: 'Y', + noBorder: true + }, + 'line-ew': { + unicode: '─', + noBorder: true + }, + 'line-ns': { + unicode: '│', + noBorder: true + } }; -},{}],319:[function(require,module,exports){ +var openSymbols = {}; +var keys = Object.keys(symbolsWithOpenSupport); + +for(var i = 0; i < keys.length; i++) { + var k = keys[i]; + openSymbols[k + '-open'] = extendFlat({}, symbolsWithOpenSupport[k]); +} + +var otherSymbols = { + 'circle-cross-open': { + unicode: '⨁', + noFill: true + }, + 'circle-x-open': { + unicode: '⨂', + noFill: true + }, + 'square-cross-open': { + unicode: '⊞', + noFill: true + }, + 'square-x-open': { + unicode: '⊠', + noFill: true + } +}; + +module.exports = extendFlat({}, + symbolsWithOpenSupport, + openSymbols, + otherSymbols +); + +},{"../lib/extend":340}],329:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63739,7 +64745,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],320:[function(require,module,exports){ +},{}],330:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63792,7 +64798,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],321:[function(require,module,exports){ +},{}],331:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63830,7 +64836,7 @@ module.exports = { }; -},{}],322:[function(require,module,exports){ +},{}],332:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63854,7 +64860,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],323:[function(require,module,exports){ +},{}],333:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63872,7 +64878,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -63913,6 +64919,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -63934,7 +64941,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":219,"./components/fx":262,"./components/images":270,"./components/legend":278,"./components/rangeselector":290,"./components/rangeslider":296,"./components/shapes":303,"./components/sliders":309,"./components/updatemenus":315,"./fonts/mathjax_config":324,"./lib/queue":348,"./plot_api/plot_schema":363,"./plot_api/register":364,"./plot_api/set_plot_config":365,"./plot_api/to_image":367,"./plot_api/validate":368,"./plotly":369,"./snapshot":418,"./snapshot/download":415,"./traces/scatter":478,"d3":60,"es6-promise":64}],324:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":223,"./components/annotations3d":228,"./components/fx":271,"./components/images":279,"./components/legend":287,"./components/rangeselector":299,"./components/rangeslider":305,"./components/shapes":312,"./components/sliders":318,"./components/updatemenus":324,"./fonts/mathjax_config":334,"./lib/queue":358,"./plot_api/plot_schema":373,"./plot_api/register":374,"./plot_api/set_plot_config":375,"./plot_api/to_image":377,"./plot_api/validate":378,"./plotly":379,"./snapshot":429,"./snapshot/download":426,"./traces/scatter":489,"d3":62,"es6-promise":66}],334:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63967,7 +64974,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],325:[function(require,module,exports){ +},{}],335:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64000,7 +65007,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":320,"fast-isnumeric":66}],326:[function(require,module,exports){ +},{"../constants/numerical":330,"fast-isnumeric":68}],336:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64015,6 +65022,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -64040,6 +65048,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -64292,6 +65314,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -64311,7 +65362,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":233,"../components/colorscale/scales":239,"./nested_property":342,"fast-isnumeric":66,"tinycolor2":194}],327:[function(require,module,exports){ +},{"../components/colorscale/get_scale":242,"../components/colorscale/scales":248,"../plots/attributes":382,"./nested_property":352,"fast-isnumeric":68,"tinycolor2":197}],337:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64939,7 +65990,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":320,"../registry":413,"./loggers":339,"./mod":341,"d3":60,"fast-isnumeric":66}],328:[function(require,module,exports){ +},{"../constants/numerical":330,"../registry":424,"./loggers":349,"./mod":351,"d3":62,"fast-isnumeric":68}],338:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64968,7 +66019,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],329:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65134,7 +66185,7 @@ var Events = { module.exports = Events; -},{"events":65}],330:[function(require,module,exports){ +},{"events":67}],340:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65248,7 +66299,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":338}],331:[function(require,module,exports){ +},{"./is_plain_object.js":348}],341:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65299,7 +66350,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],332:[function(require,module,exports){ +},{}],342:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65330,7 +66381,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],333:[function(require,module,exports){ +},{}],343:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65418,7 +66469,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":220,"../components/colorscale":235,"color-rgba":52,"fast-isnumeric":66}],334:[function(require,module,exports){ +},{"../components/color/attributes":229,"../components/colorscale":244,"color-rgba":54,"fast-isnumeric":68}],344:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65487,7 +66538,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":321,"superscript-text":190}],335:[function(require,module,exports){ +},{"../constants/string_mappings":331,"superscript-text":193}],345:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65503,7 +66554,7 @@ module.exports = convertHTMLToUnicode; module.exports = function identity(d) { return d; }; -},{}],336:[function(require,module,exports){ +},{}],346:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65516,6 +66567,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -65532,6 +66588,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -65593,6 +66650,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -65843,6 +66907,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -65850,6 +66923,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -65890,7 +67008,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -65920,13 +67038,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -66167,7 +67278,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":325,"./coerce":326,"./dates":327,"./ensure_array":328,"./extend":330,"./filter_unique":331,"./filter_visible":332,"./identity":335,"./is_array":337,"./is_plain_object":338,"./loggers":339,"./matrix":340,"./mod":341,"./nested_property":342,"./noop":343,"./notifier":344,"./push_unique":347,"./relink_private":349,"./search":350,"./stats":353,"./to_log_range":356,"d3":60}],337:[function(require,module,exports){ +},{"../constants/numerical":330,"./clean_number":335,"./coerce":336,"./dates":337,"./ensure_array":338,"./extend":340,"./filter_unique":341,"./filter_visible":342,"./identity":345,"./is_array":347,"./is_plain_object":348,"./loggers":349,"./matrix":350,"./mod":351,"./nested_property":352,"./noop":353,"./notifier":354,"./push_unique":357,"./relink_private":359,"./search":360,"./stats":363,"./to_log_range":366,"d3":62,"fast-isnumeric":68}],347:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66191,7 +67302,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],338:[function(require,module,exports){ +},{}],348:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66220,7 +67331,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],339:[function(require,module,exports){ +},{}],349:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66294,7 +67405,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":362}],340:[function(require,module,exports){ +},{"../plot_api/plot_config":372}],350:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66404,7 +67515,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],341:[function(require,module,exports){ +},{}],351:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66424,7 +67535,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],342:[function(require,module,exports){ +},{}],352:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66728,7 +67839,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":358,"./is_array":337,"./is_plain_object":338,"fast-isnumeric":66}],343:[function(require,module,exports){ +},{"../plot_api/container_array_match":368,"./is_array":347,"./is_plain_object":348,"fast-isnumeric":68}],353:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66744,7 +67855,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],344:[function(require,module,exports){ +},{}],354:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66826,7 +67937,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":60,"fast-isnumeric":66}],345:[function(require,module,exports){ +},{"d3":62,"fast-isnumeric":68}],355:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66875,7 +67986,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":351}],346:[function(require,module,exports){ +},{"./setcursor":361}],356:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67116,7 +68227,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":320,"./matrix":340}],347:[function(require,module,exports){ +},{"../constants/numerical":330,"./matrix":350}],357:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67154,7 +68265,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],348:[function(require,module,exports){ +},{}],358:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67365,7 +68476,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":336,"../plot_api/plot_config":362}],349:[function(require,module,exports){ +},{"../lib":346,"../plot_api/plot_config":372}],359:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67422,7 +68533,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":337,"./is_plain_object":338}],350:[function(require,module,exports){ +},{"./is_array":347,"./is_plain_object":348}],360:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67533,7 +68644,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":339,"fast-isnumeric":66}],351:[function(require,module,exports){ +},{"./loggers":349,"fast-isnumeric":68}],361:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67556,7 +68667,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],352:[function(require,module,exports){ +},{}],362:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67605,7 +68716,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":221}],353:[function(require,module,exports){ +},{"../components/color":230}],363:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67701,7 +68812,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":66}],354:[function(require,module,exports){ +},{"fast-isnumeric":68}],364:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67722,7 +68833,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-rgba":52}],355:[function(require,module,exports){ +},{"color-rgba":54}],365:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67741,62 +68852,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -67804,42 +68860,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); - - result = _context.appendSVG(converted); + .style('white-space', 'pre'); - if(!result) _context.text(str); + var hasLink = buildSVGText(_context.node(), str); - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -67847,14 +68905,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -67869,7 +68928,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -67886,36 +68949,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -67928,9 +68991,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -67961,23 +69027,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -67988,24 +69066,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -68016,26 +69113,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -68045,122 +69148,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -68197,28 +69375,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + context.style({'pointer-events': _delegate ? 'none' : 'all'}); + + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -68233,63 +69424,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -68301,10 +69491,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":321,"../constants/xmlns_namespaces":322,"../lib":336,"d3":60}],356:[function(require,module,exports){ +},{"../constants/alignment":326,"../constants/string_mappings":331,"../constants/xmlns_namespaces":332,"../lib":346,"d3":62}],366:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68332,7 +69522,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":66}],357:[function(require,module,exports){ +},{"fast-isnumeric":68}],367:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68366,7 +69556,7 @@ module.exports = function truncate(arrayIn, len) { throw new Error('This array type is not yet supported by `truncate`.'); }; -},{}],358:[function(require,module,exports){ +},{}],368:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68424,7 +69614,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":413}],359:[function(require,module,exports){ +},{"../registry":424}],369:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68642,7 +69832,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -68775,18 +69964,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -68842,7 +70051,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -68945,7 +70154,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":221,"../lib":336,"../plots/cartesian/axes":374,"../plots/plots":406,"../registry":413,"fast-isnumeric":66,"gl-mat4/fromQuat":86}],360:[function(require,module,exports){ +},{"../components/color":230,"../lib":346,"../plots/cartesian/axes":384,"../plots/plots":417,"../registry":424,"fast-isnumeric":68,"gl-mat4/fromQuat":88}],370:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -69159,7 +70368,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":338,"../lib/loggers":339,"../lib/nested_property":342,"../lib/noop":343,"../lib/search":350,"../registry":413,"./container_array_match":358}],361:[function(require,module,exports){ +},{"../lib/is_plain_object":348,"../lib/loggers":349,"../lib/nested_property":352,"../lib/noop":353,"../lib/search":360,"../registry":424,"./container_array_match":368}],371:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -69194,7 +70403,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -69351,9 +70562,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -69382,19 +70591,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; - - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); + if(JSON.stringify(fullLayout._size) === oldmargins) return; - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -69432,7 +70641,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -69532,6 +70744,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -69629,7 +70842,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -69638,9 +70851,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -69655,11 +70869,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -70545,6 +71758,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -70644,6 +71858,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -71075,10 +72292,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -71100,7 +72319,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -71108,7 +72328,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -71121,11 +72341,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -71205,6 +72439,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -71303,7 +72538,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -71351,7 +72595,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -72185,7 +73429,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":245,"../components/errorbars":251,"../constants/xmlns_namespaces":322,"../lib":336,"../lib/events":329,"../lib/queue":348,"../lib/svg_text_utils":355,"../plotly":369,"../plots/cartesian/axis_ids":377,"../plots/cartesian/constants":379,"../plots/cartesian/constraints":381,"../plots/cartesian/graph_interact":383,"../plots/plots":406,"../plots/polar":409,"../registry":413,"./helpers":359,"./manage_arrays":360,"./subroutines":366,"d3":60,"fast-isnumeric":66}],362:[function(require,module,exports){ +},{"../components/drawing":254,"../components/errorbars":260,"../constants/xmlns_namespaces":332,"../lib":346,"../lib/events":339,"../lib/queue":358,"../lib/svg_text_utils":365,"../plotly":379,"../plots/cartesian/axis_ids":387,"../plots/cartesian/constants":389,"../plots/cartesian/constraints":391,"../plots/cartesian/graph_interact":393,"../plots/plots":417,"../plots/polar":420,"../registry":424,"./helpers":369,"./manage_arrays":370,"./subroutines":376,"d3":62,"fast-isnumeric":68}],372:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72311,7 +73555,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],363:[function(require,module,exports){ +},{}],373:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72470,7 +73714,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -72490,9 +73737,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -72717,7 +73963,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":336,"../plots/animation_attributes":370,"../plots/attributes":372,"../plots/frame_attributes":399,"../plots/layout_attributes":404,"../plots/polar/area_attributes":407,"../plots/polar/axis_attributes":408,"../registry":413}],364:[function(require,module,exports){ +},{"../lib":346,"../plots/animation_attributes":380,"../plots/attributes":382,"../plots/frame_attributes":409,"../plots/layout_attributes":415,"../plots/polar/area_attributes":418,"../plots/polar/axis_attributes":419,"../registry":424}],374:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72816,7 +74062,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":336,"../registry":413}],365:[function(require,module,exports){ +},{"../lib":346,"../registry":424}],375:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72842,7 +74088,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":336,"../plotly":369}],366:[function(require,module,exports){ +},{"../lib":346,"../plotly":379}],376:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72971,15 +74217,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -73099,27 +74346,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -73220,19 +74469,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -73249,7 +74501,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":221,"../components/drawing":245,"../components/modebar":281,"../components/titles":310,"../lib":336,"../plotly":369,"../plots/cartesian/graph_interact":383,"../plots/plots":406,"../registry":413,"d3":60}],367:[function(require,module,exports){ +},{"../components/color":230,"../components/drawing":254,"../components/modebar":290,"../components/titles":319,"../lib":346,"../plotly":379,"../plots/cartesian/graph_interact":393,"../plots/plots":417,"../registry":424,"d3":62}],377:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73359,7 +74611,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":336,"../plotly":369,"../snapshot/cloneplot":414,"../snapshot/helpers":417,"../snapshot/svgtoimg":419,"../snapshot/tosvg":421,"fast-isnumeric":66}],368:[function(require,module,exports){ +},{"../lib":346,"../plotly":379,"../snapshot/cloneplot":425,"../snapshot/helpers":428,"../snapshot/svgtoimg":430,"../snapshot/tosvg":432,"fast-isnumeric":68}],378:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73581,6 +74833,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -73629,6 +74886,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -73646,7 +74913,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -73663,8 +74930,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -73730,7 +74997,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":336,"../plots/plots":406,"./plot_schema":363}],369:[function(require,module,exports){ +},{"../lib":346,"../plots/plots":417,"./plot_schema":373}],379:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73764,7 +75031,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":281,"./plot_api/plot_api":361,"./plot_api/plot_config":362,"./plots/cartesian/axes":374,"./plots/plots":406}],370:[function(require,module,exports){ +},{"./components/modebar":290,"./plot_api/plot_api":371,"./plot_api/plot_config":372,"./plots/cartesian/axes":384,"./plots/plots":417}],380:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73866,7 +75133,7 @@ module.exports = { } }; -},{}],371:[function(require,module,exports){ +},{}],381:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73947,7 +75214,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":336}],372:[function(require,module,exports){ +},{"../lib":346}],382:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74004,11 +75271,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -74032,7 +75308,7 @@ module.exports = { } }; -},{"../components/fx/attributes":254}],373:[function(require,module,exports){ +},{"../components/fx/attributes":263}],383:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74059,7 +75335,7 @@ module.exports = { } }; -},{}],374:[function(require,module,exports){ +},{}],384:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74089,7 +75365,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -74162,33 +75437,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -74429,6 +75698,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -74524,6 +75796,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -75875,10 +77154,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -75911,17 +77190,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -76387,7 +77659,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":221,"../../components/drawing":245,"../../components/titles":310,"../../constants/numerical":320,"../../lib":336,"../../lib/svg_text_utils":355,"../../registry":413,"./axis_autotype":375,"./axis_ids":377,"./layout_attributes":385,"./layout_defaults":386,"./set_convert":391,"d3":60,"fast-isnumeric":66}],375:[function(require,module,exports){ +},{"../../components/color":230,"../../components/drawing":254,"../../components/titles":319,"../../constants/numerical":330,"../../lib":346,"../../lib/svg_text_utils":365,"../../registry":424,"./axis_autotype":385,"./axis_ids":387,"./layout_attributes":395,"./layout_defaults":396,"./set_convert":401,"d3":62,"fast-isnumeric":68}],385:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76462,7 +77734,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":320,"../../lib":336,"fast-isnumeric":66}],376:[function(require,module,exports){ +},{"../../constants/numerical":330,"../../lib":346,"fast-isnumeric":68}],386:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76585,7 +77857,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":220,"../../lib":336,"../../registry":413,"./category_order_defaults":378,"./layout_attributes":385,"./ordered_categories":387,"./set_convert":391,"./tick_label_defaults":392,"./tick_mark_defaults":393,"./tick_value_defaults":394,"tinycolor2":194}],377:[function(require,module,exports){ +},{"../../components/color/attributes":229,"../../lib":346,"../../registry":424,"./category_order_defaults":388,"./layout_attributes":395,"./ordered_categories":397,"./set_convert":401,"./tick_label_defaults":402,"./tick_mark_defaults":403,"./tick_value_defaults":404,"tinycolor2":197}],387:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76707,7 +77979,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":336,"../../registry":413,"../plots":406,"./constants":379}],378:[function(require,module,exports){ +},{"../../lib":346,"../../registry":424,"../plots":417,"./constants":389}],388:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76741,7 +78013,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],379:[function(require,module,exports){ +},{}],389:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76796,7 +78068,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],380:[function(require,module,exports){ +},{}],390:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76814,10 +78086,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(containerOut.fixedrange) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); + + if(!containerIn.scaleanchor) return; + + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -76836,7 +78123,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -76935,7 +78222,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":336,"./axis_ids":377}],381:[function(require,module,exports){ +},{"../../lib":346,"./axis_ids":387}],391:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76952,12 +78239,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; -module.exports = function enforceAxisConstraints(gd) { + +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -76973,12 +78262,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -76986,32 +78281,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } } } } }; -},{"../../constants/numerical":320,"./axis_ids":377,"./scale_zoom":389}],382:[function(require,module,exports){ +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; + } + } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } + } +}; + +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":326,"../../constants/numerical":330,"./axis_ids":387,"./scale_zoom":399}],392:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77034,6 +78450,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -77143,7 +78562,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -77197,6 +78615,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -77295,8 +78716,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -77329,7 +78750,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -77348,11 +78770,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -77537,6 +78959,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -77556,8 +78980,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -77654,24 +79083,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -77706,11 +79128,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -77721,7 +79147,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -77730,7 +79156,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -77813,7 +79239,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -77829,13 +79255,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -78012,7 +79440,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":221,"../../components/dragelement":242,"../../components/drawing":245,"../../lib":336,"../../lib/setcursor":351,"../../lib/svg_text_utils":355,"../../plotly":369,"../../registry":413,"./axes":374,"./axis_ids":377,"./constants":379,"./scale_zoom":389,"./select":390,"d3":60,"tinycolor2":194}],383:[function(require,module,exports){ +},{"../../components/color":230,"../../components/dragelement":251,"../../components/drawing":254,"../../constants/alignment":326,"../../lib":346,"../../lib/setcursor":361,"../../lib/svg_text_utils":365,"../../plotly":379,"../../registry":424,"../plots":417,"./axes":384,"./axis_ids":387,"./constants":389,"./scale_zoom":399,"./select":400,"d3":62,"tinycolor2":197}],393:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78035,7 +79463,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -78053,8 +79481,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -78112,7 +79538,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -78173,7 +79599,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":242,"../../components/fx":262,"./constants":379,"./dragbox":382,"fast-isnumeric":66}],384:[function(require,module,exports){ +},{"../../components/dragelement":251,"../../components/fx":271,"./constants":389,"./dragbox":392,"fast-isnumeric":68}],394:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78360,6 +79786,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -78562,7 +79993,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":336,"../plots":406,"./attributes":373,"./axis_ids":377,"./constants":379,"./layout_attributes":385,"./transition_axes":395,"d3":60}],385:[function(require,module,exports){ +},{"../../lib":346,"../plots":417,"./attributes":383,"./axis_ids":387,"./constants":389,"./layout_attributes":395,"./transition_axes":405,"d3":62}],395:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78657,6 +80088,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -78954,7 +80399,7 @@ module.exports = { } }; -},{"../../components/color/attributes":220,"../../components/drawing/attributes":244,"../../lib/extend":330,"../font_attributes":398,"./constants":379}],386:[function(require,module,exports){ +},{"../../components/color/attributes":229,"../../components/drawing/attributes":253,"../../lib/extend":340,"../font_attributes":408,"./constants":389}],396:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79227,7 +80672,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":221,"../../lib":336,"../../registry":413,"../layout_attributes":404,"./axis_defaults":376,"./axis_ids":377,"./constants":379,"./constraint_defaults":380,"./layout_attributes":385,"./position_defaults":388,"./type_defaults":396}],387:[function(require,module,exports){ +},{"../../components/color":230,"../../lib":346,"../../registry":424,"../layout_attributes":415,"./axis_defaults":386,"./axis_ids":387,"./constants":389,"./constraint_defaults":390,"./layout_attributes":395,"./position_defaults":398,"./type_defaults":406}],397:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79306,7 +80751,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":60}],388:[function(require,module,exports){ +},{"d3":62}],398:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79371,7 +80816,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":336,"fast-isnumeric":66}],389:[function(require,module,exports){ +},{"../../lib":346,"fast-isnumeric":68}],399:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79383,20 +80828,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],390:[function(require,module,exports){ +},{"../../constants/alignment":326}],400:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79410,6 +80858,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -79550,7 +80999,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -79596,7 +81047,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":221,"../../lib/polygon":346,"./axes":374,"./constants":379}],391:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":230,"../../components/fx/helpers":268,"../../lib/polygon":356,"./axes":384,"./constants":389}],401:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79615,6 +81083,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -79627,13 +81096,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -79751,7 +81213,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -79764,8 +81226,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -79781,10 +81243,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -79792,16 +81256,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -79819,26 +81285,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -80039,7 +81517,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":320,"../../lib":336,"./axis_ids":377,"./constants":379,"d3":60,"fast-isnumeric":66}],392:[function(require,module,exports){ +},{"../../constants/numerical":330,"../../lib":346,"./axis_ids":387,"./constants":389,"d3":62,"fast-isnumeric":68}],402:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80123,7 +81601,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":336}],393:[function(require,module,exports){ +},{"../../lib":346}],403:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80156,7 +81634,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":336,"./layout_attributes":385}],394:[function(require,module,exports){ +},{"../../lib":346,"./layout_attributes":395}],404:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80240,7 +81718,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":320,"../../lib":336,"fast-isnumeric":66}],395:[function(require,module,exports){ +},{"../../constants/numerical":330,"../../lib":346,"fast-isnumeric":68}],405:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80556,7 +82034,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":245,"../../plotly":369,"../../registry":413,"./axes":374,"d3":60}],396:[function(require,module,exports){ +},{"../../components/drawing":254,"../../plotly":379,"../../registry":424,"./axes":384,"d3":62}],406:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80684,7 +82162,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":413,"./axis_autotype":375,"./axis_ids":377}],397:[function(require,module,exports){ +},{"../../registry":424,"./axis_autotype":385,"./axis_ids":387}],407:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80949,6 +82427,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -81109,7 +82589,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":336,"../plotly":369}],398:[function(require,module,exports){ +},{"../lib":346,"../plotly":379}],408:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81140,7 +82620,7 @@ module.exports = { } }; -},{}],399:[function(require,module,exports){ +},{}],409:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81186,7 +82666,7 @@ module.exports = { } }; -},{}],400:[function(require,module,exports){ +},{}],410:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81320,7 +82800,7 @@ function createCamera(scene) { if(Math.abs(dx * dydx) > Math.abs(dy)) { result.boxEnd[1] = result.boxStart[1] + - Math.abs(dx) * dydx * (Math.sign(dy) || 1); + Math.abs(dx) * dydx * (dy >= 0 ? 1 : -1); // gl-select-box clips to the plot area bounds, // which breaks the axis constraint, so don't allow @@ -81338,7 +82818,7 @@ function createCamera(scene) { } else { result.boxEnd[0] = result.boxStart[0] + - Math.abs(dy) / dydx * (Math.sign(dx) || 1); + Math.abs(dy) / dydx * (dx >= 0 ? 1 : -1); if(result.boxEnd[0] < dataBox[0]) { result.boxEnd[0] = dataBox[0]; @@ -81468,7 +82948,7 @@ function createCamera(scene) { return result; } -},{"../cartesian/constants":379,"mouse-change":153,"mouse-wheel":155}],401:[function(require,module,exports){ +},{"../cartesian/constants":389,"mouse-change":155,"mouse-wheel":157}],411:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81714,7 +83194,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":334,"../../lib/str2rgbarray":354,"../cartesian/axes":374,"../plots":406}],402:[function(require,module,exports){ +},{"../../lib/html2unicode":344,"../../lib/str2rgbarray":364,"../cartesian/axes":384,"../plots":417}],412:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81729,7 +83209,8 @@ module.exports = createAxes2D; var Scene2D = require('./scene2d'); var Plots = require('../plots'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); - +var constants = require('../cartesian/constants'); +var Cartesian = require('../cartesian'); exports.name = 'gl2d'; @@ -81737,15 +83218,9 @@ exports.attr = ['xaxis', 'yaxis']; exports.idRoot = ['x', 'y']; -exports.idRegex = { - x: /^x([2-9]|[1-9][0-9]+)?$/, - y: /^y([2-9]|[1-9][0-9]+)?$/ -}; +exports.idRegex = constants.idRegex; -exports.attrRegex = { - x: /^xaxis([2-9]|[1-9][0-9]+)?$/, - y: /^yaxis([2-9]|[1-9][0-9]+)?$/ -}; +exports.attrRegex = constants.attrRegex; exports.attributes = require('../cartesian/attributes'); @@ -81799,6 +83274,15 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) delete oldFullLayout._plots[id]; } } + + // since we use cartesian interactions, do cartesian clean + Cartesian.clean.apply(this, arguments); +}; + +exports.drawFramework = function(gd) { + if(!gd._context.staticPlot) { + Cartesian.drawFramework(gd); + } }; exports.toSVG = function(gd) { @@ -81826,7 +83310,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":322,"../cartesian/attributes":373,"../plots":406,"./scene2d":403}],403:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":332,"../cartesian":394,"../cartesian/attributes":383,"../cartesian/constants":389,"../plots":417,"./scene2d":413}],413:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81851,7 +83335,9 @@ var createOptions = require('./convert'); var createCamera = require('./camera'); var convertHTMLToUnicode = require('../../lib/html2unicode'); var showNoWebGlMsg = require('../../lib/show_no_webgl_msg'); -var enforceAxisConstraints = require('../../plots/cartesian/constraints'); +var axisConstraints = require('../../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var AXES = ['xaxis', 'yaxis']; var STATIC_CANVAS, STATIC_CONTEXT; @@ -81896,6 +83382,11 @@ function Scene2D(options, fullLayout) { // last pick result this.pickResult = null; + // is the mouse over the plot? + // it's OK if this says true when it's not, so long as + // when we get a mouseout we set it to false before handling + this.isMouseOver = true; + this.bounds = [Infinity, Infinity, -Infinity, -Infinity]; // flag to stop render loop @@ -81976,12 +83467,22 @@ proto.makeFramework = function() { // create div to catch the mouse event var mouseContainer = this.mouseContainer = document.createElement('div'); mouseContainer.style.position = 'absolute'; + mouseContainer.style['pointer-events'] = 'auto'; // append canvas, hover svg and mouse div to container var container = this.container; container.appendChild(canvas); container.appendChild(svgContainer); container.appendChild(mouseContainer); + + var self = this; + mouseContainer.addEventListener('mouseout', function() { + self.isMouseOver = false; + self.unhover(); + }); + mouseContainer.addEventListener('mouseover', function() { + self.isMouseOver = true; + }); }; proto.toImage = function(format) { @@ -82072,13 +83573,6 @@ proto.computeTickMarks = function() { this.xaxis.setScale(); this.yaxis.setScale(); - // override _length from backward compatibility - // even though setScale 'should' give the correct result - this.xaxis._length = - this.glplot.viewBox[2] - this.glplot.viewBox[0]; - this.yaxis._length = - this.glplot.viewBox[3] - this.glplot.viewBox[1]; - var nextTicks = [ Axes.calcTicks(this.xaxis), Axes.calcTicks(this.yaxis) @@ -82200,6 +83694,7 @@ proto.plot = function(fullData, calcData, fullLayout) { this.updateRefs(fullLayout); this.updateTraces(fullData, calcData); + this.updateFx(fullLayout.dragmode); var width = fullLayout.width, height = fullLayout.height; @@ -82210,6 +83705,15 @@ proto.plot = function(fullData, calcData, fullLayout) { options.merge(fullLayout); options.screenBox = [0, 0, width, height]; + var mockGraphDiv = {_fullLayout: { + _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, + xaxis: this.xaxis, + yaxis: this.yaxis + }}; + + cleanAxisConstraints(mockGraphDiv, this.xaxis); + cleanAxisConstraints(mockGraphDiv, this.yaxis); + var size = fullLayout._size, domainX = this.xaxis.domain, domainY = this.yaxis.domain; @@ -82256,12 +83760,7 @@ proto.plot = function(fullData, calcData, fullLayout) { ax.setScale(); } - var mockLayout = { - _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, - xaxis: this.xaxis, - yaxis: this.yaxis - }; - enforceAxisConstraints({_fullLayout: mockLayout}); + enforceAxisConstraints(mockGraphDiv); options.ticks = this.computeTickMarks(); @@ -82336,11 +83835,19 @@ proto.updateTraces = function(fullData, calcData) { this.glplot.objects.sort(function(a, b) { return a._trace.index - b._trace.index; }); +}; +proto.updateFx = function(dragmode) { + if(dragmode === 'lasso' || dragmode === 'select') { + this.mouseContainer.style['pointer-events'] = 'none'; + } else { + this.mouseContainer.style['pointer-events'] = 'auto'; + } }; proto.emitPointAction = function(nextSelection, eventType) { var uid = nextSelection.trace.uid; + var ptNumber = nextSelection.pointIndex; var trace; for(var i = 0; i < this.fullData.length; i++) { @@ -82349,18 +83856,20 @@ proto.emitPointAction = function(nextSelection, eventType) { } } - this.graphDiv.emit(eventType, { - points: [{ - x: nextSelection.traceCoord[0], - y: nextSelection.traceCoord[1], - curveNumber: trace.index, - pointNumber: nextSelection.pointIndex, - data: trace._input, - fullData: this.fullData, - xaxis: this.xaxis, - yaxis: this.yaxis - }] - }); + var pointData = { + x: nextSelection.traceCoord[0], + y: nextSelection.traceCoord[1], + curveNumber: trace.index, + pointNumber: ptNumber, + data: trace._input, + fullData: this.fullData, + xaxis: this.xaxis, + yaxis: this.yaxis + }; + + Fx.appendArrayPointValue(pointData, trace, ptNumber); + + this.graphDiv.emit(eventType, {points: [pointData]}); }; proto.draw = function() { @@ -82403,7 +83912,7 @@ proto.draw = function() { glplot.setDirty(); } - else if(!camera.panning) { + else if(!camera.panning && this.isMouseOver) { this.selectBox.enabled = false; var size = fullLayout._size, @@ -82452,8 +83961,11 @@ proto.draw = function() { // also it's important to copy, otherwise data is lost by the time event data is read this.emitPointAction(nextSelection, 'plotly_hover'); - var hoverinfo = selection.hoverinfo; - if(hoverinfo !== 'all') { + var trace = this.fullData[selection.trace.index] || {}; + var ptNumber = selection.pointIndex; + var hoverinfo = Fx.castHoverinfo(trace, fullLayout, ptNumber); + + if(hoverinfo && hoverinfo !== 'all') { var parts = hoverinfo.split('+'); if(parts.indexOf('x') === -1) selection.traceCoord[0] = undefined; if(parts.indexOf('y') === -1) selection.traceCoord[1] = undefined; @@ -82462,9 +83974,6 @@ proto.draw = function() { if(parts.indexOf('name') === -1) selection.name = undefined; } - var trace = this.fullData[selection.trace.index] || {}; - var ptNumber = selection.pointIndex; - Fx.loneHover({ x: selection.screenCoord[0], y: selection.screenCoord[1], @@ -82479,7 +83988,8 @@ proto.draw = function() { fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') }, { - container: this.svgContainer + container: this.svgContainer, + gd: this.graphDiv }); } } @@ -82487,14 +83997,20 @@ proto.draw = function() { // Remove hover effects if we're not over a point OR // if we're zooming or panning (in which case result is not set) - if(!result && this.lastPickResult) { + if(!result) { + this.unhover(); + } + + glplot.draw(); +}; + +proto.unhover = function() { + if(this.lastPickResult) { this.spikes.update({}); this.lastPickResult = null; this.graphDiv.emit('plotly_unhover'); Fx.loneUnhover(this.svgContainer); } - - glplot.draw(); }; proto.hoverFormatter = function(axisName, val) { @@ -82504,7 +84020,41 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/fx":262,"../../lib/html2unicode":334,"../../lib/show_no_webgl_msg":352,"../../plots/cartesian/axes":374,"../../plots/cartesian/constraints":381,"../../registry":413,"./camera":400,"./convert":401,"gl-plot2d":100,"gl-select-box":128,"gl-spikes2d":137,"webgl-context":207}],404:[function(require,module,exports){ +},{"../../components/fx":271,"../../lib/html2unicode":344,"../../lib/show_no_webgl_msg":362,"../../plots/cartesian/axes":384,"../../plots/cartesian/constraints":391,"../../registry":424,"./camera":410,"./convert":411,"gl-plot2d":102,"gl-select-box":130,"gl-spikes2d":139,"webgl-context":210}],414:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; + + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } + } + + return out; +} + +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} + +module.exports = project; + +},{}],415:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82647,7 +84197,7 @@ module.exports = { } }; -},{"../components/color/attributes":220,"../lib":336,"./font_attributes":398}],405:[function(require,module,exports){ +},{"../components/color/attributes":229,"../lib":346,"./font_attributes":408}],416:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82685,7 +84235,7 @@ module.exports = { } }; -},{}],406:[function(require,module,exports){ +},{}],417:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82701,6 +84251,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -83193,12 +84744,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -83523,12 +85100,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -83541,7 +85118,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -84474,6 +86054,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -84689,7 +86273,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -84710,6 +86300,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -84757,25 +86348,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -84784,11 +86361,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -84861,7 +86434,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":221,"../components/errorbars":251,"../constants/numerical":320,"../lib":336,"../plotly":369,"../registry":413,"./animation_attributes":370,"./attributes":372,"./command":397,"./font_attributes":398,"./frame_attributes":399,"./layout_attributes":404,"d3":60,"fast-isnumeric":66}],407:[function(require,module,exports){ +},{"../components/color":230,"../components/errorbars":260,"../constants/numerical":330,"../lib":346,"../plot_api/plot_schema":373,"../plotly":379,"../registry":424,"./animation_attributes":380,"./attributes":382,"./command":407,"./font_attributes":408,"./frame_attributes":409,"./layout_attributes":415,"d3":62,"fast-isnumeric":68}],418:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -84886,7 +86459,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":468}],408:[function(require,module,exports){ +},{"../../traces/scatter/attributes":479}],419:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85001,7 +86574,7 @@ module.exports = { } }; -},{"../../lib/extend":330,"../cartesian/layout_attributes":385}],409:[function(require,module,exports){ +},{"../../lib/extend":340,"../cartesian/layout_attributes":395}],420:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85016,7 +86589,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":410,"./micropolar_manager":411}],410:[function(require,module,exports){ +},{"./micropolar":421,"./micropolar_manager":422}],421:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86435,7 +88008,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":336,"d3":60}],411:[function(require,module,exports){ +},{"../../lib":346,"d3":62}],422:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86521,7 +88094,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":221,"../../lib":336,"./micropolar":410,"./undo_manager":412,"d3":60}],412:[function(require,module,exports){ +},{"../../components/color":230,"../../lib":346,"./micropolar":421,"./undo_manager":423,"d3":62}],423:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86587,7 +88160,7 @@ module.exports = function UndoManager() { }; }; -},{}],413:[function(require,module,exports){ +},{}],424:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86778,7 +88351,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":339,"./lib/noop":343,"./lib/push_unique":347,"./plots/attributes":372}],414:[function(require,module,exports){ +},{"./lib/loggers":349,"./lib/noop":353,"./lib/push_unique":357,"./plots/attributes":382}],425:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86950,7 +88523,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":336,"../plots/plots":406}],415:[function(require,module,exports){ +},{"../lib":346,"../plots/plots":417}],426:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87016,7 +88589,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":336,"../plot_api/to_image":367,"./filesaver":416}],416:[function(require,module,exports){ +},{"../lib":346,"../plot_api/to_image":377,"./filesaver":427}],427:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87084,7 +88657,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],417:[function(require,module,exports){ +},{}],428:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87117,7 +88690,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],418:[function(require,module,exports){ +},{}],429:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87143,7 +88716,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":414,"./download":415,"./helpers":417,"./svgtoimg":419,"./toimage":420,"./tosvg":421}],419:[function(require,module,exports){ +},{"./cloneplot":425,"./download":426,"./helpers":428,"./svgtoimg":430,"./toimage":431,"./tosvg":432}],430:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87181,7 +88754,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -87274,7 +88847,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":336,"events":65}],420:[function(require,module,exports){ +},{"../lib":346,"events":67}],431:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87354,7 +88927,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":336,"../plotly":369,"./cloneplot":414,"./helpers":417,"./svgtoimg":419,"./tosvg":421,"events":65}],421:[function(require,module,exports){ +},{"../lib":346,"../plotly":379,"./cloneplot":425,"./helpers":428,"./svgtoimg":430,"./tosvg":432,"events":67}],432:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87368,12 +88941,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -87426,20 +89016,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -87447,10 +89039,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -87464,16 +89067,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":221,"../components/drawing":245,"../constants/xmlns_namespaces":322,"../lib/svg_text_utils":355,"d3":60}],422:[function(require,module,exports){ +},{"../components/color":230,"../components/drawing":254,"../constants/xmlns_namespaces":332,"d3":62}],433:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87576,7 +89179,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":222,"../../components/colorscale/attributes":226,"../../components/drawing/attributes":244,"../../lib/extend":330,"../heatmap/attributes":432,"../scatter/attributes":468}],423:[function(require,module,exports){ +},{"../../components/colorbar/attributes":231,"../../components/colorscale/attributes":235,"../../components/drawing/attributes":253,"../../lib/extend":340,"../heatmap/attributes":443,"../scatter/attributes":479}],434:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87680,7 +89283,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":336,"../../plots/cartesian/axes":374,"../heatmap/calc":433}],424:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/axes":384,"../heatmap/calc":444}],435:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87742,7 +89345,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":224,"../../plots/plots":406,"./end_plus":427,"./make_color_map":428}],425:[function(require,module,exports){ +},{"../../components/colorbar/draw":233,"../../plots/plots":417,"./end_plus":438,"./make_color_map":439}],436:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87774,7 +89377,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce) { if(autoContour || !contourSize) coerce('ncontours'); }; -},{"../../lib":336,"./attributes":422}],426:[function(require,module,exports){ +},{"../../lib":346,"./attributes":433}],437:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87813,7 +89416,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":336,"../heatmap/has_columns":439,"../heatmap/xyz_defaults":443,"./attributes":422,"./contours_defaults":425,"./style_defaults":429}],427:[function(require,module,exports){ +},{"../../lib":346,"../heatmap/has_columns":450,"../heatmap/xyz_defaults":454,"./attributes":433,"./contours_defaults":436,"./style_defaults":440}],438:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87833,7 +89436,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],428:[function(require,module,exports){ +},{}],439:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87917,7 +89520,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":235,"./end_plus":427,"d3":60}],429:[function(require,module,exports){ +},{"../../components/colorscale":244,"./end_plus":438,"d3":62}],440:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87953,7 +89556,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, } }; -},{"../../components/colorscale/defaults":230}],430:[function(require,module,exports){ +},{"../../components/colorscale/defaults":239}],441:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88141,7 +89744,7 @@ function createContour(scene, fullTrace, calcTrace) { module.exports = createContour; -},{"../../lib/str2rgbarray":354,"../../plots/cartesian/axes":374,"../contour/make_color_map":428,"gl-contour2d":74,"gl-heatmap2d":81}],431:[function(require,module,exports){ +},{"../../lib/str2rgbarray":364,"../../plots/cartesian/axes":384,"../contour/make_color_map":439,"gl-contour2d":76,"gl-heatmap2d":83}],442:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88172,7 +89775,7 @@ ContourGl.meta = { module.exports = ContourGl; -},{"../../plots/gl2d":402,"../contour/attributes":422,"../contour/calc":423,"../contour/colorbar":424,"../contour/defaults":426,"./convert":430}],432:[function(require,module,exports){ +},{"../../plots/gl2d":412,"../contour/attributes":433,"../contour/calc":434,"../contour/colorbar":435,"../contour/defaults":437,"./convert":441}],443:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88256,7 +89859,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":222,"../../components/colorscale/attributes":226,"../../lib/extend":330,"../scatter/attributes":468}],433:[function(require,module,exports){ +},{"../../components/colorbar/attributes":231,"../../components/colorscale/attributes":235,"../../lib/extend":340,"../scatter/attributes":479}],444:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88316,10 +89919,15 @@ module.exports = function calc(gd, trace) { z = binned.z; } else { - if(hasColumns(trace)) convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + if(hasColumns(trace)) { + convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + x = trace.x; + y = trace.y; + } else { + x = trace.x ? xa.makeCalcdata(trace, 'x') : []; + y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + } - x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace.y ? ya.makeCalcdata(trace, 'y') : []; x0 = trace.x0 || 0; dx = trace.dx || 1; y0 = trace.y0 || 0; @@ -88398,7 +90006,7 @@ module.exports = function calc(gd, trace) { return [cd0]; }; -},{"../../components/colorscale/calc":227,"../../lib":336,"../../plots/cartesian/axes":374,"../../registry":413,"../histogram2d/calc":451,"./clean_2d_array":434,"./convert_column_xyz":436,"./find_empties":438,"./has_columns":439,"./interp2d":440,"./make_bound_array":441,"./max_row_length":442}],434:[function(require,module,exports){ +},{"../../components/colorscale/calc":236,"../../lib":346,"../../plots/cartesian/axes":384,"../../registry":424,"../histogram2d/calc":462,"./clean_2d_array":445,"./convert_column_xyz":447,"./find_empties":449,"./has_columns":450,"./interp2d":451,"./make_bound_array":452,"./max_row_length":453}],445:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88443,7 +90051,7 @@ module.exports = function clean2dArray(zOld, transpose) { return zNew; }; -},{"fast-isnumeric":66}],435:[function(require,module,exports){ +},{"fast-isnumeric":68}],446:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88494,7 +90102,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":224,"../../components/colorscale":235,"../../lib":336,"../../plots/plots":406,"fast-isnumeric":66}],436:[function(require,module,exports){ +},{"../../components/colorbar/draw":233,"../../components/colorscale":244,"../../lib":346,"../../plots/plots":417,"fast-isnumeric":68}],447:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88575,7 +90183,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, if(hasColumnText) trace.text = text; }; -},{"../../constants/numerical":320,"../../lib":336}],437:[function(require,module,exports){ +},{"../../constants/numerical":330,"../../lib":346}],448:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88620,7 +90228,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":230,"../../lib":336,"./attributes":432,"./has_columns":439,"./xyz_defaults":443}],438:[function(require,module,exports){ +},{"../../components/colorscale/defaults":239,"../../lib":346,"./attributes":443,"./has_columns":450,"./xyz_defaults":454}],449:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88726,7 +90334,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"./max_row_length":442}],439:[function(require,module,exports){ +},{"./max_row_length":453}],450:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88742,7 +90350,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],440:[function(require,module,exports){ +},{}],451:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88874,7 +90482,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":336}],441:[function(require,module,exports){ +},{"../../lib":346}],452:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88956,7 +90564,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../registry":413}],442:[function(require,module,exports){ +},{"../../registry":424}],453:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88978,7 +90586,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],443:[function(require,module,exports){ +},{}],454:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89073,7 +90681,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../registry":413,"./has_columns":439,"fast-isnumeric":66}],444:[function(require,module,exports){ +},{"../../registry":424,"./has_columns":450,"fast-isnumeric":68}],455:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89115,7 +90723,7 @@ extendFlat( module.exports = attrs; -},{"../../components/colorbar/attributes":222,"../../components/colorscale/attributes":226,"../../lib/extend":330,"../heatmap/attributes":432}],445:[function(require,module,exports){ +},{"../../components/colorbar/attributes":231,"../../components/colorscale/attributes":235,"../../lib/extend":340,"../heatmap/attributes":443}],456:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89255,7 +90863,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":354,"../../plots/cartesian/axes":374,"gl-heatmap2d":81}],446:[function(require,module,exports){ +},{"../../lib/str2rgbarray":364,"../../plots/cartesian/axes":384,"gl-heatmap2d":83}],457:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89286,7 +90894,7 @@ HeatmapGl.meta = { module.exports = HeatmapGl; -},{"../../plots/gl2d":402,"../heatmap/calc":433,"../heatmap/colorbar":435,"../heatmap/defaults":437,"./attributes":444,"./convert":445}],447:[function(require,module,exports){ +},{"../../plots/gl2d":412,"../heatmap/calc":444,"../heatmap/colorbar":446,"../heatmap/defaults":448,"./attributes":455,"./convert":456}],458:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89312,7 +90920,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],448:[function(require,module,exports){ +},{}],459:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89388,7 +90996,7 @@ module.exports = { } }; -},{"fast-isnumeric":66}],449:[function(require,module,exports){ +},{"fast-isnumeric":68}],460:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89465,7 +91073,7 @@ module.exports = function cleanBins(trace, ax, binDirection) { if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; }; -},{"../../constants/numerical":320,"../../lib":336,"fast-isnumeric":66}],450:[function(require,module,exports){ +},{"../../constants/numerical":330,"../../lib":346,"fast-isnumeric":68}],461:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89500,7 +91108,7 @@ module.exports = { } }; -},{}],451:[function(require,module,exports){ +},{}],462:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89703,7 +91311,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":336,"../../plots/cartesian/axes":374,"../histogram/average":447,"../histogram/bin_functions":448,"../histogram/clean_bins":449,"../histogram/norm_functions":450}],452:[function(require,module,exports){ +},{"../../lib":346,"../../plots/cartesian/axes":384,"../histogram/average":458,"../histogram/bin_functions":459,"../histogram/clean_bins":460,"../histogram/norm_functions":461}],463:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89843,7 +91451,7 @@ module.exports = { ) }; -},{"../../components/colorbar/attributes":222,"../../components/colorscale/color_attributes":228,"../../components/colorscale/scales":239,"../../lib/extend":330,"../../plots/cartesian/layout_attributes":385,"../../plots/font_attributes":398}],453:[function(require,module,exports){ +},{"../../components/colorbar/attributes":231,"../../components/colorscale/color_attributes":237,"../../components/colorscale/scales":248,"../../lib/extend":340,"../../plots/cartesian/layout_attributes":395,"../../plots/font_attributes":408}],464:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89919,7 +91527,7 @@ exports.toSVG = function(gd) { }, 60); }; -},{"../../constants/xmlns_namespaces":322,"../../plots/plots":406,"./constants":456,"./plot":461,"d3":60}],454:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":332,"../../plots/plots":417,"./constants":467,"./plot":472,"d3":62}],465:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89950,7 +91558,7 @@ module.exports = function calc(gd, trace) { }]; }; -},{"../../components/colorscale/calc":227,"../../components/colorscale/has_colorscale":234,"../../lib":336}],455:[function(require,module,exports){ +},{"../../components/colorscale/calc":236,"../../components/colorscale/has_colorscale":243,"../../lib":346}],466:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90004,7 +91612,7 @@ module.exports = function colorbar(gd, cd) { .options(line.colorbar)(); }; -},{"../../components/colorbar/draw":224,"../../components/colorscale":235,"../../lib":336,"../../plots/plots":406,"fast-isnumeric":66}],456:[function(require,module,exports){ +},{"../../components/colorbar/draw":233,"../../components/colorscale":244,"../../lib":346,"../../plots/plots":417,"fast-isnumeric":68}],467:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90041,7 +91649,7 @@ module.exports = { } }; -},{}],457:[function(require,module,exports){ +},{}],468:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90154,7 +91762,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceFont(coerce, 'rangefont', fontDflt); }; -},{"../../components/colorscale/defaults":230,"../../components/colorscale/has_colorscale":234,"../../lib":336,"./attributes":452,"./constants":456}],458:[function(require,module,exports){ +},{"../../components/colorscale/defaults":239,"../../components/colorscale/has_colorscale":243,"../../lib":346,"./attributes":463,"./constants":467}],469:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90183,7 +91791,7 @@ Parcoords.meta = { module.exports = Parcoords; -},{"./attributes":452,"./base_plot":453,"./calc":454,"./colorbar":455,"./defaults":457,"./plot":461}],459:[function(require,module,exports){ +},{"./attributes":463,"./base_plot":464,"./calc":465,"./colorbar":466,"./defaults":468,"./plot":472}],470:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90608,7 +92216,7 @@ module.exports = function(canvasGL, lines, canvasWidth, canvasHeight, initialDim }; }; -},{"./constants":456,"regl":173}],460:[function(require,module,exports){ +},{"./constants":467,"regl":176}],471:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91384,7 +92992,7 @@ module.exports = function(root, svg, styledData, layout, callbacks) { return tweakables; }; -},{"../../components/drawing":245,"../../lib":336,"./constants":456,"./lines":459,"d3":60}],461:[function(require,module,exports){ +},{"../../components/drawing":254,"../../lib":346,"./constants":467,"./lines":470,"d3":62}],472:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91504,7 +93112,7 @@ module.exports = function plot(gd, cdparcoords) { }); }; -},{"./parcoords":460}],462:[function(require,module,exports){ +},{"./parcoords":471}],473:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91529,7 +93137,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":221}],463:[function(require,module,exports){ +},{"../../components/color":230}],474:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91618,7 +93226,7 @@ module.exports = { } }; -},{"../scattergl/attributes":492}],464:[function(require,module,exports){ +},{"../scattergl/attributes":503}],475:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91849,7 +93457,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":354,"../scatter/get_trace_color":476,"gl-pointcloud2d":109}],465:[function(require,module,exports){ +},{"../../lib/str2rgbarray":364,"../scatter/get_trace_color":487,"gl-pointcloud2d":111}],476:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91894,7 +93502,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { coerce('marker.border.arearatio'); }; -},{"../../lib":336,"./attributes":463}],466:[function(require,module,exports){ +},{"../../lib":346,"./attributes":474}],477:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91924,7 +93532,7 @@ pointcloud.meta = { module.exports = pointcloud; -},{"../../plots/gl2d":402,"../scatter3d/calc":491,"./attributes":463,"./convert":464,"./defaults":465}],467:[function(require,module,exports){ +},{"../../plots/gl2d":412,"../scatter3d/calc":502,"./attributes":474,"./convert":475,"./defaults":476}],478:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91976,7 +93584,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":336}],468:[function(require,module,exports){ +},{"../../lib":346}],479:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92022,20 +93630,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -92256,7 +93856,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":222,"../../components/colorscale/color_attributes":228,"../../components/drawing":245,"../../components/drawing/attributes":244,"../../components/errorbars/attributes":247,"../../lib/extend":330,"./constants":473}],469:[function(require,module,exports){ +},{"../../components/colorbar/attributes":231,"../../components/colorscale/color_attributes":237,"../../components/drawing":254,"../../components/drawing/attributes":253,"../../components/errorbars/attributes":256,"../../lib/extend":340,"./constants":484}],480:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92387,7 +93987,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":320,"../../plots/cartesian/axes":374,"./arrays_to_calcdata":467,"./colorscale_calc":472,"./subtypes":488,"fast-isnumeric":66}],470:[function(require,module,exports){ +},{"../../constants/numerical":330,"../../plots/cartesian/axes":384,"./arrays_to_calcdata":478,"./colorscale_calc":483,"./subtypes":499,"fast-isnumeric":68}],481:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92426,7 +94026,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],471:[function(require,module,exports){ +},{}],482:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92482,7 +94082,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":224,"../../components/colorscale":235,"../../lib":336,"../../plots/plots":406,"fast-isnumeric":66}],472:[function(require,module,exports){ +},{"../../components/colorbar/draw":233,"../../components/colorscale":244,"../../lib":346,"../../plots/plots":417,"fast-isnumeric":68}],483:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92515,7 +94115,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":227,"../../components/colorscale/has_colorscale":234,"./subtypes":488}],473:[function(require,module,exports){ +},{"../../components/colorscale/calc":236,"../../components/colorscale/has_colorscale":243,"./subtypes":499}],484:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92531,7 +94131,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],474:[function(require,module,exports){ +},{}],485:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92570,11 +94170,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -92613,7 +94211,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":250,"../../lib":336,"./attributes":468,"./constants":473,"./fillcolor_defaults":475,"./line_defaults":479,"./line_shape_defaults":481,"./marker_defaults":484,"./subtypes":488,"./text_defaults":489,"./xy_defaults":490}],475:[function(require,module,exports){ +},{"../../components/errorbars/defaults":259,"../../lib":346,"./attributes":479,"./constants":484,"./fillcolor_defaults":486,"./line_defaults":490,"./line_shape_defaults":492,"./marker_defaults":495,"./subtypes":499,"./text_defaults":500,"./xy_defaults":501}],486:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92651,7 +94249,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":221}],476:[function(require,module,exports){ +},{"../../components/color":230}],487:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92704,7 +94302,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":221,"./subtypes":488}],477:[function(require,module,exports){ +},{"../../components/color":230,"./subtypes":499}],488:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92731,11 +94329,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -92791,7 +94390,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -92875,7 +94474,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":221,"../../components/errorbars":251,"../../components/fx":262,"../../lib":336,"./get_trace_color":476}],478:[function(require,module,exports){ +},{"../../components/color":230,"../../components/errorbars":260,"../../components/fx":271,"../../lib":346,"./get_trace_color":487}],489:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92919,7 +94518,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":384,"./arrays_to_calcdata":467,"./attributes":468,"./calc":469,"./clean_data":470,"./colorbar":471,"./defaults":474,"./hover":477,"./plot":485,"./select":486,"./style":487,"./subtypes":488}],479:[function(require,module,exports){ +},{"../../plots/cartesian":394,"./arrays_to_calcdata":478,"./attributes":479,"./calc":480,"./clean_data":481,"./colorbar":482,"./defaults":485,"./hover":488,"./plot":496,"./select":497,"./style":498,"./subtypes":499}],490:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92952,7 +94551,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":230,"../../components/colorscale/has_colorscale":234}],480:[function(require,module,exports){ +},{"../../components/colorscale/defaults":239,"../../components/colorscale/has_colorscale":243}],491:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93125,7 +94724,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":320}],481:[function(require,module,exports){ +},{"../../constants/numerical":330}],492:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93144,7 +94743,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],482:[function(require,module,exports){ +},{}],493:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93185,7 +94784,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],483:[function(require,module,exports){ +},{}],494:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93227,7 +94826,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":66}],484:[function(require,module,exports){ +},{"fast-isnumeric":68}],495:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93302,7 +94901,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":221,"../../components/colorscale/defaults":230,"../../components/colorscale/has_colorscale":234,"./subtypes":488}],485:[function(require,module,exports){ +},{"../../components/color":230,"../../components/colorscale/defaults":239,"../../components/colorscale/has_colorscale":243,"./subtypes":499}],496:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93645,10 +95244,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -93659,7 +95260,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -93667,7 +95269,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -93724,17 +95327,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -93746,6 +95352,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -93765,6 +95373,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -93773,7 +95383,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -93850,7 +95460,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":245,"../../components/errorbars":251,"../../lib":336,"../../lib/polygon":346,"./line_points":480,"./link_traces":482,"./subtypes":488,"d3":60}],486:[function(require,module,exports){ +},{"../../components/drawing":254,"../../components/errorbars":260,"../../lib":346,"../../lib/polygon":356,"./line_points":491,"./link_traces":493,"./subtypes":499,"d3":62}],497:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93872,7 +95482,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -93896,11 +95505,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -93923,7 +95530,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":488}],487:[function(require,module,exports){ +},{"./subtypes":499}],498:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -93954,10 +95561,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -93969,7 +95576,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":245,"../../components/errorbars":251,"d3":60}],488:[function(require,module,exports){ +},{"../../components/drawing":254,"../../components/errorbars":260,"d3":62}],499:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94005,7 +95612,7 @@ module.exports = { } }; -},{"../../lib":336}],489:[function(require,module,exports){ +},{"../../lib":346}],500:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94026,7 +95633,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":336}],490:[function(require,module,exports){ +},{"../../lib":346}],501:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94076,7 +95683,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":413}],491:[function(require,module,exports){ +},{"../../registry":424}],502:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94105,7 +95712,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":467,"../scatter/colorscale_calc":472}],492:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":478,"../scatter/colorscale_calc":483}],503:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94120,7 +95727,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); var DASHES = require('../../constants/gl2d_dashes'); -var MARKERS = require('../../constants/gl_markers'); +var MARKERS = require('../../constants/gl2d_markers'); var extendFlat = require('../../lib/extend').extendFlat; var extendDeep = require('../../lib/extend').extendDeep; @@ -94187,7 +95794,52 @@ module.exports = { error_x: scatterAttrs.error_x }; -},{"../../components/colorscale/color_attributes":228,"../../constants/gl2d_dashes":317,"../../constants/gl_markers":318,"../../lib/extend":330,"../scatter/attributes":468}],493:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":237,"../../constants/gl2d_dashes":327,"../../constants/gl2d_markers":328,"../../lib/extend":340,"../scatter/attributes":479}],504:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 Axes = require('../../plots/cartesian/axes'); +var arraysToCalcdata = require('../scatter/arrays_to_calcdata'); +var calcColorscales = require('../scatter/colorscale_calc'); + +module.exports = function calc(gd, trace) { + var dragmode = gd._fullLayout.dragmode; + var cd; + + if(dragmode === 'lasso' || dragmode === 'select') { + var xa = Axes.getFromId(gd, trace.xaxis || 'x'); + var ya = Axes.getFromId(gd, trace.yaxis || 'y'); + + var x = xa.makeCalcdata(trace, 'x'); + var y = ya.makeCalcdata(trace, 'y'); + + var serieslen = Math.min(x.length, y.length), i; + + // create the "calculated data" to plot + cd = new Array(serieslen); + + for(i = 0; i < serieslen; i++) { + cd[i] = {x: x[i], y: y[i]}; + } + } else { + cd = [{x: false, y: false, trace: trace, t: {}}]; + arraysToCalcdata(cd, trace); + } + + calcColorscales(trace); + + return cd; +}; + +},{"../../plots/cartesian/axes":384,"../scatter/arrays_to_calcdata":478,"../scatter/colorscale_calc":483}],505:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94215,11 +95867,12 @@ var formatColor = require('../../lib/gl_format_color'); var subTypes = require('../scatter/subtypes'); var makeBubbleSizeFn = require('../scatter/make_bubble_size_func'); var getTraceColor = require('../scatter/get_trace_color'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl2d_markers'); var DASHES = require('../../constants/gl2d_dashes'); var AXES = ['xaxis', 'yaxis']; - +var DESELECTDIM = 0.2; +var TRANSPARENT = [0, 0, 0, 0]; function LineWithMarkers(scene, uid) { this.scene = scene; @@ -94285,11 +95938,14 @@ function LineWithMarkers(scene, uid) { size: 12, color: [0, 0, 0, 1], borderSize: 1, - borderColor: [0, 0, 0, 1] + borderColor: [0, 0, 0, 1], + snapPoints: true }; + var scatterOptions1 = Lib.extendFlat({}, scatterOptions0, {snapPoints: false}); this.scatter = this.initObject(createScatter, scatterOptions0, 3); this.fancyScatter = this.initObject(createFancyScatter, scatterOptions0, 4); + this.selectScatter = this.initObject(createScatter, scatterOptions1, 5); } var proto = LineWithMarkers.prototype; @@ -94404,7 +96060,7 @@ function _convertArray(convert, data, count) { var convertNumber = convertArray.bind(null, function(x) { return +x; }); var convertColorBase = convertArray.bind(null, str2RGBArray); var convertSymbol = convertArray.bind(null, function(x) { - return MARKER_SYMBOLS[x] || '●'; + return MARKER_SYMBOLS[x] ? x : 'circle'; }); function convertColor(color, opacity, count) { @@ -94441,8 +96097,21 @@ function _convertColor(colors, opacities, count) { return result; } -proto.update = function(options) { +function isSymbolOpen(symbol) { + return symbol.split('-open')[1] === ''; +} + +function fillColor(colorIn, colorOut, offsetIn, offsetOut, isDimmed) { + var dim = isDimmed ? DESELECTDIM : 1; + var j; + + for(j = 0; j < 3; j++) { + colorIn[4 * offsetIn + j] = colorOut[4 * offsetOut + j]; + } + colorIn[4 * offsetIn + j] = dim * colorOut[4 * offsetOut + j]; +} +proto.update = function(options, cdscatter) { if(options.visible !== true) { this.isVisible = false; this.hasLines = false; @@ -94493,6 +96162,11 @@ proto.update = function(options) { // not quite on-par with 'scatter', but close enough for now // does not handle the colorscale case this.color = getTraceColor(options, {}); + + // provide reference for selecting points + if(cdscatter && cdscatter[0] && !cdscatter[0].glTrace) { + cdscatter[0].glTrace = this; + } }; // We'd ideally know that all values are of fast types; sampling gives no certainty but faster @@ -94527,7 +96201,9 @@ proto.updateFast = function(options) { positions = new Float64Array(2 * len), bounds = this.bounds, pId = 0, - ptr = 0; + ptr = 0, + selection = options.selection, + i, selPositions, l; var xx, yy; @@ -94540,7 +96216,7 @@ proto.updateFast = function(options) { // TODO bypass this on modebar +/- zoom if(fastType || isDateTime) { - for(var i = 0; i < len; ++i) { + for(i = 0; i < len; ++i) { xx = x[i]; yy = y[i]; @@ -94550,11 +96226,11 @@ proto.updateFast = function(options) { xx = Lib.dateTime2ms(xx, xcalendar); } - idToIndex[pId++] = i; - positions[ptr++] = xx; positions[ptr++] = yy; + idToIndex[pId++] = i; + bounds[0] = Math.min(bounds[0], xx); bounds[1] = Math.min(bounds[1], yy); bounds[2] = Math.max(bounds[2], xx); @@ -94566,6 +96242,16 @@ proto.updateFast = function(options) { positions = truncate(positions, ptr); this.idToIndex = idToIndex; + // form selected set + if(selection) { + selPositions = new Float64Array(2 * selection.length); + + for(i = 0, l = selection.length; i < l; i++) { + selPositions[i * 2 + 0] = selection[i].x; + selPositions[i * 2 + 1] = selection[i].y; + } + } + this.updateLines(options, positions); this.updateError('X', options); this.updateError('Y', options); @@ -94573,23 +96259,68 @@ proto.updateFast = function(options) { var markerSize; if(this.hasMarkers) { - this.scatter.options.positions = positions; + var markerColor, borderColor, opacity; + + // if we have selPositions array - means we have to render all points transparent, and selected points opaque + if(selPositions) { + this.scatter.options.positions = null; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); + opacity = (options.opacity) * (options.marker.opacity) * DESELECTDIM; + + markerColor[3] *= opacity; + this.scatter.options.color = markerColor; + + borderColor[3] *= opacity; + this.scatter.options.borderColor = borderColor; + + markerSize = options.marker.size; + this.scatter.options.size = markerSize; + this.scatter.options.borderSize = options.marker.line.width; + + this.scatter.update(); + this.scatter.options.positions = positions; - var markerColor = str2RGBArray(options.marker.color), - borderColor = str2RGBArray(options.marker.line.color), + + this.selectScatter.options.positions = selPositions; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); + opacity = (options.opacity) * (options.marker.opacity); + + markerColor[3] *= opacity; + this.selectScatter.options.color = markerColor; + + borderColor[3] *= opacity; + this.selectScatter.options.borderColor = borderColor; + + markerSize = options.marker.size; + this.selectScatter.options.size = markerSize; + this.selectScatter.options.borderSize = options.marker.line.width; + + this.selectScatter.update(); + } + + else { + this.scatter.options.positions = positions; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); opacity = (options.opacity) * (options.marker.opacity); + markerColor[3] *= opacity; + this.scatter.options.color = markerColor; - markerColor[3] *= opacity; - this.scatter.options.color = markerColor; + borderColor[3] *= opacity; + this.scatter.options.borderColor = borderColor; - borderColor[3] *= opacity; - this.scatter.options.borderColor = borderColor; + markerSize = options.marker.size; + this.scatter.options.size = markerSize; + this.scatter.options.borderSize = options.marker.line.width; - markerSize = options.marker.size; - this.scatter.options.size = markerSize; - this.scatter.options.borderSize = options.marker.line.width; + this.scatter.update(); + } - this.scatter.update(); } else { this.scatter.clear(); @@ -94606,7 +96337,8 @@ proto.updateFancy = function(options) { var scene = this.scene, xaxis = scene.xaxis, yaxis = scene.yaxis, - bounds = this.bounds; + bounds = this.bounds, + selection = options.selection; // makeCalcdata runs d2c (data-to-coordinate) on every point var x = this.pickXData = xaxis.makeCalcdata(options, 'x').slice(); @@ -94631,7 +96363,7 @@ proto.updateFancy = function(options) { var getX = (xaxis.type === 'log') ? xaxis.d2l : function(x) { return x; }; var getY = (yaxis.type === 'log') ? yaxis.d2l : function(y) { return y; }; - var i, j, xx, yy, ex0, ex1, ey0, ey1; + var i, xx, yy, ex0, ex1, ey0, ey1; for(i = 0; i < len; ++i) { this.xData[i] = xx = getX(x[i]); @@ -94667,7 +96399,14 @@ proto.updateFancy = function(options) { this.updateError('X', options, positions, errorsX); this.updateError('Y', options, positions, errorsY); - var sizes; + var sizes, selIds; + + if(selection) { + selIds = {}; + for(i = 0; i < selection.length; i++) { + selIds[selection[i].pointNumber] = true; + } + } if(this.hasMarkers) { this.scatter.options.positions = positions; @@ -94681,32 +96420,65 @@ proto.updateFancy = function(options) { this.scatter.options.colors = new Array(pId * 4); this.scatter.options.borderColors = new Array(pId * 4); - var markerSizeFunc = makeBubbleSizeFn(options), - markerOpts = options.marker, - markerOpacity = markerOpts.opacity, - traceOpacity = options.opacity, - colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len), - glyphs = convertSymbol(markerOpts.symbol, len), - borderWidths = convertNumber(markerOpts.line.width, len), - borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len), - index; + var markerSizeFunc = makeBubbleSizeFn(options); + var markerOpts = options.marker; + var markerOpacity = markerOpts.opacity; + var traceOpacity = options.opacity; + var symbols = convertSymbol(markerOpts.symbol, len); + var colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len); + var borderWidths = convertNumber(markerOpts.line.width, len); + var borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len); + var index, size, symbol, symbolSpec, isOpen, isDimmed, _colors, _borderColors, bw, minBorderWidth; sizes = convertArray(markerSizeFunc, markerOpts.size, len); for(i = 0; i < pId; ++i) { index = idToIndex[i]; - this.scatter.options.sizes[i] = 4.0 * sizes[index]; - this.scatter.options.glyphs[i] = glyphs[index]; - this.scatter.options.borderWidths[i] = 0.5 * borderWidths[index]; + symbol = symbols[index]; + symbolSpec = MARKER_SYMBOLS[symbol]; + isOpen = isSymbolOpen(symbol); + isDimmed = selIds && !selIds[index]; - for(j = 0; j < 4; ++j) { - this.scatter.options.colors[4 * i + j] = colors[4 * index + j]; - this.scatter.options.borderColors[4 * i + j] = borderColors[4 * index + j]; + if(symbolSpec.noBorder && !isOpen) { + _colors = borderColors; + } else { + _colors = colors; + } + + if(isOpen) { + _borderColors = colors; + } else { + _borderColors = borderColors; } + + // See https://github.com/plotly/plotly.js/pull/1781#discussion_r121820798 + // for more info on this logic + size = sizes[index]; + bw = borderWidths[index]; + minBorderWidth = (symbolSpec.noBorder || symbolSpec.noFill) ? 0.1 * size : 0; + + this.scatter.options.sizes[i] = 4.0 * size; + this.scatter.options.glyphs[i] = symbolSpec.unicode; + this.scatter.options.borderWidths[i] = 0.5 * ((bw > minBorderWidth) ? bw - minBorderWidth : 0); + + if(isOpen && !symbolSpec.noBorder && !symbolSpec.noFill) { + fillColor(this.scatter.options.colors, TRANSPARENT, i, 0); + } else { + fillColor(this.scatter.options.colors, _colors, i, index, isDimmed); + } + fillColor(this.scatter.options.borderColors, _borderColors, i, index, isDimmed); } - this.fancyScatter.update(); + // prevent scatter from resnapping points + if(selIds) { + this.scatter.options.positions = null; + this.fancyScatter.update(); + this.scatter.options.positions = positions; + } + else { + this.fancyScatter.update(); + } } else { this.fancyScatter.clear(); @@ -94828,15 +96600,16 @@ proto.dispose = function() { this.fancyScatter.dispose(); }; -function createLineWithMarkers(scene, data) { +function createLineWithMarkers(scene, data, cdscatter) { var plot = new LineWithMarkers(scene, data.uid); - plot.update(data); + plot.update(data, cdscatter); + return plot; } module.exports = createLineWithMarkers; -},{"../../components/errorbars":251,"../../constants/gl2d_dashes":317,"../../constants/gl_markers":318,"../../lib":336,"../../lib/gl_format_color":333,"../../lib/str2rgbarray":354,"../../lib/typed_array_truncate":357,"../../plots/cartesian/axes":374,"../../plots/cartesian/axis_autotype":375,"../scatter/get_trace_color":476,"../scatter/make_bubble_size_func":483,"../scatter/subtypes":488,"fast-isnumeric":66,"gl-error2d":77,"gl-line2d":85,"gl-scatter2d":126,"gl-scatter2d-sdf":121}],494:[function(require,module,exports){ +},{"../../components/errorbars":260,"../../constants/gl2d_dashes":327,"../../constants/gl2d_markers":328,"../../lib":346,"../../lib/gl_format_color":343,"../../lib/str2rgbarray":364,"../../lib/typed_array_truncate":367,"../../plots/cartesian/axes":384,"../../plots/cartesian/axis_autotype":385,"../scatter/get_trace_color":487,"../scatter/make_bubble_size_func":494,"../scatter/subtypes":499,"fast-isnumeric":68,"gl-error2d":79,"gl-line2d":87,"gl-scatter2d":128,"gl-scatter2d-sdf":123}],506:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94893,7 +96666,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":250,"../../lib":336,"../scatter/constants":473,"../scatter/fillcolor_defaults":475,"../scatter/line_defaults":479,"../scatter/marker_defaults":484,"../scatter/subtypes":488,"../scatter/xy_defaults":490,"./attributes":492}],495:[function(require,module,exports){ +},{"../../components/errorbars/defaults":259,"../../lib":346,"../scatter/constants":484,"../scatter/fillcolor_defaults":486,"../scatter/line_defaults":490,"../scatter/marker_defaults":495,"../scatter/subtypes":499,"../scatter/xy_defaults":501,"./attributes":503}],507:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -94909,10 +96682,12 @@ var ScatterGl = {}; ScatterGl.attributes = require('./attributes'); ScatterGl.supplyDefaults = require('./defaults'); ScatterGl.colorbar = require('../scatter/colorbar'); +ScatterGl.hoverPoints = require('../scatter/hover'); // reuse the Scatter3D 'dummy' calc step so that legends know what to do -ScatterGl.calc = require('../scatter3d/calc'); +ScatterGl.calc = require('./calc'); ScatterGl.plot = require('./convert'); +ScatterGl.selectPoints = require('./select'); ScatterGl.moduleType = 'trace'; ScatterGl.name = 'scattergl'; @@ -94924,5 +96699,67 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":402,"../scatter/colorbar":471,"../scatter3d/calc":491,"./attributes":492,"./convert":493,"./defaults":494}]},{},[6])(6) +},{"../../plots/gl2d":412,"../scatter/colorbar":482,"../scatter/hover":488,"./attributes":503,"./calc":504,"./convert":505,"./defaults":506,"./select":508}],508:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 subtypes = require('../scatter/subtypes'); + +module.exports = function selectPoints(searchInfo, polygon) { + var cd = searchInfo.cd, + xa = searchInfo.xaxis, + ya = searchInfo.yaxis, + selection = [], + trace = cd[0].trace, + i, + di, + x, + y; + + var scattergl = cd[0].glTrace; + var scene = cd[0].glTrace.scene; + + var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); + if(trace.visible !== true || hasOnlyLines) return; + + // filter out points by visible scatter ones + if(polygon === false) { + // clear selection + for(i = 0; i < cd.length; i++) cd[i].dim = 0; + } + else { + for(i = 0; i < cd.length; i++) { + di = cd[i]; + x = xa.c2p(di.x); + y = ya.c2p(di.y); + if(polygon.contains([x, y])) { + selection.push({ + pointNumber: i, + x: di.x, + y: di.y + }); + di.dim = 0; + } + else di.dim = 1; + } + } + + // highlight selected points here + trace.selection = selection; + + scattergl.update(trace, cd); + scene.glplot.setDirty(); + + return selection; +}; + +},{"../scatter/subtypes":499}]},{},[6])(6) }); \ No newline at end of file diff --git a/dist/plotly-gl2d.min.js b/dist/plotly-gl2d.min.js index 0900e1c4f9e..e25a770ffd1 100644 --- a/dist/plotly-gl2d.min.js +++ b/dist/plotly-gl2d.min.js @@ -1,43 +1,43 @@ /** -* plotly.js (gl2d - minified) v1.27.1 +* plotly.js (gl2d - minified) v1.28.0 * Copyright 2012-2017, 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(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(i)return i(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 a(r||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o0?r=r.ushln(f):f<0&&(c=c.ushln(-f)),l(r,c)}var a=t("./is-rat"),i=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&&a(t[0])&&a(t[1])}var a=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 a(0))}var a=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 i=0;i20?52:r+32}var a=t("double-bits"),i=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":29,"double-bits":61}],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=i.exponent(t);return e<52?new a(t):new a(t*Math.pow(2,52-e)).ushln(e-52)}var a=t("bn.js"),i=t("double-bits");e.exports=n},{"bn.js":30,"double-bits":61}],22:[function(t,e,r){"use strict";function n(t,e){var r=i(t),n=i(e);if(0===r)return[a(0),a(1)];if(0===n)return[a(0),a(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 a=t("./num-to-bn"),i=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 a(t)}var a=t("bn.js");e.exports=n},{"bn.js":30}],24:[function(t,e,r){"use strict";function n(t,e){return a(t[0].mul(e[0]),t[1].mul(e[1]))}var a=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":22}],25:[function(t,e,r){"use strict";function n(t){return a(t[0])*a(t[1])}var a=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":17}],26:[function(t,e,r){"use strict";function n(t,e){return a(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var a=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.abs().divmod(r.abs()),o=n.div,s=a(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=i(s)+4,f=a(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=a(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}var a=t("./lib/bn-to-num"),i=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,a,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",a?".get(m)":"[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],!1,a),n("B","x"+t+"y",e,["y"],!0,a),n("P","c(x,y)"+t+"0",e,["y","c"],!1,a),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,a),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var a=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--a;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))<<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))<<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(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function a(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){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(t,e,r){for(var n=0,a=Math.min(t.length,r),i=e;i=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var a=0,i=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return a}function l(t){for(var e=new Array(t.bitLength()),r=0;r>>a}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var a=0|t.words[0],i=0|e.words[0],o=a*i,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;a=0|t.words[p],i=0|e.words[d],o=a*i+f,c+=o/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,a=0,i=0;i>>26)|0,a+=o>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}function f(t,e,r){return(new h).mulp(t,e,r)}function h(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function m(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var a=0;"-"===t[0]&&a++,16===e?this._parseHex(t,a):this._parseBase(t,e,a),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a=0;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);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)a=o(t,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==e&&(a=o(t,e,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=e)n++;n--,a=a/e|0;for(var i=t.length-r,o=i%n,l=Math.min(i,i-o)+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.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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],A=[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){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var a=0,i=0,o=0;o>>24-a&16777215,r=0!==i||o!==this.length-1?_[6-l.length]+l+r:l+r,a+=2,a>=26&&(a-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=A[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(t);f=f.idivn(c),r=f.isZero()?h+r:_[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(i),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},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=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,a=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;it.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,a;r>0?(n=this,a=t):(n=t,a=this);for(var i=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==i&&o>26,this.words[o]=67108863&e;if(0===i&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,m=0|o[2],v=8191&m,y=m>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],A=8191&w,k=w>>>13,M=0|o[5],T=8191&M,E=M>>>13,L=0|o[6],S=8191&L,C=L>>>13,O=0|o[7],R=8191&O,I=O>>>13,D=0|o[8],P=8191&D,z=D>>>13,F=0|o[9],B=8191&F,N=F>>>13,j=0|s[0],H=8191&j,U=j>>>13,V=0|s[1],q=8191&V,G=V>>>13,X=0|s[2],Y=8191&X,W=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,K=0|s[4],J=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,at=0|s[6],it=8191&at,ot=at>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(f,H),a=Math.imul(f,U),a=a+Math.imul(h,H)|0,i=Math.imul(h,U);var mt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),a=Math.imul(p,U),a=a+Math.imul(g,H)|0,i=Math.imul(g,U),n=n+Math.imul(f,q)|0,a=a+Math.imul(f,G)|0,a=a+Math.imul(h,q)|0,i=i+Math.imul(h,G)|0;var vt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,H),a=Math.imul(v,U),a=a+Math.imul(y,H)|0,i=Math.imul(y,U),n=n+Math.imul(p,q)|0,a=a+Math.imul(p,G)|0,a=a+Math.imul(g,q)|0,i=i+Math.imul(g,G)|0,n=n+Math.imul(f,Y)|0,a=a+Math.imul(f,W)|0,a=a+Math.imul(h,Y)|0,i=i+Math.imul(h,W)|0;var yt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,H),a=Math.imul(x,U),a=a+Math.imul(_,H)|0,i=Math.imul(_,U),n=n+Math.imul(v,q)|0,a=a+Math.imul(v,G)|0,a=a+Math.imul(y,q)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(p,Y)|0,a=a+Math.imul(p,W)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(g,W)|0,n=n+Math.imul(f,Q)|0,a=a+Math.imul(f,$)|0,a=a+Math.imul(h,Q)|0,i=i+Math.imul(h,$)|0;var bt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,H),a=Math.imul(A,U),a=a+Math.imul(k,H)|0,i=Math.imul(k,U),n=n+Math.imul(x,q)|0,a=a+Math.imul(x,G)|0,a=a+Math.imul(_,q)|0,i=i+Math.imul(_,G)|0,n=n+Math.imul(v,Y)|0,a=a+Math.imul(v,W)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(y,W)|0,n=n+Math.imul(p,Q)|0,a=a+Math.imul(p,$)|0,a=a+Math.imul(g,Q)|0,i=i+Math.imul(g,$)|0,n=n+Math.imul(f,J)|0,a=a+Math.imul(f,tt)|0,a=a+Math.imul(h,J)|0,i=i+Math.imul(h,tt)|0;var xt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,H),a=Math.imul(T,U),a=a+Math.imul(E,H)|0,i=Math.imul(E,U),n=n+Math.imul(A,q)|0,a=a+Math.imul(A,G)|0,a=a+Math.imul(k,q)|0,i=i+Math.imul(k,G)|0,n=n+Math.imul(x,Y)|0,a=a+Math.imul(x,W)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(v,Q)|0,a=a+Math.imul(v,$)|0,a=a+Math.imul(y,Q)|0,i=i+Math.imul(y,$)|0,n=n+Math.imul(p,J)|0,a=a+Math.imul(p,tt)|0,a=a+Math.imul(g,J)|0,i=i+Math.imul(g,tt)|0,n=n+Math.imul(f,rt)|0,a=a+Math.imul(f,nt)|0,a=a+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0;var _t=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,H),a=Math.imul(S,U),a=a+Math.imul(C,H)|0,i=Math.imul(C,U),n=n+Math.imul(T,q)|0,a=a+Math.imul(T,G)|0,a=a+Math.imul(E,q)|0,i=i+Math.imul(E,G)|0,n=n+Math.imul(A,Y)|0,a=a+Math.imul(A,W)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(x,Q)|0,a=a+Math.imul(x,$)|0,a=a+Math.imul(_,Q)|0,i=i+Math.imul(_,$)|0,n=n+Math.imul(v,J)|0,a=a+Math.imul(v,tt)|0,a=a+Math.imul(y,J)|0,i=i+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,a=a+Math.imul(p,nt)|0,a=a+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0,n=n+Math.imul(f,it)|0,a=a+Math.imul(f,ot)|0,a=a+Math.imul(h,it)|0,i=i+Math.imul(h,ot)|0;var wt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,H),a=Math.imul(R,U),a=a+Math.imul(I,H)|0,i=Math.imul(I,U),n=n+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,a=a+Math.imul(C,q)|0,i=i+Math.imul(C,G)|0,n=n+Math.imul(T,Y)|0,a=a+Math.imul(T,W)|0,a=a+Math.imul(E,Y)|0,i=i+Math.imul(E,W)|0,n=n+Math.imul(A,Q)|0,a=a+Math.imul(A,$)|0,a=a+Math.imul(k,Q)|0,i=i+Math.imul(k,$)|0,n=n+Math.imul(x,J)|0,a=a+Math.imul(x,tt)|0,a=a+Math.imul(_,J)|0,i=i+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,a=a+Math.imul(v,nt)|0,a=a+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,n=n+Math.imul(p,it)|0,a=a+Math.imul(p,ot)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(g,ot)|0,n=n+Math.imul(f,lt)|0,a=a+Math.imul(f,ut)|0,a=a+Math.imul(h,lt)|0,i=i+Math.imul(h,ut)|0;var At=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(P,H),a=Math.imul(P,U),a=a+Math.imul(z,H)|0,i=Math.imul(z,U),n=n+Math.imul(R,q)|0,a=a+Math.imul(R,G)|0,a=a+Math.imul(I,q)|0,i=i+Math.imul(I,G)|0,n=n+Math.imul(S,Y)|0,a=a+Math.imul(S,W)|0,a=a+Math.imul(C,Y)|0,i=i+Math.imul(C,W)|0,n=n+Math.imul(T,Q)|0,a=a+Math.imul(T,$)|0,a=a+Math.imul(E,Q)|0,i=i+Math.imul(E,$)|0,n=n+Math.imul(A,J)|0,a=a+Math.imul(A,tt)|0,a=a+Math.imul(k,J)|0,i=i+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,a=a+Math.imul(x,nt)|0,a=a+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,n=n+Math.imul(v,it)|0,a=a+Math.imul(v,ot)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,a=a+Math.imul(p,ut)|0,a=a+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0,n=n+Math.imul(f,ft)|0,a=a+Math.imul(f,ht)|0,a=a+Math.imul(h,ft)|0,i=i+Math.imul(h,ht)|0;var kt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,H),a=Math.imul(B,U),a=a+Math.imul(N,H)|0,i=Math.imul(N,U),n=n+Math.imul(P,q)|0,a=a+Math.imul(P,G)|0,a=a+Math.imul(z,q)|0,i=i+Math.imul(z,G)|0,n=n+Math.imul(R,Y)|0,a=a+Math.imul(R,W)|0,a=a+Math.imul(I,Y)|0,i=i+Math.imul(I,W)|0,n=n+Math.imul(S,Q)|0,a=a+Math.imul(S,$)|0,a=a+Math.imul(C,Q)|0,i=i+Math.imul(C,$)|0,n=n+Math.imul(T,J)|0,a=a+Math.imul(T,tt)|0,a=a+Math.imul(E,J)|0,i=i+Math.imul(E,tt)|0,n=n+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,a=a+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,n=n+Math.imul(x,it)|0,a=a+Math.imul(x,ot)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,a=a+Math.imul(v,ut)|0,a=a+Math.imul(y,lt)|0,i=i+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,a=a+Math.imul(p,ht)|0,a=a+Math.imul(g,ft)|0,i=i+Math.imul(g,ht)|0,n=n+Math.imul(f,pt)|0,a=a+Math.imul(f,gt)|0,a=a+Math.imul(h,pt)|0,i=i+Math.imul(h,gt)|0;var Mt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(B,q),a=Math.imul(B,G),a=a+Math.imul(N,q)|0,i=Math.imul(N,G),n=n+Math.imul(P,Y)|0,a=a+Math.imul(P,W)|0,a=a+Math.imul(z,Y)|0,i=i+Math.imul(z,W)|0,n=n+Math.imul(R,Q)|0,a=a+Math.imul(R,$)|0,a=a+Math.imul(I,Q)|0,i=i+Math.imul(I,$)|0,n=n+Math.imul(S,J)|0,a=a+Math.imul(S,tt)|0,a=a+Math.imul(C,J)|0,i=i+Math.imul(C,tt)|0,n=n+Math.imul(T,rt)|0,a=a+Math.imul(T,nt)|0,a=a+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,n=n+Math.imul(A,it)|0,a=a+Math.imul(A,ot)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,a=a+Math.imul(x,ut)|0,a=a+Math.imul(_,lt)|0,i=i+Math.imul(_,ut)|0,n=n+Math.imul(v,ft)|0,a=a+Math.imul(v,ht)|0,a=a+Math.imul(y,ft)|0,i=i+Math.imul(y,ht)|0,n=n+Math.imul(p,pt)|0,a=a+Math.imul(p,gt)|0,a=a+Math.imul(g,pt)|0,i=i+Math.imul(g,gt)|0;var Tt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(B,Y),a=Math.imul(B,W),a=a+Math.imul(N,Y)|0,i=Math.imul(N,W),n=n+Math.imul(P,Q)|0,a=a+Math.imul(P,$)|0,a=a+Math.imul(z,Q)|0,i=i+Math.imul(z,$)|0,n=n+Math.imul(R,J)|0,a=a+Math.imul(R,tt)|0,a=a+Math.imul(I,J)|0,i=i+Math.imul(I,tt)|0,n=n+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,a=a+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,n=n+Math.imul(T,it)|0,a=a+Math.imul(T,ot)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(E,ot)|0,n=n+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,a=a+Math.imul(k,lt)|0,i=i+Math.imul(k,ut)|0,n=n+Math.imul(x,ft)|0,a=a+Math.imul(x,ht)|0,a=a+Math.imul(_,ft)|0,i=i+Math.imul(_,ht)|0,n=n+Math.imul(v,pt)|0,a=a+Math.imul(v,gt)|0,a=a+Math.imul(y,pt)|0,i=i+Math.imul(y,gt)|0;var Et=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(B,Q),a=Math.imul(B,$),a=a+Math.imul(N,Q)|0,i=Math.imul(N,$),n=n+Math.imul(P,J)|0,a=a+Math.imul(P,tt)|0,a=a+Math.imul(z,J)|0,i=i+Math.imul(z,tt)|0,n=n+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,a=a+Math.imul(I,rt)|0,i=i+Math.imul(I,nt)|0,n=n+Math.imul(S,it)|0,a=a+Math.imul(S,ot)|0,a=a+Math.imul(C,it)|0,i=i+Math.imul(C,ot)|0,n=n+Math.imul(T,lt)|0,a=a+Math.imul(T,ut)|0,a=a+Math.imul(E,lt)|0,i=i+Math.imul(E,ut)|0,n=n+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0,a=a+Math.imul(k,ft)|0,i=i+Math.imul(k,ht)|0,n=n+Math.imul(x,pt)|0,a=a+Math.imul(x,gt)|0,a=a+Math.imul(_,pt)|0,i=i+Math.imul(_,gt)|0;var Lt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(B,J),a=Math.imul(B,tt),a=a+Math.imul(N,J)|0,i=Math.imul(N,tt),n=n+Math.imul(P,rt)|0,a=a+Math.imul(P,nt)|0,a=a+Math.imul(z,rt)|0,i=i+Math.imul(z,nt)|0,n=n+Math.imul(R,it)|0,a=a+Math.imul(R,ot)|0,a=a+Math.imul(I,it)|0,i=i+Math.imul(I,ot)|0,n=n+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,a=a+Math.imul(C,lt)|0,i=i+Math.imul(C,ut)|0,n=n+Math.imul(T,ft)|0,a=a+Math.imul(T,ht)|0,a=a+Math.imul(E,ft)|0,i=i+Math.imul(E,ht)|0,n=n+Math.imul(A,pt)|0,a=a+Math.imul(A,gt)|0,a=a+Math.imul(k,pt)|0,i=i+Math.imul(k,gt)|0;var St=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,rt),a=Math.imul(B,nt),a=a+Math.imul(N,rt)|0,i=Math.imul(N,nt),n=n+Math.imul(P,it)|0,a=a+Math.imul(P,ot)|0,a=a+Math.imul(z,it)|0,i=i+Math.imul(z,ot)|0,n=n+Math.imul(R,lt)|0,a=a+Math.imul(R,ut)|0,a=a+Math.imul(I,lt)|0,i=i+Math.imul(I,ut)|0,n=n+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0,a=a+Math.imul(C,ft)|0,i=i+Math.imul(C,ht)|0,n=n+Math.imul(T,pt)|0,a=a+Math.imul(T,gt)|0,a=a+Math.imul(E,pt)|0,i=i+Math.imul(E,gt)|0;var Ct=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(B,it),a=Math.imul(B,ot),a=a+Math.imul(N,it)|0,i=Math.imul(N,ot),n=n+Math.imul(P,lt)|0,a=a+Math.imul(P,ut)|0,a=a+Math.imul(z,lt)|0,i=i+Math.imul(z,ut)|0,n=n+Math.imul(R,ft)|0,a=a+Math.imul(R,ht)|0,a=a+Math.imul(I,ft)|0,i=i+Math.imul(I,ht)|0,n=n+Math.imul(S,pt)|0,a=a+Math.imul(S,gt)|0,a=a+Math.imul(C,pt)|0,i=i+Math.imul(C,gt)|0;var Ot=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(B,lt),a=Math.imul(B,ut),a=a+Math.imul(N,lt)|0,i=Math.imul(N,ut),n=n+Math.imul(P,ft)|0,a=a+Math.imul(P,ht)|0,a=a+Math.imul(z,ft)|0,i=i+Math.imul(z,ht)|0,n=n+Math.imul(R,pt)|0,a=a+Math.imul(R,gt)|0,a=a+Math.imul(I,pt)|0,i=i+Math.imul(I,gt)|0;var Rt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(B,ft),a=Math.imul(B,ht),a=a+Math.imul(N,ft)|0,i=Math.imul(N,ht),n=n+Math.imul(P,pt)|0,a=a+Math.imul(P,gt)|0,a=a+Math.imul(z,pt)|0,i=i+Math.imul(z,gt)|0;var It=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(B,pt),a=Math.imul(B,gt),a=a+Math.imul(N,pt)|0,i=Math.imul(N,gt);var Dt=(u+n|0)+((8191&a)<<13)|0;return u=(i+(a>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,l[0]=mt,l[1]=vt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=At,l[8]=kt,l[9]=Mt,l[10]=Tt,l[11]=Et,l[12]=Lt,l[13]=St,l[14]=Ct,l[15]=Ot,l[16]=Rt,l[17]=It,l[18]=Dt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(k=u),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?k(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):f(this,t,e)},h.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},h.prototype.permute=function(t,e,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=a/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=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.imul(this.clone())},i.prototype.pow=function(t){var e=l(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,r=t%26,a=(t-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==a){for(e=this.length-1;e>=0;e--)this.words[e+a]=this.words[e];for(e=0;e=0);var a;a=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=a);u--){var f=0|this.words[u];this.words[u]=c<<26-i|f>>>i,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,a=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var a=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(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[a+r]=67108863&o}for(;a>26,this.words[a+r]=67108863&o;if(0===s)return this.strip();for(n(s===-1),s=0,a=0;a>26,this.words[a]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){s=new i(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[a.length+f])+(0|n.words[a.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(a,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(a,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new 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",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),a=t.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,a=this.length-1;a>=0;a--)r=(e*r+(0|this.words[a]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*e;this.words[r]=a/t|0,e=a%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(f)),a.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s),o.isub(l)):(r.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(o)):(r.isub(e),o.isub(a))}var h;return h=0===e.cmpn(1)?a:o,h.cmpn(0)<0&&h.iadd(t),h},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=e.cmp(r);if(a<0){var i=e;e=r,r=i}else if(0===a||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(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){n("number"==typeof t);var e=t%26,r=(t-e)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var a=0|this.words[0];r=a===t?0:at.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|t.words[r];if(n!==a){na&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return this.cmpn(t)===-1},i.prototype.lt=function(t){return this.cmp(t)===-1},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new y(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},a(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,a=i}a>>>=22,t.words[n-10]=a,0===a&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=a,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(M[t])return M[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new g;else if("p192"===t)e=new m;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new v}return M[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,a),h=this.pow(t,a.addn(1).iushrn(1)),d=this.pow(t,a),p=o;0!==d.cmp(s);){for(var g=d,m=0;0!==g.cmp(s);m++)g=g.redSqr();n(m=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new b(t)},a(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())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).iushrn(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)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===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*i),c=f.mallocInt32(i);if((i=a(t,s,u,c))>0){if(1===s&&n)h.init(i), -l=h.sweepComplete(s,r,0,i,u,c,0,i,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=a(e,s,p,g),o>0&&(h.init(i+o),l=1===s?h.sweepBipartite(s,r,0,i,u,c,0,o,p,g):d(s,r,n,i,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=[],i(t,t,o,!0),c}function l(t,e){return c=[],i(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?i(t,t,e,!0):l(t,e);case 3:return i(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":199}],32:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",n,"(",w.join(),"){","var ",u,"=2*",i,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+i+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+m+";++j,"+b+"+="+u+"){var y0="+v+"["+o+"+"+b+"],"+(r?"y1="+v+"["+o+"+"+b+"+"+i+"],":"")+"yi="+y+"[j];";return t?a.push(l,_,":",A):a.push(A,_,":",l),r?a.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=a.join("")+o.join("");return new Function(s)()}var i="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",m="be",v="bb",y="bi",b="bp",x="rv",_="Q",w=[i,o,s,c,f,h,d,g,m,v,y];r.partial=a(!1),r.full=a(!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);E.length0;){O-=1;var I=O*M,D=E[I],P=E[I+1],z=E[I+2],F=E[I+3],B=E[I+4],N=E[I+5],j=O*T,H=L[j],U=L[j+1],V=1&N,q=!!(16&N),G=l,X=u,Y=g,W=S;if(V&&(G=g,X=S,Y=l,W=u),!(2&N&&(z=_(t,D,P,z,G,X,U),P>=z)||4&N&&(P=w(t,D,P,z,G,X,H))>=z)){var Z=z-P,Q=B-F;if(q){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&a[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=i[h*f+e];u=b?(d=y,p=b):v>=_?(d=m,p=v):(d=x,p=_):b>=_?(d=y,p=b):_>=v?(d=m,p=v):(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(a.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var a="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?a(0,e-1,t):f(0,e-1,t)}function a(t,e,r){for(var n=2*(t+1),a=t+1;a<=e;++a){for(var i=r[n++],o=r[n++],s=a,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 a=n[t];return a>1,m=g-n,v=g+n,y=d,b=m,x=g,_=v,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,O=2*x,R=2*w,I=2*d,D=2*g,P=2*p,z=0;z<2;++z){var F=r[C+z],B=r[O+z],N=r[R+z];r[I+z]=F,r[D+z]=B,r[P+z]=N}o(m,t,r),o(v,e,r);for(var j=A;j<=k;++j)if(c(j,T,E,r))j!==A&&i(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):(i(j,k,r),--k);break}if(--k>>1;h(x,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,a(m,v,S--,C);else if(C>=0)a(p,g,L--,C);else if(C<=-d){C=-C-d|0;for(var O=0;O>>1;h(x,L);for(var S=0,C=0,O=0,k=0;k>1==x[2*k+3]>>1&&(I=2,k+=1),R<0){for(var D=-(R>>1)-1,P=0;P>1)-1;0===I?a(p,g,S--,D):1===I?a(m,v,C--,D):2===I&&a(y,b,O--,D)}}}function l(t,e,r,n,o,s,l,u,c,f,m,v){var y=0,b=2*t,_=e,w=e+t,A=1,k=1;n?k=d:A=d;for(var M=o;M>>1;h(x,S);for(var C=0,M=0;M=d?(R=!n,T-=d):(R=!!n,T-=1),R)i(p,g,C++,T);else{var I=v[T],D=b*T,P=m[D+e+1],z=m[D+e+1+t];t:for(var F=0;F>>1;h(x,A);for(var k=0,y=0;y=d)p[k++]=b-d;else{b-=1;var T=c[b],E=g*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(p[C]===b){for(var D=C+1;DZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return i(t,e,r)}function i(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?f(t,e,r):"string"==typeof t?u(t,e):h(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),i=n(r),o=i.write(t,e);return o!==r&&(i=i.slice(0,o)),i}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),a=0;a=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),a.alloc(+t)}function g(t,e){if(a.isBuffer(t))return t.length;if(G(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 j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return j(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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 E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(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,X(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=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,a){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}var u;if(a){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;ha&&(n=a):n=a;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+s<=r){var l,u,c,f;switch(s){case 1:i<128&&(o=i);break;case 2:l=t[a+1],128==(192&l)&&(f=(31&i)<<6|63&l)>127&&(o=f);break;case 3:l=t[a+1],u=t[a+2],128==(192&l)&&128==(192&u)&&(f=(15&i)<<12|(63&l)<<6|63&u)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:l=t[a+1],u=t[a+2],c=t[a+3],128==(192&l)&&128==(192&u)&&128==(192&c)&&(f=(15&i)<<18|(63&l)<<12|(63&u)<<6|63&c)>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),a+=s}return L(n)}function L(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function P(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function B(t){if(t=t.trim().replace($,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function N(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){e=e||1/0;for(var r,n=t.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(t){for(var e=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function V(t){return Y.toByteArray(B(t))}function q(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function X(t){return t!==t}var Y=t("base64-js"),W=t("ieee754");r.Buffer=a,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return i(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return s(t,e,r)},a.allocUnsafe=function(t){return l(t)},a.allocUnsafeSlow=function(t){return l(t)},a.isBuffer=function(t){return null!=t&&t._isBuffer===!0},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},a.prototype.compare=function(t,e,r,n,i){if(!a.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 o=i-n,s=r-e,l=Math.min(o,s),u=this.slice(n,i),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t],a=1,i=0;++i=a&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||I(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),W.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),W.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),W.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),W.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){D(this,t,e,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,!n){D(this,t,e,r,Math.pow(2,8*r)-1,0)}var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);D(this,t,e,r,a-1,-a)}var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);D(this,t,e,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.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),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},a.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;--a)t[a+e]=this[a+r];else if(i<1e3)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function a(t){return 3*t.length/4-n(t)}function i(t){var e,r,a,i,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),a=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,s[u++]=255&i):1===o&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),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,a=[],i=e;il?l:o+16383));return 1===n?(e=t[r-1],a+=u[e>>2],a+=u[e<<4&63],a+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],a+=u[e>>10],a+=u[e>>4&63],a+=u[e<<2&63],a+="="),i.push(a),i.join("")}r.byteLength=a,r.toByteArray=i,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 i=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=a},{"binary-search-bounds":45,"robust-in-sphere":175}],42:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,this.boundary=o}function a(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function i(t,e){for(var r=t.cells(),i=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-a){u[d]=a;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]=a))}}}var m=l;l=s,s=m,l.length=0,a=-a}var v=o(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var i=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],a]),f-=1;c.length=f,c.push(a);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],a]),f-=1;p.length=f,p.push(a)}}function l(t,e){var r;return(r=t.a[0]v[0]&&l.push(new a(v,d,m,f),new a(d,v,g,f))}l.sort(i);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===m?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,m=2;e.exports=f},{"binary-search-bounds":45,"robust-orientation":176}],44:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function a(t,e,r){for(var n=1,a=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;a(n[t],e,r),a(n[e],r,t),a(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,a=r.length;n>>1,x=a[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],46:[function(t,e,r){function n(t,e,r){return er?r:t:te?e:t}e.exports=n},{}],47:[function(t,e,r){"use strict";function n(t){var e=_(t);return[A(e,-1/0),A(e,1/0)]}function a(t,e){for(var r=new Array(e.length),n=0;n=0;--i){var p=n[i];o=p[0];var g=e[o],m=g[0],v=g[1],y=t[m],A=t[v];if((y[0]-A[0]||y[1]-A[1])<0){var M=m;m=v,v=M}g[0]=m;var T,E=g[1]=p[1];for(a&&(T=g[2]);i>0&&n[i-1][0]===o;){var p=n[--i],L=p[1];a?e.push([E,L,T]):e.push([E,L]),E=L}a?e.push([E,v,T]):e.push([E,v])}return s}function u(t,e,r){for(var a=e.length,i=new m(a),o=[],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 g(t,e,r){var n;if(r){n=e;for(var a=new Array(e.length),i=0;i10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):i(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var a=t("color-name"),i=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":50,"is-plain-obj":152}],52:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[u]=255*i;return a}},n.hsl=function(t){var e,r,n,a=t[0]/255,i=t[1]/255,o=t[2]/255,s=Math.min(a,i,o),l=Math.max(a,i,o),u=l-s;return l===s?e=0:a===l?e=(i-o)/u:i===l?e=2+(o-a)/u:o===l&&(e=4+(a-i)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":54}],54:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],55:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),a=s(t[1],-e[1]),i=s(r[0],-e[0]),o=s(r[1],-e[1]),c=u(l(n,i),l(a,o));return c[c.length-1]>=0}function a(t,e,r,a){var s=i(e,r,a);if(0===s){var l=o(i(t,e,r)),u=o(i(t,e,a));if(l===u){if(0===l){var c=n(t,e,r);return c===n(t,e,a)?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,a)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var f=i(t,e,r);return f>0?s>0&&i(t,e,a)>0?1:-1:f<0?s>0||i(t,e,a)>0?1:-1:i(t,e,a)>0?1:n(t,e,r)?1:-1}e.exports=a;var i=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":176,"robust-product":177,"robust-sum":181,signum:182,"two-sum":198}],56:[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 a(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 a=0;a0)throw new Error("cwise: pre() block may not reference array args");if(a0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a0)throw new Error("cwise: pre() block may not reference array index");if(a0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),ar.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,i(e)}var i=t("./lib/thunk.js");e.exports=a},{"./lib/thunk.js":58}],57:[function(t,e,r){"use strict";function n(t,e,r){var n,a,i=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 a(t,e,r,a){for(var i=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=i(m);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("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:201}],58:[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 i=[],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:0/0}function i(t){return null===t?0/0:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+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 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 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=a+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Io.get(t);return u&&(t=u,l=Q),s?e?a:n:e?A:i}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-"+ ++Po,a="click"+r,i=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(i.on(r,null),Do&&(o[Do]=s),t){var e=function(){i.on(a,null)};i.on(a,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 a=r.createSVGPoint();if(zo<0){var i=n(t);if(i.scrollX||i.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?(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 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?Uo:t<-1?-Uo:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function it(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?i+(o-i)*t/60:t<180?o:t<240?i+(o-i)*(240-t)/60:i}function a(t){return Math.round(255*n(t))}var i,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,i=2*r-o,new bt(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 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,a=n+e/500,i=n-r/200;return a=mt(a)*Ko,n=mt(n)*Jo,i=mt(i)*ts,new bt(yt(3.2404542*a-1.5371385*n-.4985314*i),yt(-.969266*a+1.8760108*n+.041556*i),yt(.0556434*a-.2040259*n+1.0572252*i))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*qo,Math.sqrt(e*e+r*r),t):new ft(0/0,0/0,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 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,a,i,o=0,s=0,l=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(Et(a[0]),Et(a[1]),Et(a[2]))}return(i=ns.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function kt(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new ut(n,a,l)}function Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/Ko),a=vt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*a-16,500*(n-a),200*(a-vt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 a(){var t,e=l.status;if(!e&&Rt(l)||e>=200&&e<300||304===e){try{t=r.call(i,l)}catch(t){return void o.error.call(i,t)}o.load.call(i,t)}else o.error.call(i,l)}var i={},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=a:l.onreadystatechange=function(){l.readyState>3&&a()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(i,l)}finally{uo.event=e}},i.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",i)},i.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",i):e},i.responseType=function(t){return arguments.length?(u=t,i):u},i.response=function(t){return r=t,i},["get","post"].forEach(function(t){i[t]=function(){return i.send.apply(i,[t].concat(fo(arguments)))}}),i.send=function(r,n,a){if(2===arguments.length&&"function"==typeof n&&(a=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!=a&&i.on("error",a).on("load",function(t){a(null,t)}),o.beforesend.call(i,l),l.send(null==n?null:n),i},i.abort=function(){return l.abort(),i},uo.rebind(i,o,"on"),null==n?i:i.get(Ot(n))}function Ot(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 It(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var a=r+e,i={c:t,t:a,n:null};return is?is.n=i:as=i,is=i,os||(ss=clearTimeout(ss),os=1,ls(Dt)),i}function Dt(){var t=Pt(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Dt,e)),os=0):(os=1,ls(Dt))}function Pt(){for(var t=Date.now(),e=as;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=as,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,a=t.currency,i=n&&r?function(t,e){for(var a=t.length,i=[],o=0,s=n[0],l=0;a>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(a-=s,a+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return i.reverse().join(r)}:x;return function(t){var r=cs.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="",m="",v=!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,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,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=a[0],m=a[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=fs.get(d)||jt;var b=u&&f;return function(t){var r=m;if(v&&t%1)return"";var a=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+m}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=i(x,1/0));var k=g.length+x.length+_.length+(b?0:a.length),M=k"===o?M+a+t:"^"===o?M.substring(0,k>>=1)+a+t+M.substring(k):a+(b?t:M+t))+r}}}function jt(t){return t+""}function Ht(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ut(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=u)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=S[o in gs?e.charAt(s++):o])||(n=i(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=A.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function i(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,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ht;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ht;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(m),A=Yt(m),k=Xt(v),M=Yt(v),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(hs.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:a,b:i,B:o,c:s,d:re,e:re,H:ae,I:ae,j:ne,L:se,m:ee,M:ie,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?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3)}function ee(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ie(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ms.lastIndex=0;var n=ms.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,a=xo(e)%60;return r+Gt(n,"0",2)+Gt(a,"0",2)}function ue(t,e,r){vs.lastIndex=0;var n=vs.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=i*u,f=a*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),n=t,a=l,i=u}var e,r,n,a,i;ks.point=function(o,s){ks.point=t,n=(e=o)*Vo,a=Math.cos(s=(r=s)*Vo/2+No/4),i=Math.sin(s)},ks.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 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)a.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,a);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);a.lineEnd()}}}function Ie(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n0){for(_||(i.polygonStart(),_=!0),i.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,m=e(i),v=a.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=Ue(v,p);d.length?(_||(i.polygonStart(),_=!0),Re(d,Be,t,r,i)):t&&(_||(i.polygonStart(),_=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),d=p=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}},b=Fe(),x=e(b),_=!1;return y}}function ze(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:A,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function Be(t,e){return((t=t.x)[0]<0?t[1]-Uo-Fo:Uo-t[1])-((e=e.x)[0]<0?e[1]-Uo-Fo:Uo-e[1])}function Ne(t){var e,r=0/0,n=0/0,a=0/0;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?No:-No,l=xo(i-r);xo(l-No)0?Uo:-Uo),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=No&&(xo(r-a)Fo?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}function He(t,e,r,n){var a;if(null==t)a=r*Uo,n.point(-No,a),n.point(0,a),n.point(No,a),n.point(No,0),n.point(No,-a),n.point(0,-a),n.point(-No,-a),n.point(-No,0),n.point(-No,a);else if(xo(t[0]-e[0])>Fo){var i=t[0]=0?1:-1,A=w*_,k=A>No,M=p*b;if(As.add(Math.atan2(M*w*Math.sin(A),g*x+M*Math.cos(A))),i+=k?_+w*jo:_,k^h>=r^v>=r){var T=be(ve(f),ve(t));we(T);var E=be(a,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(!m++)break;h=v,p=b,g=x,f=t}}return(i<-Fo||ii}function r(t){var r,i,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),m=o?g?0:a(f,h):g?a(f+(f<0?No:-No),h):0;if(!r&&(u=l=g)&&t.lineStart(),g!==l&&(d=n(r,p),(ke(r,d)||ke(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&i||!(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&&ke(r,p)||t.point(p[0],p[1]),r=p,l=g,i=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),a=ve(e),o=[1,0,0],s=be(n,a),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=i*l/c,h=-i*u/c,d=be(o,s),p=_e(o,f);xe(p,_e(s,h));var g=d,m=ye(p,g),v=ye(g,g),y=m*m-v*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-m-b)/v);if(xe(x,p),x=Ae(x),!r)return x;var _,w=t[0],A=e[0],k=t[1],M=e[1];A0^x[1]<(xo(x[0]-w)No^(w<=x[0]&&x[0]<=A)){var S=_e(g,(-m+b)/v);return xe(S,p),[x,Ae(S)]}}}function a(e,r){var n=o?t:No-t,a=0;return e<-n?a|=1:e>n&&(a|=2),r<-n?a|=4:r>n&&(a|=8),a}var i=Math.cos(t),o=i>0,s=xo(i)>Fo;return Pe(e,r,mr(t,6*Vo),o?[0,-t]:[-No,t-No])}function qe(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(i=t-l,p||!(i>0)){if(i/=p,p<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=r-l,p||!(i<0)){if(i/=p,p<0){if(i>d)return;i>h&&(h=i)}else if(p>0){if(i0)){if(i/=g,g<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=n-u,g||!(i<0)){if(i/=g,g<0){if(i>d)return;i>h&&(h=i)}else if(g>0){if(i0&&(a.a={x:l+h*p,y:u+h*g}),d<1&&(a.b={x:l+d*p,y:u+d*g}),a}}}}}}function Ge(t,e,r,n){function a(n,a){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:a>0?3:2}function i(t,e){return o(t.x,e.x)}function o(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(s){function l(t){for(var e=0,r=m.length,n=t[1],a=0;an&&et(u,i,t)>0&&++e:i[1]<=n&&et(u,i,t)<0&&--e,u=i;return 0!==e}function u(i,s,l,u){var c=0,f=0;if(null==i||(c=a(i,l))!==(f=a(s,l))||o(i,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(a,i){return t<=a&&a<=r&&e<=i&&i<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,m&&m.push(v=[]),k=!0,A=!1,_=w=0/0}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(m&&v.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,m,v,y,b,x,_,w,A,k,M,T=s,E=Fe(),L=qe(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],m=[],M=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=M&&e,a=g.length;(r||a)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),a&&Re(g,i,e,u,s),s.polygonEnd()),g=m=v=null}};return S}}function Xe(t){var e=0,r=No/3,n=lr(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*No/180,r=t[1]*No/180):[e/No*180,r/No*180]},a}function Ye(t,e){function r(t,e){var r=Math.sqrt(i-2*a*Math.sin(e))/a;return[r*Math.sin(t*=a),o-r*Math.cos(t)]}var n=Math.sin(t),a=(n+Math.sin(e))/2,i=1+n*(2*a-n),o=Math.sqrt(i)/a;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/a,nt((i-(t*t+r*r)*a*a)/(2*a))]},r}function We(){function t(t,e){js+=a*t-n*e,n=t,a=e}var e,r,n,a;Gs.point=function(i,o){Gs.point=t,e=n=i,r=a=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tVs&&(Vs=t),eqs&&(qs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,i)}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 a(){o.push("Z")}var i=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return i=$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){Es+=t,Ls+=e,++Ss}function Je(){function t(t,n){var a=t-e,i=n-r,o=Math.sqrt(a*a+i*i);Cs+=o*(e+t)/2,Os+=o*(r+n)/2,Rs+=o,Ke(e=t,r=n)}var e,r;Ys.point=function(n,a){Ys.point=t,Ke(e=n,r=a)}}function tr(){Ys.point=Ke}function er(){function t(t,e){var r=t-n,i=e-a,o=Math.sqrt(r*r+i*i);Cs+=o*(n+t)/2,Os+=o*(a+e)/2,Rs+=o,o=a*t-n*e,Is+=o*(n+t),Ds+=o*(a+e),Ps+=3*o,Ke(n=t,a=e)}var e,r,n,a;Ys.point=function(i,o){Ys.point=t,Ke(e=n=i,r=a=o)},Ys.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 a(){s.point=e}function i(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:a,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=a,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=0/0,k.point=i,e.lineStart()}function i(r,n){var i=ve([r,n]),o=t(r,n);a(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=i[0],w=i[1],A=i[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){i(f=t,h=e),d=b,p=x,g=_,m=w,v=A,k.point=i}function c(){a(b,x,y,_,w,A,d,p,f,g,m,v,s,e),k.lineEnd=o,o()}var f,h,d,p,g,m,v,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 a(e,r,n,s,l,u,c,f,h,d,p,g,m,v){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*i&&m--){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)i||xo((y*C+b*O)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(i)},e}function ar(t){var e=nr(function(e,r){return t([e*qo,r*qo])});return function(t){return ur(e(t))}}function ir(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[0]*qo,t[1]*qo]}function n(){s=Ce(o=hr(v,y,b),i);var t=i(g,m);return l=d-t[0]*h,u=p+t[1]*h,a()}function a(){return c&&(c.valid=!1,c=null),e}var i,o,s,l,u,c,f=nr(function(t,e){return t=i(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,m=0,v=0,y=0,b=0,_=Fs,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,Fs):Ve((A=+t)*Vo),a()):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,a()):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,m=t[1]%360*Vo,n()):[g*qo,m*qo]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vo,y=t[1]%360*Vo,b=t.length>2?t[2]%360*Vo:0,n()):[v*qo,y*qo,b*qo]},uo.rebind(e,f,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.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>No?t-jo:t<-No?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>No?e-jo:e<-No?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*a;return[Math.atan2(l*i-c*o,s*n-u*a),nt(c*i+l*o)]}var n=Math.cos(t),a=Math.sin(t),i=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*i-l*o;return[Math.atan2(l*i+u*o,s*n+c*a),nt(c*n-s*a)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=vr(r,a),i=vr(r,i),(o>0?ai)&&(a+=o*jo)):(a=t+o*jo,i=t-.5*l);for(var u,c=a;o>0?c>i:c0?e<-Uo+Fo&&(e=-Uo+Fo):e>Uo-Fo&&(e=Uo-Fo);var r=o/Math.pow(a(e),i);return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),a=function(t){return Math.tan(No/4+t/2)},i=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(a(e)/a(t)),o=n*Math.pow(a(t),i)/i;return i?(r.invert=function(t,e){var r=o-e,n=tt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(o/n,1/i))-Uo]},r):Er}function Tr(t,e){function r(t,e){var r=i-e;return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}var n=Math.cos(t),a=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),i=n/a+t;return xo(a)1&&et(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function Ir(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 Pr(t,e,r,n){var a=t[0],i=r[0],o=e[0]-a,s=n[0]-i,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(a-i))/(f*o-s*c);return[a+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 Fr(){an(this),this.edge=this.site=this.circle=null}function Br(t){var e=sl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),al.remove(t),sl.push(t),an(t)}function jr(t){var e=t.circle,r=e.x,n=e.cy,a={x:r,y:n},i=t.P,o=t.N,s=[t];Nr(t);for(var l=i;l.circle&&xo(r-l.circle.x)Fo)s=s.L;else{if(!((a=i-Vr(s,o))>Fo)){n>-Fo?(e=s.P,r=s):a>-Fo?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Br(t);if(al.insert(e,l),e||r){if(e===r)return Zr(e),r=Br(e.site),al.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,m=p.y-f,v=2*(h*m-d*g),y=h*h+d*d,b=g*g+m*m,x={x:(m*y-d*b)/v+c,y:(h*b-g*y)/v+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 Ur(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-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/i-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n:(n+s)/2}function Vr(t,e){var r=t.N;if(r)return Ur(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,a,i,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=nl,m=g.length;m--;)if((i=g[m])&&i.prepare())for(s=i.edges,l=s.length,o=0;oFo||xo(a-r)>Fo)&&(s.splice(o,0,new rn(tn(i.site,c,xo(n-f)Fo?{x:f,y:xo(e-f)Fo?{x:xo(r-p)Fo?{x:h,y:xo(e-h)Fo?{x:xo(r-d)=-Bo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,m=(l*p-c*d)/h,f=m+s,v=ll.pop()||new Yr;v.arc=t,v.site=a,v.x=g+o,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,b=ol._;b;)if(v.y=s)return;if(h>p){if(i){if(i.y>=u)return}else i={x:m,y:l};r={x:m,y:u}}else{if(i){if(i.y1)if(h>p){if(i){if(i.y>=u)return}else i={x:(l-a)/n,y:l};r={x:(u-a)/n,y:u}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xi||f>o||h=x,A=r>=_,k=A<<1|w,M=k+4;ki&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(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)})),i=fl.lastIndex;return i=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],a=[],i=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*Uo)}function On(t){return Math.pow(2,10*(t-1))}function Rn(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 Dn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Pn(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,a=t.l,i=e.h-r,o=e.c-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ht(r+i*t,n+o*t,a+s*t)+""}}function Fn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,a=t.l,i=e.h-r,o=e.s-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ct(r+i*t,n+o*t,a+s*t)+""}}function Bn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,a=t.b,i=e.l-r,o=e.a-n,s=e.b-a;return function(t){return pt(r+i*t,n+o*t,a+s*t)+""}}function Nn(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=Un(e),a=Hn(e,r),i=Un(Vn(r,e,-a))||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 a=r.push(qn(r)+"scale(",null,",",null,")");n.push({i:a-4,x:bn(t[0],e[0])},{i:a-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,a=-1,i=n.length;++a=0;)r.push(a[n])}function la(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++oa&&(n=r,a=e);return n}function ba(t){return t.reduce(xa,0)}function xa(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,i=[];++r<=e;)i[r]=a*r+n;return i}function Aa(t){return[uo.min(t),uo.max(t)]}function ka(t,e){return t.value-e.value}function Ma(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 Ea(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 La(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,a,i,o,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;if(r.forEach(Sa),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(a=r[1],a.x=a.r,a.y=0,e(a),u>2))for(i=r[2],Ra(n,a,i),e(i),Ma(n,i),n._pack_prev=i,Ma(i,a),a=n._pack_next,o=3;o=0;)e=a[i],e.z+=r,e.m+=r,r+=e.s+(n+=e.c)}function Ba(t,e,r){return t.a.parent===e.parent?t.a:r}function Na(t){return 1+uo.max(t,function(t){return t.y})}function ja(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ha(t){var e=t.children;return e&&e.length?Ha(e[0]):t}function Ua(t){var e,r=t.children;return r&&(e=r.length)?Ua(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function qa(t,e){var r=t.x+e[3],n=t.y+e[0],a=t.dx-e[1]-e[3],i=t.dy-e[0]-e[2];return a<0&&(r+=a/2,a=0),i<0&&(n+=i/2,i=0),{x:r,y:n,dx:a,dy:i}}function Ga(t){var e=t[0],r=t[t.length-1];return e2?Qa:Ya,l=n?$n:Qn;return o=a(t,e,l,r),s=a(e,t,l,_n),i}function i(t){return o(t)}var o,s;return i.invert=function(t){return s(t)},i.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},i.range=function(t){return arguments.length?(e=t,a()):e},i.rangeRound=function(t){return i.range(t).interpolate(Nn)},i.clamp=function(t){return arguments.length?(n=t,a()):n},i.interpolate=function(t){return arguments.length?(r=t,a()):r},i.ticks=function(e){return ei(t,e)},i.tickFormat=function(e,r){return ri(t,e,r)},i.nice=function(e){return Ja(t,e),a()},i.copy=function(){return $a(t,e,r,n)},a()}function Ka(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ja(t,e){return Wa(t,Za(ti(t,e)[2])),Wa(t,Za(ti(t,e)[2])),t}function ti(t,e){null==e&&(e=10);var r=Ga(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),i=e/n*a;return i<=.15?a*=10:i<=.35?a*=5:i<=.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 ei(t,e){return uo.range.apply(uo,ti(t,e))}function ri(t,e,r){var n=ti(t,e);if(r){var a=cs.exec(r);if(a.shift(),"s"===a[8]){var i=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return a[7]||(a[7]="."+ni(i.scale(n[2]))),a[8]="f",r=uo.format(a.join("")),function(t){return r(i.scale(t))+i.symbol}}a[7]||(a[7]="."+ai(a[8],n)),r=a.join("")}else r=",."+ni(n[2])+"f";return uo.format(r)}function ni(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ai(t,e){var r=ni(e[2]);return t in Al?Math.abs(r-ni(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function ii(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 i(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(a(e))}return o.invert=function(e){return i(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(a)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(a)),o):e},o.nice=function(){var e=Wa(n.map(a),r?Math:Ml);return t.domain(e),n=e.map(i),o},o.ticks=function(){var t=Ga(n),o=[],s=t[0],l=t[1],u=Math.floor(a(s)),c=Math.ceil(a(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(i(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 kl;arguments.length<2?r=kl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/i(Math.round(a(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xi(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,m=h-c,v=d-f,y=m*m+v*v,b=r-n,x=c*d-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-m*_)/y,A=(-x*m-v*_)/y,k=(x*v+m*_)/y,M=(-x*m+v*_)/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 _i(t){function e(e){function o(){u.push("M",i(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 Ai(t){return t.join("L")+"Z"}function ki(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 Mi(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;u9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));for(s=-1;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}function Hi(t){return t.length<3?wi(t):t[0]+Ci(t,ji(t))}function Ui(t){for(var e,r,n,a=-1,i=t.length;++a0;)d[--s].call(t,o);if(i>=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=a.time,u=It(i,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=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 ao(t){return t.toISOString()}function io(t,e,r){function n(e){return t(e)}function a(t,r){var n=t[1]-t[0],a=n/r,i=uo.bisect(Ql,a);return i==Ql.length?[e.year,ti(t.map(function(t){return t/31536e6}),r)[2]]:i?e[a/Ql[i-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=Ga(n.domain()),i=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return i&&(t=i[0],e=i[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return io(t.copy(),e,r)},Ka(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,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=a,uo.descending=function(t,e){return et?1:e>=t?0:0/0},uo.min=function(t,e){var r,n,a=-1,i=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},uo.max=function(t,e){var r,n,a=-1,i=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},uo.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(a);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return a(t(e),r)}:t)},uo.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=0;)for(n=t[a],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,a=[],i=u(xo(r)),o=-1;if(t*=i,e*=i,r*=i,r<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=i.length)return n?n.call(a,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=i[s++],m=new f;++d=i.length)return t;var n=[],a=o[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={},i=[],o=[];return a.map=function(e,r){return t(r,e,0)},a.entries=function(r){return e(t(uo.map,r,0),0)},a.key=function(t){return i.push(t),a},a.sortKeys=function(t){return o[i.length-1]=t,a},a.sortValues=function(t){return r=t,a},a.rollup=function(t){return n=t,a},a},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,a,i=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Oo.hasOwnProperty(r)?{space:Oo[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=P(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=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"}),m=null)}function f(){function t(){s=1,i(uo.mouse(a),h),u(o)}function r(){f.on(R,null).on(I,null),d(s),c(o)}var a=this,o=P.of(a,arguments),s=0,f=uo.select(n(a)).on(R,t).on(I,r),h=e(uo.mouse(a)),d=$(a);jl.call(a),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.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(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,a=0,i=r.length;a1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);jl.call(p);for(var s=0,l=o.length;s=u)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fs=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))))}}),hs=uo.time={},ds=Date;Ht.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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Ut(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Ut(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Ut(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},ms=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:qt(t)}};var ys=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=ys.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&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,a=r.length;++nd&&(d=e)}function e(e,r){var n=ve([e*Vo,r*Vo]);if(v){var a=be(v,n),i=[a[1],-a[0],0],o=be(i,a);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*qo*u,m=xo(l)>180;if(m^(u*pd&&(d=y)}else if(g=(g+360)%360-180,m^(u*pd&&(d=r);m?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);v=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,v=null}function a(t,r){if(v){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,m=r;ks.point(t,r),e(t,r)}function i(){ks.lineStart()}function o(){a(g,m),ks.lineEnd(),xo(y)>Fo&&(c=-(h=180)),x[0]=c,x[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]:tFo?d=90:y<-Fo&&(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,a=b[0],i=[a];ns(a[0],a[1])&&(a[1]=r[1]),s(r[0],a[1])>s(a[0],a[1])&&(a[0]=r[0])):i.push(a=r);for(var o,r,p=-1/0,e=i.length-1,n=0,a=i[e];n<=e;a=r,++n)r=i[n],(o=s(a[1],r[0]))>p&&(p=o,c=r[0],h=a[1])}return b=x=null,1/0===c||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){Ms=Ts=Es=Ls=Ss=Cs=Os=Rs=Is=Ds=Ps=0,uo.geo.stream(t,zs);var e=Is,r=Ds,n=Ps,a=e*e+r*r+n*n;return a=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},t.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.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?(i.precision(e),o.precision(e),s.precision(e),t):i.precision()},t.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),s.scale(e),t.translate(i.translate())):i.scale()},t.translate=function(e){if(!arguments.length)return i.translate();var u=i.scale(),c=+e[0],f=+e[1];return r=i.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+Fo,f+.12*u+Fo],[c-.214*u-Fo,f+.234*u-Fo]]).stream(l).point,a=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Fo,f+.166*u+Fo],[c-.115*u-Fo,f+.234*u-Fo]]).stream(l).point,t},t.scale(1070)};var Ns,js,Hs,Us,Vs,qs,Gs={point:A,lineStart:A,lineEnd:A,polygonStart:function(){js=0,Gs.lineStart=We},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=A,Ns+=xo(js/2)}},Xs={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Ys={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ys.lineStart=er},polygonEnd:function(){Ys.point=Ke,Ys.lineStart=Je,Ys.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&i.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=a(i)),uo.geo.stream(t,o)),i.result()}function e(){return o=null,t}var r,n,a,i,o,s=4.5;return t.area=function(t){return Ns=0,uo.geo.stream(t,a(Gs)),Ns},t.centroid=function(t){return Es=Ls=Ss=Cs=Os=Rs=Is=Ds=Ps=0,uo.geo.stream(t,a(Ys)),Ps?[Is/Ps,Ds/Ps]:Rs?[Cs/Rs,Os/Rs]:Ss?[Es/Ss,Ls/Ss]:[0/0,0/0]},t.bounds=function(t){return Vs=qs=-(Hs=Us=1/0),uo.geo.stream(t,a(Xs)),[[Hs,Us],[Vs,qs]]},t.projection=function(t){return arguments.length?(a=(r=t)?t.stream||ar(t):x,e()):r},t.context=function(t){return arguments.length?(i=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&i.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(i.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ir(e);for(var n in t)r[n]=t[n];return r}}},ir.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,a=[];return r(null,null,1,{point:function(t,r){a.push(t=e(t,r)),t[0]*=qo,t[1]*=qo}}),{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)*Vo,a*Vo),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Vo,(a=+n)*Vo),t):a},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,a=t[1]*Vo,i=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),u=Math.cos(a),c=Math.sin(i),f=Math.cos(i);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(i/m)*m,a,m).map(h).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 xo(t%m)>Fo}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%v)>Fo}).map(f))}var r,n,a,i,o,s,l,u,c,f,h,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:[h(i).concat(d(l).slice(1),h(a).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?(i=+e[0][0],a=+e[1][0],u=+e[0][1],l=+e[1][1],i>a&&(e=i,i=a,a=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[i,u],[a,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),f=br(n,r,y),h=yr(u,l,90),d=br(i,a,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||a.apply(this,arguments)]}}var e,r,n=xr,a=_r;return t.distance=function(){return uo.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},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 Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Qs=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Uo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var Js=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Uo]},(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,a=Lt(r),i=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<=i&&u.y>=a&&u.y<=o?[[n,o],[i,o],[i,a],[n,a]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(i(t,e)/Fo)*Fo,y:Math.round(o(t,e)/Fo)*Fo,i:e}})}var n=Cr,a=Or,i=n,o=a,s=ul;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 a,i=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===i?u.r:u.l;++s=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?a=u:s=u,h?o=c:l=c,i(t,e,r,n,a,o,s,l)}var c,f,h,d,p,g,m,v,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,m=r,v=n,y=a;else if(v=y=-(g=m=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=_),w>y&&(y=w),f.push(_),h.push(w)}var A=v-g,k=y-m;A>k?y=m+A:v=g+k;var M=pn();if(M.add=function(t){i(M,t,+b(t,++d),+x(t,d),g,m,v,y)},M.visit=function(t){gn(t,M,g,m,v,y)},M.find=function(t){return mn(M,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=dl.get(r)||hl,n=pl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Fn,uo.interpolateLab=Bn,uo.interpolateRound=Nn,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:gl)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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?a=t:(r.c=null,r.t=0/0,r=null,u.end({type:"end",alpha:a=0})):t>0&&(u.start({type:"start",alpha:a=t}),r=It(l.tick)),l):a},l.start=function(){function t(t,n){if(!r){for(r=new Array(a),l=0;l=0;)o.push(c=u[l]),c.parent=i,c.depth=i.depth+1;n&&(i.value=0),i.children=u}else n&&(i.value=+n.call(t,i,i.depth)||0),delete i.children;return la(a,function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)}),s}var e=fa,r=ua,n=ca;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&&(sa(e,function(t){t.children&&(t.value=0)}),la(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,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.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(i=-1;++i=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[i]));return l}var e=!0,r=Number,n=Aa,a=_a;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?(a="number"==typeof e?function(t){return wa(t,e)}:Lt(e),t):a},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],u=a[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,la(s,function(t){t.r=+c(t.value)}),la(s,La),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;la(s,function(t){t.r+=f}),la(s,La),la(s,function(t){t.r-=f})}return Oa(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(ka),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},oa(t,r)},uo.layout.tree=function(){function t(t,a){var c=o.call(this,t,a),f=c[0],h=e(f);if(la(h,r),h.parent.m=-h.z,sa(h,n),u)sa(f,i);else{var d=f,p=f,g=f;sa(f,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);sa(f,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 a,i=e.children,o=0,s=i.length;o0&&(za(Ba(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=a.m,h+=l.m,c+=i.m;o&&!Pa(i)&&(i.t=o,i.m+=f-c),a&&!Da(l)&&(l.t=a,l.m+=u-h,r=t)}return r}function i(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ia,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)?i:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:i,t):u?l:null},oa(t,o)},uo.layout.cluster=function(){function t(t,i){var o,s=e.call(this,t,i),l=s[0],u=0;la(l,function(t){var e=t.children;e&&e.length?(t.x=ja(e),t.y=Na(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ha(l),f=Ua(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return la(l,a?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=Ia,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},oa(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,a=-1,i=t.length;++a0;)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,a(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(a(c,g,u,!0),c.length=c.area=0),i.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var i,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;i=s.pop();)l.push(i),l.area+=i.area,null!=i.z&&(a(l,i.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,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return n*=n,e*=e,n?Math.max(e*a*p/n,n/(e*i*p)):1/0}function a(t,e,r,n){var a,i=-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);++ir.dx)&&(c=r.dx);++i1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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=Ho)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=i===Cl?Math.sqrt(t*t+u*u):+i.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),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)<=No?0:1;if(E&&bi(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 O=Math.abs(c-f+2*T)<=No?0:1;if(T&&bi(w,A,k,M)===1-d^O){var R=(c+f)/2;w=t*Math.cos(R),A=t*Math.sin(R),k=M=null}}else w=A=0 -;if(h>Fo&&(p=Math.min(Math.abs(u-t)/2,+a.apply(this,arguments)))>.001){g=tNo)+",1 "+e}function a(t,e,r,n){return"Q 0,0 "+n}var i=xr,o=_r,s=qi,l=mi,u=vi;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(i=Lt(e),t):i},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,a){var i=e.call(this,t,a),o=r.call(this,t,a),s=(i.y+o.y)/2,l=[i,{x:i.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=Gi;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=Gi,r=t.projection;return t.projection=function(t){return arguments.length?r(Xi(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Pl.get(e.call(this,t,n))||Zi)(r.call(this,t,n))}var e=Wi,r=Yi;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 Pl=uo.map({circle:Zi,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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Pl.keys();var zl=Math.sqrt(3),Fl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=Bl||++Ul,a=to(t),i=[],o=Nl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==uo.event.keyCode&&(S||(b=null,O[0]-=f[1],O[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=h[1],S=0,T())}function m(){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]),O[0]=f[+(t[0]>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:38}],62:[function(t,e,r){"use strict";function n(t,e,r){var a=0|t[r];if(a<=0)return[];var i,o=new Array(a);if(r===t.length-1)for(i=0;i0)return a(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=i},{}],63:[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(!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,i,s;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=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(o(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;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){return 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)}},{}],66:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],67:[function(t,e,r){"use strict";function n(t){t=t||{} -;var e,r,n=t.canvas||document.createElement("canvas"),i=t.family||"monospace",o=t.shape||[512,512],s=t.step||[32,32],l=t.size||16,u=t.chars||[32,126],c=Math.floor((s[0]-l)/2),f=t.radius||1.5*c,h=new a(l,c,f,0,i),d=t.align||!0;if("number"==typeof l&&(l+="px"),Array.isArray(u)){if(2===u.length&&"number"==typeof u[0]&&"number"==typeof u[1]){var p=[];for(e=u[0],r=0;e<=u[1];e++)p[r++]=String.fromCharCode(e);u=p}}else u=String(u).split("");o=o.slice(),n.width=o[0],n.height=o[1];var g=n.getContext("2d");g.fillStyle="#000",g.fillRect(0,0,n.width,n.height),g.font=l+" "+i,g.textBaseline="middle";var m=0,v=0,y=Math.min(u.length,Math.floor(o[0]/s[0])*Math.ceil(o[1]/s[1])),b=h.ctx.textAlign,x=h.buffer;for(h.ctx.textAlign="center",h.buffer=h.size/2,e=0;e0){s=r;break}if(s)break}for(r=o;r--;){for(n=r*i*4,e=0;e0){l=r;break}if(l)break}return s-.5*(s+(o-l))}(_)),g.putImageData(_,m,v-w),m+=s[0],m>o[0]-s[0]&&(m=0,v+=s[1])}return h.ctx.textAlign=b,h.buffer=x,n}var a=t("tiny-sdf");e.exports=n},{"tiny-sdf":193}],68:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=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,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=c(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return c(t,e,r,n,a.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=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=a(n),s=n.right=a(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=a(n),s=n.left=a(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=i(m,n));r.right=i(m,n);continue}if(n=a(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=a(n),s=n.right=a(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=i(m,n));r.left=i(m,n);continue}if(n=a(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,a=this.root,l=[],u=[];a;){var c=r(t,a.key);l.push(a),u.push(c),a=c<=0?a.left:a.right}l.push(new n(m,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var a=l[f];u[f]<=0?l[f]=new n(a._color,a.key,a.value,l[f+1],a.right,a._count+1):l[f]=new n(a._color,a.key,a.value,a.left,l[f+1],a._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],a=l[f];if(h._color===v||a._color===v)break;var d=l[f-2];if(d.left===h)if(h.left===a){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=h.right,h._color=v,h.right=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else{var p=d.right;if(!p||p._color!==m){if(h.right=a.left,d._color=m,d.left=a.right,a._color=v,a.left=h,a.right=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.left===d?g.left=a:g.right=a}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else if(h.right===a){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=h.left,h._color=v,h.left=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=v,d.left=i(v,p),d._color=m,f-=1}else{var p=d.left;if(!p||p._color!==m){if(h.left=a.right,d._color=m,d.right=a.left,a._color=v,a.right=h,a.left=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.right===d?g.right=a:g.left=a}break}h._color=v,d.left=i(v,p),d._color=m,f-=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 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=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new f(this,n);r=a<=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 a=t.length-2;a>=0;--a){var r=t[a];r.left===t[a+1]?e[a]=new n(r._color,r.key,r.value,e[a+1],r.right,r._count):e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var i=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[i-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[i-1].key=r.key,e[i-1].value=r.value;for(var a=e.length-2;a>=i;--a)r=e[a],e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count);e[i-1].left=e[i]}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 a=0;a0)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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)a=e[i],a.left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._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}})},{}],69:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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],i=1;i<9;i++)r+=a[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],70:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,i,a),r}function i(t,e){for(var r=l.malloc(t.length,e),n=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,a){if(r=r||t.ARRAY_BUFFER,a=a||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(a!==t.DYNAMIC_DRAW&&a!==t.STATIC_DRAW&&a!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=t.createBuffer(),o=new n(t,r,i,0,a);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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=a(this.gl,this.type,this.length,this.usage,t.data,e):this.length=a(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?a(this.gl,this.type,this.length,this.usage,n,e):a(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?i(t,"uint16"):i(t,"float32"),this.length=e<0?a(this.gl,this.type,this.length,this.usage,h,e):a(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=a(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:158,"ndarray-ops":157,"typedarray-pool":199}],72:[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"}},{}],73:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":72}],74:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=a,this.idBuffer=i,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 a(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 i(t,e){var r=t.gl,a=s(r,p.vertex,p.fragment),i=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,a,i,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=i;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,m=[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,a=this.plot,i=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=a.gl,f=a.viewBox,h=a.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],m=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/m,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/m-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=i.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){i.bind();var v=this.lineWidth*a.pixelRatio;r=i.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=v,r.pointSize=1e3,n=i.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=v,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 a=n-r;return Math.abs(a)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/a))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),i=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,v=g[0]=n[0],y=g[1]=i[0],b=g[2]=n[n.length-1],x=g[3]=i[i.length-1];v===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-v),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 O=c(A,C),R=255*p[4*S]|0,I=255*p[4*S+1]|0,D=255*p[4*S+2]|0,P=255*p[4*S+3]|0,z=O.cells,F=O.positions,B=Array(F.length),N=0;N1)){var V,q=U[0],G=U[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(U[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),m[b++]=h*(r-p+T),m[b++]=d*(n-g+E),m[b++]=o*M[2]+(l+o)*M[4],m[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);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 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 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(i),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))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!a)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(a.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,a)}var d=t("gl-texture2d");e.exports=h;var p,g,m,v,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*d&255;this.pickOffset=r,a.bind();var p=a.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/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]),a=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],m=f[3]=n[n.length-1],v=1/(g-d),y=1/(m-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(h.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),A=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),M=s.mallocUint32(_),T=0,E=0;E2&&!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,i),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,a/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 a=this.setProjectionModel(),i=this.plot,o=this.width,s=i.gl,l=i.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,a),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,a=this.numPoints;if(r=n+a)return null;var i=r-n,o=this.data;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},h.update=function(t){t=t||{};var e,r,n,i,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=a(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 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 M=--n;i=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(i)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,i=(i-m[0])/(m[2]-m[0]),o=(o-m[1])/(m[3]-m[1]),E=(E-m[0])/(m[2]-m[0]),L=(L-m[1])/(m[3]-m[1]);var S=E-i,C=L-o,O=M|1<<24,R=M-1,I=M,D=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=R,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=D,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=I,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=R,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=R}}for(e=0;es[k]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n],i.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n],i.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]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n+2],i.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],i.uniforms.dataAxis=r, -i.uniforms.screenOffset=e,i.uniforms.color=x[n+2],i.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,a=r.gl,i=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-i[c])/(i[2+c]-i[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,a=this.shader,i=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;a.bind();for(var u=0;u<2;++u){var c=i[u],f=i[u+2],h=f-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],b=s[u+2],x=b-y;e[u]=2*h/p*v/x,t[u]=2*(c-d)/p*v/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),a.uniforms.dataScale=e,a.uniforms.dataShift=t,a.uniforms.textScale=r,this.vbo.bind(),a.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,a,i,o=[],l=t.ticks,u=t.bounds;for(i=0;i<2;++i){var c=[Math.floor(o.length/3)],f=[-1/0],h=l[i];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);i(),d._relink=i,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=i},{"./lib/GLError":94,"./lib/create-attributes":95,"./lib/create-uniforms":96,"./lib/reflect":97,"./lib/runtime-reflect":98,"./lib/shader-cache":99}],94:[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},{}],95:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}function a(t,e,r,a,i,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);a(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);i(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 a=this,i=a._gl,o=a._locations[a._index];i.vertexAttribPointer(o,a._dimension,t||i.FLOAT,!!e,r||0,n||0),i.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":94}],96:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function a(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"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new 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 a=e[n],i=t;parseInt(n)+""===n?i+="["+n+"]":i+="."+n,"object"==typeof a?r.push.apply(r,c(i,a)):r.push([i,a])}return r}function f(e){for(var n=["return function updateProperty(obj){"],a=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?a(r,!1):a(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 a(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,a){if("object"==typeof a){var o=p(a);Object.defineProperty(t,e,{get:n(o),set:f(a),enumerable:!0,configurable:!1})}else i[a]?Object.defineProperty(t,e,{get:l(a),set:f(a),enumerable:!0,configurable:!1}):t[e]=h(r[a].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]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function i(t,e){var r=t.gl,a=s(r),i=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,a,i,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=i;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,a=t.positions instanceof Float32Array,i=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=a?o:l.mallocFloat32(o.length),u=i?t.idToIndex:l.mallocInt32(n);if(a||s.set(o),!i)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),i.attributes.pickId.pointer(o.UNSIGNED_BYTE),i.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,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":101,"gl-buffer":71,"gl-shader":102,"typedarray-pool":199}],110:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n", -pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],111:[function(t,e,r){arguments[4][45][0].apply(r,arguments)},{dup:45}],112:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"./lib/GLError":113,"./lib/create-attributes":114,"./lib/create-uniforms":115,"./lib/reflect":116,"./lib/runtime-reflect":117,"./lib/shader-cache":118,dup:93}],113:[function(t,e,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],114:[function(t,e,r){arguments[4][95][0].apply(r,arguments)},{"./GLError":113,dup:95}],115:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{"./GLError":113,"./reflect":116,dup:96}],116:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{dup:97}],117:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{dup:98}],118:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{"./GLError":113,dup:99,"gl-format-compiler-error":80,"weakmap-shim":206}],119:[function(t,e,r){"use strict";function n(t,e,r,n,i){i<=4*h?a(0,i-1,t,e,r,n):f(0,i-1,t,e,r,n)}function a(t,e,r,n,a,i){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=a[o],f=i[o],h=o;h>t;){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],a[h]=a[h-1],i[h]=i[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,a[h]=c,i[h]=f}}function i(t,e,r,n,a,i){var o=r[t],s=n[2*t],l=n[2*t+1],u=a[t],c=i[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,a[e]=u,i[e]=c}function o(t,e,r,n,a,i){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e]}function s(t,e,r,n,a,i,o){var s=n[t],l=a[2*t],u=a[2*t+1],c=i[t],f=o[t];n[t]=n[e],a[2*t]=a[2*e],a[2*t+1]=a[2*e+1],i[t]=i[e],o[t]=o[e],n[e]=n[r],a[2*e]=a[2*r],a[2*e+1]=a[2*r+1],i[e]=i[r],o[e]=o[r],n[r]=s,a[2*r]=l,a[2*r+1]=u,i[r]=c,o[r]=f}function l(t,e,r,n,a,i,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]=a,u[e]=i,c[e]=o}function u(t,e,r,n,a){return(r[t]-r[e]||n[2*e]-n[2*t]||a[t]-a[e])<0}function c(t,e,r,n,a,i,o,s){return(e-i[t]||o[2*t]-r||a-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,b=y-g,x=y+g,_=m,w=b,A=y,k=x,M=v,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],O=n[2*w+1],R=d[w],I=p[w],D=r[k],P=n[2*k],z=n[2*k+1],F=d[k],B=p[k],N=_,j=A,H=M,U=m,V=y,q=v,G=r[N],X=r[j],Y=r[H];r[U]=G,r[V]=X,r[q]=Y;for(var W=0;W<2;++W){var Z=n[2*N+W],Q=n[2*j+W],$=n[2*H+W];n[2*U+W]=Z,n[2*V+W]=Q,n[2*q+W]=$}var K=d[N],J=d[j],tt=d[H];d[U]=K,d[V]=J,d[q]=tt;var et=p[N],rt=p[j],nt=p[H];p[U]=et,p[V]=rt,p[q]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var at=T;at<=E;++at)if(c(at,S,C,O,R,r,n,d))at!==T&&i(at,T,r,n,d,p),++T;else if(!c(at,D,P,z,F,r,n,d))for(;;){if(c(E,D,P,z,F,r,n,d)){c(E,S,C,O,R,r,n,d)?(s(at,T,E,r,n,d,p),++T,--E):(i(at,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(m,v,f,h,b,c+1),h=b}l(m,v,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)*v,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new a(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new a(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=i},{"./lib/sort":119,"typedarray-pool":199}],121:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=a,this.colorBuffer=i,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=f(this.plot.gl,this.charCanvas),this.charStep=400,this.snapThreshold=1e4,this.paletteTexture=f(this.plot.gl,[256,1])}function a(t,e){var r=t.gl,a=i(r,l.vertex,l.fragment),s=i(r,l.pickVertex,l.pickFragment),u=o(r),c=o(r),f=o(r),h=o(r),d=o(r),p=new n(t,a,s,u,c,f,h,d);return p.update(e),t.addObject(p),p}e.exports=a;var i=t("gl-shader"),o=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders"),u=t("snap-points-2d"),c=t("font-atlas-sdf"),f=t("gl-texture2d"),h=t("color-id"),d=t("ndarray"),p=t("clamp"),g=t("binary-search-bounds"),m=n.prototype;!function(){function t(){var t=this.plot,u=t.viewBox,c=t.dataBox,f=t.pixelRatio,h=c[2]-c[0],d=c[3]-c[1],p=2/h,g=2/d,m=-c[0]-.5*h,v=-c[1]-.5*d;a[0]=p,i[0]=p-a[0],a[1]=g,i[1]=g-a[1],o[0]=m,s[0]=m-o[0],o[1]=v,s[1]=v-o[1];var y=u[2]-u[0],b=u[3]-u[1];e=Math.min(h/y,d/b),l[0]=2*f/y,l[1]=2*f/b,r=c[0],n=c[2]}var e,r,n,a=new Float32Array([0,0]),i=new Float32Array([0,0]),o=new Float32Array([0,0]),s=new Float32Array([0,0]),l=[0,0],u=[0,0,0,0];m.drawPick=function(l){var c=void 0!==l,f=this.plot,h=this.pointCount,d=h>this.snapThreshold;if(!h)return l;t.call(this);var p=f.gl,m=c?this.pickShader:this.shader,v=p.isEnabled(p.BLEND);if(m.bind(),c){this.pickOffset=l;for(var y=0;y<4;++y)u[y]=l>>8*y&255;m.uniforms.pickOffset=u,this.idBuffer.bind(),m.attributes.id.pointer(p.UNSIGNED_BYTE,!1)}else p.blendFuncSeparate(p.SRC_ALPHA,p.ONE_MINUS_SRC_ALPHA,p.ONE,p.ONE_MINUS_SRC_ALPHA),p.blendColor(0,0,0,1),v||p.enable(p.BLEND),this.colorBuffer.bind(),m.attributes.color.pointer(p.UNSIGNED_BYTE,!1),this.charBuffer.bind(),m.attributes.char.pointer(p.UNSIGNED_BYTE,!1),m.uniforms.chars=this.charTexture.bind(0),m.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],m.uniforms.charsStep=this.charStep,m.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),m.attributes.size.pointer(p.FLOAT,!1,8,0),c||m.attributes.border.pointer(p.FLOAT,!1,8,4),this.positionBuffer.bind(),m.attributes.positionHi.pointer(p.FLOAT,!1,16,0),m.attributes.positionLo.pointer(p.FLOAT,!1,16,8),m.uniforms.pixelRatio=f.pixelRatio,m.uniforms.scaleHi=a,m.uniforms.scaleLo=i,m.uniforms.translateHi=o,m.uniforms.translateLo=s,m.uniforms.viewBox=f.viewBox;var b=this.scales;if(d)for(var x=b.length-1;x>=0;x--){var _=b[x];if(!(_.pixelSize&&_.pixelSize<1.25*e&&x>1)){var w=_.offset,A=_.count+w,k=g.ge(this.xCoords,r,w,A-1),M=g.lt(this.xCoords,n,k,A-1)+1;M>k&&p.drawArrays(p.POINTS,k,M-k)}}else p.drawArrays(p.POINTS,0,h);if(c)return l+h;v?p.blendFunc(p.ONE,p.ONE_MINUS_SRC_ALPHA):p.disable(p.BLEND)}}(),m.draw=m.drawPick,m.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},m.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],a=t.sizes||[],i=t.borderWidths||[],o=t.borderColors||[],l=this.plot.gl;this.points=e;var f=this.points.length/2,g=s.mallocInt32(f),m=s.mallocFloat32(2*f),v=s.mallocFloat64(2*f);v.set(this.points),this.pointCount=f;var y=f>this.snapThreshold;y&&(this.scales=u(v,g,m));for(var b=s.mallocFloat32(4*f),x=s.mallocFloat32(2*f),_=s.mallocUint8(2*f),w=s.mallocUint32(f),A=s.mallocUint8(2*f),k={},M=[],T=[],E=[],L=0,S=f,C=0;LP&&(P=a[L]);var z=this.charStep;this.charStep=p(Math.ceil(4*P),128,768);var F=Object.keys(I),B=this.charStep,N=Math.floor(B/2),j=l.getParameter(l.MAX_TEXTURE_SIZE),H=j/B*(j/B),U=Math.min(j,B*F.length),V=Math.min(j,B*Math.ceil(B*F.length/j)),q=Math.floor(U/B);F.length>H&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==F+""&&this.charStep==z||(this.charCanvas=c({canvas:this.charCanvas,family:"sans-serif",size:N,shape:[U,V],step:[B,B],chars:F,align:!0}),this.chars=F);for(var L=0;L>>1,n=u.mallocInt32(r),a=u.mallocFloat32(2*r),i=u.mallocFloat64(2*r);i.set(this.points),this.scales=l(i,n,a,this.bounds);var o=u.mallocFloat64(r),s=u.mallocFloat32(2*r),c=u.mallocFloat32(2*r);s.set(i);for(var f=0,h=0;f>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 R=this.xCoords,I=(x[0]-u[0]-E*c*y)/_,D=(x[2]-u[0]+E*c*y)/_,P=!0,z=a.length-1;z>=0;z--){var F=a[z];if(!(F.pixelSize1)){var B=F.offset,N=F.count+B,j=s.ge(R,I,B,N-1),H=s.lt(R,D,j,N-1)+1;H>j&&v.drawArrays(v.POINTS,j,H-j),!e&&P&&(P=!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":122,"binary-search-bounds":123,"gl-buffer":71,"gl-shader":130,"snap-points-2d":125,"typedarray-pool":199}],127:[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"},{}],128:[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 a(t,e){var r=t.gl,a=o(r,[0,0,0,1,1,0,1,1]),l=i(r,s.boxVertex,s.boxFragment),u=new n(t,a,l);return u.update(e),t.addOverlay(u),u}var i=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=a;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),a=(this.outerFill,this.outerColor),i=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 v=r*c;o.drawBox(f-v,h-v,d+v,h+v,i),o.drawBox(f-v,p-v,d+v,p+v,i),o.drawBox(f-v,h-v,f+v,p+v,i),o.drawBox(d-v,h-v,d+v,p+v,i)}}}},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":127,"gl-buffer":71,"gl-shader":130}],129:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function a(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 i(t,e){return new a(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}e.exports=i;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)),a=0;a=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);i(),d._relink=i,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=i},{"./lib/GLError":131,"./lib/create-attributes":132,"./lib/create-uniforms":133,"./lib/reflect":134,"./lib/runtime-reflect":135,"./lib/shader-cache":136}],131:[function(t,e,r){arguments[4][94][0].apply(r,arguments)},{dup:94}],132:[function(t,e,r){arguments[4][95][0].apply(r,arguments)},{"./GLError":131,dup:95}],133:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{"./GLError":131,"./reflect":134,dup:96}],134:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{dup:97}],135:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{dup:98}],136:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{"./GLError":131,dup:99,"gl-format-compiler-error":80,"weakmap-shim":206}],137:[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 a(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=a;var i=n.prototype;i.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()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,a=this.plot,i=a.line,o=a.dataBox,s=a.viewBox;if(i.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]&&i.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&i.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&i.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&i.drawLine(l,u,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],138:[function(t,e,r){"use strict";function n(t){v=[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 a(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 i(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,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,a,i,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");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}c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||a!==t.LUMINANCE&&a!==t.ALPHA||(h=a),h!==a)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var v=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),f===i&&d)0===l.offset&&l.data.length===v?y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data):y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data.subarray(l.offset,l.offset+v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data.subarray(l.offset,l.offset+v));else{var b;b=i===t.FLOAT?m.mallocFloat32(v):m.mallocUint8(v);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&i===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,b.subarray(0,v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,b.subarray(0,v)),i===t.FLOAT?m.freeFloat32(b):m.freeUint8(b)}}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,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new o(t,s,e,r,n,a)}function f(t,e,r,n,a,i){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new o(t,s,r,n,a,i)}function h(t,e){var r=e.dtype,n=e.shape.slice(),a=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>a||n[1]<0||n[1]>a)throw new Error("gl-texture2d: Invalid texture size");var i=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,i=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,i=!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,i=!1);var f,h,d=e.size;if(i)f=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];h=m.malloc(d,r);var y=p(h,n,v,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),i||m.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(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],r=a(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,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"),m=t("typedarray-pool");e.exports=d;var v=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&&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(),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 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}}}),_.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 i=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=a(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,o)}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(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:158,"ndarray-ops":157,"typedarray-pool":199}],139:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:a(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),G+=n.length,H=H.slice(n.length),H.length}}function O(){return/[^a-fA-F0-9]/.test(P)?(e(H.join("")),j=u,B):(H.push(P),z=P,B+1)}function R(){return"."===P?(H.push(P),j=m,z=P,B+1):/[eE]/.test(P)?(H.push(P),j=m,z=P,B+1):"x"===P&&1===H.length&&"0"===H[0]?(j=w,H.push(P),z=P,B+1):/[^\d]/.test(P)?(e(H.join("")),j=u,B):(H.push(P),z=P,B+1)}function I(){return"f"===P&&(H.push(P),z=P,B+=1),/[eE]/.test(P)?(H.push(P),z=P,B+1):"-"===P&&/[eE]/.test(z)?(H.push(P),z=P,B+1):/[^\d]/.test(P)?(e(H.join("")),j=u,B):(H.push(P),z=P,B+1)}function D(){if(/[^\d\w_]/.test(P)){var t=H.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:v,e(H.join("")),j=u,B}return H.push(P),z=P,B+1}var P,z,F,B=0,N=0,j=u,H=[],U=[],V=1,q=0,G=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=a;return"300 es"===t.version&&(Z=l,Q=s),function(t){return U=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var a=t("./lib/literals"),i=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,m=5,v=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":142,"./lib/builtins-300es":141,"./lib/literals":144,"./lib/literals-300es":143,"./lib/operators":145}],141:[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":142}],142:[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"]},{}],143:[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":144}],144:[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"]},{}],145:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],146:[function(t,e,r){function n(t,e){var r=a(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var a=t("./index");e.exports=n},{"./index":140}],147:[function(t,e,r){r.read=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,c=-7,f=r?a-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-c)-1,d>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===i)i=1-u;else{if(i===l)return o?0/0:1/0*(d?-1:1);o+=Math.pow(2,n),i-=u}return(d?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,h=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(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,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+d]=255&s,d+=p,s/=256,a-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],148:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function a(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 i(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),i(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),i(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function c(t,e){for(var r=0;r>1],i=[],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,h),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,i=this.left;i.right;)n=i,i=i.right;if(n===this)i.right=this.right;else{var o=this.left,r=this.right;n.count-=i.count,n.right=i.left,i.left=o,i.right=r}a(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?a(this,this.left):a(this,this.right);return b}for(var o=v.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":28}],149:[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+"+"+m(_)+"]");x.push(v(0));for(var _=0;_0){",h(x[t]),"=1;"),D(t-1,e|1<0&&G.push(s(H,x[U-1])+"*"+o(x[U-1])),N.push(d(H,x[U])+"=("+G.join("-")+")|0")}for(var H=0;H=0;--H)X.push(o(x[H]));N.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),N.push(p(0)+"=0");for(var U=1;U<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 i=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,a,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":199}],157:[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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=i({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]=i({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=i({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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=i({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=i({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=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=i({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":56}],158:[function(t,e,r){function n(t,e){return t[0]-e[0]}function a(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),i.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+"]"});i.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}");i.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),i.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+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",i.join("\n"));return o(f[t],a)}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 a=f.array[0];return a([])}"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,a.pack(n,r)}var a=t("double-bits"),i=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":61}],160:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":174}],161:[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}},{}],162:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--a)n=l[a],r=s[a],s[a]=s[n],s[n]=r,l[a]=l[r],l[r]=n,u=(u+r)*a;return i.freeUint32(l),i.freeUint32(s),u}function a(t,e,r){switch(t){case 0:return r||[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,a,i,o=1;for(r[0]=0,i=1;i0;--i)n=e/o|0,e=e-n*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}var i=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=a},{"invert-permutation":149,"typedarray-pool":199}],164:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,i){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return i?l:(o&&r(o,u),l)}for(var i=0|e.length,o=t.length,s=[new Array(i),new Array(i)],l=0;l0;){var d=(s[0][l].length,function(t,i){var o=s[i][t][0],l=[t];r(o,i);for(var u=o[1^i];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(a(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var a=t("compare-angle")},{"compare-angle":55}],165:[function(t,e,r){"use strict";function n(t,e){for(var r=a(t,e.length),n=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function i(t){for(var e=t.length,r=0;r0;){var H=N.pop(),U=R[H];f(U,function(t,e){return t-e});var V,q=U.length,G=j[H];if(0===G){var T=v[H];V=[T]}for(var m=0;m=0)&&(j[X]=1^G,N.push(X),0===G)){var T=v[X];i(T)||(T.reverse(),V.push(T))}}0===G&&d.push(V)}return d}e.exports=i;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":165,"edges-to-adjacency-list":63,"planar-dual":164,"point-in-big-polygon":167,"robust-sum":181,"two-product":197,uniq:201}],167:[function(t,e,r){function n(){return!0}function a(t){return function(e,r){var a=t[e];return!!a&&!!a.queryPoint(r,n)}}function i(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;a=t[n-1]}for(var i=1;a;){var o=a.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;i=-1,a=a.right}else if(s>0)a=a.left;else{if(!(s<0))return 0;i=1,a=a.right}}return i}}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=[],a=0;a1)for(var r=1;r=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")}function l(t,r,a){r.indexOf(t)<0&&e("invalid value"+n(a)+". must be one of: "+r)}function u(t){Object.keys(t).forEach(function(t){te.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+te)})}function c(t,e){for(t+="";t.length0&&e.push(new d("unknown",0,t))}}),e}function y(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}function b(t,e,n,a,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(e),s=a===t.FRAGMENT_SHADER?"fragment":"vertex";T(n,"string",s+" shader source must be a string",i);var l=m(n,i),u=v(o);y(l,u),Object.keys(l).forEach(function(t){function e(t,e){n.push(t),a.push(e||"")}var r=l[t];if(r.hasErrors){var n=[""],a=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var a=n.message,i=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(i){var o=i[1];switch(a=i[2],o){case"assign":o="="}r=Math.max(t.line.indexOf(o,r),0)}else r=0;e(c("| ",6)),e(c("^^^",r+3)+"\n","font-weight:bold"),e(c("| ",6)),e(a+"\n","font-weight:bold")}),e(c("| ",6)+"\n")}else e(c(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(a[0]=n.join("%c"),console.log.apply(console,a)):console.log(n.join(""))}}),r.raise("Error compiling "+s+" shader, "+l[0].name)}}function x(t,e,n,a,i){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=m(n,i),l=m(a,i),u='Error linking program with vertex shader, "'+l[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+o),r.raise(u)}}function _(t){t._commandRef=p()}function w(t,e,r,n){function a(t){return t?n.id(t):0}function i(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}_(t),t._fragId=a(t.static.frag),t._vertId=a(t.static.vert);var o=t._uniformSet={};i(o,e.static),i(o,e.dynamic);var s=t._attributeSet={};i(s,r.static),i(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function A(t,r){var n=g();e(t+" in command "+(r||p())+("unknown"===n?"":" called from "+n))}function k(t,e,r){t||A(e,r||p())}function M(t,e,r,a){t in e||A("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),a||p())}function T(t,e,r,a){typeof t!==e&&A("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,a||p())}function E(t){t()}function L(t,e,r){t.texture?l(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):l(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}function S(t,e){return t===ue||t===le||t===ce?2:t===fe?4:he[t]*e}function C(t){return!(t&t-1||!t)}function O(t,e,n){var a,i=e.width,o=e.height,s=e.channels;r(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ee&&t.wrapT===ee||r(C(i)&&C(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==i&&1!==o&&r(t.minFilter!==ne&&t.minFilter!==ie&&t.minFilter!==ae&&t.minFilter!==oe,"min filter requires mipmap"):(r(C(i)&&C(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),e.type===se&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===re&&t.magFilter===re,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(a=0;a<16;++a)if(l[a]){var u=i>>a,c=o>>a;r(e.mipmask&1<0&&i<=a.maxTextureSize&&o>0&&o<=a.maxTextureSize,"invalid texture shape"),r(i===o,"cube map must be square"),r(e.wrapS===ee&&e.wrapT===ee,"wrap mode not supported by cube map");for(var l=0;l>f,p=o>>f;r(u.mipmask&1<1&&e===r&&('"'===e||"'"===e))return['"'+D(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return P(t.substr(0,n.index)).concat(P(n[1])).concat(P(t.substr(n.index+n[0].length)));var a=t.split(".");if(1===a.length)return['"'+D(t)+'"'];for(var i=[],o=0;o0,"invalid pixel ratio"))):de.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!a){if(!n){de("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=H(r||document.body,f,u);if(!d)return null;n=d.canvas,h=d.onDestroy}a=U(n,o)}return a?{gl:a,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:u,profile:c,onDone:f,onDestroy:h}:(h(),f("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function W(t,e){function r(e){de.type(e,"string","extension name must be string");var r,a=e.toLowerCase();try{r=n[a]=t.getExtension(a)}catch(t){}return!!r}for(var n={},a=0;a65535)<<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)|t>>1}function J(t){var e=$(t),r=Le[K(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function tt(t){Le[K(t.byteLength)>>2].push(t)}function et(t,e){var r=null;switch(t){case _e:r=new Int8Array(J(e),0,e);break;case we:r=new Uint8Array(J(e),0,e);break;case Ae:r=new Int16Array(J(2*e),0,e);break;case ke:r=new Uint16Array(J(2*e),0,e);break;case Me:r=new Int32Array(J(4*e),0,e);break;case Te:r=new Uint32Array(J(4*e),0,e);break;case Ee:r=new Float32Array(J(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r}function rt(t){tt(t.buffer)}function nt(t,e,r){for(var n=0;n0){var l;if(Array.isArray(e[0])){s=De(e);for(var u=1,c=1;c0)if("number"==typeof t[0]){var a=Se.allocType(p.dtype,t.length);ct(a,t),f(a,n),Se.freeType(a)}else if(Array.isArray(t[0])||Kt(t[0])){r=De(t);var i=Ie(t,r,p.dtype);f(i,n),Se.freeType(i)}else de.raise("invalid buffer data")}else if(Kt(t))f(t,n);else if(Z(t)){r=t.shape;var o=t.stride,s=0,l=0,u=0,h=0;1===r.length?(s=r[0],l=1,u=o[0],h=0):2===r.length?(s=r[0],l=r[1],u=o[0],h=o[1]):de.raise("invalid shape");var d=Array.isArray(t.data)?p.dtype:ut(t.data),g=Se.allocType(d,s*l);ft(g,t.data,s,l,u,h,t.offset),f(g,n),Se.freeType(g)}else de.raise("invalid data for buffer subdata");return c}e.bufferCount++;var p=new n(i);return h[p.id]=p,o||c(a),c._reglType="buffer",c._buffer=p,c.subdata=d,r.profile&&(c.stats=p.stats),c.destroy=function(){l(p)},c}function c(){xe(h).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}var f=0,h={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){l(this)};var d=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:u,createStream:a,destroyStream:i,clear:function(){xe(h).forEach(l),d.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:c,_initBuffer:s}}function dt(t,e,r,n){function a(t){this.id=f++,c[this.id]=this,this.buffer=t,this.primType=Ve,this.vertCount=0,this.type=0}function i(t){var e=d.pop();return e||(e=new a(r.create(null,Qe,!0,!1)._buffer)),s(e,t,$e,-1,-1,0,0),e}function o(t){d.push(t)}function s(n,a,i,o,s,l,u){if(n.buffer.bind(),a){var c=u;u||Kt(a)&&(!Z(a)||Kt(a.data))||(c=e.oes_element_index_uint?Ze:Ye),r._initBuffer(n.buffer,a,i,c,3)}else t.bufferData(Qe,l,i),n.buffer.dtype=f||Ge,n.buffer.usage=i,n.buffer.dimension=3,n.buffer.byteLength=l;var f=u;if(!u){switch(n.buffer.dtype){case Ge:case qe:f=Ge;break;case Ye:case Xe:f=Ye;break;case Ze:case We:f=Ze;break;default:de.raise("unsupported type for element array")}n.buffer.dtype=f}n.type=f,de(f!==Ze||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var h=s;h<0&&(h=n.buffer.byteLength,f===Ye?h>>=1:f===Ze&&(h>>=2)),n.vertCount=h;var d=o;if(o<0){d=Ve;var p=n.buffer.dimension;1===p&&(d=He),2===p&&(d=Ue),3===p&&(d=Ve)}n.primType=d}function l(t){n.elementsCount--,de(null!==t.buffer,"must not double destroy elements"),delete c[t.id],t.buffer.destroy(),t.buffer=null}function u(t,e){function i(t){if(t)if("number"==typeof t)o(t),u.primType=Ve,u.vertCount=0|t,u.type=Ge;else{var e=null,r=Ke,n=-1,a=-1,l=0,c=0;Array.isArray(t)||Kt(t)||Z(t)?e=t:(de.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,de(Array.isArray(e)||Kt(e)||Z(e),"invalid data for element buffer")),"usage"in t&&(de.parameter(t.usage,Re,"invalid element buffer usage"),r=Re[t.usage]),"primitive"in t&&(de.parameter(t.primitive,je,"invalid element buffer primitive"),n=je[t.primitive]),"count"in t&&(de("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),a=0|t.count),"type"in t&&(de.parameter(t.type,h,"invalid buffer type"),c=h[t.type]),"length"in t?l=0|t.length:(l=a,c===Ye||c===Xe?l*=2:c!==Ze&&c!==We||(l*=4))),s(u,e,r,n,a,l,c)}else o(),u.primType=Ve,u.vertCount=0,u.type=Ge;return i}var o=r.create(null,Qe,!0),u=new a(o._buffer);return n.elementsCount++,i(t),i._reglType="elements",i._elements=u,i.subdata=function(t,e){return o.subdata(t,e),i},i.destroy=function(){l(u)},i}var c={},f=0,h={uint8:Ge,uint16:Ye};e.oes_element_index_uint&&(h.uint32=Ze),a.prototype.bind=function(){this.buffer.bind()};var d=[];return{create:u,createStream:i,destroyStream:o,getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){xe(c).forEach(l)}}}function pt(t){for(var e=Se.allocType(er,t.length),r=0;r>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)e[r]=a;else if(i<-14){var s=-14-i;e[r]=a+(o+1024>>s)}else e[r]=i>15?a+31744:a+(i+15<<10)+o}return e}function gt(t){return Array.isArray(t)||Kt(t)}function mt(t){return"[object "+t+"]"}function vt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function yt(t){return!!Array.isArray(t)&&!(0===t.length||!gt(t[0]))}function bt(t){return Object.prototype.toString.call(t)}function xt(t){return bt(t)===dn}function _t(t){return bt(t)===pn}function wt(t){return bt(t)===gn}function At(t){return bt(t)===mn}function kt(t){if(!t)return!1;var e=bt(t);return vn.indexOf(e)>=0||(vt(t)||yt(t)||Z(t))}function Mt(t){return 0|$t[Object.prototype.toString.call(t)]}function Tt(t,e){var r=e.length;switch(t.type){case Pr:case zr:case Fr:case Br:var n=Se.allocType(t.type,r);n.set(e),t.data=n;break;case wr:t.data=pt(e);break;default:de.raise("unsupported texture type, must specify a typed array")}}function Et(t,e){return Se.allocType(t.type===wr?Br:t.type,e)}function Lt(t,e){t.type===wr?(t.data=pt(e),Se.freeType(e)):t.data=e}function St(t,e,r,n,a,i){for(var o=t.width,s=t.height,l=t.channels,u=o*s*l,c=Et(t,u),f=0,h=0;h=1;)s+=o*l*l,l/=2;return s}return o*r*n}function Ot(t,e,r,n,a,i,o){function s(){this.internalformat=or,this.format=or,this.type=Pr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function u(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(de.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(de.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(de.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(de.parameter(n.colorSpace,B,"invalid colorSpace"),t.colorSpace=B[n.colorSpace]),"type"in n){var a=n.type;de(e.oes_texture_float||!("float"===a||"float32"===a),"you must enable the OES_texture_float extension in order to use floating point textures."),de(e.oes_texture_half_float||!("half float"===a||"float16"===a),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),de(e.webgl_depth_texture||!("uint16"===a||"uint32"===a||"depth stencil"===a),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(a,N,"invalid texture type"),t.type=N[a]}var i=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(de(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),i=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],de(s>0&&s<=4,"invalid number of channels"),l=!0),de(i>=0&&i<=r.maxTextureSize,"invalid width"),de(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(i=o=n.radius,de(i>=0&&i<=r.maxTextureSize,"invalid radius")),"width"in n&&(i=n.width,de(i>=0&&i<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,de(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,de(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|i,t.height=0|o,t.channels=0|s;var u=!1;if("format"in n){var c=n.format;de(e.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(c,j,"invalid texture format");var f=t.internalformat=j[c];t.format=Q[f],c in N&&("type"in n||(t.type=N[c])),c in H&&(t.compressed=!0),u=!0}!l&&u?t.channels=hn[t.format]:l&&!u?t.channels!==fn[t.format]&&(t.format=t.internalformat=fn[t.channels]):u&&l&&de(t.channels===hn[t.format],"number of channels inconsistent with specified format")}}function c(e){t.pixelStorei(an,e.flipY),t.pixelStorei(on,e.premultiplyAlpha),t.pixelStorei(sn,e.colorSpace),t.pixelStorei(nn,e.unpackAlignment)}function f(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function h(t,e){var n=null;if(kt(e)?n=e:e&&(de.type(e,"object","invalid pixel data type"),u(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),kt(e.data)&&(n=e.data)),de(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){de(!n,"can not specify copy and data field for the same texture");var i=a.viewportWidth,o=a.viewportHeight;t.width=t.width||i-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,de(t.xOffset>=0&&t.xOffset=0&&t.yOffset0&&t.width<=i&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(Kt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Pr||(t.type=Mt(n));else if(vt(n))t.channels=t.channels||4,Tt(t,n),t.alignment=1,t.needsFree=!0;else if(Z(n)){var s=n.data;Array.isArray(s)||t.type!==Pr||(t.type=Mt(s));var l,c,f,h,d,p,g=n.shape,m=n.stride;3===g.length?(f=g[2],p=m[2]):(de(2===g.length,"invalid ndarray pixel data, must be 2 or 3D"),f=1,p=1),l=g[0],c=g[1],h=m[0],d=m[1],t.alignment=1,t.width=l,t.height=c,t.channels=f,t.format=t.internalformat=fn[f],t.needsFree=!0,St(t,s,h,d,p,n.offset)}else if(xt(n)||_t(n))xt(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(wt(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(At(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(yt(n)){var v=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=gt(n[0][0])?b||n[0][0].length:b||1;for(var x=Ce.shape(n),_=1,w=0;w=0,"oes_texture_float extension not enabled"):t.type===wr&&de(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,a){var i=e.element,o=e.data,s=e.internalformat,l=e.format,u=e.type,f=e.width,h=e.height;c(e),i?t.texImage2D(r,a,l,l,u,i):e.compressed?t.compressedTexImage2D(r,a,s,f,h,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,a,l,e.xOffset,e.yOffset,f,h,0)):t.texImage2D(r,a,l,f,h,0,l,u,o)}function p(e,r,a,i,o){var s=e.element,l=e.data,u=e.internalformat,f=e.format,h=e.type,d=e.width,p=e.height;c(e),s?t.texSubImage2D(r,o,a,i,f,h,s):e.compressed?t.compressedTexSubImage2D(r,o,a,i,u,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,a,i,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,a,i,d,p,f,h,l)}function g(){return $.pop()||new f}function m(t){t.needsFree&&Se.freeType(t.data),f.call(t),$.push(t)}function v(){s.call(this),this.genMipmaps=!1,this.mipmapHint=Jr,this.mipmask=0,this.images=Array(16)}function y(t,e,r){var n=t.images[0]=g();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function b(t,e){var r=null;if(kt(e))r=t.images[0]=g(),l(r,t),h(r,e),t.mipmask=1;else if(u(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,a=0;a>=a,r.height>>=a,h(r,n[a]),t.mipmask|=1<=0&&(t.genMipmaps=!0)}if("mag"in e){var a=e.mag;de.parameter(a,z),t.magFilter=z[a]}var i=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(de.parameter(s,P),i=o=P[s]):Array.isArray(s)&&(de.parameter(s[0],P),de.parameter(s[1],P),i=P[s[0]],o=P[s[1]])}else{if("wrapS"in e){var l=e.wrapS;de.parameter(l,P),i=P[l]}if("wrapT"in e){var u=e.wrapT;de.parameter(u,P),o=P[u]}}if(t.wrapS=i,t.wrapT=o,"anisotropic"in e){var c=e.anisotropic;de("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var f=!1;switch(typeof e.mipmap){case"string":de.parameter(e.mipmap,D,"invalid mipmap hint"),t.mipmapHint=D[e.mipmap],t.genMipmaps=!0,f=!0;break;case"boolean":f=t.genMipmaps=e.mipmap;break;case"object":de(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,f=!0;break;default:de.raise("invalid mipmap type")}!f||"min"in e||(t.minFilter=Wr)}}function M(r,n){t.texParameteri(n,Gr,r.minFilter),t.texParameteri(n,qr,r.magFilter),t.texParameteri(n,Nr,r.wrapS),t.texParameteri(n,jr,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,rn,r.anisotropic),r.genMipmaps&&(t.hint(Kr,r.mipmapHint),t.generateMipmap(n))}function T(e){s.call(this),this.mipmask=0,this.internalformat=or,this.id=J++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new A,o.profile&&(this.stats={size:0})}function E(e){t.activeTexture(un),t.bindTexture(e.target,e.texture)}function L(){var e=rt[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(nr,null)}function S(e){var r=e.texture;de(r,"must not double destroy texture");var n=e.unit,a=e.target;n>=0&&(t.activeTexture(un+n),t.bindTexture(a,null),rt[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete tt[e.id],i.textureCount--}function C(e,n){function a(t,e){var n=c.texInfo;A.call(n);var i=_();return"number"==typeof t?"number"==typeof e?y(i,0|t,0|e):y(i,0|t,0|t):t?(de.type(t,"object","invalid arguments to regl.texture"),k(n,t),b(i,t)):y(i,1,1),n.genMipmaps&&(i.mipmask=(i.width<<1)-1),c.mipmask=i.mipmask,l(c,i),de.texture2D(n,i,r),c.internalformat=i.internalformat,a.width=i.width,a.height=i.height,E(c),x(i,nr),M(n,nr),L(),w(i),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,i.width,i.height,n.genMipmaps,!1)),a.format=q[c.internalformat],a.type=G[c.type],a.mag=X[n.magFilter],a.min=Y[n.minFilter],a.wrapS=W[n.wrapS],a.wrapT=W[n.wrapT],a}function s(t,e,r,n){de(!!t,"must specify image data");var i=0|e,o=0|r,s=0|n,u=g();return l(u,c),u.width=0,u.height=0,h(u,t),u.width=u.width||(c.width>>s)-i,u.height=u.height||(c.height>>s)-o,de(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),de(c.mipmask&1<>s;++s)t.texImage2D(nr,s,c.format,n>>s,i>>s,0,c.format,c.type,null);return L(),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,n,i,!1,!1)),a}var c=new T(nr);return tt[c.id]=c,i.textureCount++,a(e,n),a.subimage=s,a.resize=u,a._reglType="texture2d",a._texture=c,o.profile&&(a.stats=c.stats),a.destroy=function(){c.decRef()},a}function O(e,n,a,s,c,f){function d(t,e,n,a,i,s){var c,f=C.texInfo;for(A.call(f),c=0;c<6;++c)O[c]=_();if("number"!=typeof t&&t)if("object"==typeof t)if(e)b(O[0],t),b(O[1],e),b(O[2],n),b(O[3],a),b(O[4],i),b(O[5],s);else if(k(f,t),u(C,t),"faces"in t){var h=t.faces;for(de(Array.isArray(h)&&6===h.length,"cube faces must be a length 6 array"),c=0;c<6;++c)de("object"==typeof h[c]&&!!h[c],"invalid input for cube map face"),l(O[c],C),b(O[c],h[c])}else for(c=0;c<6;++c)b(O[c],t);else de.raise("invalid arguments to cube map");else{var p=0|t||1;for(c=0;c<6;++c)y(O[c],p,p)}for(l(C,O[0]),f.genMipmaps?C.mipmask=(O[0].width<<1)-1:C.mipmask=O[0].mipmask,de.textureCube(C,f,O,r),C.internalformat=O[0].internalformat,d.width=O[0].width,d.height=O[0].height,E(C),c=0;c<6;++c)x(O[c],ir+c);for(M(f,ar),L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,f.genMipmaps,!0)),d.format=q[C.internalformat],d.type=G[C.type],d.mag=X[f.magFilter],d.min=Y[f.minFilter],d.wrapS=W[f.wrapS],d.wrapT=W[f.wrapT],c=0;c<6;++c)w(O[c]);return d}function v(t,e,r,n,a){de(!!e,"must specify image data"),de("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var i=0|r,o=0|n,s=0|a,u=g();return l(u,C),u.width=0,u.height=0,h(u,e),u.width=u.width||(C.width>>s)-i,u.height=u.height||(C.height>>s)-o,de(C.type===u.type&&C.format===u.format&&C.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=C.width&&o+u.height<=C.height,"texture.subimage write out of bounds"),de(C.mipmask&1<>a;++a)t.texImage2D(ir+n,a,C.format,r>>a,r>>a,0,C.format,C.type,null);return L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,!1,!0)),d}}var C=new T(ar);tt[C.id]=C,i.cubeCount++;var O=new Array(6);return d(e,n,a,s,c,f),d.subimage=v,d.resize=S,d._reglType="textureCube",d._texture=C,o.profile&&(d.stats=C.stats),d.destroy=function(){C.decRef()},d}function R(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(ir+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);M(e.texInfo,e.target)})}var D={"don't care":Jr,"dont care":Jr,nice:en,fast:tn},P={repeat:Hr,clamp:Ur,mirror:Vr},z={nearest:Xr,linear:Yr},F=Jt({mipmap:$r,"nearest mipmap nearest":Wr,"linear mipmap nearest":Zr,"nearest mipmap linear":Qr,"linear mipmap linear":$r},z),B={none:0,browser:ln},N={uint8:Pr,rgba4:pr,rgb565:mr,"rgb5 a1":gr},j={alpha:sr,luminance:ur,"luminance alpha":cr,rgb:lr,rgba:or,rgba4:fr,"rgb5 a1":hr,rgb565:dr},H={};e.ext_srgb&&(j.srgb=xr,j.srgba=_r),e.oes_texture_float&&(N.float32=N.float=Br),e.oes_texture_half_float&&(N.float16=N["half float"]=wr),e.webgl_depth_texture&&(Jt(j,{depth:yr,"depth stencil":br}),Jt(N,{uint16:zr,uint32:Fr,"depth stencil":vr})),e.webgl_compressed_texture_s3tc&&Jt(H,{"rgb s3tc dxt1":Ar,"rgba s3tc dxt1":kr,"rgba s3tc dxt3":Mr,"rgba s3tc dxt5":Tr}),e.webgl_compressed_texture_atc&&Jt(H,{"rgb atc":Er,"rgba atc explicit alpha":Lr,"rgba atc interpolated alpha":Sr}),e.webgl_compressed_texture_pvrtc&&Jt(H,{"rgb pvrtc 4bppv1":Cr,"rgb pvrtc 2bppv1":Or,"rgba pvrtc 4bppv1":Rr,"rgba pvrtc 2bppv1":Ir}),e.webgl_compressed_texture_etc1&&(H["rgb etc1"]=Dr);var U=Array.prototype.slice.call(t.getParameter(rr));Object.keys(H).forEach(function(t){var e=H[t];U.indexOf(e)>=0&&(j[t]=e)});var V=Object.keys(j);r.textureFormats=V;var q=[];Object.keys(j).forEach(function(t){var e=j[t];q[e]=t});var G=[];Object.keys(N).forEach(function(t){var e=N[t];G[e]=t});var X=[];Object.keys(z).forEach(function(t){var e=z[t];X[e]=t});var Y=[];Object.keys(F).forEach(function(t){var e=F[t];Y[e]=t});var W=[];Object.keys(P).forEach(function(t){var e=P[t];W[e]=t});var Q=V.reduce(function(t,e){var r=j[e];return r===ur||r===sr||r===ur||r===cr||r===yr||r===br?t[r]=r:r===hr||e.indexOf("rgba")>=0?t[r]=or:t[r]=lr,t},{}),$=[],K=[],J=0,tt={},et=r.maxTextureUnits,rt=Array(et).map(function(){return null});return Jt(T.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;a.unit=-1}rt[n]=e,r=n;break}r>=et&&de.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits=En&&e=2,"invalid shape for framebuffer"),u=R[0],d=R[1]}else"radius"in O&&(u=d=O.radius),"width"in O&&(u=O.width),"height"in O&&(d=O.height);("color"in O||"colors"in O)&&(y=O.color||O.colors,Array.isArray(y)&&de(1===y.length||o,"multiple render targets not supported")),y||("colorCount"in O&&(T=0|O.colorCount,de(T>0,"invalid color buffer count")),"colorTexture"in O&&(b=!!O.colorTexture,x="rgba4"),"colorType"in O&&(M=O.colorType,b?(de(e.oes_texture_float||!("float"===M||"float32"===M),"you must enable OES_texture_float in order to use floating point framebuffer objects"),de(e.oes_texture_half_float||!("half float"===M||"float16"===M),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===M||"float16"===M?(de(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==M&&"float32"!==M||(de(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),de.oneOf(M,k,"invalid color type")),"colorFormat"in O&&(x=O.colorFormat,w.indexOf(x)>=0?b=!0:A.indexOf(x)>=0?b=!1:b?de.oneOf(O.colorFormat,w,"invalid color format for texture"):de.oneOf(O.colorFormat,A,"invalid color format for renderbuffer"))),("depthTexture"in O||"depthStencilTexture"in O)&&(C=!(!O.depthTexture&&!O.depthStencilTexture),de(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in O&&("boolean"==typeof O.depth?p=O.depth:(E=O.depth,m=!1)),"stencil"in O&&("boolean"==typeof O.stencil?m=O.stencil:(L=O.stencil,p=!1)),"depthStencil"in O&&("boolean"==typeof O.depthStencil?p=m=O.depthStencil:(S=O.depthStencil,p=!1,m=!1))}else u=d=1;var I=null,D=null,P=null,z=null;if(Array.isArray(y))I=y.map(c);else if(y)I=[c(y)];else for(I=new Array(T),i=0;i=0||I[i].renderbuffer&&jn.indexOf(I[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),I[i]&&I[i].texture){var B=Pn[I[i].texture._texture.format]*zn[I[i].texture._texture.type];null===F?F=B:de(F===B,"all color attachments much have the same number of bits per pixel.")}return l(D,u,d),de(!D||D.texture&&D.texture._texture.format===In||D.renderbuffer&&D.renderbuffer._renderbuffer.format===Fn,"invalid depth attachment for framebuffer object"),l(P,u,d), -de(!P||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Bn,"invalid stencil attachment for framebuffer object"),l(z,u,d),de(!z||z.texture&&z.texture._texture.format===Nn||z.renderbuffer&&z.renderbuffer._renderbuffer.format===Nn,"invalid depth-stencil attachment for framebuffer object"),g(s),s.width=u,s.height=d,s.colorAttachments=I,s.depthAttachment=D,s.stencilAttachment=P,s.depthStencilAttachment=z,a.color=I.map(h),a.depth=h(D),a.stencil=h(P),a.depthStencil=h(z),a.width=s.width,a.height=s.height,v(s),a}function o(t,e){de(_.next!==s,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===s.width&&n===s.height)return a;for(var i=s.colorAttachments,o=0;o=2,"invalid shape for framebuffer"),de(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&de(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(u=d.color||d.colors,Array.isArray(u)&&de(1===u.length||i,"multiple render targets not supported")),u||("colorCount"in d&&(h=0|d.colorCount,de(h>0,"invalid color buffer count")),"colorType"in d&&(de.oneOf(d.colorType,k,"invalid color type"),f=d.colorType),"colorFormat"in d&&(c=d.colorFormat,de.oneOf(d.colorFormat,w,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var g;if(u)if(Array.isArray(u))for(g=[],r=0;r0&&(s.depth=o[0].depth,s.stencil=o[0].stencil,s.depthStencil=o[0].depthStencil),o[r]?o[r](s):o[r]=y(s)}return Jt(a,{width:l,height:l,color:g})}function i(t){var e,n=0|t;if(de(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e1)for(var g=0;gt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);xe(c).forEach(e),c={},xe(f).forEach(e),f={},d.forEach(function(e){t.deleteProgram(e.program)}),d.length=0,h={},r.shaderCount=0},program:function(t,e,n){de.command(t>=0,"missing vertex shader",n),de.command(e>=0,"missing fragment shader",n);var a=h[e];a||(a=h[e]={});var i=a[t];return i||(i=new s(e,t),r.shaderCount++,l(i,n),a[t]=i,d.push(i)),i},restore:u,shader:o,frag:-1,vert:-1}}function Ft(t,e,r,n,a,i){function o(o){var s;null===e.next?(de(a.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Wn):(de(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,i.oes_texture_float?de(s===Wn||s===Qn,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):de(s===Wn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,u=0,c=n.framebufferWidth,f=n.framebufferHeight,h=null;Kt(o)?h=o:o&&(de.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,u=0|o.y,de(l>=0&&l=0&&u0&&c+l<=n.framebufferWidth,"invalid width for read pixels"),de(f>0&&f+u<=n.framebufferHeight,"invalid height for read pixels"),r();var d=c*f*4;return h||(s===Wn?h=new Uint8Array(d):s===Qn&&(h=h||new Float32Array(d))),de.isTypedArray(h,"data buffer for regl.read() must be a typedarray"),de(h.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(Zn,4),t.readPixels(l,u,c,f,Yn,s,h),h}function s(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}function l(t){return t&&"framebuffer"in t?s(t):o(t)}return l}function Bt(t){return Array.prototype.slice.call(t)}function Nt(t){return Bt(t).join("")}function jt(){function t(t){for(var e=0;e0&&(r.push(t,"="),r.push.apply(r,Bt(arguments)),r.push(";")),t}var r=[],n=[];return Jt(t,{def:e,toString:function(){return Nt([n.length>0?"var "+n+";":"",Nt(r)])}})}function r(){function t(t,e){n(t,e,"=",r.def(t,e),";")}var r=e(),n=e(),a=r.toString,i=n.toString;return Jt(function(){r.apply(r,Bt(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,a){t(e,n),r(e,n,"=",a,";")},toString:function(){return a()+i()}})}function n(){var t=Nt(arguments),e=r(),n=r(),a=e.toString,i=n.toString;return Jt(e,{then:function(){return e.apply(e,Bt(arguments)),this},else:function(){return n.apply(n,Bt(arguments)),this},toString:function(){var e=i();return e&&(e="else{"+e+"}"),Nt(["if(",t,"){",a(),"}",e])}})}function a(t,e){function n(){var t="a"+a.length;return a.push(t),t}var a=[];e=e||0;for(var i=0;i=1,n>=2,e)}if(r===ia){var a=t.data;return new Vt(a.thisDep,a.contextDep,a.propDep,e)}return new Vt(r===aa,r===na,r===ra,e)}function Yt(t,e,r,n,a,i,o,s,l,u,c,f,h,d,p){function g(t){return t.replace(".","_")}function m(t,e,r){var n=g(t);et.push(t),tt[n]=J[n]=!!r,rt[n]=e}function v(t,e,r){var n=g(t);et.push(t),Array.isArray(r)?(J[n]=r.slice(),tt[n]=r.slice()):J[n]=tt[n]=r,nt[n]=e}function y(){var t=jt(),r=t.link,n=t.global;t.id=ot++,t.batchId="0";var a=r(at),i=t.shared={props:"a0"};Object.keys(at).forEach(function(t){i[t]=n.def(a,".",t)}),de.optional(function(){t.CHECK=r(de),t.commandStr=de.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},it.invalidBlendCombinations=Hi});var o=t.next={},s=t.current={};Object.keys(nt).forEach(function(t){Array.isArray(J[t])&&(o[t]=n.def(i.next,".",t),s[t]=n.def(i.current,".",t))});var l=t.constants={};Object.keys(it).forEach(function(t){l[t]=n.def(JSON.stringify(it[t]))}),t.invoke=function(e,n){switch(n.type){case ea:var a=["this",i.context,i.props,t.batchId];return e.def(r(n.data),".call(",a.slice(0,Math.max(n.data.length+1,4)),")");case ra:return e.def(i.props,n.data);case na:return e.def(i.context,n.data);case aa:return e.def("this",n.data);case ia:return n.data.append(t,e),n.data.ref}},t.attribCache={};var c={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in c)return c[n];var a=u.scope[n];return a||(a=u.scope[n]=new W),c[n]=r(a)},t}function b(t){var e,r=t.static,n=t.dynamic;if(Ia in r){var a=!!r[Ia];e=Gt(function(t,e){return a}),e.enable=a}else if(Ia in n){var i=n[Ia];e=Xt(i,function(t,e){return t.invoke(e,i)})}return e}function x(t,e){var r=t.static,n=t.dynamic;if(Da in r){var a=r[Da];return a?(a=s.getFramebuffer(a),de.command(a,"invalid framebuffer object"),Gt(function(t,e){var r=t.link(a),n=t.shared;e.set(n.framebuffer,".next",r);var i=n.context;return e.set(i,"."+Ua,r+".width"),e.set(i,"."+Va,r+".height"),r})):Gt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Ua,n+"."+Xa),e.set(n,"."+Va,n+"."+Ya),"null"})}if(Da in n){var i=n[Da];return Xt(i,function(t,e){var r=t.invoke(e,i),n=t.shared,a=n.framebuffer,o=e.def(a,".getFramebuffer(",r,")");de.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(a,".next",o);var s=n.context;return e.set(s,"."+Ua,o+"?"+o+".width:"+s+"."+Xa),e.set(s,"."+Va,o+"?"+o+".height:"+s+"."+Ya),o})}return null}function _(t,e,r){function n(t){if(t in a){var n=a[t];de.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,u=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,de.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,de.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new Vt(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,a=o;"width"in n||(a=e.def(r,".",Ua,"-",u));var i=s;return"height"in n||(i=e.def(r,".",Va,"-",c)),[u,c,a,i]})}if(t in i){var f=i[t],h=Xt(f,function(e,r){var n=e.invoke(r,f);de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var a=e.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Ua,"-",i,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",Va,"-",o,")");return de.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[i,o,s,l]});return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new Vt(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Ua),e.def(r,".",Va)]}):null}var a=t.static,i=t.dynamic,o=n(Ra);if(o){var s=o;o=new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+qa,r[2]),e.set(n,"."+Ga,r[3]),r})}return{viewport:o,scissor_box:n(Oa)}}function w(t){function r(t){if(t in a){var r=e.id(a[t]);de.optional(function(){c.shader(qi[t],r,de.guessCommand())});var n=Gt(function(){return r});return n.id=r,n}if(t in i){var o=i[t];return Xt(o,function(e,r){var n=e.invoke(r,o),a=r.def(e.shared.strings,".id(",n,")");return de.optional(function(){r(e.shared.shader,".shader(",qi[t],",",a,",",e.command,");")}),a})}return null}var n,a=t.static,i=t.dynamic,o=r(za),s=r(Pa),l=null;return qt(o)&&qt(s)?(l=c.program(s.id,o.id),n=Gt(function(t,e){return t.link(l)})):n=new Vt(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",za);var a;a=s?s.append(t,e):e.def(n,".",Pa);var i=n+".program("+a+","+r;return de.optional(function(){i+=","+t.command}),e.def(i+")")}),{frag:o,vert:s,progVar:n,program:l}}function A(t,e){function r(t,r){if(t in n){var i=0|n[t];return de.command(!r||i>=0,"invalid "+t,e.commandStr),Gt(function(t,e){return r&&(t.OFFSET=i),i})}if(t in a){var s=a[t];return Xt(s,function(e,n){var a=e.invoke(n,s);return r&&(e.OFFSET=a,de.optional(function(){e.assert(n,a+">=0","invalid "+t)})),a})}return r&&o?Gt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,a=t.dynamic,o=function(){if(Fa in n){var t=n[Fa];Ht(t)?t=i.getElements(i.create(t,!0)):t&&(t=i.getElements(t),de.command(t,"invalid elements",e.commandStr));var r=Gt(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Fa in a){var o=a[Fa];return Xt(o,function(t,e){var r=t.shared,n=r.isBufferArgs,a=r.elements,i=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",i,")"),u=t.cond(l).then(s,"=",a,".createStream(",i,");").else(s,"=",a,".getElements(",i,");");return de.optional(function(){t.assert(u.else,"!"+i+"||"+s,"invalid elements")}),e.entry(u),e.exit(t.cond(l).then(a,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(ja,!0);return{elements:o,primitive:function(){if(Ba in n){var t=n[Ba];return de.commandParameter(t,je,"invalid primitve",e.commandStr),Gt(function(e,r){return je[t]})}if(Ba in a){var r=a[Ba];return Xt(r,function(t,e){var n=t.constants.primTypes,a=t.invoke(e,r);return de.optional(function(){t.assert(e,a+" in "+n,"invalid primitive, must be one of "+Object.keys(je))}),e.def(n,"[",a,"]")})}return o?qt(o)?Gt(o.value?function(t,e){return e.def(t.ELEMENTS,".primType")}:function(){return Mi}):new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Mi)}):null}(),count:function(){if(Na in n){var t=0|n[Na];return de.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),Gt(function(){return t})}if(Na in a){var r=a[Na];return Xt(r,function(t,e){var n=t.invoke(e,r);return de.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(qt(o)){if(o)return s?new Vt(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return de.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):Gt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var i=Gt(function(){return-1});return de.optional(function(){i.MISSING=!0}),i}var l=new Vt(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return de.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Ha,!1),offset:s}}function k(t,e){var r=t.static,a=t.dynamic,i={};return et.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);i[s]=Gt(function(){return o})}else if(t in a){var l=a[t];i[s]=Xt(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=g(t);switch(t){case ma:case sa:case oa:case Ma:case fa:case Ca:case xa:case wa:case Aa:case pa:return o(function(r){return de.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return de.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case ha:return o(function(r){return de.commandParameter(r,Ui,"invalid "+t,e.commandStr),Ui[r]},function(e,r,n){var a=e.constants.compareFuncs;return de.optional(function(){e.assert(r,n+" in "+a,"invalid "+t+", must be one of "+Object.keys(Ui))}),r.def(a,"[",n,"]")});case da:return o(function(t){return de.command(gt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case ca:return o(function(t){de.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,a="dstRGB"in t?t.dstRGB:t.dst,i="dstAlpha"in t?t.dstAlpha:t.dst;return de.commandParameter(r,ji,s+".srcRGB",e.commandStr),de.commandParameter(n,ji,s+".srcAlpha",e.commandStr),de.commandParameter(a,ji,s+".dstRGB",e.commandStr),de.commandParameter(i,ji,s+".dstAlpha",e.commandStr),de.command(Hi.indexOf(r+", "+a)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",e.commandStr),[ji[r],ji[a],ji[n],ji[i]]},function(e,r,n){function a(a,o){var s=r.def('"',a,o,'" in ',n,"?",n,".",a,o,":",n,".",a);return de.optional(function(){e.assert(r,s+" in "+i,"invalid "+t+"."+a+o+", must be one of "+Object.keys(ji))}),s}var i=e.constants.blendFuncs;de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=a("src","RGB"),s=a("dst","RGB");de.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(i,"[",o,"]"),u=r.def(i,"[",a("src","Alpha"),"]");return[l,r.def(i,"[",s,"]"),u,r.def(i,"[",a("dst","Alpha"),"]")]});case ua:return o(function(r){return"string"==typeof r?(de.commandParameter(r,Z,"invalid "+t,e.commandStr),[Z[r],Z[r]]):"object"==typeof r?(de.commandParameter(r.rgb,Z,t+".rgb",e.commandStr),de.commandParameter(r.alpha,Z,t+".alpha",e.commandStr),[Z[r.rgb],Z[r.alpha]]):void de.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var a=e.constants.blendEquations,i=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return de.optional(function(){function r(t,r,n){e.assert(t,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(Z))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(i,"=",o,"=",a,"[",n,"];"),s.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(s),[i,o]});case la:return o(function(t){return de.command(gt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),Q(4,function(e){return+t[e]})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),Q(4,function(t){return e.def("+",r,"[",t,"]")})});case Ta:return o(function(t){return de.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Ea:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return de.commandParameter(n,Ui,t+".cmp",e.commandStr),de.commandType(a,"number",t+".ref",e.commandStr),de.commandType(i,"number",t+".mask",e.commandStr),[Ui[n],a,i]},function(t,e,r){var n=t.constants.compareFuncs;return de.optional(function(){function a(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ii),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case La:case Sa:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return de.commandParameter(n,Vi,t+".fail",e.commandStr),de.commandParameter(a,Vi,t+".zfail",e.commandStr),de.commandParameter(i,Vi,t+".zpass",e.commandStr),[t===Sa?Ei:Ti,Vi[n],Vi[a],Vi[i]]},function(e,r,n){function a(a){return de.optional(function(){e.assert(r,'!("'+a+'" in '+n+")||("+n+"."+a+" in "+i+")","invalid "+t+"."+a+", must be one of "+Object.keys(Vi))}),r.def('"',a,'" in ',n,"?",i,"[",n,".",a,"]:",Ii)}var i=e.constants.stencilOps;return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Sa?Ei:Ti,a("fail"),a("zfail"),a("zpass")]});case _a:return o(function(t){de.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return de.commandType(r,"number",s+".factor",e.commandStr),de.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case va:return o(function(t){var r=0;return"front"===t?r=Ti:"back"===t&&(r=Ei),de.command(!!r,s,e.commandStr),r},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Ti,":",Ei)});case ba:return o(function(t){return de.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case ya:return o(function(t){return de.commandParameter(t,Gi,s,e.commandStr),Gi[t]},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Li+":"+Si)});case ga:return o(function(t){return de.command(gt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),Q(4,function(t){return"!!"+r+"["+t+"]"})});case ka:return o(function(t){de.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return de.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return de.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),i}function M(t,e){var r=t.static,n=t.dynamic,a={};return Object.keys(r).forEach(function(t){var n,i=r[t];if("number"==typeof i||"boolean"==typeof i)n=Gt(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=Gt(function(t){return t.link(i)}):"framebuffer"===o||"framebufferCube"===o?(de.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=Gt(function(t){return t.link(i.color[0])})):de.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else gt(i)?n=Gt(function(e){return e.global.def("[",Q(i.length,function(r){return de.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+t,e.commandStr),i[r]}),"]")}):de.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=i,a[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];a[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),a}function T(t,r){var n=t.static,i=t.dynamic,o={};return Object.keys(n).forEach(function(t){var i=n[t],s=e.id(t),l=new W;if(Ht(i))l.state=Jn,l.buffer=a.getBuffer(a.create(i,Za,!1,!0)),l.type=0;else{var u=a.getBuffer(i);if(u)l.state=Jn,l.buffer=u,l.type=0;else if(de.command("object"==typeof i&&i,"invalid data for attribute "+t,r.commandStr),i.constant){var c=i.constant;l.buffer="null",l.state=ta,"number"==typeof c?l.x=c:(de.command(gt(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,r.commandStr),$n.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',r.commandStr);var h=0|i.stride;de.command(h>=0&&h<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|i.size;de.command(!("size"in i)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!i.normalized,g=0;"type"in i&&(de.commandParameter(i.type,Oe,"invalid type for attribute "+t,r.commandStr),g=Oe[i.type]);var m=0|i.divisor;"divisor"in i&&(de.command(0===m||$,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),de.command(m>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),de.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach(function(r){de.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=u,l.state=Jn,l.size=d,l.normalized=p,l.type=g||u.dtype,l.offset=f,l.stride=h,l.divisor=m}}o[t]=Gt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(i).forEach(function(t){function e(e,n){function a(t){n(u[t],"=",i,".",t,"|0;")}var i=e.invoke(n,r),o=e.shared,s=o.isBufferArgs,l=o.buffer;de.optional(function(){e.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+s+"("+i+")||"+l+".getBuffer("+i+")||"+l+".getBuffer("+i+".buffer)||"+s+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')});var u={isStream:n.def(!1)},c=new W;c.state=Jn,Object.keys(c).forEach(function(t){u[t]=n.def(""+c[t])});var f=u.buffer,h=u.type;return n("if(",s,"(",i,")){",u.isStream,"=true;",f,"=",l,".createStream(",Za,",",i,");",h,"=",f,".dtype;","}else{",f,"=",l,".getBuffer(",i,");","if(",f,"){",h,"=",f,".dtype;",'}else if("constant" in ',i,"){",u.state,"=",ta,";","if(typeof "+i+'.constant === "number"){',u[$n[0]],"=",i,".constant;",$n.slice(1).map(function(t){return u[t]}).join("="),"=0;","}else{",$n.map(function(t,e){return u[t]+"="+i+".constant.length>="+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",i,".buffer)){",f,"=",l,".createStream(",Za,",",i,".buffer);","}else{",f,"=",l,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",f,".dtype;",u.normalized,"=!!",i,".normalized;"),a("size"),a("offset"),a("stride"),a("divisor"),n("}}"),n.exit("if(",u.isStream,"){",l,".destroyStream(",f,");","}"),u}var r=i[t];o[t]=Xt(r,e)}),o}function E(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=Gt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),n}function L(t,e,r,n,a){function i(t){var e=u[t];e&&(f[t]=e)}var o=t.static,s=t.dynamic;de.optional(function(){function t(t){Object.keys(t).forEach(function(t){de.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',a.commandStr)})}var e=[Da,Pa,za,Fa,Ba,ja,Na,Ha,Ia].concat(et);t(o),t(s)});var l=x(t,a),u=_(t,l,a),c=A(t,a),f=k(t,a),h=w(t,a);i(Ra),i(g(Oa));var d=Object.keys(f).length>0,p={framebuffer:l,draw:c,shader:h,state:f,dirty:d};return p.profile=b(t,a),p.uniforms=M(r,a),p.attributes=T(e,a),p.context=E(n,a),p}function S(t,e,r){var n=t.shared,a=n.context,i=t.scope();Object.keys(r).forEach(function(n){e.save(a,"."+n);var o=r[n];i(a,".",n,"=",o.append(t,e),";")}),e(i)}function C(t,e,r,n){var a,i=t.shared,o=i.gl,s=i.framebuffer;K&&(a=e.def(i.extensions,".webgl_draw_buffers"));var l,u=t.constants,c=u.drawBuffer,f=u.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",Bi,",",l,".framebuffer);"),K&&e(a,".drawBuffersWEBGL(",c,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",Bi,",null);"),K&&e(a,".drawBuffersWEBGL(",f,");"),e("}",s,".cur=",l,";"),n||e("}")}function O(t,e,r){var n=t.shared,a=n.gl,i=t.current,o=t.next,s=n.current,l=n.next,u=t.cond(s,".dirty");et.forEach(function(e){var n=g(e);if(!(n in r.state)){var c,f;if(n in o){c=o[n],f=i[n];var h=Q(J[n].length,function(t){return u.def(c,"[",t,"]")});u(t.cond(h.map(function(t,e){return t+"!=="+f+"["+e+"]"}).join("||")).then(a,".",nt[n],"(",h,");",h.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";"))}else{c=u.def(l,".",n);var d=t.cond(c,"!==",s,".",n);u(d),n in rt?d(t.cond(c).then(a,".enable(",rt[n],");").else(a,".disable(",rt[n],");"),s,".",n,"=",c,";"):d(a,".",nt[n],"(",c,");",s,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&u(s,".dirty=false;"),e(u)}function R(t,e,r,n){var a=t.shared,i=t.current,o=a.current,s=a.gl;Ut(Object.keys(r)).forEach(function(a){var l=r[a];if(!n||n(l)){var u=l.append(t,e);if(rt[a]){var c=rt[a];qt(l)?u?e(s,".enable(",c,");"):e(s,".disable(",c,");"):e(t.cond(u).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(o,".",a,"=",u,";")}else if(gt(u)){var f=i[a];e(s,".",nt[a],"(",u,");",u.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";")}else e(s,".",nt[a],"(",u,");",o,".",a,"=",u,";")}})}function I(t,e){$&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function D(t,e,r,n,a){function i(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){u=e.def(),t(u,"=",i(),";"),"string"==typeof a?t(p,".count+=",a,";"):t(p,".count++;"),d&&(n?(c=e.def(),t(c,"=",m,".getNumPendingQueries();")):t(m,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",i(),"-",u,";"),d&&(n?t(m,".pushScopeStats(",c,",",m,".getNumPendingQueries(),",p,");"):t(m,".endQuery();"))}function l(t){var r=e.def(g,".profile");e(g,".profile=",t,";"),e.exit(g,".profile=",r,";")} -var u,c,f,h=t.shared,p=t.stats,g=h.current,m=h.timer,v=r.profile;if(v){if(qt(v))return void(v.enable?(o(e),s(e.exit),l("true")):l("false"));f=v.append(t,e),l(f)}else f=e.def(g,".profile");var y=t.block();o(y),e("if(",f,"){",y,"}");var b=t.block();s(b),e.exit("if(",f,"){",b,"}")}function P(t,e,r,n,a){function i(t){switch(t){case ui:case di:case vi:return 2;case ci:case pi:case yi:return 3;case fi:case gi:case bi:return 4;default:return 1}}function o(r,n,a){function i(){e("if(!",c,".buffer){",l,".enableVertexAttribArray(",u,");}");var r,i=a.type;if(r=a.size?e.def(a.size,"||",n):n,e("if(",c,".type!==",i,"||",c,".size!==",r,"||",p.map(function(t){return c+"."+t+"!=="+a[t]}).join("||"),"){",l,".bindBuffer(",Za,",",h,".buffer);",l,".vertexAttribPointer(",[u,r,i,a.normalized,a.stride,a.offset],");",c,".type=",i,";",c,".size=",r,";",p.map(function(t){return c+"."+t+"="+a[t]+";"}).join(""),"}"),$){var o=a.divisor;e("if(",c,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,o],");",c,".divisor=",o,";}")}}function o(){e("if(",c,".buffer){",l,".disableVertexAttribArray(",u,");","}if(",$n.map(function(t,e){return c+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",u,",",d,");",$n.map(function(t,e){return c+"."+t+"="+d[e]+";"}).join(""),"}")}var l=s.gl,u=e.def(r,".location"),c=e.def(s.attributes,"[",u,"]"),f=a.state,h=a.buffer,d=[a.x,a.y,a.z,a.w],p=["buffer","normalized","offset","stride"];f===Jn?i():f===ta?o():(e("if(",f,"===",Jn,"){"),i(),e("}else{"),o(),e("}"))}var s=t.shared;n.forEach(function(n){var s,l=n.name,u=r.attributes[l];if(u){if(!a(u))return;s=u.append(t,e)}else{if(!a(Xi))return;var c=t.scopeAttrib(l);de.optional(function(){t.assert(e,c+".state","missing attribute "+l)}),s={},Object.keys(new W).forEach(function(t){s[t]=e.def(c,".",t)})}o(t.link(n),i(n.info.type),s)})}function z(t,r,n,a,i){for(var o,s=t.shared,l=s.gl,u=0;u1?Q(_,function(t){return c+"["+t+"]"}):c);r(");")}}function F(t,e,r,n){function a(a){var i=c[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(t,r):i.append(t,e):e.def(u,".",a)}function i(){function t(){r(m,".drawElementsInstancedANGLE(",[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)",g],");")}function e(){r(m,".drawArraysInstancedANGLE(",[h,d,p,g],");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)"]+");")}function e(){r(l+".drawArrays("+[h,d,p]+");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,f=function(){var a,i=c.elements,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o)):a=o.def(u,".",Fa),a&&o("if("+a+")"+l+".bindBuffer("+Qa+","+a+".buffer.buffer);"),a}(),h=a(Ba),d=a(ja),p=function(){var a,i=c.count,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o),de.optional(function(){i.MISSING&&t.assert(e,"false","missing vertex count"),i.DYNAMIC&&t.assert(o,a+">=0","missing vertex count")})):(a=o.def(u,".",Na),de.optional(function(){t.assert(o,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var g,m;$&&(g=a(Ha),m=t.instancing);var v=f+".type",y=c.elements&&qt(c.elements);$&&("number"!=typeof g||g>=0)?"string"==typeof g?(r("if(",g,">0){"),i(),r("}else if(",g,"<0){"),o(),r("}")):i():o()}function B(t,e,r,n,a){var i=y(),o=i.proc("body",a);return de.optional(function(){i.commandStr=e.commandStr,i.command=i.link(e.commandStr)}),$&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),t(i,o,r,n),i.compile().body}function N(t,e,r,n){I(t,e),P(t,e,r,n.attributes,function(){return!0}),z(t,e,r,n.uniforms,function(){return!0}),F(t,e,e,r)}function j(t,e){var r=t.proc("draw",1);I(t,r),S(t,r,e.context),C(t,r,e.framebuffer),O(t,r,e),R(t,r,e.state),D(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)N(t,r,e,e.shader.program);else{var a=t.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",t.link(function(r){return B(N,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function H(t,e,r,n){function a(){return!0}t.batchId="a1",I(t,e),P(t,e,r,n.attributes,a),z(t,e,r,n.uniforms,a),F(t,e,e,r)}function U(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}I(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();if(e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&S(t,c,r.context),r.needsFramebuffer&&C(t,c,r.framebuffer),R(t,c,r.state,a),r.profile&&a(r.profile)&&D(t,c,r,!1,!0),n)P(t,u,r,n.attributes,i),P(t,c,r,n.attributes,a),z(t,u,r,n.uniforms,i),z(t,c,r,n.uniforms,a),F(t,u,c,r);else{var f=t.global.def("{}"),h=r.shader.progVar.append(t,c),d=c.def(h,".id"),p=c.def(f,"[",d,"]");c(t.shared.gl,".useProgram(",h,".program);","if(!",p,"){",p,"=",f,"[",d,"]=",t.link(function(e){return B(H,t,r,e,2)}),"(",h,");}",p,".call(this,a0[",s,"],",s,");")}}function V(t,e){function r(t){return t.contextDep&&a||t.propDep}var n=t.proc("batch",2);t.batchId="0",I(t,n);var a=!1,i=!0;Object.keys(e.context).forEach(function(t){a=a||e.context[t].propDep}),a||(S(t,n,e.context),i=!1);var o=e.framebuffer,s=!1;o?(o.propDep?a=s=!0:o.contextDep&&a&&(s=!0),s||C(t,n,o)):C(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(a=!0),O(t,n,e),R(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||D(t,n,e,!1,"a1"),e.contextDep=a,e.needsContext=i,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&a||l.propDep)U(t,n,e,null);else{var u=l.append(t,n);if(n(t.shared.gl,".useProgram(",u,".program);"),e.shader.program)U(t,n,e,e.shader.program);else{var c=t.global.def("{}"),f=n.def(u,".id"),h=n.def(c,"[",f,"]");n(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",c,"[",f,"]=",t.link(function(r){return B(U,t,e,r,2)}),"(",u,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}function q(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;S(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),Ut(Object.keys(r.state)).forEach(function(e){var n=r.state[e],o=n.append(t,a);gt(o)?o.forEach(function(r,n){a.set(t.next[e],"["+n+"]",r)}):a.set(i.next,"."+e,o)}),D(t,a,r,!0,!0),[Fa,ja,Na,Ha,Ba].forEach(function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))}),Object.keys(r.uniforms).forEach(function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new W).forEach(function(t){a.set(i,"."+t,n[t])})}),n(Pa),n(za),Object.keys(r.state).length>0&&(a(o,".dirty=true;"),a.exit(o,".dirty=true;")),a("a1(",t.shared.context,",a0,",t.batchId,");")}function G(t){if("object"==typeof t&&!gt(t)){for(var e=Object.keys(t),r=0;r=0;--t){var r=q[t];r&&r(L,null,0)}v.flush(),k&&k.update()}function r(){!Q&&q.length>0&&(Q=ve.next(e))}function n(){Q&&(ve.cancel(e),Q=null)}function a(t){t.preventDefault(),b=!0,n(),G.forEach(function(t){t()})}function i(t){v.getError(),b=!1,x.restore(),P.restore(),R.restore(),z.restore(),F.restore(),B.restore(),k&&k.restore(),N.procs.refresh(),r(),X.forEach(function(t){t()})}function o(){q.length=0,n(),V&&(V.removeEventListener(eo,a),V.removeEventListener(ro,i)),P.clear(),B.clear(),F.clear(),z.clear(),I.clear(),R.clear(),k&&k.clear(),Z.forEach(function(t){t()})}function s(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var a=t[n];me.isDynamic(a)?r[n]=me.unbox(a,n):e[n]=a}),{dynamic:r,static:e}}function r(t){for(;d.length0)return f.call(this,r(0|t),0|t)}else{if(!Array.isArray(t))return c.call(this,t);if(t.length)return f.call(this,t,t.length)}}de(!!t,"invalid args to regl({...})"),de.type(t,"object","invalid args to regl({...})");var a=e(t.context||{}),i=e(t.uniforms||{}),o=e(t.attributes||{}),s=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=Jt({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),l={gpuTime:0,cpuTime:0,count:0},u=N.compile(s,o,i,a,l),c=u.draw,f=u.batch,h=u.scope,d=[];return Jt(n,{stats:l})}function l(t,e){var r=0;N.procs.poll();var n=e.color;n&&(v.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=$i),"depth"in e&&(v.clearDepth(+e.depth),r|=Ki),"stencil"in e&&(v.clearStencil(0|e.stencil),r|=Ji),de(!!r,"called regl.clear with no buffer specified"),v.clear(r)}function u(t){if(de("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)$(Jt({framebuffer:t.framebuffer.faces[e]},t),l);else $(t,l);else l(null,t)}function c(t){function e(){function e(){var t=Zt(q,e);q[t]=q[q.length-1],q.length-=1,q.length<=0&&n()}var r=Zt(q,t);de(r>=0,"cannot cancel a frame twice"),q[r]=e}return de.type(t,"function","regl.frame() callback must be a function"),q.push(t),r(),{cancel:e}}function f(){var t=U.viewport,e=U.scissor_box;t[0]=t[1]=e[0]=e[1]=0,L.viewportWidth=L.framebufferWidth=L.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,L.viewportHeight=L.framebufferHeight=L.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function h(){L.tick+=1,L.time=p(),f(),N.procs.poll()}function d(){f(),N.procs.refresh(),k&&k.update()}function p(){return(ye()-M)/1e3}function g(t,e){de.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return c(e);case"lost":r=G;break;case"restore":r=X;break;case"destroy":r=Z;break;default:de.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:H,destroy:o,_gl:v,_refresh:d,poll:function(){h(),k&&k.update()},now:p,stats:w});return m.onDone(null,K),K}var $t={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Kt=function(t){return Object.prototype.toString.call(t)in $t},Jt=function(t,e){for(var r=Object.keys(e),n=0;n=2,"invalid renderbuffer shape"),i=0|d[0],o=0|d[1]}else"radius"in h&&(i=o=0|h.radius),"width"in h&&(i=0|h.width),"height"in h&&(o=0|h.height);"format"in h&&(de.parameter(h.format,u,"invalid renderbuffer format"),l=u[h.format])}else"number"==typeof e?(i=0|e,o="number"==typeof n?0|n:i):e?de.raise("invalid arguments to renderbuffer constructor"):i=o=1;if(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),i!==f.width||o!==f.height||l!==f.format)return s.width=f.width=i,s.height=f.height=o,f.format=l,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,l,i,o),a.profile&&(f.stats.size=Rt(f.format,f.width,f.height)),s.format=c[f.format],s}function l(e,n){var i=0|e,o=0|n||i;return i===f.width&&o===f.height?s:(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=f.width=i,s.height=f.height=o,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,f.format,i,o),a.profile&&(f.stats.size=Rt(f.format,f.width,f.height)),s)}var f=new i(t.createRenderbuffer());return h[f.id]=f,n.renderbufferCount++,s(e,o),s.resize=l,s._reglType="renderbuffer",s._renderbuffer=f,a.profile&&(s.stats=f.stats),s.destroy=function(){f.decRef()},s}function l(){xe(h).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(xn,e.renderbuffer),t.renderbufferStorage(xn,e.format,e.width,e.height)}),t.bindRenderbuffer(xn,null)}var u={rgba4:_n,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(u.srgba=35907),e.ext_color_buffer_half_float&&(u.rgba16f=34842,u.rgb16f=34843),e.webgl_color_buffer_float&&(u.rgba32f=34836);var c=[];Object.keys(u).forEach(function(t){var e=u[t];c[e]=t});var f=0,h={};return i.prototype.decRef=function(){--this.refCount<=0&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:s,clear:function(){xe(h).forEach(o)},restore:l}},kn=36160,Mn=36161,Tn=3553,En=34069,Ln=36064,Sn=36096,Cn=36128,On=33306,Rn=36053,In=6402,Dn=[6408],Pn=[];Pn[6408]=4;var zn=[];zn[5121]=1,zn[5126]=4,zn[36193]=2;var Fn=33189,Bn=36168,Nn=34041,jn=[32854,32855,36194,35907,34842,34843,34836],Hn={};Hn[Rn]="complete",Hn[36054]="incomplete attachment",Hn[36057]="incomplete dimensions",Hn[36055]="incomplete, missing attachment",Hn[36061]="unsupported";var Un=5126,Vn=35632,qn=35633,Gn=35718,Xn=35721,Yn=6408,Wn=5121,Zn=3333,Qn=5126,$n="xyzw".split(""),Kn=5121,Jn=1,ta=2,ea=0,ra=1,na=2,aa=3,ia=4,oa="dither",sa="blend.enable",la="blend.color",ua="blend.equation",ca="blend.func",fa="depth.enable",ha="depth.func",da="depth.range",pa="depth.mask",ga="colorMask",ma="cull.enable",va="cull.face",ya="frontFace",ba="lineWidth",xa="polygonOffset.enable",_a="polygonOffset.offset",wa="sample.alpha",Aa="sample.enable",ka="sample.coverage",Ma="stencil.enable",Ta="stencil.mask",Ea="stencil.func",La="stencil.opFront",Sa="stencil.opBack",Ca="scissor.enable",Oa="scissor.box",Ra="viewport",Ia="profile",Da="framebuffer",Pa="vert",za="frag",Fa="elements",Ba="primitive",Na="count",ja="offset",Ha="instances",Ua=Da+"Width",Va=Da+"Height",qa=Ra+"Width",Ga=Ra+"Height",Xa="drawingBufferWidth",Ya="drawingBufferHeight",Wa=[ca,ua,Ea,La,Sa,ka,Ra,Oa,_a],Za=34962,Qa=34963,$a=3553,Ka=34067,Ja=2884,ti=3042,ei=3024,ri=2960,ni=2929,ai=3089,ii=32823,oi=32926,si=32928,li=5126,ui=35664,ci=35665,fi=35666,hi=5124,di=35667,pi=35668,gi=35669,mi=35670,vi=35671,yi=35672,bi=35673,xi=35674,_i=35675,wi=35676,Ai=35678,ki=35680,Mi=4,Ti=1028,Ei=1029,Li=2304,Si=2305,Ci=32775,Oi=32776,Ri=519,Ii=7680,Di=0,Pi=1,zi=32774,Fi=513,Bi=36160,Ni=36064,ji={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Hi=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Ui={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Vi={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},qi={frag:35632,vert:35633},Gi={cw:Li,ccw:Si},Xi=new Vt(!1,!1,!1,function(){}),Yi=34918,Wi=34919,Zi=35007,Qi=function(t,e){function r(){return h.pop()||f.createQueryEXT()}function n(t){h.push(t)}function a(t){var e=r();f.beginQueryEXT(Zi,e),d.push(e),u(d.length-1,d.length,t)}function i(){f.endQueryEXT(Zi)}function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}function s(){return p.pop()||new o}function l(t){p.push(t)}function u(t,e,r){var n=s();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,g.push(n)}function c(){var t,e,r=d.length;if(0!==r){v.length=Math.max(v.length,r+1),m.length=Math.max(m.length,r+1),m[0]=0,v[0]=0;var a=0;for(t=0,e=0;e=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+=t,i=i.substr(0,r)}var a,i="";e.exports=n},{}],175:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",i(t.slice(0,e)),",",i(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(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=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=i*u,p=o*l,g=o*s,v=a*u,y=a*l,b=i*s,x=c*(d-p)+f*(g-v)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:m(t,e,r,n)}];!function(){for(;v.length<=p;)v.push(l(v.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&s>0||o<0&&s<0)return!1;var l=i(r,t,e),u=i(a,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,a))}e.exports=a;var i=t("robust-orientation")[3]},{"robust-orientation":176}],180:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,a=r-n,i=e-n,o=t-a,s=o+i;return s?[s,r]:[r]}function a(t,e){var r=0|t.length,a=0|e.length;if(1===r&&1===a)return n(t[0],-e[0]);var i,o,s=r+a,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],m=h(g);p=a?(i=d,(c+=1)=a?(i=d,(c+=1)0?1:0}},{}],183:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],184:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,a=t.length;n>1,s=o(t[i],e);s<=0?(0===s&&(a=i),r=i+1):s>0&&(n=i-1)}return a}function f(t,e){for(var r=new Array(t.length),n=0,a=r.length;n=t.length||0!==o(t[g],i))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(a[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,a=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){if(e0){var t=k[0];return i(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=k[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var a=t[n];if(!b[n]||a<0||a===n)break;if(n=a,a=t[n],!b[n]||a<0||a===n)break;n=a,r=t[r]}while(r!==n);for(var i=e;i!==n;i=t[i])t[i]=n;return n}for(var p=e.length,g=t.length,m=new Array(p),v=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=m[t],r=v[t];m[r]>=0&&(m[r]=e),v[e]>=0&&(v[e]=r),M[e]>=0&&h(M[e],a(e)),M[r]>=0&&h(M[r],a(r))}}(E)}for(var L=[],x=0;x=0&&r>=0&&e!==r){var n=M[e],a=M[r];n!==a&&S.push([n,a])}}),o.unique(o.normalize(S)),{positions:L,edges:S}}e.exports=a;var i=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":176,"simplicial-complex":184}],187:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var a=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?a-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],a=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=i(r,a,s),u=i(r,a,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=i(s,o,a),u=i(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 a[0]-s[0]}e.exports=a;var i=t("robust-orientation")},{"robust-orientation":176}],188:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function a(t,e){return t.y-e}function i(t,e){for(var r=null;t;){var n,a,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=i(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=i(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,a=new Array(r),i=0;i0){var s=i(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],a);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":187,"binary-search-bounds":28,"functional-red-black-tree":68,"robust-orientation":176}],189:[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 a(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function i(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="",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,"")),f=u[4]?"0"===u[4]?"0":u[4].charAt(1):" ",h=u[6]-(y+n).length,c=u[6]&&h>0?i(f,h):"",m[m.length]=u[5]?y+n+c:"0"===f?y+c+n:c+y+n)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],a=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]){a|=1;var i=[],s=r[2],l=[];if(null===(l=o.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i[i.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=o.key_access.exec(s)))i[i.length]=l[1];else{if(null===(l=o.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");i[i.length]=l[1]}r[2]=i}else a|=2;if(3===a)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)};void 0!==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)},{}],190:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in a?a[t]:""}).join("")}e.exports=n;var a={" ":" ",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"}},{}],191:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],a="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 i=[],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),m=new Array(r),v=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+m[x]+"*c");var T=p[x].length/y*.5,E=.5+v[x]/y*.5;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,m=-.5*h,d=0;d=0?1.2:1))}function a(t,e,r,n,a,o,s){for(var l=0;l.5?l/(2-i-o):l/(i+o),i){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 a,i,o;if(t=E(t,360),e=E(e,100),r=E(r,100),0===e)a=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;a=n(l,s,t+1/3),i=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*a,g:255*i,b:255*o}}function l(t,e,r){t=E(t,255),e=E(e,255),r=E(r,255);var n,a,i=q(t,e,r),o=V(t,e,r),s=i,l=i-o;if(a=0===i?0:l/i,i==o)n=0;else{switch(i){case t:n=(e-r)/l+(e>1)+720)%360;--e;)a.h=(a.h+i)%360,o.push(n(a));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,i=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:a,s:i,v:o})),o=(o+l)%1;return s}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){C(t)&&(t="100%");var n=O(t);return t=V(r,q(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 V(1,q(0,t))}function S(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function O(t){return"string"==typeof t&&t.indexOf("%")!=-1}function R(t){return 1==t.length?"0"+t:""+t}function I(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function P(t){return S(t)/255}function z(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(N,"").replace(j,"").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:P(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:P(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 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 N=/^\s+/,j=/\s+$/,H=0,U=e.round,V=e.min,q=e.max,G=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,i,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),i=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*a+.7152*i+.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),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(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*E(this._r,255))+"%",g:U(100*E(this._g,255))+"%",b:U(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*E(this._r,255))+"%, "+U(100*E(this._g,255))+"%, "+U(100*E(this._b,255))+"%)":"rgba("+U(100*E(this._r,255))+"%, "+U(100*E(this._g,255))+"%, "+U(100*E(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,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);r="#"+h(i._r,i._g,i._b,i._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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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 a in t)t.hasOwnProperty(a)&&(r[a]="a"===a?t[a]:I(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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),i=n(e).toRgb(),o=r/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var a=n(t),i=n(r);return(e.max(a.getLuminance(),i.getLuminance())+.05)/(e.min(a.getLuminance(),i.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,i,o=n.readability(t,e);switch(i=!1,a=B(r),a.level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,e,r){var a,i,o,s,l=null,u=0;r=r||{},i=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=a,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!i?l:(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"},Y=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],195:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*i(r[1],t)}function a(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var a=n(r,"font-size")/128;return e.removeChild(r),a}function i(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 a(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=i;var s=96},{"parse-unit":161}],196:[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 m(t){return new DataView(o(t),0,t)}function v(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=i,r.freeArrayBuffer=a,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 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=f,r.mallocInt32=h,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,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:62}],200:[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 i=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":56}],209:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,a(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var a=t("./lib/zc-core")},{"./lib/zc-core":208}],210:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../color"),i=t("../../plots/cartesian/axes"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,o,r,a)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;u("opacity");var h=u("bgcolor"),d=u("bordercolor"),p=a.opacity(d);u("borderpad");var g=u("borderwidth"),m=u("showarrow");u("text",m?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font),u("width"),u("align"),u("height")&&u("valign");for(var v=["x","y"],y=[-10,-30],b={_fullLayout:r},x=0;x<2;x++){var _=v[x],w=i.coerceRef(t,e,b,_,"","paper");if(i.coercePosition(e,b,u,w,_,.5),m){var A="a"+_,k=i.coerceRef(t,e,b,A,"pixel");"pixel"!==k&&k!==w&&(k=e[A]="pixel");var M="pixel"===k?y[x]:.4;i.coercePosition(e,b,u,k,A,M)}u(_+"anchor"),u(_+"shift")}if(n.noneOrAll(t,e,["x","y"]),m&&(u("arrowcolor",p?e.bordercolor:a.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(p&&g||1)),u("standoff"),n.noneOrAll(t,e,["ax","ay"])),f){var T=u("xclick"),E=u("yclick");e._xclick=void 0===T?e.x:T,e._yclick=void 0===E?e.y:E}var L=u("hovertext"),S=r.hoverlabel||{};if(L){var C=u("hoverlabel.bgcolor",S.bgcolor||(a.opacity(h)?a.rgb(h):a.defaultLine)),O=u("hoverlabel.bordercolor",S.bordercolor||a.contrast(C));n.coerceFont(u,"hoverlabel.font",{family:S.font.family,size:S.font.size,color:S.font.color||O})}return u("captureevents",!!L),e}},{"../../lib":336,"../../plots/cartesian/axes":374,"../color":221,"./attributes":212}],211:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],212:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=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({},a,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":330,"../../plots/cartesian/constants":379,"../../plots/font_attributes":398,"./arrow_paths":211}],213:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=i.getFromId(t,e.xref),o=i.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(i.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),i.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):i.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(i.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),i.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):i.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});if(i.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return a.syncOrAsync([o,n],t)}}},{"../../lib":336,"../../plots/cartesian/axes":374,"./draw":217}],214:[function(t,e,r){"use strict";function n(t,e){var r=i(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=i(t,e),a=n.on,s=n.off.concat(n.explicitOff),l={};if(a.length||s.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var n=z.selectAll("a");if(1===n.size()&&n.text()===z.text()){L.insert("a",":first-child").attr({"xlink:xlink:href":n.attr("xlink:href"),"xlink:xlink:show":n.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(R.node())}z.selectAll("tspan.line").attr({y:0,x:0});var a=L.select(".annotation-math-group"),d=!a.empty(),p=h.bBox((d?a:z).node()),b=p.width,C=p.height,P=x.width||b,F=x.height||C,B=Math.round(P+2*O),N=Math.round(F+2*O);x._w=P,x._h=F;var j=!1;if(["x","y"].forEach(function(e){var n,a,i,o,s,f=x[e+"ref"]||e,h=x["a"+e+"ref"],d=c.getFromId(t,f),p=(M+("x"===e?0:-90))*Math.PI/180,g=B*Math.cos(p),m=N*Math.sin(p),v=Math.abs(g)+Math.abs(m),b=x[e+"anchor"],_=x[e+"shift"]*("x"===e?1:-1),w=k[e];if(d){var A=d.r2fraction(x[e]);if((t._dragging||!d.autorange)&&(A<0||A>1)&&(h===f?((A=d.r2fraction(x["a"+e]))<0||A>1)&&(j=!0):j=!0,j))return;n=d._offset+d.r2p(x[e]),o=.5}else"x"===e?(i=x[e],n=y.l+y.w*i):(i=1-x[e],n=y.t+y.h*i),o=x.showarrow?.5:i;if(x.showarrow){w.head=n;var T=x["a"+e];s=g*r(.5,x.xanchor)-m*r(.5,x.yanchor),h===f?(w.tail=d._offset+d.r2p(T),a=s):(w.tail=n+T,a=s+T),w.text=w.tail+s;var E=l["x"===e?"width":"height"];if("paper"===f&&(w.head=u.constrain(w.head,1,E-1)),"pixel"===h){var L=-Math.max(w.tail-3,w.text),S=Math.min(w.tail+3,w.text)-E;L>0?(w.tail+=L,w.text+=L):S>0&&(w.tail-=S,w.text-=S)}w.tail+=_,w.head+=_}else s=v*r(o,b),a=s,w.text=n+s;w.text+=_,s+=_,a+=_,x["_"+e+"padplus"]=v/2+a,x["_"+e+"padminus"]=v/2-a,x["_"+e+"size"]=v,x["_"+e+"shift"]=s}),j)return void L.remove();var H=0,U=0;if("left"!==x.align&&(H=(P-b)*("center"===x.align?.5:1)),"top"!==x.valign&&(U=(F-C)*("middle"===x.valign?.5:1)),d)a.select("svg").attr({x:O+H-1,y:O+U}).call(h.setClipUrl,I?_:null);else{var V=O+U-p.top,q=O+H-p.left;z.attr({x:q,y:V}).call(h.setClipUrl,I?_:null),z.selectAll("tspan.line").attr({y:V,x:q})}D.select("rect").call(h.setRect,O,O,P,F),R.call(h.setRect,S/2,S/2,B-S,N-S),L.call(h.setTranslate,Math.round(k.x.text-B/2),Math.round(k.y.text-N/2)),E.attr({transform:"rotate("+M+","+k.x.text+","+k.y.text+")"});var G="annotations["+e+"]",X=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var a=k.x.head,l=k.y.head,c=k.x.tail+r,d=k.y.tail+n,p=k.x.text+r,g=k.y.text+n,b=u.rotationXYMatrix(M,p,g),_=u.apply2DTransform(b),S=u.apply2DTransform2(b),C=+R.attr("width"),O=+R.attr("height"),I=p-.5*C,D=I+C,P=g-.5*O,z=P+O,F=[[I,P,I,z],[I,z,D,z],[D,z,D,P],[D,P,I,P]].map(S);if(!F.reduce(function(t,e){return t^!!i(a,l,a+1e6,l+1e6,e[0],e[1],e[2],e[3])},!1)){F.forEach(function(t){var e=i(c,d,a,l,t[0],t[1],t[2],t[3]);e&&(c=e.x,d=e.y)});var B=x.arrowwidth,N=x.arrowcolor,j=T.append("g").style({opacity:f.opacity(N)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),H=j.append("path").attr("d","M"+c+","+d+"L"+a+","+l).style("stroke-width",B+"px").call(f.stroke,f.rgb(N));if(v(H,x.arrowhead,"end",x.arrowsize,x.standoff),t._context.editable&&H.node().parentNode){var U=a,V=l;if(x.standoff){var q=Math.sqrt(Math.pow(a-c,2)+Math.pow(l-d,2));U+=x.standoff*(c-a)/q,V+=x.standoff*(d-l)/q}var X,Y,W,Z=j.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(c-U)+","+(d-V),transform:"translate("+U+","+V+")"}).style("stroke-width",B+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");m.init({element:Z.node(),prepFn:function(){var t=h.getTranslate(L);Y=t.x,W=t.y,X={},w&&w.autorange&&(X[w._name+".autorange"]=!0),A&&A.autorange&&(X[A._name+".autorange"]=!0)},moveFn:function(t,e){var r=_(Y,W),n=r[0]+t,a=r[1]+e;L.call(h.setTranslate,n,a),X[G+".x"]=w?w.p2r(w.r2p(x.x)+t):x.x+t/y.w,X[G+".y"]=A?A.p2r(A.r2p(x.y)+e):x.y-e/y.h,x.axref===x.xref&&(X[G+".ax"]=w.p2r(w.r2p(x.ax)+t)),x.ayref===x.yref&&(X[G+".ay"]=A.p2r(A.r2p(x.ay)+e)),j.attr("transform","translate("+t+","+e+")"),E.attr({transform:"rotate("+M+","+n+","+a+")"})},doneFn:function(e){if(e){s.relayout(t,X);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(x.showarrow&&X(0,0),t._context.editable){var Y,W;m.init({element:L.node(),prepFn:function(){W=E.attr("transform"),Y={}},moveFn:function(t,e){var r="pointer";if(x.showarrow)x.axref===x.xref?Y[G+".ax"]=w.p2r(w.r2p(x.ax)+t):Y[G+".ax"]=x.ax+t,x.ayref===x.yref?Y[G+".ay"]=A.p2r(A.r2p(x.ay)+e):Y[G+".ay"]=x.ay+e,X(t,e);else{if(w)Y[G+".x"]=x.x+t/w._m;else{var n=x._xsize/y.w,a=x.x+(x._xshift-x.xshift)/y.w-n/2;Y[G+".x"]=m.align(a+t/y.w,n,0,1,x.xanchor)}if(A)Y[G+".y"]=x.y+e/A._m;else{var i=x._ysize/y.h,o=x.y-(x._yshift+x.yshift)/y.h-i/2;Y[G+".y"]=m.align(o-e/y.h,i,0,1,x.yanchor)}w&&A||(r=m.getCursor(w?.5:Y[G+".x"],A?.5:Y[G+".y"],x.xanchor,x.yanchor))}E.attr({transform:"translate("+t+","+e+")"+W}),g(L,r)},doneFn:function(e){if(g(L),e){s.relayout(t,Y);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var a=t.layout,l=t._fullLayout,y=t._fullLayout._size;l._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var b=(a.annotations||[])[e],x=l.annotations[e],_="clip"+l._uid+"_ann"+e;if(!b||x.visible===!1)return void o.selectAll("#"+_).remove();var w=c.getFromId(t,x.xref),A=c.getFromId(t,x.yref),k={x:{},y:{}},M=+x.textangle||0,T=l._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",x.opacity),E=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),L=E.append("g").style("pointer-events",x.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:b,fullAnnotation:x,event:o.event})});x.hovertext&&L.on("mouseover",function(){var e=x.hoverlabel,r=e.font,n=this.getBoundingClientRect(),a=t.getBoundingClientRect();d.loneHover({x0:n.left-a.left,x1:n.right-a.left,y:(n.top+n.bottom)/2-a.top,text:x.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:l._hoverlayer.node(),outerContainer:l._paper.node()})}).on("mouseout",function(){d.loneUnhover(l._hoverlayer.node())}) -;var S=x.borderwidth,C=x.borderpad,O=S+C,R=L.append("rect").attr("class","bg").style("stroke-width",S+"px").call(f.stroke,x.bordercolor).call(f.fill,x.bgcolor),I=x.width||x.height,D=l._defs.select(".clips").selectAll("#"+_).data(I?[0]:[]);D.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),D.exit().remove();var P=x.font,z=L.append("text").classed("annotation",!0).attr("data-unformatted",x.text).text(x.text);t._context.editable?z.call(p.makeEditable,L).call(r).on("edit",function(n){x.text=n,this.attr({"data-unformatted":x.text}),this.call(r);var a={};a["annotations["+e+"].text"]=x.text,w&&w.autorange&&(a[w._name+".autorange"]=!0),A&&A.autorange&&(a[A._name+".autorange"]=!0),s.relayout(t,a)}):z.call(r)}function i(t,e,r,n,a,i,o,s){var l=r-t,u=a-t,c=o-a,f=n-e,h=i-e,d=s-i,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,m=(u*f-l*h)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var o=t("d3"),s=t("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),m=t("../dragelement"),v=t("./draw_arrow_head");e.exports={draw:n,drawOne:a}},{"../../lib":336,"../../lib/setcursor":351,"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/cartesian/axes":374,"../../plots/plots":406,"../color":221,"../dragelement":242,"../drawing":245,"../fx":262,"./draw_arrow_head":218,d3:60}],218:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,a){d.path&&(e>5&&(a=0),n.select(h.parentElement).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}a(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,m,v,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||i.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,A=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-g.x,M=p.y-g.y;if(m=Math.atan2(M,k),v=m+Math.PI,A){if(A*A>k*k+M*M)return void c();var T=A*Math.cos(m),E=A*Math.sin(m);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var L=h.getTotalLength(),S="";if(L=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var a=t("tinycolor2"),i=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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(a(t))},o.opacity=function(t){return t?a(t).getAlpha():0},o.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||u).toRgb(),i=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},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return a(o).toRgbString()},o.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).toString()},o.stroke=function(t,e){var r=a(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=a(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,a,i,s=Object.keys(t);for(e=0;es&&(i[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,i[1]*=-1;else{J.domain[0]+=st/T.h;var u=Math.max(1,r.selectAll("tspan.line").size());i[1]+=(1-u)*s}e.attr("transform","translate("+i+")"),J.setScale()}}it.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-J.domain[1]))+")");var f=it.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 i=R(t).replace("e-",""),o=a(i).toHexString();n.select(this).attr({x:Y,width:Math.max(j,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=it.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,O(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,a=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:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,a=x();n=s.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var i={propContainer:J,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:it.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(i,r||{}))}function k(){var r=j+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,a=ot.select(".h"+J._id+"title-math-group").node();n=a&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(a).width:d.bBox(ot.node()).right-Y-T.l,r=Math.max(r,n)}var i=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=Q-$;it.select(".cbbg").attr({x:Y-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:$-G,width:Math.max(i,2),height:Math.max(s+2*G,2)}).call(p.fill,_.bgcolor).call(p.stroke,_.bordercolor).style({"stroke-width":_.borderwidth}),it.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)*i;it.attr("transform","translate("+(T.l-l)+","+T.t+")"),o.autoMargin(t,e,{x:_.x,y:_.y,l:i*({right:1,center:.5}[_.xanchor]||0),r:i*({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=[],O="function"==typeof _.line.color?_.line.color:function(){return _.line.color},R="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},I=_.levels.end+_.levels.size/100,D=_.levels.size,P=1.001*L[0]-.001*L[1],z=1.001*L[1]-.001*L[0];for(E=_.levels.start;(E-I)*D<0;E+=D)E>P&&EL[0]&&E1){var at=Math.pow(10,Math.floor(Math.log(nt)/Math.LN10));et*=at*c.roundUp(nt/at,[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 it=M._infolayer.selectAll("g."+e).data([0]);it.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)}),it.attr("transform","translate("+Math.round(T.l)+","+Math.round(T.t)+")");var ot=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(T.l)+",-"+Math.round(T.t)+")");J._axislayer=it.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:it.node(),prepFn:function(){ht=it.attr("transform"),h(it)},moveFn:function(t,e){it.attr("transform",ht+" translate("+t+","+e+")"),dt=u.align(W+t/T.w,H,0,1,_.xanchor),pt=u.align(Z-e/T.h,V,0,1,_.yanchor);var r=u.getCursor(dt,pt,_.xanchor,_.yanchor);h(it,r)},doneFn:function(e){h(it),e&&void 0!==dt&&void 0!==pt&&i.restyle(t,{"colorbar.x":dt,"colorbar.y":pt},x().index)}})}return ft}function x(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,l.colorscale=g,s.reversescale&&(g=i(g)),s.colorscale=g)}},{"../../lib":336,"./flip_scale":232,"./scales":239}],228:[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":330,"./attributes":226,"./scales.js":239}],229:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":239}],230:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=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?a.nestedProperty(t,d).get()||{}:t,g=f?a.nestedProperty(e,d).get()||{}:e,m=p[h+"min"],v=p[h+"max"],y=p.colorscale;u(f+h+"auto",!(n(m)&&n(v)&&m=0;a--,i++)e=t[a],n[i]=[1-e[0],e[1]];return n}},{}],233:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),i=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()),i(t)?t:e):e}},{"./default_scale":229,"./is_valid_scale_array":237,"./scales":239}],234:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./is_valid_scale");e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],241:[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,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":336}],242:[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&&i.plot(t)}var i=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return t.element.onmousemove=g,m._dragged=!1,m._dragging=!0,c=e.clientX,f=e.clientY,p=e.target,h=(new Date).getTime(),h-m._mouseDownTimey&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(m._dragged,v,e),!m._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(m),m._dragged=!1,o.pauseEvent(e)}var c,f,h,d,p,g,m=o.getPlotDiv(t.element)||{},v=1,y=l.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),g=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=n},{"../../constants/interactions":319,"../../lib":336,"../../plotly":369,"../../plots/cartesian/constants":379,"./align":240,"./cursor":241,"./unhover":243}],243:[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,a=t._hoverdata;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":329}],244:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],245:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){if(l.traceIs(r,"symbols")){var c=g(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===i.size?3:p.isBubble(r)?c(t.ms):(i.size||6)/2,t.mrc=e;var n=m.symbolNumber(t.mx||i.symbol)||0,a=n%100;return t.om=n%200>=100,m.symbolFuncs[a](e)+(n>=200?b:"")}).style("opacity",function(t){return(t.mo+1||i.opacity+1)-1})}var f,h,d,v=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=i.outliercolor):(d=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(o.color)?u.defaultLine:o.color,Array.isArray(i.color)&&(f=u.defaultLine,v=!0),f="mc"in t?t.mcc=n(t.mc):i.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var y=i.gradient,x=t.mgt;if(x?v=!0:x=y&&y.type,x&&"none"!==x){var _=t.mgc;_?v=!0:_=y.color;var w="g"+s._fullLayout._uid+"-"+r.uid;v&&(w+="-"+t.i),e.call(m.gradient,s,w,x,f,_)}else e.call(u.fill,f);d&&e.call(u.stroke,h)}}function a(t,e,r,n){var a=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+o*o,A/2),c=Math.pow(s*s+l*l,A/2),f=(c*c*a-u*u*s)*n,h=(c*c*o-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[i.round(e[0]+(d&&f/d),2),i.round(e[1]+(d&&h/d),2)],[i.round(e[0]-(p&&f/p),2),i.round(e[1]-(p&&h/p),2)]]}var i=t("d3"),o=t("fast-isnumeric"),s=t("tinycolor2"),l=t("../../registry"),u=t("../color"),c=t("../colorscale"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.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(u.fill,n)},m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},m.setRect=function(t,e,r,n,a){t.call(m.setPosition,e,r).call(m.setSize,n,a)},m.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),i=t.yp||n.c2p(t.y);return o(a)&&o(i)&&e.node()?("text"===e.node().nodeName?e.attr("x",a).attr("y",i):e.attr("transform","translate("+a+","+i+")"),!0):(e.remove(),!1)},m.translatePoints=function(t,e,r,n){t.each(function(t){var a=i.select(this);m.translatePoint(t,a,e,r,n)})},m.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},m.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},m.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";u.stroke(e,n||i.color),m.dashLine(e,s,o)}, -m.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,s=n||a.dash||"";i.select(this).call(u.stroke,r||a.color).call(m.dashLine,s,o)})},m.dashLine=function(t,e,r){r=+r||0,e=m.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},m.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=i.select(this);try{r.call(u.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),r.remove()}})};var v=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];m.symbolList=m.symbolList.concat([e.n,t,e.n+100,t+"-open"]),m.symbolNames[e.n]=t,m.symbolFuncs[e.n]=e.f,e.needLine&&(m.symbolNeedLines[e.n]=!0),e.noDot?m.symbolNoDot[e.n]=!0:m.symbolList=m.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=m.symbolNames.length,b="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>=y||t>=400?0:Math.floor(Math.max(t,0))};var x={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};m.gradient=function(t,e,r,n,a,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+o],f.identity);l.exit().remove(),l.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=i.select(this);"horizontal"===n?t.attr(x):"vertical"===n&&t.attr(_),t.attr("id",r);var e=s(a),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},m.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},m.singlePointStyle=function(t,e,r,a,i,o){var s=r.marker;n(t,e,r,a,i,s,s.line,o)},m.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=m.tryColorscale(r,""),a=m.tryColorscale(r,"line"),o=f.getPlotDiv(t.node());t.each(function(t){m.singlePointStyle(t,i.select(this),e,n,a,o)})}},m.tryColorscale=function(t,e){var r=e?f.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)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};m.textPointStyle=function(t,e){t.each(function(t){var r=i.select(this),n=t.tx||e.text;if(!n||Array.isArray(n))return void r.remove();var a=t.tp||e.textposition,s=a.indexOf("top")!==-1?"top":a.indexOf("bottom")!==-1?"bottom":"middle",l=a.indexOf("left")!==-1?"end":a.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(m.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(n).call(h.convertToTspans);var f=i.select(this.parentNode),d=r.selectAll("tspan.line"),p=1.3*((d[0].length||1)-1)+1,g=w[l]*c,v=.75*u+w[s]*c+(w[s]-1)*p*u/2;f.attr("transform","translate("+g+","+v+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var A=.5;m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(i.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(l),f.extendFlat({},l)},m.setClipUrl=function(t,e){if(!e)return void t.attr("clip-path",null);var r="#"+e,n=i.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")},m.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||0,y:+n[1]||0}},m.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||0,r=r||0,i=i.replace(/(\btranslate\(.*?\);?)/,"").trim(),i+=" translate("+e+", "+r+")",i=i.trim(),t[a]("transform",i),i},m.getScale=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||1,y:+n[1]||1}},m.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",i=t[n]("transform")||"";return e=e||1,r=r||1,i=i.replace(/(\bscale\(.*?\);?)/,"").trim(),i+=" scale("+e+", "+r+")",i=i.trim(),t[a]("transform",i),i},m.setPointGroupScale=function(t,e,r){var n,a,i;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",i=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(i,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};m.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=i.select(this),a=n.select("text"),o=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(n.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})},m.measureText=function(t,e,r){var n=t.append("text").text(e).call(m.font,r),a=m.bBox(n.node());return n.remove(),a}},{"../../constants/xmlns_namespaces":322,"../../lib":336,"../../lib/svg_text_utils":355,"../../registry":413,"../../traces/scatter/make_bubble_size_func":483,"../../traces/scatter/subtypes":488,"../color":221,"../colorscale":235,"./symbol_defs":246,d3:60,"fast-isnumeric":66,tinycolor2:194}],246:[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,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),i=n.round(t*-.309,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.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),i=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);return"M"+r+","+l+"H"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+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),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),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(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:60}],247:[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"}}}},{}],248:[function(t,e,r){"use strict";function n(t,e,r,n){var i=e["error_"+n]||{},l=i.visible&&["linear","log"].indexOf(r.type)!==-1,u=[];if(l){for(var c=s(i),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=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);c&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=a.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&i(o.x)&&i(o.yh)&&i(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 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",f)}if(h.visible&&i(o.y)&&i(o.xh)&&i(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(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":488,d3:60,"fast-isnumeric":66}],253:[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||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)})}},{"../color":221,d3:60}],254:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":330,"../../plots/font_attributes":398}],255:[function(t,e,r){"use strict";function n(t,e,r){Array.isArray(t)&&(e[0][r]=t)}var a=t("../../lib"),i=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=0;r=0&&r.index$.width||Z<0||Z>$.height)return b.unhoverRaw(t,e)}if(I="xval"in e?w.flat(n,e.xval):w.p2c(T,W),D="yval"in e?w.flat(n,e.yval):w.p2c(E,Z),!f(I[0])||!f(D[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var K=1/0;for(z=0;z1||B.hoverinfo.indexOf("name")!==-1?B.name:void 0,index:!1,distance:Math.min(K,A.MAXDIST),color:y.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},h[N]&&(q.subplot=h[N]._subplot),G=X.length,"array"===H){var J=e[z];"pointNumber"in J?(q.index=J.pointNumber,H="closest"):(H="","xval"in J&&(U=J.xval,H="x"),"yval"in J&&(V=J.yval,H=H?"closest":"y"))}else U=I[j],V=D[j];if(B._module&&B._module.hoverPoints){var tt=B._module.hoverPoints(q,U,V,H);if(tt)for(var et,rt=0;rtG&&(X.splice(0,G),K=X[0].distance)}if(0===X.length)return b.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,at=[];for(P=0;P1,lt=y.combine(h.plot_bgcolor||y.background,h.paper_bgcolor),ut={hovermode:R,rotateLabels:st,bgColor:lt,container:h._hoverlayer,outerContainer:h._paperdiv,commonLabelOpts:h.hoverlabel},ct=a(X,ut);if(i(X,st?"xa":"ya"),o(ct,st),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,at);m(c.select(e.target),ft?"pointer":"")}e.target&&u(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:E,xvals:I,yvals:D}))}function a(t,e){var r,n,a=e.hovermode,i=e.rotateLabels,o=e.bgColor,s=e.container,l=e.outerContainer,u=e.commonLabelOpts||{},f=e.fontFamily||A.HOVERFONT,h=e.fontSize||A.HOVERFONTSIZE,d=t[0],p=d.xa,m=d.ya,b="y"===a?"yLabel":"xLabel",x=d[b],_=(String(x)||"").split(" ")[0],w=l.node().getBoundingClientRect(),M=w.top,T=w.width,E=w.height,L=d.distance<=A.MAXDIST&&("x"===a||"y"===a);for(r=0;r15&&(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):L&&t[a+"Label"]===x?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 d=e.select("text.nums").call(v.font,t.fontFamily||f,t.fontSize||h,t.fontColor||u).call(v.setPosition,0,0).text(n).attr("data-notex",1).call(g.convertToTspans);d.selectAll("tspan.line").call(v.setPosition,0,0);var p=e.select("text.name"),m=0;r&&r!==n?(p.call(v.font,t.fontFamily||f,t.fontSize||h,l).text(r).call(v.setPosition,0,0).attr("data-notex",1).call(g.convertToTspans),p.selectAll("tspan.line").call(v.setPosition,0,0),m=p.node().getBoundingClientRect().width+2*C):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var b,_,w=d.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,O=t.ya._offset+(t.y0+t.y1)/2,R=Math.abs(t.x1-t.x0),I=Math.abs(t.y1-t.y0),D=w.width+S+C+m;t.ty0=M-w.top,t.bx=w.width+2*C,t.by=w.height+2*C,t.anchor="start",t.txwidth=w.width,t.tx2width=m,t.offset=0,i?(t.pos=A,b=O+I/2+D<=E,_=O-I/2-D>=0,"top"!==t.idealAlign&&b||!_?b?(O+=I/2,t.anchor="start"):t.anchor="middle":(O-=I/2,t.anchor="end")):(t.pos=O,b=A+R/2+D<=T,_=A-R/2-D>=0,"left"!==t.idealAlign&&b||!_?b?(A+=R/2,t.anchor="start"):t.anchor="middle":(A-=R/2,t.anchor="end")),d.attr("text-anchor",t.anchor),m&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+O+")"+(i?"rotate("+k+")":""))}),I}function i(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;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-=i;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,a,i,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)?T: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+=a;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(i=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=i;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var m=f[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 o(t,e){t.each(function(t){var r=c.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),i={start:1,end:-1,middle:0}[t.anchor],o=i*(S+C),s=o+i*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2), -e&&(u*=-L,l=t.offset*E),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*S+l)+","+(S+u)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+l)+"V"+(u-S)+"Z"),a.call(v.setPosition,o+l,u+t.ty0-t.by/2+C).selectAll("tspan.line").attr({x:a.attr("x"),y:a.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(v.setPosition,s+i*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(v.setRect,s+(i-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(i[r])s=i[r];else if(a[r]){var l=a[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},a=t.cd[0],i=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t}function l(t,e){var r=e.hovermode,n=e.container,a=t[0],i=a.xa,o=a.ya,s=i.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=i._offset+(a.x0+a.x1)/2,f=o._offset+(a.y0+a.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(a.color,d)<1.5?y.contrast(d):a.color;if(l){var g=o.spikemode,m=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber))return!0}return!1}var c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),A=t("./constants"),k=A.YANGLE,M=Math.PI*k/180,T=1/Math.sin(M),E=Math.cos(M),L=Math.sin(M),S=A.HOVERARROWSIZE,C=A.HOVERTEXTPAD;r.hover=function(t,e,r){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+A.HOVERMINTIME)return n(t,e,r),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),i=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:i},l=a([r],s);return o(l,s.rotateLabels),l.node()}},{"../../lib":336,"../../lib/events":329,"../../lib/override_cursor":345,"../../lib/svg_text_utils":355,"../../plots/cartesian/axes":374,"../../registry":413,"../color":221,"../dragelement":242,"../drawing":245,"./constants":257,"./helpers":259,d3:60,"fast-isnumeric":66,tinycolor2:194}],261:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":336}],262:[function(t,e,r){"use strict";function n(t){var e=o.isD3Selection(t)?t:i.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){var n=t.hoverlabel||{},a=o.nestedProperty(n,r).get();return Array.isArray(a)?Array.isArray(e)&&Array.isArray(a[e[0]])?a[e[0]][e[1]]:a[e]:a}var i=t("d3"),o=t("../../lib"),s=t("../dragelement"),l=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:l.getDistanceFunction,getClosest:l.getClosest,inbox:l.inbox,castHoverOption:a,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":336,"../dragelement":242,"./attributes":254,"./calc":255,"./click":256,"./constants":257,"./defaults":258,"./helpers":259,"./hover":260,"./layout_attributes":263,"./layout_defaults":264,"./layout_global_defaults":265,d3:60}],263:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),i=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:i.HOVERFONT}),size:n({},a.size,{dflt:i.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":330,"../../plots/font_attributes":398,"./constants":257}],264:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],272:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:i({},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":330,"../../plots/font_attributes":398,"../color/attributes":220}],273:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],274:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return a.coerce(d,p,i,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1)!==!1){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),a.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),a.noneOrAll(d,p,["x","y"])}}},{"../../lib":336,"../../plots/layout_attributes":404,"../../registry":413,"./attributes":272,"./helpers":277}],275:[function(t,e,r){"use strict";function n(t,e){function r(r){y.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,s=p.traceIs(i,"pie"),l=i.index,u=s?n.label:i.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(u),e._context.editable&&!s?c.call(y.makeEditable).call(r).on("edit",function(t){this.attr({"data-unformatted":t}),this.text(t).call(r),this.text()||(t=" ");var a,i=n.trace._fullInput||{};if(["ohlc","candlestick"].indexOf(i.type)!==-1){var o=n.trace.transforms;a=o[o.length-1].direction+".name"}else a="name";f.restyle(e,a,t,l)}):c.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeT&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){i(t,e,n)},T):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,i(t,e,n))}})}function i(t,e,r){if(!e._dragged&&!e._editing){var n,a,i=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&M&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),M=!1):M=!1,p.traceIs(l,"pie")){var d=o.label,g=i.indexOf(d);1===r?g===-1?i.push(d):i.splice(g,1):2===r&&(i=[],e.calcdata[0].forEach(function(t){d!==t.label&&i.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===i.length&&g===-1&&(i=[])),f.relayout(e,"hiddenlabels",i)}else{var m,v=[],y=[];for(m=0;mtspan"),f=c[0].length||1;r=s*f,n=u.node()&&m.bBox(u.node()).width;var h=s*(.3+(1-f)/2);u.attr("y",h),c.attr("y",h)}r=Math.max(r,16)+3,a.height=r,a.width=n}function s(t,e,r){var n=t._fullLayout,a=n.legend,i=a.borderwidth,o=A.isGrouped(a);if(A.isVertical(a))o&&e.each(function(t,e){m.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;m.setTranslate(this,i,5+i+a.height+r/2),a.height+=r,a.width=Math.max(a.width,n)}),a.width+=45+2*i,a.height+=10+2*i,o&&(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];c.select(this).select(".legendtoggle").call(m.setRect,0,-r.height/2,(t._context.editable?0:a.width)+40,r.height)});else if(o){a.width=0,a.height=0;for(var s=[a.width],l=e.data(),u=0,f=l.length;un.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),m.setTranslate(this,i+y,5+i+e.height/2+p),a.width+=o+r,a.height=Math.max(a.height,e.height),y+=o+r,g=Math.max(e.height,g)}),a.width+=2*i,a.height+=10+2*i,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0];c.select(this).select(".legendtoggle").call(m.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";k.isRightAnchor(r)?n="right":k.isCenterAnchor(r)&&(n="center");var a="top";k.isBottomAnchor(r)?a="bottom":k.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 u(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),A=t("./helpers"),k=t("./anchor_utils"),M=!0,T=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(m.setTranslate,0,e),C.call(m.setRect,N,t,b.scrollBarWidth,b.scrollBarHeight),E.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&_(t.calcdata,y),A=r.hiddenlabels||[];if(!r.showlegend||!x.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 E=r._topdefs.selectAll("#"+o).data([0]);E.enter().append("clipPath").attr("id",o).append("rect");var L=M.selectAll("rect.bg").data([0]);L.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),L.call(v.stroke,y.bordercolor),L.call(v.fill,y.bgcolor),L.style("stroke-width",y.borderwidth+"px");var S=M.selectAll("g.scrollbox").data([0]);S.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 O=S.selectAll("g.groups").data(x);O.enter().append("g").attr("class","groups"),O.exit().remove();var R=O.selectAll("g.traces").data(h.identity);R.enter().append("g").attr("class","traces"),R.exit().remove(),R.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?A.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var I=0!==M.enter().size();I&&(s(t,O,R),l(t));var D=r.width,P=r.height;s(t,O,R),y.height>P?u(t):l(t);var z=r._size,F=z.l+z.w*y.x,B=z.t+z.h*(1-y.y);k.isRightAnchor(y)?F-=y.width:k.isCenterAnchor(y)&&(F-=y.width/2),k.isBottomAnchor(y)?B-=y.height:k.isMiddleAnchor(y)&&(B-=y.height/2);var N=y.width,j=z.w;N>j?(F=z.l,N=j):(F+N>D&&(F=D-N),F<0&&(F=0),N=Math.min(D-F,y.width));var H=y.height,U=z.h;H>U?(B=z.t,H=U):(B+H>P&&(B=P-H),B<0&&(B=0),H=Math.min(P-B,y.height)),m.setTranslate(M,F,B);var V,q,G=H-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-H;if(y.height<=H||t._context.staticPlot)L.attr({width:N-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(S,0,0),E.select("rect").attr({width:N-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(m.setClipUrl,o);else{V=b.scrollBarMargin,q=S.attr("data-scroll")||0,L.attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),E.select("rect").attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-q}),S.call(m.setClipUrl,o),I&&e(V,q),M.on("wheel",null),M.on("wheel",function(){q=h.constrain(S.attr("data-scroll")-c.event.deltaY/G*X,-X,0),V=b.scrollBarMargin-q/X*G,e(V,q),0!==q&&q!==-X&&c.event.preventDefault()}),C.on(".drag",null),S.on(".drag",null);var Y=c.behavior.drag().on("drag",function(){V=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),q=-(V-b.scrollBarMargin)/G*X,e(V,q)});C.call(Y),S.call(Y)}if(t._context.editable){var W,Z,Q,$;M.classed("cursor-move",!0),g.init({element:M.node(),prepFn:function(){var t=m.getTranslate(M);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;m.setTranslate(M,r,n),W=g.align(r,0,z.l,z.l+z.w,y.xanchor),Z=g.align(n,0,z.t+z.h,z.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==W&&void 0!==Z)f.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});o.size()>0&&(1===n?M._clickTimeout=setTimeout(function(){i(o,t,n)},T):2===n&&(M._clickTimeout&&clearTimeout(M._clickTimeout),i(o,t,n)))}}})}}}},{"../../constants/interactions":319,"../../lib":336,"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/plots":406,"../../registry":413,"../color":221,"../dragelement":242,"../drawing":245,"./anchor_utils":271,"./constants":273,"./get_legend_data":276,"./helpers":277,"./style":279,d3:60}],276:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))l.indexOf(t)===-1?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var i,o,s={},l=[],u=!1,c={},f=0;for(i=0;ir[1])return r[1]}return a}function r(t){return t[0]}var n,a,i=t[0],o=i.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(i,p)],a=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(f.pointStyle,a),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(f.textPointStyle,a)}function i(t){var e=t[0].trace,r=e.marker||{},n=r.line||{},a=l.select(this).select("g.legendpoints").selectAll("path.legendbar").data(u.traceIs(e,"bar")?[t]:[]);a.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),a.exit().remove(),a.each(function(t){var e=l.select(this),a=t[0],i=(a.mlw+1||n.width+1)-1;e.style("stroke-width",i+"px").call(h.fill,a.mc||r.color),i&&e.call(h.stroke,a.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(){var t=e.line.width,r=l.select(this);r.style("stroke-width",t+"px").call(h.fill,e.fillcolor),t&&r.call(h.stroke,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.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var n=r.selectAll("g.legendsymbols").data([t]);n.enter().append("g").classed("legendsymbols",!0),n.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(i).each(o).each(s).each(n).each(a)}},{"../../lib":336,"../../registry":413,"../../traces/pie/style_one":462,"../../traces/scatter/subtypes":488,"../color":221,"../drawing":245,d3:60}],280:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,i=a.getAttribute("data-attr"),o=a.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===i){var d,p="in"===o?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g)&&i(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(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function a(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,l);f("x",p[0]),f("y",p[1]),i.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),i.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":336,"../color":221,"./attributes":284,"./button_attributes":285,"./constants":286}],288:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;sX&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-i/n):"move";g(e,o),G=o.split("-")[0]}function i(e){N=f.getFromId(t,r.xref),j=f.getFromId(t,r.yref),H=v.getDataToPixel(t,N),U=v.getDataToPixel(t,j,!0),V=v.getPixelToData(t,N),q=v.getPixelToData(t,j,!0);var i="shapes["+n+"]";"path"===r.type?(F=r.path,B=i+".path"):(m=H(r.x0),y=U(r.y0),b=H(r.x1),x=U(r.y1),_=i+".x0",w=i+".y0",A=i+".x1",k=i+".y1"),mY&&(d[S]=r[I]=q(u),d[C]=r[D]=q(c)),h-f>X&&(d[O]=r[P]=V(f),d[R]=r[z]=V(h))}e.attr("d",o(t,r))}var d,m,y,b,x,_,w,A,k,M,T,E,L,S,C,O,R,I,D,P,z,F,B,N,j,H,U,V,q,G,X=10,Y=10,W={setCursor:a,element:e.node(),prepFn:i,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W)}function o(t,e){var r,n,a,i,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=v.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(a=v.shapePositionToRange(u),i=function(t){return u._offset+u.r2p(a(t,!0))}):i=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=v.decodeDate(n)),u&&"date"===u.type&&(i=v.decodeDate(i)),s(e.path,n,i);var h=n(e.x0),d=n(e.x1),p=i(e.y0),g=i(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var m=(h+d)/2,y=(p+g)/2,b=Math.abs(m-h),x=Math.abs(y-p),_="A"+b+","+x,w=m+b+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a],l=t.substr(1).replace(m.paramRE,function(t){return i[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),a+l})}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=s?t:(i[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":336,"../../lib/setcursor":351,"../../plotly":369,"../../plots/cartesian/axes":374,"../color":221,"../dragelement":242,"../drawing":245,"./constants":299,"./helpers":302}],302:[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,i=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return i.t+i.h*(1-t)}:function(t){return i.l+i.w*t};return a},r.getPixelToData=function(t,e,n){var a,i=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);a=function(t){return o(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return a}},{}],303:[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":297,"./calc_autorange":298,"./defaults":300,"./draw":301}],304:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,i,r,a)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,b;"paper"!==m?(v=a.getFromId(g,m),b=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],A=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,u,m,x,.25),a.coercePosition(e,g,u,m,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=A}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":336,"../../plots/cartesian/axes":374,"./attributes":297,"./helpers":302}],305:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),i=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({},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: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:i({},n,{})},font:i({},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":330,"../../plots/animation_attributes":370,"../../plots/font_attributes":398,"../../plots/pad_attributes":405,"./constants":306}],306:[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}},{}],307:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("x"),n("y"),i.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"),i.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),i.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 i.coerce(n,a,c,t,e)}for(var n,a,o=t.steps||[],s=e.steps=[],l=0;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),M.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,a,i=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-L.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=L.currentValueInset,a="left"}i.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",a);var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}return e.currentvalue.suffix&&(o+=e.currentvalue.suffix),i.call(M.font,e.currentvalue.font).text(o).call(T.convertToTspans),M.setTranslate(i,n,e.currentValueHeight),i}}function l(t,e,r){var n=t.selectAll("rect."+L.gripRectClass).data([0]);n.enter().append("rect").classed(L.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:L.gripWidth,height:L.gripHeight,rx:L.gripRadius,ry:L.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),n.call(M.font,r.font).text(e.step.label).call(T.convertToTspans),n}function c(t,e){var r=t.selectAll("g."+L.labelsClass).data([0]);r.enter().append("g").classed(L.labelsClass,!0);var n=r.selectAll("g."+L.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(L.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),M.setTranslate(r,v(e,t.fraction),L.tickOffset+e.ticklen+e.labelHeight+L.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var i=Math.round(n*(r.steps.length-1));i!==r.active&&h(t,e,r,i,!0,a)}function h(t,e,r,n,a,i){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),i),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:o}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=i):(e._nextMethod={step:l,doCallback:a,doTransition:i},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(A.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var a=r.node(),i=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+L.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(a)[0]);f(e,r,t,s,!0),t._dragging=!0,i.on("mousemove",function(){var t=n(),i=y(t,w.mouse(a)[0]);f(e,r,t,i,!1)}),i.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),i.on("mouseup",null),i.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+L.tickRectClass).data(e.steps);r.enter().append("rect").classed(L.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),M.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?L.tickOffset:L.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(i-.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 b(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),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(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"),M.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,a);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+g+")")}}}var g=r.propContainer,m=r.propName,v=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(h);var O="Click to enter "+y+" title";t._context.editable?(S?C.on(".opacity",null):function(){E=0,L=!0,S=O,C.attr({"data-unformatted":S}).text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),C.call(c.makeEditable).on("edit",function(e){void 0!==v?i.restyle(t,m,e,v):i.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(h)}).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)}},{"../../constants/interactions":319,"../../lib":336,"../../lib/svg_text_utils":355,"../../plotly":369,"../../plots/plots":406,"../color":221,"../drawing":245,d3:60,"fast-isnumeric":66}],311:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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:i({},o,{}),font:i({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":330,"../../plots/font_attributes":398,"../../plots/pad_attributes":405,"../color/attributes":220}],312:[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"}},{}],313:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return i.coerce(n,a,c,t,e)}for(var n,a,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(i.enter().append("g").classed(L.containerClassName,!0).style("cursor","pointer"),i.exit().remove(),i.exit().size()&&_(t),0!==r.length){var c=i.selectAll("g."+L.headerGroupClassName).data(r,a);c.enter().append("g").classed(L.headerGroupClassName,!0);var f=i.selectAll("g."+L.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(L.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hA,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,L=p,S=m+v;S+E>u&&(S=u-E);var C=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,n.barColor),M?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:L,y:S,width:T,height:E}),this._hbarXMin=L+T/2,this._hbarTranslateMax=A-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>k,R=n.barWidth+2*n.barPad,I=n.barLength+2*n.barPad,D=p+g,P=m;D+R>l&&(D=l-R);var z=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,n.barColor),O?(this.vbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:D,y:P,width:R,height:I}),this._vbarYMin=P+I/2,this._vbarTranslateMax=k-I):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,B=c-.5,N=O?f+R+.5:f+.5,j=h-.5,H=M?d+E+.5:d+.5,U=s._topdefs.selectAll("#"+F).data(M||O?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",F).append("rect"),M||O?(this._clipRect=U.select("rect").attr({x:Math.floor(B),y:Math.floor(j),width:Math.ceil(N)-Math.floor(B),height:Math.ceil(H)-Math.floor(j)}),this.container.call(o.setClipUrl,F),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),M||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var q=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));M&&this.hbar.on(".drag",null).call(q),O&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,o=i+this._vbarTranslateMax;e=(s.constrain(a.event.y,i,o)-i)/(o-i)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(o.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var i=e/n;this.vbar.call(o.setTranslate,t,e+i*this._vbarTranslateMax)}}},{"../../lib":336,"../color":221,"../drawing":245,d3:60}],317:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],318:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],319:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],320:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],321:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],322:[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}},{}],323:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.27.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/fx"),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=t("./components/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":219,"./components/fx":262,"./components/images":270,"./components/legend":278,"./components/rangeselector":290,"./components/rangeslider":296,"./components/shapes":303,"./components/sliders":309,"./components/updatemenus":315,"./fonts/mathjax_config":324,"./lib/queue":348,"./plot_api/plot_schema":363,"./plot_api/register":364,"./plot_api/set_plot_config":365,"./plot_api/to_image":367,"./plot_api/validate":368,"./plotly":369,"./snapshot":418,"./snapshot/download":415,"./traces/scatter":478,d3:60,"es6-promise":64}],324:[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},{}],325:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),n(t)?Number(t):a}},{"../constants/numerical":320,"fast-isnumeric":66}],326:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=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,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(i(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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);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 a=t.split("+"),i=0;i0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,b=m.ONEHOUR,x=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,A=t("../registry"),k=h.time.format.utc,M=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?A.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:A.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?A.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,E;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=T&&t<=E?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),i=t.charAt(0);!a||"G"!==i&&"g"!==i||(t=t.substr(1),e="");var o=a&&"chinese"===e.substr(0,7),s=t.match(o?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(a){if(2===l.length)return v;l=Number(l);var p;try{var g=A.getComponentMethod("calendars","getCal")(e);if(o){var m="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,m),c)}else p=g.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*b+h*x+d*_:v}l=2===l.length?(Number(l)+2e3-M)%100+M:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*_},T=r.MIN_MS=r.dateTime2ms("-9999"),E=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var L=90*y,S=3*b,C=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=T&&t<=E))return v;e||(e=0);var a,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{a=A.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){a=k("G%Y-%m-%d")(new Date(h))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=T+y&&t<=E-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return i(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,R=[59,59.9,59.99,59.999,59.9999],I=k("%Y"),D=k("%b %Y"),P=k("%b %-d"),z=k("%b %-d, %Y");r.formatDate=function(t,e,r,a){var i,h;if(a=n(a)&&a,e)return o(e,t,a);if(a)try{var d=Math.floor((t+.05)/y)+w,p=A.getComponentMethod("calendars","getCal")(a).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(i=l(p),h=c(p)):(i=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=I(g):"m"===r?h=D(g):"d"===r?(i=I(g),h=P(g)):(i=z(g),h=s(t,r))}return h+(i?"\n"+i:"")};var F=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var i=Math.round(t/y)+w,o=A.getComponentMethod("calendars","getCal")(r),s=o.fromJD(i);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+F);return l.setUTCMonth(l.getUTCMonth()+e)+a-F},r.findExactDates=function(t,e){for(var r,a,i=0,o=0,s=0,l=0,u=n(e)&&A.getComponentMethod("calendars","getCal")(e),c=0;c",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function i(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))},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.simpleMap=function(t,e,r,n){for(var a=t.length,i=new Array(a),o=0;o-1||1/0!==c&&c>=Math.pow(2,r)?t(e,r,n):l},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)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*u[n];c[r]=i}return c},a.syncOrAsync=function(t,e,r){function n(){return a.syncOrAsync(t,e,r)}for(var i,o;t.length;)if(o=t.splice(0,1)[0],(i=o(e))&&i.then)return i.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,i=!1,o=!0;for(n=0;n1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l}},{"./clean_number":325,"./coerce":326,"./dates":327,"./ensure_array":328,"./extend":330,"./filter_unique":331,"./filter_visible":332,"./identity":335,"./is_array":337,"./is_plain_object":338,"./loggers":339,"./matrix":340,"./mod":341,"./nested_property":342,"./noop":343,"./notifier":344,"./push_unique":347,"./relink_private":349,"./search":350,"./stats":353,"./to_log_range":356,d3:60}],337:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],338:[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}},{}],339:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],i=t[e][1],l=!1, -d(n))for(r=n.length-1;r>=0;r--)a(n[r],o(i,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)a(n[s[r]],o(i,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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,a,o,s=0,l=e.split(".");s/g),s=0;so||n===a||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===a||ro||u===a||ul)return!1;var c,f,h,d,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(c=1;cMath.max(f,m)||u>Math.max(h,v)))if(uc||Math.abs(n(o,h))>a)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=a;n.splice(i+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":320,"./matrix":340}],347:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)},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:a:r?o:i;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,a=e[n]-e[0]||1,i=a/(n||1)/1e4,o=[e[0]],s=0;se[s]+i&&(a=Math.min(a,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,u=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":66}],354:[function(t,e,r){"use strict";function n(t){var e=a(t);return e.length?e:[0,0,0,1]}var a=t("color-rgba");e.exports=n},{"color-rgba":52}],355:[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 i(t,e,r){var n="math-output-"+d.randstr([],64),i=h.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,i.node()],function(){var e=h.select("body").select("#MathJax_SVG_glyphs");if(i.select(".MathJax_SVG").empty()||!i.select("svg").node())d.log("There was an error in the tex syntax.",t),r();else{var n=i.select("svg").node().getBoundingClientRect();r(i.select(".MathJax_SVG"),e,n)}i.remove()})}function o(t,e){for(var r=t||"",n=0;n":"")+(v[n]||"");if("br"===n)return"
";var i,o=e[4];if("a"===n){var s=o&&o.match(T),u=s&&(s[3]||s[4]);if(i="':i+">"}return r.xml_entity_encode(t).replace(/");a>0;a=e.indexOf("
",a+1))n.push(a);var i=0;n.forEach(function(t){for(var r=t+i,n=e.slice(0,r),a="",o=n.length-1;o>=0;o--){var s=n[o].match(/<(\/?).*>/i);if(s&&"
"!==n[o]){s[1]||(a=n[o]);break}}a&&(e.splice(r+1,0,a),e.splice(r,0,""),i+=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,a,i,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return a="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},i="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:a()-u.top+"px",left:i()-u.left+"px","z-index":1e3}),this}}var f,h=t("d3"),d=t("../lib"),p=t("../constants/xmlns_namespaces"),g=t("../constants/string_mappings");r.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=r.getDOMParser(),a=n.parseFromString(e,"application/xml"),i=a.documentElement.firstChild;i;)this.node().appendChild(this.node().ownerDocument.importNode(i,!0)),i=i.nextSibling;return a.querySelector("parsererror")?(d.log(a.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?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=s.attr("class")+"-math",f.select("svg."+p).remove()),t.text("").style({visibility:"inherit","white-space":"pre"}),c=t.appendSVG(o),c||t.text(a),t.select("a").size()&&t.style("pointer-events","all"),e&&e.call(s)}var a=t.text(),o=u(a),s=t,l=!s.attr("data-notex")&&o.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/),c=a,f=h.select(s.node().parentNode);if(!f.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=d.getPlotDiv(s.node());(m&&m._promises||[]).push(new Promise(function(t){s.style({visibility:"hidden"});var a={fontSize:parseInt(s.style("font-size"),10)};i(l[2],a,function(a,i,o){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var l=a&&a.select("svg");if(!l||!l.node())return r(),void t();var u=f.append("g").classed(p+"-group",!0).attr({"pointer-events":"none"});u.node().appendChild(l.node()),i&&i.node()&&l.node().insertBefore(i.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"),d=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-d/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-d/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:g,y:+s.attr("y")+v-d/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var m={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},v={sup:'',sub:''},y=["http:","https:","mailto:"],b=new RegExp("]*)?/?>","g"),x=Object.keys(g.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:g.entityToUnicode[t]}}),_=Object.keys(g.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+g.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,A=/(<[^<>]*>)/,k=/<(\/?)([^ >]*)(\s+(.*))?>/i,M=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,E=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(b," ")},r.makeEditable=function(t,e,r){function n(){i(),o.style({opacity:0});var t,e=u.attr("class");(t=e?"."+e.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(o.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 i(){var t=d.getPlotDiv(o.node()),e=h.select(t),n=e.select(".svg-container"),i=n.append("div");i.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,n,r)).on("blur",function(){t._editing=!1,o.text(this.textContent).style({opacity:1});var e,r=h.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(o.node().parentNode).select(e).style({opacity:0});var n=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var e=this;t._editing=!0,h.select(document).on("mouseup",function(){if(h.event.target===e)return!1;document.activeElement===i.node()&&i.node().blur()})}).on("keyup",function(){27===h.event.which?(t._editing=!1,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,n,r)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(a)}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":321,"../constants/xmlns_namespaces":322,"../lib":336,d3:60}],356:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":66}],357:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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=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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(m,v),d(t),!0)}var b,x,_,w,A,k,M,T=Object.keys(r).map(Number).sort(s),E=e.get(),L=E||[],S=n(v,f).get(),C=[],O=-1,R=L.length;for(b=0;bL.length-(M?0:1))o.warn("index out of range",f,_);else if(void 0!==k)A.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?C.push(_):M?("add"===k&&(k={}),L.splice(_,0,k),S&&S.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,k),O===-1&&(O=_);else for(x=0;x=0;b--)L.splice(C[b],1),S&&S.splice(C[b],1);if(L.length?E||e.set(L):e.set(null),g)return!1;if(h(m,v),p!==i){var I;if(O===-1)I=T;else{for(R=Math.max(L.length,R),I=[],b=0;b=O);b++)I.push(_);for(b=O;b=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lN.range[0]?[1,2]:[2,1]);else{var U=N.range[0],V=N.range[1];j?(U<=0&&V<=0&&r(z+".autorange",!0),U<=0?U=V/1e6:V<=0&&(V=U/1e6),r(z+".range[0]",Math.log(U)/Math.LN10),r(z+".range[1]",Math.log(V)/Math.LN10)):(r(z+".range[0]",Math.pow(10,U)),r(z+".range[1]",Math.pow(10,V)))}else r(z+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,B,T,r),w.getComponentMethod("images","convertCoords")(t,B,T,r)}else r(z+".autorange",!0)}else if(R.match(I.AX_NAME_PATTERN)){var q=b.nestedProperty(u,k).get(),G=(T||{}).type;G&&"-"!==G||(G="linear"),w.getComponentMethod("annotations","convertCoords")(t,q,G,r),w.getComponentMethod("images","convertCoords")(t,q,G,r)}var X=C.containerArrayMatch(k);if(X){i=X.array,o=X.index;var Y=X.property,W=b.nestedProperty(l,i),Z=(W||[])[o]||{};if(""===o)k.indexOf("updatemenus")===-1&&(m.docalc=!0);else if(""===Y){var Q=T;C.isAddVal(T)?x[k]=null:C.isRemoveVal(T)?(x[k]=Z,Q=Z):b.warn("unrecognized full object value",e),(n(Q,"x")||n(Q,"y")&&k.indexOf("updatemenus")===-1)&&(m.docalc=!0)}else!n(Z,"x")&&!n(Z,"y")||b.containsAny(k,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);h[i]||(h[i]={});var $=h[i][o];$||($=h[i][o]={}),$[Y]=T,delete e[k]}else if("reverse"===R)F.range?F.range.reverse():(r(z+".autorange",!0),F.range=[1,0]),B.autorange?m.docalc=!0:m.doplot=!0;else{var K=String(M.parts[1]||"");0===S.indexOf("scene")?"camera"===M.parts[1]?m.docamera=!0:m.doplot=!0:0===S.indexOf("geo")?m.doplot=!0:0===S.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===k?m.doplot=!0:"margin"===S||"autorange"===K||"rangemode"===K||"type"===K||"domain"===K||"fixedrange"===K||"scaleanchor"===K||"scaleratio"===K||k.indexOf("calendar")!==-1||k.match(/^(bar|box|font)/)?m.docalc=!0:!u._has("gl2d")||k.indexOf("axis")===-1&&"plot_bgcolor"!==k?"hiddenlabels"===k?m.docalc=!0:S.indexOf("legend")!==-1?m.dolegend=!0:k.indexOf("title")!==-1?m.doticks=!0:S.indexOf("bgcolor")!==-1?m.dolayoutstyle=!0:E>1&&b.containsAny(K,["tick","exponent","grid","zeroline"])?m.doticks=!0:k.indexOf(".linewidth")!==-1&&k.indexOf("axis")!==-1?m.doticks=m.dolayoutstyle=!0:E>1&&K.indexOf("line")!==-1?m.dolayoutstyle=!0:E>1&&"mirror"===K?m.doticks=m.dolayoutstyle=!0:"margin.pad"===k?m.doticks=m.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(k)!==-1||k.indexOf("spike")!==-1?m.domodebar=!0:["height","width","autosize"].indexOf(k)===-1&&(m.doplot=!0):m.doplot=!0,M.set(T)}}}for(i in h){C.applyContainerArrayChanges(t,b.nestedProperty(l,i),h[i],m)||(m.doplot=!0)}var J=u._axisConstraintGroups;for(var tt in _)for(o=0;o=s.length?s[0]:s[t]:s}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function i(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,A.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?m>=s.length?t.transitionOpts=s[m]:t.transitionOpts=s[0]:t.transitionOpts=s,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&kk)&&M.push(g);v=M}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;a--)if(b.isPlainObject(e[a])){var h=(u[e[a].name]||{}).name,d=e[a].name;h&&d&&"number"==typeof d&&u[h]&&(n++,b.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:A.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:c+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(i=f[a].frame,"number"==typeof i.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;u[i.name="frame "+t._transitionData._counter++];);if(u[i.name]){for(o=0;o=0;r--)n=e[r],i.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:a[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,i];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,i)},y.purge=function(t){t=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":245,"../components/errorbars":251,"../constants/xmlns_namespaces":322,"../lib":336,"../lib/events":329,"../lib/queue":348,"../lib/svg_text_utils":355,"../plotly":369,"../plots/cartesian/axis_ids":377,"../plots/cartesian/constants":379,"../plots/cartesian/constraints":381,"../plots/cartesian/graph_interact":383,"../plots/plots":406,"../plots/polar":409,"../registry":413,"./helpers":359,"./manage_arrays":360,"./subroutines":366,d3:60,"fast-isnumeric":66}],362:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],363:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e] -;r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var i={};w(i,e.layoutAttributes),a.layoutAttributes=s(i)}return a}function a(){var t={};return w(t,m),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function i(t){var e=d.transformsRegistry[t],r=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(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)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(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 _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[A]=!0,n.set(a)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,A="_isSubplotObj",k="_isLinkedToArray",M=[A,k,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=A,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=M,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]=i(t)}),{defs:{valObjects:p.valObjects,metaKeys:M.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var i=t[n];M.indexOf(n)===-1&&(e(i,n,t,a),r.isValObject(i)||p.isPlainObject(i)&&r.crawl(i,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){if(i=i.slice(0,s).concat([r]),e&&("data_array"===e.valType||e.arrayOk===!0)){var l=n(i),u=p.nestedProperty(t,l).get();Array.isArray(u)&&a.push(l)}}function n(t){return t.join(".")}var a=[],i=[];if(r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}var a=t("d3"),i=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),f=t("../components/titles"),h=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=i.Axes.list(t);for(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.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);i.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})})}var a=t("fast-isnumeric"),i=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":336,"../plotly":369,"../snapshot/cloneplot":414,"../snapshot/helpers":417,"../snapshot/svgtoimg":419,"../snapshot/tosvg":421,"fast-isnumeric":66}],368:[function(t,e,r){"use strict";function n(t,e,r,a,i,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,m=r.length,v=0;v.3*f||i(n)||i(a))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=P.tickIncrement(t,"M6","reverse")+1.5*C:i.exactMonths>.8?t=P.tickIncrement(t,"M1","reverse")+15.5*C:t-=C/2;var s=P.tickIncrement(t,r);if(s<=n)return s}return t}function i(t){var e,r,n=t.tickvals,a=t.ticktext,i=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(a)||(a=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=C&&a<=10||e>=15*C)t._tickround="d";else if(e>=R&&a<=16||e>=O)t._tickround="M";else if(e>=I&&a<=19||e>=R)t._tickround="S";else{var i=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,i)-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 l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var a=t._tickround,i=r&&t.hoverformat||t.tickformat;n&&(a=b(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var o,s=_.formatDate(e.x,i,a,t.calendar),l=s.indexOf("\n");l!==-1&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===a?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(t,e,r,n,a){var i=t.dtick,o=e.x;if(!n||"string"==typeof i&&"L"===i.charAt(0)||(i="L3"),t.tickformat||"string"==typeof i&&"L"===i.charAt(0))e.text=d(Math.pow(10,o),t,a,n);else if(b(i)||"D"===i.charAt(0)&&_.mod(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,o),t,"","fakehover"),"D1"===i&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==i.charAt(0))throw"unrecognized dtick "+String(i);e.text=String(Math.round(Math.pow(10,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(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,o=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]};s(f),i=(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,-i)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=q[l/3+5])}return a?"\u2212"+t:t}function p(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},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);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 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(),_.simpleMap(r,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._input;r.range=t.range.slice(),r.autorange=t.autorange}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,a=0;a=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var i,o,s,l,u,c,f,h,d,p,g,m=e.length,v=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),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),A=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(i=0;i<6;i++)a(i);for(i=m-1;i>5;i--)a(i)}},P.autoBin=function(t,e,r,i,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,i?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},P.setConvert(d),P.autoTicks(d,u);var p,g=P.tickIncrement(P.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=a(g,t,d.dtick,s,o)),p=g;p<=l;)p=P.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},P.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),P.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return i(t);t._tmin=P.tickFirst(t);var a=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=P.tickIncrement(u,t.dtick,a,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,B)):n>S?(e/=S,t.dtick="M"+o(e,1,N)):n>C?(t.dtick=o(e,C,H),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=o(e,O,N):n>R?t.dtick=o(e,R,j):n>I?t.dtick=o(e,I,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,B))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var i=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/i, -r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(e,r,B)}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=o(e,r,B));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,n){var a=r?-1:1;if(b(e))return t+a*e;var i=e.charAt(0),o=a*Number(e.substr(1));if("M"===i)return _.incrementMonth(t,o,n);if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?V:U,l=t+.01*a,u=_.roundUp(_.mod(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=_.simpleMap(t.range,e),n=r[1]1&&e2*a}function i(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,i=0;i2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t,e){return a(t,e)?"date":i(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":320,"../../lib":336,"fast-isnumeric":66}],376:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),i=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,g){function m(r,n){return i.coerce2(t,e,s,r,n)}var v=p.letter,y=p.font||{},b="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?d(v,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),A=w===t.color?w:y.color;r("title",b),i.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:A}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var k=m("linecolor",w),M=m("linewidth"),T=r("showline",!!k||!!M);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var E=m("gridcolor",n(w,p.bgColor,o).toRgbString()),L=m("gridwidth");r("showgrid",p.showGrid||!!E||!!L)||(delete e.gridcolor,delete e.gridwidth);var S=m("zerolinecolor",w),C=m("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!C)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":220,"../../lib":336,"../../registry":413,"./category_order_defaults":378,"./layout_attributes":385,"./ordered_categories":387,"./set_convert":391,"./tick_label_defaults":392,"./tick_mark_defaults":393,"./tick_value_defaults":394,tinycolor2:194}],377:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,i=[],o=0;o0;i&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),i||"array"!==o||(e.categoryorder="trace")}}},{}],379:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],380:[function(t,e,r){"use strict";function n(t,e,r,n){var a,i,s,l,u=n[o(e)].type,c=[];for(i=0;ii*p))for(r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",i>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return["lasso","select"].indexOf(t)!==-1}function m(t,e){return"M"+(t.l-.5)+","+(e-z-.5)+"h-3v"+(2*z+1)+"h3ZM"+(t.r+.5)+","+(e-z-.5)+"h3v"+(2*z+1)+"h-3Z"}function v(t,e){return"M"+(e-z-.5)+","+(t.t-.5)+"v-3h"+(2*z+1)+"v3ZM"+(e-z-.5)+","+(t.b+.5)+"v3h"+(2*z+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,z)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,a,i,o,s,l,u=!1,c={},f={};for(n=0;nz||s>z?(wt="xy",o/nt>s/at?(s=o*at/nt,vt>i?yt.t=vt-s:yt.b=vt+s):(o=s*nt/at,mt>a?yt.l=mt-o:yt.r=mt+o),kt.attr("d",y(yt))):n():!ot||szoom back out","long"),F=!1)}function G(e,r){var n=1===(N+j).length;if(e)Q();else if(2!==r||n){if(1===r&&n){var a=N?tt[0]:J[0],o="s"===N||"w"===j?0:1,s=a._name+".range["+o+"]",l=i(a,o),u="left",c="middle";if(a.fixedrange)return;N?(c="n"===N?"top":"bottom","right"===a.side&&(u="right")):"e"===j&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(pt).call(M.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else Z()}function X(e){function r(t,e,r){function n(e){return t.l2r(i+(e-i)*r)}if(!t.fixedrange){var a=k.simpleMap(t.range,t.r2l),i=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var n=t.querySelector(".plotly");if(H(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Tt);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void k.log("Did not find wheel motion attributes: ",e);var i,o=Math.exp(-Math.min(Math.max(a,-20),20)/100),s=Lt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(j||lt){for(j||(l=.5),i=0;ic[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":336,"fast-isnumeric":66}],389:[function(t,e,r){"use strict";e.exports=function(t,e,r){void 0===r&&(r=.5);var n=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=n[0]+(n[1]-n[0])*r,i=(a-n[0])*e;t.range=t._input.range=[t.l2r(a-i),t.l2r(a+i)]}},{}],390:[function(t,e,r){"use strict";function n(t){return t._id}var a=t("../../lib/polygon"),i=t("../../components/color"),o=t("./axes"),s=t("./constants"),l=a.filter,u=a.tester,c=s.MINSELECT;e.exports=function(t,e,r,a,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=a.gd._fullLayout._zoomlayer,m=a.element.getBoundingClientRect(),v=a.plotinfo.xaxis._offset,y=a.plotinfo.yaxis._offset,b=e-m.left,x=r-m.top,_=b,w=x,A="M"+b+","+x,k=a.xaxes[0]._length,M=a.yaxes[0]._length,T=a.xaxes.map(n),E=a.yaxes.map(n),L=a.xaxes.concat(a.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("+v+", "+y+")").attr("d",A+"Z");var C,O,R,I,D,P=g.append("path").attr("class","zoombox-corners").style({fill:i.background,stroke:i.defaultLine,"stroke-width":1}).attr("transform","translate("+v+", "+y+")").attr("d","M0,0Z"),z=[],F=a.gd,B=[];for(C=0;Ch?d:o(t)?Number(t):d):d}var i=t("d3"),o=t("fast-isnumeric"),s=t("../../lib"),l=s.cleanNumber,u=s.ms2DateTime,c=s.dateTime2ms,f=t("../../constants/numerical"),h=f.FP_SAFE,d=f.BADNUM,p=t("./constants"),g=t("./axis_ids");e.exports=function(t,e){function r(e,r){if(e>0)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*w*Math.abs(n-a))}return d}function f(e,r,n){var a=c(e,n||t.calendar);if(a===d){if(!o(e))return d;a=c(new Date(+e))}return a}function m(e,r,n){return u(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if("number"==typeof e)return e}function x(e){return o(e)?i.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:a,t.l2c="log"===t.type?n:a,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=a,t.d2p=t.r2p=function(t){return x(l(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(l(t),e)},t.r2d=t.r2c=function(t){return n(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=a,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return x(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(t){return x(l(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=s.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=m,t.d2p=t.r2p=function(t,e,r){return x(f(t,0,r))},t.p2d=t.p2r=function(t,e,r){return m(_(t),e,r)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2l_noadd=b,t.r2l=t.l2r=t.r2c=t.c2r=a,t.d2p=function(t){return x(b(t))},t.p2d=function(t){return v(_(t))},t.r2p=x,t.p2r=_),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=s.nestedProperty(t,e).get(),i=(t._id||"x").charAt(0);if(n="date"===t.type?s.dfltRange(t.calendar):"y"===i?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void s.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=s.cleanDate(a[0],d,t.calendar),a[1]=s.cleanDate(a[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!s.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var l=s.constrain(t.r2l(a[0]),s.MIN_MS+1e3,s.MAX_MS-1e3);a[0]=t.l2r(l-1e3),a[1]=t.l2r(l+1e3);break}}else{if(!o(a[r])){if(!o(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-h?a[r]=-h:a[r]>h&&(a[r]=h),a[0]===a[1]){var u=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=u,a[1]+=u}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var i=g.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var o=r&&t._r?"_r":"range",l=t.calendar;t.cleanRange(o);var u=t.r2l(t[o][0],l),c=t.r2l(t[o][1],l);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw s.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,i,o="date"===t.type&&e[r+"calendar"];if(r in e)for(n=e[r],a=new Array(n.length),i=0;i0?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?a.dateTick0(e.calendar):0,p=r("tick0",d);"date"===o?e.tick0=a.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":320,"../../lib":336,"fast-isnumeric":66}],395:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),i=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r){for(a=0;ar.duration?(d(),k=window.cancelAnimationFrame(g)):k=window.requestAnimationFrame(g)}var m=t._fullLayout,v=[],y=function(t){var e,r,n,a,i,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(a=m[u],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=u,i.length=a._length,v.push(s),o[s]=i}return o}(e),b=Object.keys(y),x=function(t,e,r){var n,a,i,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(),a=r[u]?r[u].to:f,i=r[c]?r[c].to:h,f[0]===a[0]&&f[1]===a[1]&&h[0]===i[0]&&h[1]===i[1]||e.indexOf(u)===-1&&e.indexOf(c)===-1||s.push(l)}}return s}(m,b,y);if(!x.length)return!1;var _;u&&(_=u());var w,A,k,M=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(k),k=null,p()}),w=Date.now(),k=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":245,"../../plotly":369,"../../registry":413,"./axes":374,d3:60}],396:[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 u=a(e,r,n);if(u){if("histogram"===u.type&&n==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=n+"calendar",f=u[c];if(o(u,n)){for(var h,d=i(u),p=[],g=0;g0?".":"")+a;u.isPlainObject(i)?s(i,e,o,n+1):e(o,a,i)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,a,i){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,a,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&&i&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(i({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(f)?(u.boxEnd[1]=u.boxStart[1]+Math.abs(c)*w*(Math.sign(f)||1),u.boxEnd[1]h[3]&&(u.boxEnd[1]=h[3],u.boxEnd[0]=u.boxStart[0]+(h[3]-u.boxStart[1])/Math.abs(w))):(u.boxEnd[0]=u.boxStart[0]+Math.abs(f)/w*(Math.sign(c)||1),u.boxEnd[0]h[2]&&(u.boxEnd[0]=h[2],u.boxEnd[1]=u.boxStart[1]+(h[2]-u.boxStart[0])*Math.abs(w)))}}else u.boxEnabled?(c=u.boxStart[0]!==u.boxEnd[0],f=u.boxStart[1]!==u.boxEnd[1],c||f?(c&&(o(0,u.boxStart[0],u.boxEnd[0]),t.xaxis.autorange=!1),f&&(o(1,u.boxStart[1],u.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),u.boxEnabled=!1,u.boxInited=!1):u.boxInited&&(u.boxInited=!1);break;case"pan":u.boxEnabled=!1,u.boxInited=!1,n?(u.panning||(u.dragStart[0]=a,u.dragStart[1]=i),Math.abs(u.dragStart[0]-a)f[d+2]&&(f[d]=-1,f[d+2]=1),h=this[b[d]],h._length=o.viewBox[d+2]-o.viewBox[d],l.doAutoRange(h),h.setScale();var v={_axisConstraintGroups:this.graphDiv._fullLayout._axisConstraintGroups,xaxis:this.xaxis,yaxis:this.yaxis};y({_fullLayout:v}),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},x.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,a=t.r2l,i=e.r2l;return[a(r[0]),i(n[0]),a(r[1]),i(n[1])]},x.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,a=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[a(t[1]),a(t[3])]},x.updateTraces=function(t,e){var r,n,a,i=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),l=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),l.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=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).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||{},i=t._fullData||[],o=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var l=r.width,c=r.height;p.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=l),a.height||(n.height=c)}else{p.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,h=n.autosize,d=t._context&&t._context.autosizable;f&&(h||d)?p.plotAutoSize(t,a,n):f&&p.sanitizeMargins(t),!h&&f&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,o,a,n),n._has=p._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var c=i(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,g=1-2*s,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(m.width-h)),a=Math.round(g*(m.height-d))}else{var v=u?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=p.layoutAttributes.width.min,b=p.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||x)&&(x&&(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,i;u.Axes.supplyLayoutDefaults(t,e,r);var o=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];n._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),i=Math.max(e.margin.r||0,0),o=Math.max(e.margin.t||0,0),s=Math.max(e.margin.b||0,0),c=e._pushmargin;if(e.margin.autoexpand!==!1){c.base={l:{val:0,size:a},r:{val:1,size:i},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(c),h=0;hm){var k=(v*w+(A-e.width)*m)/(w-m),M=(A*(1-m)+(v-e.width)*(1-w))/(w-m);k>=0&&M>=0&&k+M>a+i&&(a=k,i=M)}}if(l(b)&&c[_].t){var T=c[_].t.val,E=c[_].t.size;if(T>y){var L=(b*T+(E-e.height)*y)/(T-y),S=(E*(1-y)+(b-e.height)*(1-T))/(T-y);L>=0&&S>=0&&L+S>s+o&&(s=L,o=S)}}}}if(r.l=Math.round(a),r.r=Math.round(i),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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,r,n,a){function i(t){if("function"==typeof t)return null;if(f.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=i(t[e])}return a}return Array.isArray(t)?t.map(i):f.isJSDate(t)?f.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=i(t);return e&&delete r.fit,r})};return e||(u.layout=i(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=i(l)),"object"===n?u:JSON.stringify(u)},p.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=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 o,s,l=0,c=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=E?f.angularAxis.domain:n.extent(A),S=Math.abs(A[1]-A[0]);M&&!k&&(S=0);var C=L.slice();T&&k&&(C[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var R=f.angularAxis.ticksStep||(C[1]-C[0])/(O*(f.minorTicks+1));w&&(R=Math.max(Math.round(R),1)),C[2]||(C[2]=R);var I=n.range.apply(this,C);if(I=I.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?S:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var D=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),P=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(P)}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 z,F=e.select(".chart-group"),B={fill:"none",stroke:f.tickColor},N={"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){z=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var j=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=void 0===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:i({},o.Legend.defaultConfig().legendConfig,{container:z,elements:j,reverseOrder:f.legend.reverseOrder})})();var H=z.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],a.range([0,b]),c.layout.radialAxis.domain=a.domain(),z.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else z=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*b+(H?H.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/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 V=e.select("g.title-group text").style(N).text(f.title),q=V.node().getBBox();V.attr({x:_[0]-q.width/2,y:_[1]-b-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=G.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()}G.select("circle.outside-circle").attr({r:b}).style(B);var Y=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var W=n.svg.axis().scale(a).ticks(5).tickSize(5);G.call(W).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(N).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,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=e.select(".angular.axis-group").selectAll("g.angular-tick").data(I),Q=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),Z.exit().remove(),Q.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),Q.selectAll(".minor").style({stroke:f.minorTickColor}),Z.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var $=Z.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(N);f.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));z.attr({transform:"translate("+[b+K,f.margin.top]+")"});var J=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||J){var et=[];d.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=s,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return i(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,it,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ft=ot.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(Y).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=s.invert(n);var a=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Y).radius;ht.attr({r:r}).style({opacity:.5}),it=a.invert(o.util.getMousePos(Y).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ut.text(o.util.round(it)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),i=a.style("fill"),s="black",l=a.style("opacity")||1;if(a.attr({"data-opacity":l}),"none"!=i){a.attr({"data-fill":i}),s=n.hsl(i).darker().toString(),a.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=w[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-U[0]-h.left,f.top+f.height/2-U[1]-h.top];ct.config({color:s}).text(c),ct.move(d)}else i=a.style("stroke"),a.attr({"data-stroke":i}),s=n.hsl(i).darker().toString(),a.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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")})})}),h}var e,r,a,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]={}),i(l.data[e],o.Axis.defaultConfig().data[0]),i(l.data[e],t)}),i(l.layout,o.Axis.defaultConfig().layout),i(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return a},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var a=e||6,i=[],o=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)});var s={t:i,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return 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;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){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 m.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,i)},"stroke-width":function(t,e){return m["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,i)},opacity:function(t,e){return m.opacity(r,a,i)},display:function(t,e){return m.display(r,a,i)}})}};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,a){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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),i(e[r],o.PolyChart.defaultConfig()),i(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=i({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||void 0===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),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=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,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),x.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?(i(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=function(){t=a.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:a.padding+10,dy:.3*+a.fontSize}),l};return l.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(c);var f=a.padding,h=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,g=h.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l}, -l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return i(a,t),l},l},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=i({},t);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",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=o.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 s=i({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":336,d3:60}],411:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,u=e.exports={};u.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?l(r,e):e,i||(i=o.Axis()),c=o.adapter.plotly().convert(r),i.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,a,i,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return i.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:i.angularScale(),r:i.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,a),a=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"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../components/color":221,"../../lib":336,"./micropolar":410,"./undo_manager":412,d3:60}],412:[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-1}var i=t("../lib"),o=t("../plots/plots"),s=i.extendFlat,l=i.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,i=t.data,u=t.layout,c=l([],i),f=l({},u,n(e.tileClass)),h=t._context||{};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;rs.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),i(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var u=s.start,c=s.end,f=e._input.contours;if(u>c&&(s.start=f.start=c,c=s.end=f.end=u,u=s.start),!(s.size>0)){var h;h=u===c?1:n(u,c,e.ncontours).dtick,f.size=s.size=h}}return r}},{"../../lib":336,"../../plots/cartesian/axes":374,"../heatmap/calc":433}],424:[function(t,e,r){"use strict";var n=t("../../plots/plots"),a=t("../../components/colorbar/draw"),i=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void n.autoMargin(t,s);var l=a(t,s);e[0].t.cb=l;var u=r.contours,c=r.line,f=u.size||1,h=u.coloring,d=i(r,{isColorbar:!0});"heatmap"===h&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===h||"heatmap"===h?d:"").line({color:"lines"===h?d:c.color,width:u.showlines!==!1?c.width:0,dash:c.dash}).levels({start:u.start,end:o(u),size:f}).options(r.colorbar)()}},{"../../components/colorbar/draw":224,"../../plots/plots":406,"./end_plus":427,"./make_color_map":428}],425:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){var i,o=n.coerce2(t,e,a,"contours.start"),s=n.coerce2(t,e,a,"contours.end"),l=o===!1||s===!1,u=r("contours.size");!(i=l?e.autocontour=!0:r("autocontour",!1))&&u||r("ncontours")}},{"../../lib":336,"./attributes":422}],426:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/has_columns"),i=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,a){return n.coerce(t,e,l,r,a)}if(!i(t,e,c,u))return void(e.visible=!1);c("text"),c("connectgaps",a(e)),o(t,e,c),s(t,e,c,u)}},{"../../lib":336,"../heatmap/has_columns":439,"../heatmap/xyz_defaults":443,"./attributes":422,"./contours_defaults":425,"./style_defaults":429}],427:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],428:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/colorscale"),i=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=i(e),s=e.size||1,l=Math.floor((o-r)/s)+1,u="lines"===e.coloring?0:1;isFinite(s)||(s=1,l=1);var c,f,h=t.colorscale,d=h.length,p=new Array(d),g=new Array(d);if("heatmap"===e.coloring){for(t.zauto&&t.autocontour===!1&&(t.zmin=r-s/2,t.zmax=t.zmin+l*s),f=0;fO){r("x scale is not linear");break}}if(y.length&&"fast"===L){var R=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(R/100);for(w=0;wI){r("y scale is not linear");break}}}var D=c(_),P="scaled"===e.xtype?"":g,z=p(e,P,m,v,D,A),F="scaled"===e.ytype?"":y,B=p(e,F,b,x,_.length,k);E||(i.expand(A,z),i.expand(k,B));var N={x:z,y:B,z:_,text:e.text};if(s(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};N.xfill=p(j,P,m,v,D,A),N.yfill=p(j,F,b,x,_.length,k)}return[N]}},{"../../components/colorscale/calc":227,"../../lib":336,"../../plots/cartesian/axes":374,"../../registry":413,"../histogram2d/calc":451,"./clean_2d_array":434,"./convert_column_xyz":436,"./find_empties":438,"./has_columns":439,"./interp2d":440,"./make_bound_array":441,"./max_row_length":442}],434:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,a,i,o,s,l;if(e){for(r=0,s=0;s=0;o--)i=h[o],r=i[0],a=i[1],(s=((f[[r-1,a]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],h.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(i in l)f[i]=l[i],c.push(l[i])}return c.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":442}],439:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],440:[function(t,e,r){"use strict";function n(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,a,i,s,l,u,c,f,h,d,p,g,m,v=0;for(s=0;sg&&(v=Math.max(v,Math.abs(t[a][i]-p)/(m-g))))}return v}var i=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o.01;o++)l=a(t,e,n(l));return l>.01&&i.log("interp2d didn't converge quickly",l),t}},{"../../lib":336}],441:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,a,i,o){var s,l,u,c=[],f=n.traceIs(t,"contour"),h=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!h&&"category"!==o.type){var p=e.length;if(!(p<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)c=e.slice(0,i);else if(1===i)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],u=1;u0&&(n=!0);for(var s=0;si){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]0?Number(h):f;else if("string"!=typeof h)u.size=f;else{var d=h.charAt(0),p=h.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==i||"M"!==d||p!==Math.round(p))&&(u.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((u.start||0===u.start)&&(u.end||0===u.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":320,"../../lib":336,"fast-isnumeric":66}],450:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ak&&g.splice(k,g.length-k),v.length>k&&v.splice(k,v.length-k),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(a.tickIncrement(x(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(a.tickIncrement(x(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d",b),"histogram2dcontour"===e.type&&(e.ybins.start=A(a.tickIncrement(_(e.ybins.start),e.ybins.size,!0,b)),e.ybins.end=A(a.tickIncrement(_(e.ybins.end),e.ybins.size,!1,b))),e._input.ybins=e.ybins),h=[];var M,T,E=[],L=[],S="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,O=S?[]:e.xbins,R=C?[]:e.ybins,I=0,D=[],P=e.histnorm,z=e.histfunc,F=P.indexOf("density")!==-1,B="max"===z||"min"===z,N=B?null:0,j=i.count,H=o[P],U=!1,V=[],q=[],G="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";G&&"count"!==z&&(U="avg"===z,j=i[z]);var X=e.xbins,Y=x(X.start),W=x(X.end)+(Y-a.tickIncrement(Y,X.size,!1,y))/1e6;for(d=Y;d=0&&M=0&&T<$&&(I+=j(M,d,h[T],G,D[T]));if(U)for(T=0;T<$;T++)I+=s(h[T],D[T]);if(H)for(T=0;T<$;T++)H(h[T],I,V,q[T]);return{x:g,x0:r,dx:u,y:v,y0:c,dy:f,z:h}}},{"../../lib":336,"../../plots/cartesian/axes":374,"../histogram/average":447,"../histogram/bin_functions":448,"../histogram/clean_bins":449,"../histogram/norm_functions":450}],452:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/colorbar/attributes"),i=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendDeep,u=t("../../lib/extend").extendFlat;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]}},labelfont:u({},s,{}),tickfont:u({},s,{}),rangefont:u({},s,{}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string"},tickvals:o.tickvals,ticktext:o.ticktext,tickformat:{valType:"string",dflt:"3s"},visible:{valType:"boolean",dflt:!0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},constraintrange:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},values:{valType:"data_array",dflt:[]}},line:u({},l({},n("line"),{colorscale:l({},n("line").colorscale,{dflt:i.Viridis}),autocolorscale:l({},n("line").autocolorscale,{dflt:!1})}),{showscale:{valType:"boolean",dflt:!1},colorbar:a})}},{"../../components/colorbar/attributes":222,"../../components/colorscale/color_attributes":228,"../../components/colorscale/scales":239,"../../lib/extend":330,"../../plots/cartesian/layout_attributes":385,"../../plots/font_attributes":398}],453:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("./plot"),o=t("../../constants/xmlns_namespaces"),s=t("./constants");r.name="parcoords",r.attr="type",r.plot=function(t){var e=a.getSubplotCalcData(t.calcdata,"parcoords","parcoords");e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){function e(e){var n=this,a=n.toDataURL("image/png"),i=r.append("svg:image"),l=t._fullLayout._size,u=t._fullData[e.model.key].domain;i.attr({xmlns:o.svg,"xlink:href":a,x:l.l+l.w*u.x[0]-s.overdrag,y:l.t+l.h*(1-u.y[1]),width:(u.x[1]-u.x[0])*l.w+2*s.overdrag,height:(u.y[1]-u.y[0])*l.h,preserveAspectRatio:"none"})}var r=t._fullLayout._glimages,a=n.selectAll(".svg-container");a.filter(function(t,e){return e===a.size()-1}).selectAll(".parcoords-lines.context, .parcoords-lines.focus").each(e),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":322,"../../plots/plots":406,"./constants":456,"./plot":461,d3:60}],454:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("../../lib");e.exports=function(t,e){var r=!!e.line.colorscale&&i.isArray(e.line.color),o=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),s=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&a(e,e.line.color,"line","c"),[{lineColor:o,cscale:s}]}},{"../../components/colorscale/calc":227,"../../components/colorscale/has_colorscale":234,"../../lib":336}],455:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.line,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.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":224,"../../components/colorscale":235,"../../lib":336,"../../plots/plots":406,"fast-isnumeric":66}],456:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0}}},{}],457:[function(t,e,r){"use strict";function n(t,e,r,n,a){a("line.color",r),s(t,"line")&&i.isArray(t.line.color)?(a("line.colorscale"),l(t,e,n,a,{prefix:"line.",cLetter:"c"})):a("line.color",r)}function a(t,e){function r(t,e){return i.coerce(n,a,o.dimensions,t,e)}var n,a,s,l=t.dimensions||[],c=e.dimensions=[],f=1/0;for(l.length>u&&(i.log("parcoords traces support up to "+u+" dimensions at the moment"),l.splice(u)),s=0;s0);d&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),f=Math.min(f,a.values.length)),a._index=s,c.push(a)}if(isFinite(f))for(s=0;sf&&(a.values=a.values.slice(0,f));return c}var i=t("../../lib"),o=t("./attributes"),s=t("../../components/colorscale/has_colorscale"),l=t("../../components/colorscale/defaults"),u=t("./constants").maxDimensionCount;e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}var u=a(t,e);n(t,e,r,s,l),l("domain.x"),l("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var c={family:s.font.family,size:Math.round(s.font.size*(10/12)),color:s.font.color};i.coerceFont(l,"labelfont",c),i.coerceFont(l,"tickfont",c),i.coerceFont(l,"rangefont",c)}},{"../../components/colorscale/defaults":230,"../../components/colorscale/has_colorscale":234,"../../lib":336,"./attributes":452,"./constants":456}],458:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","noOpacity"],n.meta={},e.exports=n},{"./attributes":452,"./base_plot":453,"./calc":454,"./colorbar":455,"./defaults":457,"./plot":461}],459:[function(t,e,r){"use strict";function n(t){t.read({x:0,y:0,width:1,height:1,data:x})}function a(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function i(t,e,r,i,o,s){function l(n){var c;c=Math.min(i,o-n*i),s.offset=v*n*i,s.count=v*c,0===n&&(window.cancelAnimationFrame(r.currentRafs[u]),delete r.currentRafs[u],a(t,s.scissorX,s.scissorY,s.scissorWidth,s.viewBoxSize[1])),r.clearOnly||(e(s),n*i+c>>8*e)%256/255}function u(t,e,r,n){for(var a=[],i=0;i=m-4?l(i,m-2-s):.5);return a}function c(t,e,r){var n,a,i,o=[];for(a=0;ah&&(h=t[l].dim2.canvasX,c=l),t[l].dim1.canvasXa)return i;a=o,i=n[r]}return n[n.length-1]}function l(t,e,r){var n=o(r);return r.tickvals?_.scale.ordinal().domain(r.tickvals).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):_.scale.linear().domain(n).range([t-e,e])}function u(t,e){return _.scale.linear().range([t-e,e])}function c(t){return _.scale.linear().domain(o(t))}function f(t){var e=o(t);return t.tickvals&&_.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}function h(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}),n=r.map(function(t){return _.rgb(t)}),a=function(t){return function(e){return e[t]}},i="rgb".split("").map(function(t){return _.scale.linear().clamp(!0).domain(e).range(n.map(a(t)))});return function(t){return i.map(function(e){return e(t)})}}function d(t){return t[0]}function p(t,e,r){var n=d(e),a=n.trace,o=n.lineColor,s=n.cscale,l=a.line,u=a.domain,f=a.dimensions,p=t.width,g=a.labelfont,m=a.tickfont,v=a.rangefont,y=x.extendDeep({},l,{color:o.map(c({values:o,range:[l.cmin,l.cmax]})),blockLineCount:b.blockLineCount,canvasOverdrag:b.overdrag*b.canvasPixelRatio}),_=Math.floor(p*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),A=t.margin||{l:80,r:80,t:100,b:80},k=_,M=w;return{key:r,colCount:f.filter(i).length,dimensions:f,tickDistance:b.tickDistance,unitToColor:h(s),lines:y,labelFont:g,tickFont:m,rangeFont:v,translateX:u.x[0]*p,translateY:t.height-u.y[1]*t.height,pad:A,canvasWidth:k*b.canvasPixelRatio+2*y.canvasOverdrag,canvasHeight:M*b.canvasPixelRatio,width:k,height:M,canvasPixelRatio:b.canvasPixelRatio}}function g(t){var e=t.width,r=t.height,n=t.dimensions,a=t.canvasPixelRatio,o=function(r){return e*r/Math.max(1,t.colCount-1)},s=b.verticalPadding/(r*a),h=1-2*s,d=function(t){return s+h*t},p={key:t.key,xScale:o,model:t},g={};return p.dimensions=n.filter(i).map(function(e,n){var i=c(e),s=g[e.label];return g[e.label]=(s||0)+1,{key:e.label+(s?"__"+s:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:b.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(i).map(d),xScale:o,x:o(n),canvasX:o(n)*a,unitScale:u(r,b.verticalPadding),domainScale:l(r,b.verticalPadding,e),ordinalScale:f(e),domainToUnitScale:i,filter:e.constraintrange?e.constraintrange.map(i):[0,1],parent:p,model:t}}),p}function m(t){return b.layers.map(function(e){return{key:e,context:"contextLineLayer"===e,pick:"pickLineLayer"===e,viewModel:t,model:t.model}})}function v(t){t.classed("axisExtentText",!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var y=t("./lines"),b=t("./constants"),x=t("../../lib"),_=t("d3"),w=t("../../components/drawing");e.exports=function(t,e,r,i,o){function l(t){var e=t.selectAll("defs").data(a,n);e.enter().append("defs");var r=e.selectAll("#filterBarPattern").data(a,n);r.enter().append("pattern").attr("id","filterBarPattern").attr("patternUnits","userSpaceOnUse"),r.attr("x",-b.bar.width).attr("width",b.bar.capturewidth).attr("height",function(t){return t.model.height});var i=r.selectAll("rect").data(a,n);i.enter().append("rect").attr("shape-rendering","crispEdges"),i.attr("height",function(t){return t.model.height}).attr("width",b.bar.width).attr("x",b.bar.width/2).attr("fill",b.bar.fillcolor).attr("fill-opacity",b.bar.fillopacity).attr("stroke",b.bar.strokecolor).attr("stroke-opacity",b.bar.strokeopacity).attr("stroke-width",b.bar.strokewidth)}function u(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function c(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),a=n.length-1,i=0;i<1;i++)for(var o=0;o=r||s>=n)return;var l=t.lineLayer.readPixel(i,n-1-s),u=0!==l[3],c=u?l[2]+256*(l[1]+256*l[0]):null,f={x:i,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};c!==R&&(u?o.hover(f):o.unhover&&o.unhover(f),R=c)}}),C.style("margin",function(t){var e=t.model.pad;return e.t+"px "+e.r+"px "+e.b+"px "+e.l+"px"}).attr("width",function(t){return t.model.canvasWidth}).attr("height",function(t){return t.model.canvasHeight}).style("width",function(t){return t.model.width+2*b.overdrag+"px"}).style("height",function(t){return t.model.height+"px"}).style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var I=e.selectAll(".parcoords").data(L,n);I.exit().remove(),I.enter().append("g").classed("parcoords",!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(l),I.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var D=I.selectAll(".parcoordsControlView").data(a,n);D.enter().append("g").classed("parcoordsControlView",!0).style("box-sizing","content-box"),D.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var P=D.selectAll(".yAxis").data(function(t){return t.dimensions},n);P.enter().append("g").classed("yAxis",!0).each(function(t){O.dimensions.push(t)}),D.each(function(t){h(P,t)}),C.each(function(t){t.lineLayer=y(this,t.model.lines,t.model.canvasWidth,t.model.canvasHeight,t.viewModel.dimensions,t.viewModel.panels,t.model.unitToColor,t.context,t.pick,b.scatter),t.viewModel[t.key]=t.lineLayer,O.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}), -P.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),P.call(_.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;E=!1,T||(t.x=Math.max(-b.overdrag,Math.min(t.model.width+b.overdrag,_.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,P.sort(function(t,e){return t.x-e.x}).each(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio}),h(P,e),P.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),_.select(this).attr("transform","translate("+t.x+", 0)"),P.each(function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer.render&&e.focusLineLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;if(T)return void("ending"===T&&(T=!1));t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,h(P,e),_.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer&&e.focusLineLayer.render(e.panels),e.pickLineLayer&&e.pickLineLayer.render(e.panels,!0),E=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex}))})),P.exit().remove();var z=P.selectAll(".axisOverlays").data(a,n);z.enter().append("g").classed("axisOverlays",!0),z.selectAll(".axis").remove();var F=z.selectAll(".axis").data(a,n);F.enter().append("g").classed("axis",!0),F.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain(),a=t.ticktext;_.select(this).call(_.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n.map(function(t,e){return a&&a[e]||t}):null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),w.font(F.selectAll("text"),t.model.tickFont)}),F.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),F.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var B=z.selectAll(".axisHeading").data(a,n);B.enter().append("g").classed("axisHeading",!0);var N=B.selectAll(".axisTitle").data(a,n);N.enter().append("text").classed("axisTitle",!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),N.attr("transform","translate(0,"+-b.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){w.font(N,t.model.labelFont)});var j=z.selectAll(".axisExtent").data(a,n);j.enter().append("g").classed("axisExtent",!0);var H=j.selectAll(".axisExtentTop").data(a,n);H.enter().append("g").classed("axisExtentTop",!0),H.attr("transform","translate(0,"+-b.axisExtentOffset+")");var U=H.selectAll(".axisExtentTopText").data(a,n);U.enter().append("text").classed("axisExtentTopText",!0).attr("alignment-baseline","after-edge").call(v),U.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){w.font(U,t.model.rangeFont)});var V=j.selectAll(".axisExtentBottom").data(a,n);V.enter().append("g").classed("axisExtentBottom",!0),V.attr("transform",function(t){return"translate(0,"+(t.model.height+b.axisExtentOffset)+")"});var q=V.selectAll(".axisExtentBottomText").data(a,n);q.enter().append("text").classed("axisExtentBottomText",!0).attr("alignment-baseline","before-edge").call(v),q.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){w.font(q,t.model.rangeFont)});var G=z.selectAll(".axisBrush").data(a,n),X=G.enter().append("g").classed("axisBrush",!0);G.each(function(t){t.brush||(t.brush=_.svg.brush().y(t.unitScale).on("brushstart",A).on("brush",k).on("brushend",M),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),_.select(this).call(t.brush))}),X.selectAll("rect").attr("x",-b.bar.capturewidth/2).attr("width",b.bar.capturewidth),X.selectAll("rect.extent").attr("fill","url(#filterBarPattern)").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),X.selectAll(".resize rect").attr("height",b.bar.handleheight).attr("opacity",0).style("visibility","visible"),X.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",b.bar.handleoverlap-b.bar.handleheight),X.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",b.bar.handleoverlap);var Y=!1,W=!1;return O}},{"../../components/drawing":245,"../../lib":336,"./constants":456,"./lines":459,d3:60}],461:[function(t,e,r){"use strict";var n=t("./parcoords");e.exports=function(t,e){var r=t._fullLayout,a=r._paper,i=r._paperdiv,o={},s={},l=r._size;e.forEach(function(e,r){o[r]=t.data[r].dimensions,s[r]=t.data[r].dimensions.slice()});var u=function(e,r,n){var a=s[e][r],i=a.constraintrange;i&&2===i.length||(i=a.constraintrange=[]),i[0]=n[0],i[1]=n[1],t.emit("plotly_restyle")},c=function(e){t.emit("plotly_hover",e)},f=function(e){t.emit("plotly_unhover",e)},h=function(e,r){function n(t){return!("visible"in t)||t.visible}function a(t,e,r){var n=e.indexOf(r),a=t.indexOf(n);return a===-1&&(a+=e.length),a}var i=function(t){return function(e,n){return a(r,t,e)-a(r,t,n)}}(s[e].filter(n));o[e].sort(i),s[e].filter(function(t){return!n(t)}).sort(function(t){return s[e].indexOf(t)}).forEach(function(t){o[e].splice(o[e].indexOf(t),1),o[e].splice(s[e].indexOf(t),0,t)}),t.emit("plotly_restyle")};n(i,a,e,{width:l.w,height:l.h,margin:{t:l.t,r:l.r,b:l.b,l:l.l}},{filterChanged:u,hover:c,unhover:f,axesMoved:h})}},{"./parcoords":460}],462:[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 i=r.marker.line.width||0;Array.isArray(i)&&(i=i[e.i]||0),t.style({"stroke-width":i}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":221}],463:[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":492}],464:[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=i(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function a(t,e){var r=new n(t,e.uid);return r.update(e),r}var i=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.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=s(t,{})},u.updateFast=function(t){var e,r,n,a,i,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,f=t.xbounds&&t.ybounds,h=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>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]=a),id[3]&&(d[3]=i);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=a),id[3]&&(d[3]=i);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){v=l.length<100||u.length<100}this.pointcloudOptions.blend=v,g[3]*=m,this.pointcloudOptions.borderColor=g;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},u.expandAxesFast=function(t,e){for(var r,n,a,i=e||.5,o=0;o<2;o++)r=this.scene[l[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:i}),a=r._max,a||(a=[]),a.push({val:t[o+2],pad:i})},u.dispose=function(){this.pointcloud.dispose()},e.exports=a},{"../../lib/str2rgbarray":354,"../scatter/get_trace_color":476,"gl-pointcloud2d":109}],465:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio")}},{"../../lib":336,"./attributes":463}],466:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":402,"../scatter3d/calc":491,"./attributes":463,"./convert":464,"./defaults":465}],467:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&d.splice(g,d.length-g),p.length>g&&p.splice(g,p.length-g);var m={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};a.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>g&&u.splice(g,u.length-g)}var b,x=1.6*(e.marker.sizeref||1);b="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=v.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-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)||d[0]===d[g-1]&&p[0]===p[g-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,a.expand(f,d,m),a.expand(h,p,v);var _=new Array(g);for(c=0;c=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],471:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=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 i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.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":224,"../../components/colorscale":235,"../../lib":336,"../../plots/plots":406,"fast-isnumeric":66}],472:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("./subtypes");e.exports=function(t){i.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),i.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":227,"../../components/colorscale/has_colorscale":234,"./subtypes":488}],473:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],474:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=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,i){return n.coerce(t,e,a,r,i)}var m=s(t,e,p,g),v=mH!=I>=H&&(C=L[T-1][0],O=L[T][0],S=C+(O-C)*(H-R)/(I-R),F=Math.min(F,S),B=Math.max(B,S));F=Math.max(F,0),B=Math.min(B,h._length);var U=s.defaultLine;return s.opacity(f.fillcolor)?U=f.fillcolor:s.opacity((f.line||{}).color)&&(U=f.line.color),n.extendFlat(t,{distance:l+10,x0:F,x1:B,y0:H,y1:H,color:U}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":221,"../../components/errorbars":251,"../../components/fx":262,"../../lib":336,"./get_trace_color":476}],478:[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":384,"./arrays_to_calcdata":467,"./attributes":468,"./calc":469,"./clean_data":470,"./colorbar":471,"./defaults":474,"./hover":477,"./plot":485,"./select":486,"./style":487,"./subtypes":488}],479:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,o,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))a(t,e,i,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":230,"../../components/colorscale/has_colorscale":234}],480:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}var i,o,s,l,u,c,f,h,d,p,g,m,v,y,b,x,_=e.xaxis,w=e.yaxis,A=e.simplify,k=e.connectGaps,M=e.baseTolerance,T=e.linear,E=[],L=.2,S=new Array(t.length),C=0;for(A||(M=L=-1),i=0;ia(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>g?(g=v,l=c,h=!1):v=t.length||!c)break;S[C++]=c,o=c}}else S[C++]=l}E.push(S.slice(0,C))}return E}},{"../../constants/numerical":320}],481:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],482:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,i=null,o=0;o0?Math.max(e,a):0}}},{"fast-isnumeric":66}],484:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",r),a(t,"marker")&&i(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?n.background:n.defaultLine,l("marker.line.color",c),a(t,"marker.line")&&i(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":221,"../../components/colorscale/defaults":230,"../../components/colorscale/has_colorscale":234,"./subtypes":488}],485:[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 a(t,e,r,n,a,h,p){function g(t){return A?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function b(){return!1}function x(e){var r,n,a,i=e[0].trace,u=o.select(this),f=c.hasMarkers(i),h=c.hasText(i),d=y(i),p=b,v=b;f&&(p=i.marker.maxdisplayed||i._needsCull?m:s.identity),h&&(v=i.marker.maxdisplayed||i._needsCull?m:s.identity),n=u.selectAll("path.point"),r=n.data(p,d);var x=r.enter().append("path").classed("point",!0);x.call(l.pointStyle,i).call(l.translatePoints,k,M,i),A&&x.style("opacity",0).transition().style("opacity",1);var _=f&&l.tryColorscale(i.marker,""),w=f&&l.tryColorscale(i.marker,"line");r.each(function(e){var r=o.select(this),n=g(r);(a=l.translatePoint(e,n,k,M))&&(l.singlePointStyle(e,n,i,_,w,t),i.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),A?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=u.selectAll("g"),r=n.data(v,d),r.enter().append("g").classed("textpoint",!0).append("text"),r.each(function(t){var e=o.select(this),r=g(e.select("text"));(a=l.translatePoint(t,r,k,M))||e.remove()}),r.selectAll("text").call(l.textPointStyle,i).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||M.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){g(o.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;i(t,e,r,n,a);var A=!!p&&p.duration>0,k=r.xaxis,M=r.yaxis,T=n[0].trace,E=T.line,L=o.select(h);if(L.call(u.plot,r,p),T.visible===!0){g(L).style("opacity",T.opacity);var S,C,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=L;var R="",I=[],D=T._prevtrace;D&&(R=D._prevRevpath||"",C=D._nextFill,I=D._polygons);var P,z,F,B,N,j,H,U,V,q="",G="",X=[],Y=[],W=s.noop;if(S=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(C&&C.datum(n),["hv","vh","hvh","vhv"].indexOf(E.shape)!==-1?(F=l.steps(E.shape),B=l.steps(E.shape.split("").reverse().join(""))):F=B="spline"===E.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),E.smoothing):l.smoothopen(t,E.smoothing)}:function(t){return"M"+t.join("L")},N=function(t){return B(t.reverse())},X=f(n,{xaxis:k,yaxis:M,connectGaps:T.connectgaps,baseTolerance:Math.max(E.width||1,3)/4,linear:"linear"===E.shape,simplify:E.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),W=function(t){return function(e){if(P=F(e),z=N(e),q?O?(q+="L"+P.substr(1),G=z+"L"+G.substr(1)):(q+="Z"+P,G=z+"Z"+G):(q=P,G=z),c.hasLines(T)&&e.length>1){var r=o.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",P).call(l.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",P),l.singleLineStyle(n,a)}}}}}var Z=L.selectAll(".js-line").data(Y);g(Z.exit()).style("opacity",0).remove(),Z.each(W(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),X.length&&(S?j&&U&&(O?("y"===O?j[1]=U[1]=M.c2p(0,!0):"x"===O&&(j[0]=U[0]=k.c2p(0,!0)),g(S).attr("d","M"+U+"L"+j+"L"+q.substr(1))):g(S).attr("d",q+"Z")):"tonext"===T.fill.substr(0,6)&&q&&R&&("tonext"===T.fill?g(C).attr("d",q+"Z"+R+"Z"):g(C).attr("d",q+"L"+R.substr(1)+"Z"),T._polygons=T._polygons.concat(I)),T._prevRevpath=G,T._prevPolygons=V);var Q=L.selectAll(".points");_=Q.data([n]),Q.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove()}}function i(t,e,r,n,a){var i=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(i.range,i.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=n[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),m=0;a.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),h(t,e,r),n(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),m){s&&(d=s());o.transition().duration(i.duration).ease(i.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).each(function(){p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)})})}else p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":245,"../../components/errorbars":251,"../../lib":336,"../../lib/polygon":346,"./line_points":480,"./link_traces":482,"./subtypes":488,d3:60}],486:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace,h=f.index,d=f.marker,p=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!p){var g=Array.isArray(d.opacity)?1:d.opacity;if(e===!1)for(r=0;r=e.length?a:e[i]);return n}function o(t,e,r){return l(O(t,r),C(e,r),r)}function s(t,e,r,n){var a=w(t,e,n);return a=Array.isArray(a[0])?a:i(m.identity,[a],n),l(a,C(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),a=0;aa&&(a=t[o]),t[o]0?r=r.ushln(f):f<0&&(c=c.ushln(-f)),l(r,c)}var a=t("./is-rat"),i=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":16,"./is-rat":18,"./lib/is-bn":22,"./lib/num-to-bn":23,"./lib/rationalize":24,"./lib/str-to-bn":25}],18:[function(t,e,r){"use strict";function n(t){return Array.isArray(t)&&2===t.length&&a(t[0])&&a(t[1])}var a=t("./lib/is-bn");e.exports=n},{"./lib/is-bn":22}],19:[function(t,e,r){"use strict";function n(t){return t.cmp(new a(0))}var a=t("bn.js");e.exports=n},{"bn.js":32}],20:[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 i=0;i20?52:r+32}var a=t("double-bits"),i=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":31,"double-bits":63}],22:[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":32}],23:[function(t,e,r){"use strict";function n(t){var e=i.exponent(t);return e<52?new a(t):new a(t*Math.pow(2,52-e)).ushln(e-52)}var a=t("bn.js"),i=t("double-bits");e.exports=n},{"bn.js":32,"double-bits":63}],24:[function(t,e,r){"use strict";function n(t,e){var r=i(t),n=i(e);if(0===r)return[a(0),a(1)];if(0===n)return[a(0),a(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 a=t("./num-to-bn"),i=t("./bn-sign");e.exports=n},{"./bn-sign":19,"./num-to-bn":23}],25:[function(t,e,r){"use strict";function n(t){return new a(t)}var a=t("bn.js");e.exports=n},{"bn.js":32}],26:[function(t,e,r){"use strict";function n(t,e){return a(t[0].mul(e[0]),t[1].mul(e[1]))}var a=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":24}],27:[function(t,e,r){"use strict";function n(t){return a(t[0])*a(t[1])}var a=t("./lib/bn-sign");e.exports=n},{"./lib/bn-sign":19}],28:[function(t,e,r){"use strict";function n(t,e){return a(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}var a=t("./lib/rationalize");e.exports=n},{"./lib/rationalize":24}],29:[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.abs().divmod(r.abs()),o=n.div,s=a(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=i(s)+4,f=a(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=a(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}var a=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":20,"./lib/ctz":21}],30:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){var o=["function ",t,"(a,l,h,",n.join(","),"){",i?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",a?".get(m)":"[m]"];return i?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),i?o.push("return -1};"):o.push("return i};"),o.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],!1,a),n("B","x"+t+"y",e,["y"],!0,a),n("P","c(x,y)"+t+"0",e,["y","c"],!1,a),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,a),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],31:[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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var a=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--a;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))<<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))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],32:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function a(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){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(t,e,r){for(var n=0,a=Math.min(t.length,r),i=e;i=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var a=0,i=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return a}function l(t){for(var e=new Array(t.bitLength()),r=0;r>>a}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var a=0|t.words[0],i=0|e.words[0],o=a*i,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;a=0|t.words[p],i=0|e.words[d],o=a*i+f,c+=o/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,a=0,i=0;i>>26)|0,a+=o>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r.strip()}function f(t,e,r){return(new h).mulp(t,e,r)}function h(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function m(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),t=t.toString().replace(/\s+/g,"");var a=0;"-"===t[0]&&a++,16===e?this._parseHex(t,a):this._parseBase(t,e,a),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a=0;a-=3)o=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);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)a=o(t,r,r+6),this.words[n]|=a<>>26-i&4194303,(i+=24)>=26&&(i-=26,n++);r+6!==e&&(a=o(t,e,r+6),this.words[n]|=a<>>26-i&4194303),this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=e)n++;n--,a=a/e|0;for(var i=t.length-r,o=i%n,l=Math.min(i,i-o)+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.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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],A=[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){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var a=0,i=0,o=0;o>>24-a&16777215,r=0!==i||o!==this.length-1?_[6-l.length]+l+r:l+r,a+=2,a>=26&&(a-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=A[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(t);f=f.idivn(c),r=f.isZero()?h+r:_[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(i),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},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=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){ +return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,a=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;it.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,a;r>0?(n=this,a=t):(n=t,a=this);for(var i=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==i&&o>26,this.words[o]=67108863&e;if(0===i&&o>>13,d=0|o[1],p=8191&d,g=d>>>13,m=0|o[2],v=8191&m,y=m>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],A=8191&w,k=w>>>13,M=0|o[5],T=8191&M,E=M>>>13,L=0|o[6],S=8191&L,C=L>>>13,O=0|o[7],I=8191&O,R=O>>>13,D=0|o[8],P=8191&D,z=D>>>13,N=0|o[9],F=8191&N,B=N>>>13,j=0|s[0],H=8191&j,U=j>>>13,V=0|s[1],G=8191&V,q=V>>>13,X=0|s[2],Y=8191&X,W=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,K=0|s[4],J=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,at=0|s[6],it=8191&at,ot=at>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(f,H),a=Math.imul(f,U),a=a+Math.imul(h,H)|0,i=Math.imul(h,U);var mt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,H),a=Math.imul(p,U),a=a+Math.imul(g,H)|0,i=Math.imul(g,U),n=n+Math.imul(f,G)|0,a=a+Math.imul(f,q)|0,a=a+Math.imul(h,G)|0,i=i+Math.imul(h,q)|0;var vt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,H),a=Math.imul(v,U),a=a+Math.imul(y,H)|0,i=Math.imul(y,U),n=n+Math.imul(p,G)|0,a=a+Math.imul(p,q)|0,a=a+Math.imul(g,G)|0,i=i+Math.imul(g,q)|0,n=n+Math.imul(f,Y)|0,a=a+Math.imul(f,W)|0,a=a+Math.imul(h,Y)|0,i=i+Math.imul(h,W)|0;var yt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,H),a=Math.imul(x,U),a=a+Math.imul(_,H)|0,i=Math.imul(_,U),n=n+Math.imul(v,G)|0,a=a+Math.imul(v,q)|0,a=a+Math.imul(y,G)|0,i=i+Math.imul(y,q)|0,n=n+Math.imul(p,Y)|0,a=a+Math.imul(p,W)|0,a=a+Math.imul(g,Y)|0,i=i+Math.imul(g,W)|0,n=n+Math.imul(f,Q)|0,a=a+Math.imul(f,$)|0,a=a+Math.imul(h,Q)|0,i=i+Math.imul(h,$)|0;var bt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(A,H),a=Math.imul(A,U),a=a+Math.imul(k,H)|0,i=Math.imul(k,U),n=n+Math.imul(x,G)|0,a=a+Math.imul(x,q)|0,a=a+Math.imul(_,G)|0,i=i+Math.imul(_,q)|0,n=n+Math.imul(v,Y)|0,a=a+Math.imul(v,W)|0,a=a+Math.imul(y,Y)|0,i=i+Math.imul(y,W)|0,n=n+Math.imul(p,Q)|0,a=a+Math.imul(p,$)|0,a=a+Math.imul(g,Q)|0,i=i+Math.imul(g,$)|0,n=n+Math.imul(f,J)|0,a=a+Math.imul(f,tt)|0,a=a+Math.imul(h,J)|0,i=i+Math.imul(h,tt)|0;var xt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,H),a=Math.imul(T,U),a=a+Math.imul(E,H)|0,i=Math.imul(E,U),n=n+Math.imul(A,G)|0,a=a+Math.imul(A,q)|0,a=a+Math.imul(k,G)|0,i=i+Math.imul(k,q)|0,n=n+Math.imul(x,Y)|0,a=a+Math.imul(x,W)|0,a=a+Math.imul(_,Y)|0,i=i+Math.imul(_,W)|0,n=n+Math.imul(v,Q)|0,a=a+Math.imul(v,$)|0,a=a+Math.imul(y,Q)|0,i=i+Math.imul(y,$)|0,n=n+Math.imul(p,J)|0,a=a+Math.imul(p,tt)|0,a=a+Math.imul(g,J)|0,i=i+Math.imul(g,tt)|0,n=n+Math.imul(f,rt)|0,a=a+Math.imul(f,nt)|0,a=a+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0;var _t=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(S,H),a=Math.imul(S,U),a=a+Math.imul(C,H)|0,i=Math.imul(C,U),n=n+Math.imul(T,G)|0,a=a+Math.imul(T,q)|0,a=a+Math.imul(E,G)|0,i=i+Math.imul(E,q)|0,n=n+Math.imul(A,Y)|0,a=a+Math.imul(A,W)|0,a=a+Math.imul(k,Y)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(x,Q)|0,a=a+Math.imul(x,$)|0,a=a+Math.imul(_,Q)|0,i=i+Math.imul(_,$)|0,n=n+Math.imul(v,J)|0,a=a+Math.imul(v,tt)|0,a=a+Math.imul(y,J)|0,i=i+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,a=a+Math.imul(p,nt)|0,a=a+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0,n=n+Math.imul(f,it)|0,a=a+Math.imul(f,ot)|0,a=a+Math.imul(h,it)|0,i=i+Math.imul(h,ot)|0;var wt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(I,H),a=Math.imul(I,U),a=a+Math.imul(R,H)|0,i=Math.imul(R,U),n=n+Math.imul(S,G)|0,a=a+Math.imul(S,q)|0,a=a+Math.imul(C,G)|0,i=i+Math.imul(C,q)|0,n=n+Math.imul(T,Y)|0,a=a+Math.imul(T,W)|0,a=a+Math.imul(E,Y)|0,i=i+Math.imul(E,W)|0,n=n+Math.imul(A,Q)|0,a=a+Math.imul(A,$)|0,a=a+Math.imul(k,Q)|0,i=i+Math.imul(k,$)|0,n=n+Math.imul(x,J)|0,a=a+Math.imul(x,tt)|0,a=a+Math.imul(_,J)|0,i=i+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,a=a+Math.imul(v,nt)|0,a=a+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,n=n+Math.imul(p,it)|0,a=a+Math.imul(p,ot)|0,a=a+Math.imul(g,it)|0,i=i+Math.imul(g,ot)|0,n=n+Math.imul(f,lt)|0,a=a+Math.imul(f,ut)|0,a=a+Math.imul(h,lt)|0,i=i+Math.imul(h,ut)|0;var At=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(P,H),a=Math.imul(P,U),a=a+Math.imul(z,H)|0,i=Math.imul(z,U),n=n+Math.imul(I,G)|0,a=a+Math.imul(I,q)|0,a=a+Math.imul(R,G)|0,i=i+Math.imul(R,q)|0,n=n+Math.imul(S,Y)|0,a=a+Math.imul(S,W)|0,a=a+Math.imul(C,Y)|0,i=i+Math.imul(C,W)|0,n=n+Math.imul(T,Q)|0,a=a+Math.imul(T,$)|0,a=a+Math.imul(E,Q)|0,i=i+Math.imul(E,$)|0,n=n+Math.imul(A,J)|0,a=a+Math.imul(A,tt)|0,a=a+Math.imul(k,J)|0,i=i+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,a=a+Math.imul(x,nt)|0,a=a+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,n=n+Math.imul(v,it)|0,a=a+Math.imul(v,ot)|0,a=a+Math.imul(y,it)|0,i=i+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,a=a+Math.imul(p,ut)|0,a=a+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0,n=n+Math.imul(f,ft)|0,a=a+Math.imul(f,ht)|0,a=a+Math.imul(h,ft)|0,i=i+Math.imul(h,ht)|0;var kt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,H),a=Math.imul(F,U),a=a+Math.imul(B,H)|0,i=Math.imul(B,U),n=n+Math.imul(P,G)|0,a=a+Math.imul(P,q)|0,a=a+Math.imul(z,G)|0,i=i+Math.imul(z,q)|0,n=n+Math.imul(I,Y)|0,a=a+Math.imul(I,W)|0,a=a+Math.imul(R,Y)|0,i=i+Math.imul(R,W)|0,n=n+Math.imul(S,Q)|0,a=a+Math.imul(S,$)|0,a=a+Math.imul(C,Q)|0,i=i+Math.imul(C,$)|0,n=n+Math.imul(T,J)|0,a=a+Math.imul(T,tt)|0,a=a+Math.imul(E,J)|0,i=i+Math.imul(E,tt)|0,n=n+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,a=a+Math.imul(k,rt)|0,i=i+Math.imul(k,nt)|0,n=n+Math.imul(x,it)|0,a=a+Math.imul(x,ot)|0,a=a+Math.imul(_,it)|0,i=i+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,a=a+Math.imul(v,ut)|0,a=a+Math.imul(y,lt)|0,i=i+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,a=a+Math.imul(p,ht)|0,a=a+Math.imul(g,ft)|0,i=i+Math.imul(g,ht)|0,n=n+Math.imul(f,pt)|0,a=a+Math.imul(f,gt)|0,a=a+Math.imul(h,pt)|0,i=i+Math.imul(h,gt)|0;var Mt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,G),a=Math.imul(F,q),a=a+Math.imul(B,G)|0,i=Math.imul(B,q),n=n+Math.imul(P,Y)|0,a=a+Math.imul(P,W)|0,a=a+Math.imul(z,Y)|0,i=i+Math.imul(z,W)|0,n=n+Math.imul(I,Q)|0,a=a+Math.imul(I,$)|0,a=a+Math.imul(R,Q)|0,i=i+Math.imul(R,$)|0,n=n+Math.imul(S,J)|0,a=a+Math.imul(S,tt)|0,a=a+Math.imul(C,J)|0,i=i+Math.imul(C,tt)|0,n=n+Math.imul(T,rt)|0,a=a+Math.imul(T,nt)|0,a=a+Math.imul(E,rt)|0,i=i+Math.imul(E,nt)|0,n=n+Math.imul(A,it)|0,a=a+Math.imul(A,ot)|0,a=a+Math.imul(k,it)|0,i=i+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,a=a+Math.imul(x,ut)|0,a=a+Math.imul(_,lt)|0,i=i+Math.imul(_,ut)|0,n=n+Math.imul(v,ft)|0,a=a+Math.imul(v,ht)|0,a=a+Math.imul(y,ft)|0,i=i+Math.imul(y,ht)|0,n=n+Math.imul(p,pt)|0,a=a+Math.imul(p,gt)|0,a=a+Math.imul(g,pt)|0,i=i+Math.imul(g,gt)|0;var Tt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,Y),a=Math.imul(F,W),a=a+Math.imul(B,Y)|0,i=Math.imul(B,W),n=n+Math.imul(P,Q)|0,a=a+Math.imul(P,$)|0,a=a+Math.imul(z,Q)|0,i=i+Math.imul(z,$)|0,n=n+Math.imul(I,J)|0,a=a+Math.imul(I,tt)|0,a=a+Math.imul(R,J)|0,i=i+Math.imul(R,tt)|0,n=n+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,a=a+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,n=n+Math.imul(T,it)|0,a=a+Math.imul(T,ot)|0,a=a+Math.imul(E,it)|0,i=i+Math.imul(E,ot)|0,n=n+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,a=a+Math.imul(k,lt)|0,i=i+Math.imul(k,ut)|0,n=n+Math.imul(x,ft)|0,a=a+Math.imul(x,ht)|0,a=a+Math.imul(_,ft)|0,i=i+Math.imul(_,ht)|0,n=n+Math.imul(v,pt)|0,a=a+Math.imul(v,gt)|0,a=a+Math.imul(y,pt)|0,i=i+Math.imul(y,gt)|0;var Et=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,Q),a=Math.imul(F,$),a=a+Math.imul(B,Q)|0,i=Math.imul(B,$),n=n+Math.imul(P,J)|0,a=a+Math.imul(P,tt)|0,a=a+Math.imul(z,J)|0,i=i+Math.imul(z,tt)|0,n=n+Math.imul(I,rt)|0,a=a+Math.imul(I,nt)|0,a=a+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,n=n+Math.imul(S,it)|0,a=a+Math.imul(S,ot)|0,a=a+Math.imul(C,it)|0,i=i+Math.imul(C,ot)|0,n=n+Math.imul(T,lt)|0,a=a+Math.imul(T,ut)|0,a=a+Math.imul(E,lt)|0,i=i+Math.imul(E,ut)|0,n=n+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0,a=a+Math.imul(k,ft)|0,i=i+Math.imul(k,ht)|0,n=n+Math.imul(x,pt)|0,a=a+Math.imul(x,gt)|0,a=a+Math.imul(_,pt)|0,i=i+Math.imul(_,gt)|0;var Lt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(F,J),a=Math.imul(F,tt),a=a+Math.imul(B,J)|0,i=Math.imul(B,tt),n=n+Math.imul(P,rt)|0,a=a+Math.imul(P,nt)|0,a=a+Math.imul(z,rt)|0,i=i+Math.imul(z,nt)|0,n=n+Math.imul(I,it)|0,a=a+Math.imul(I,ot)|0,a=a+Math.imul(R,it)|0,i=i+Math.imul(R,ot)|0,n=n+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,a=a+Math.imul(C,lt)|0,i=i+Math.imul(C,ut)|0,n=n+Math.imul(T,ft)|0,a=a+Math.imul(T,ht)|0,a=a+Math.imul(E,ft)|0,i=i+Math.imul(E,ht)|0,n=n+Math.imul(A,pt)|0,a=a+Math.imul(A,gt)|0,a=a+Math.imul(k,pt)|0,i=i+Math.imul(k,gt)|0;var St=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,rt),a=Math.imul(F,nt),a=a+Math.imul(B,rt)|0,i=Math.imul(B,nt),n=n+Math.imul(P,it)|0,a=a+Math.imul(P,ot)|0,a=a+Math.imul(z,it)|0,i=i+Math.imul(z,ot)|0,n=n+Math.imul(I,lt)|0,a=a+Math.imul(I,ut)|0,a=a+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,n=n+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0,a=a+Math.imul(C,ft)|0,i=i+Math.imul(C,ht)|0,n=n+Math.imul(T,pt)|0,a=a+Math.imul(T,gt)|0,a=a+Math.imul(E,pt)|0,i=i+Math.imul(E,gt)|0;var Ct=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,it),a=Math.imul(F,ot),a=a+Math.imul(B,it)|0,i=Math.imul(B,ot),n=n+Math.imul(P,lt)|0,a=a+Math.imul(P,ut)|0,a=a+Math.imul(z,lt)|0,i=i+Math.imul(z,ut)|0,n=n+Math.imul(I,ft)|0,a=a+Math.imul(I,ht)|0,a=a+Math.imul(R,ft)|0,i=i+Math.imul(R,ht)|0,n=n+Math.imul(S,pt)|0,a=a+Math.imul(S,gt)|0,a=a+Math.imul(C,pt)|0,i=i+Math.imul(C,gt)|0;var Ot=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(F,lt),a=Math.imul(F,ut),a=a+Math.imul(B,lt)|0,i=Math.imul(B,ut),n=n+Math.imul(P,ft)|0,a=a+Math.imul(P,ht)|0,a=a+Math.imul(z,ft)|0,i=i+Math.imul(z,ht)|0,n=n+Math.imul(I,pt)|0,a=a+Math.imul(I,gt)|0,a=a+Math.imul(R,pt)|0,i=i+Math.imul(R,gt)|0;var It=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,ft),a=Math.imul(F,ht),a=a+Math.imul(B,ft)|0,i=Math.imul(B,ht),n=n+Math.imul(P,pt)|0,a=a+Math.imul(P,gt)|0,a=a+Math.imul(z,pt)|0,i=i+Math.imul(z,gt)|0;var Rt=(u+n|0)+((8191&a)<<13)|0;u=(i+(a>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(F,pt),a=Math.imul(F,gt),a=a+Math.imul(B,pt)|0,i=Math.imul(B,gt);var Dt=(u+n|0)+((8191&a)<<13)|0;return u=(i+(a>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,l[0]=mt,l[1]=vt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=At,l[8]=kt,l[9]=Mt,l[10]=Tt,l[11]=Et,l[12]=Lt,l[13]=St,l[14]=Ct,l[15]=Ot,l[16]=It,l[17]=Rt,l[18]=Dt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(k=u),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?k(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):f(this,t,e)},h.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},h.prototype.permute=function(t,e,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*e;o>=26,e+=a/67108864|0,e+=i>>>26,this.words[r]=67108863&i}return 0!==e&&(this.words[r]=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.imul(this.clone())},i.prototype.pow=function(t){var e=l(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,r=t%26,a=(t-r)/26,i=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==a){for(e=this.length-1;e>=0;e--)this.words[e+a]=this.words[e];for(e=0;e=0);var a;a=e?(e-e%26)/26:0;var i=t%26,o=Math.min((t-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=a);u--){var f=0|this.words[u];this.words[u]=c<<26-i|f>>>i,c=f&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,a=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var a=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(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[a+r]=67108863&o}for(;a>26,this.words[a+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,a=0;a>26,this.words[a]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){s=new i(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[a.length+f])+(0|n.words[a.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(a,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(a,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new 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",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),a=t.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,a=this.length-1;a>=0;a--)r=(e*r+(0|this.words[a]))%t;return r},i.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var a=(0|this.words[r])+67108864*e;this.words[r]=a/t|0,e=a%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(f)),a.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s),o.isub(l)):(r.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(o)):(r.isub(e),o.isub(a))}var h;return h=0===e.cmpn(1)?a:o,h.cmpn(0)<0&&h.iadd(t),h},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var a=e.cmp(r);if(a<0){var i=e;e=r,r=i}else if(0===a||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},i.prototype.invm=function(t){return this.egcd(t).a.umod(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){n("number"==typeof t);var e=t%26,r=(t-e)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var a=0|this.words[0];r=a===t?0:at.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|t.words[r];if(n!==a){na&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new y(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(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 n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var M={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},a(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,a=i}a>>>=22,t.words[n-10]=a,0===a&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=a,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(M[t])return M[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new g;else if("p192"===t)e=new m;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new v}return M[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,a),h=this.pow(t,a.addn(1).iushrn(1)),d=this.pow(t,a),p=o;0!==d.cmp(s);){for(var g=d,m=0;0!==g.cmp(s);m++)g=g.redSqr();n(m=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new b(t)},a(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},b.prototype.mul=function(t,e){ +if(t.isZero()||e.isZero())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).iushrn(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)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],33:[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*i),c=f.mallocInt32(i);if((i=a(t,s,u,c))>0){if(1===s&&n)h.init(i),l=h.sweepComplete(s,r,0,i,u,c,0,i,u,c);else{var p=f.mallocDouble(2*s*o),g=f.mallocInt32(o);o=a(e,s,p,g),o>0&&(h.init(i+o),l=1===s?h.sweepBipartite(s,r,0,i,u,c,0,o,p,g):d(s,r,n,i,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=[],i(t,t,o,!0),c}function l(t,e){return c=[],i(t,e,o,!1),c}function u(t,e,r){switch(arguments.length){case 1:return s(t);case 2:return"function"==typeof e?i(t,t,e,!0):l(t,e);case 3:return i(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":35,"./lib/sweep":39,"typedarray-pool":202}],34:[function(t,e,r){"use strict";function n(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),a=["function ",n,"(",w.join(),"){","var ",u,"=2*",i,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+i+"],xi="+d+"[i];",A="for(var j="+g+","+b+"="+u+"*"+g+";j<"+m+";++j,"+b+"+="+u+"){var y0="+v+"["+o+"+"+b+"],"+(r?"y1="+v+"["+o+"+"+b+"+"+i+"],":"")+"yi="+y+"[j];";return t?a.push(l,_,":",A):a.push(A,_,":",l),r?a.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=a.join("")+o.join("");return new Function(s)()}var i="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",g="bs",m="be",v="bb",y="bi",b="bp",x="rv",_="Q",w=[i,o,s,c,f,h,d,g,m,v,y];r.partial=a(!1),r.full=a(!0)},{}],35:[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);E.length0;){O-=1;var R=O*M,D=E[R],P=E[R+1],z=E[R+2],N=E[R+3],F=E[R+4],B=E[R+5],j=O*T,H=L[j],U=L[j+1],V=1&B,G=!!(16&B),q=l,X=u,Y=g,W=S;if(V&&(q=g,X=S,Y=l,W=u),!(2&B&&(z=_(t,D,P,z,q,X,U),P>=z)||4&B&&(P=w(t,D,P,z,q,X,H))>=z)){var Z=z-P,Q=F-N;if(G){if(t*Z*(Z+Q)=p0)&&!(p1>=hi)",["p0","p1"]),x=g("lo===p0",["p0"]),_=g("lor&&a[f+e]>u;--c,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=i[h*f+e];u=b?(d=y,p=b):v>=_?(d=m,p=v):(d=x,p=_):b>=_?(d=y,p=b):_>=v?(d=m,p=v):(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(a.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)}e.exports=n;var a="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"},{}],38:[function(t,e,r){"use strict";function n(t,e){e<=4*h?a(0,e-1,t):f(0,e-1,t)}function a(t,e,r){for(var n=2*(t+1),a=t+1;a<=e;++a){for(var i=r[n++],o=r[n++],s=a,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 a=n[t];return a>1,m=g-n,v=g+n,y=d,b=m,x=g,_=v,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,O=2*x,I=2*w,R=2*d,D=2*g,P=2*p,z=0;z<2;++z){var N=r[C+z],F=r[O+z],B=r[I+z];r[R+z]=N,r[D+z]=F,r[P+z]=B}o(m,t,r),o(v,e,r);for(var j=A;j<=k;++j)if(c(j,T,E,r))j!==A&&i(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):(i(j,k,r),--k);break}if(--k>>1;h(x,E);for(var L=0,S=0,A=0;A=d)C=C-d|0,a(m,v,S--,C);else if(C>=0)a(p,g,L--,C);else if(C<=-d){C=-C-d|0;for(var O=0;O>>1;h(x,L);for(var S=0,C=0,O=0,k=0;k>1==x[2*k+3]>>1&&(R=2,k+=1),I<0){for(var D=-(I>>1)-1,P=0;P>1)-1;0===R?a(p,g,S--,D):1===R?a(m,v,C--,D):2===R&&a(y,b,O--,D)}}}function l(t,e,r,n,o,s,l,u,c,f,m,v){var y=0,b=2*t,_=e,w=e+t,A=1,k=1;n?k=d:A=d;for(var M=o;M>>1;h(x,S);for(var C=0,M=0;M=d?(I=!n,T-=d):(I=!!n,T-=1),I)i(p,g,C++,T);else{var R=v[T],D=b*T,P=m[D+e+1],z=m[D+e+1+t];t:for(var N=0;N>>1;h(x,A);for(var k=0,y=0;y=d)p[k++]=b-d;else{b-=1;var T=c[b],E=g*b,L=u[E+e+1],S=u[E+e+1+t];t:for(var C=0;C=0;--C)if(p[C]===b){for(var D=C+1;DZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return i(t,e,r)}function i(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?f(t,e,r):"string"==typeof t?u(t,e):h(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),i=n(r),o=i.write(t,e);return o!==r&&(i=i.slice(0,o)),i}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),a=0;a=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),a.alloc(+t)}function g(t,e){if(a.isBuffer(t))return t.length;if(q(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 j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(t).length;default:if(n)return j(t).length;e=(""+e).toLowerCase(),n=!0}}function m(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 E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(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,X(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=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,a){function i(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}var u;if(a){var c=-1;for(u=r;us&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;ha&&(n=a):n=a;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o239?4:i>223?3:i>191?2:1;if(a+s<=r){var l,u,c,f;switch(s){case 1:i<128&&(o=i);break;case 2:l=t[a+1],128==(192&l)&&(f=(31&i)<<6|63&l)>127&&(o=f);break;case 3:l=t[a+1],u=t[a+2],128==(192&l)&&128==(192&u)&&(f=(15&i)<<12|(63&l)<<6|63&u)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:l=t[a+1],u=t[a+2],c=t[a+3],128==(192&l)&&128==(192&u)&&128==(192&c)&&(f=(15&i)<<18|(63&l)<<12|(63&u)<<6|63&c)>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),a+=s}return L(n)}function L(t){var e=t.length;if(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var a="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,r,n,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function P(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function z(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function N(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function F(t){if(t=t.trim().replace($,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){e=e||1/0;for(var r,n=t.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function H(t){for(var e=[],r=0;r>8,a=r%256,i.push(a),i.push(n);return i}function V(t){return Y.toByteArray(F(t))}function G(t,e,r,n){for(var a=0;a=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function q(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function X(t){return t!==t}var Y=t("base64-js"),W=t("ieee754");r.Buffer=a,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,a.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(t,e,r){return i(t,e,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(t,e,r){return s(t,e,r)},a.allocUnsafe=function(t){return l(t)},a.allocUnsafeSlow=function(t){return l(t)},a.isBuffer=function(t){return null!=t&&!0===t._isBuffer},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},a.prototype.compare=function(t,e,r,n,i){if(!a.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 o=i-n,s=r-e,l=Math.min(o,s),u=this.slice(n,i),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-e;if((void 0===r||r>a)&&(r=a),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return A(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],a=1,i=0;++i>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t+--e],a=1;e>0&&(a*=256);)n+=this[t+--e]*a;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=this[t],a=1,i=0;++i=a&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var n=e,a=1,i=this[t+--n];n>0&&(a*=256);)i+=this[t+--n]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),W.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),W.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){D(this,t,e,r,Math.pow(2,8*r)-1,0)}var a=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,!n){D(this,t,e,r,Math.pow(2,8*r)-1,0)}var a=r-1,i=1;for(this[e+a]=255&t;--a>=0&&(i*=256);)this[e+a]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);D(this,t,e,r,a-1,-a)}var i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var a=Math.pow(2,8*r-1);D(this,t,e,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.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),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},a.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;--a)t[a+e]=this[a+r];else if(i<1e3)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function a(t){return 3*t.length/4-n(t)}function i(t){var e,r,a,i,o,s,l=t.length;o=n(t),s=new f(3*l/4-o),a=o>0?l-4:l;var u=0;for(e=0,r=0;e>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===o?(i=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4, +s[u++]=255&i):1===o&&(i=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),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,a=[],i=e;il?l:o+16383));return 1===n?(e=t[r-1],a+=u[e>>2],a+=u[e<<4&63],a+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],a+=u[e>>10],a+=u[e>>4&63],a+=u[e<<2&63],a+="="),i.push(a),i.join("")}r.byteLength=a,r.toByteArray=i,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 i=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=a},{"binary-search-bounds":47,"robust-in-sphere":178}],44:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=a,this.next=i,this.boundary=o}function a(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}function i(t,e){for(var r=t.cells(),i=r.length,o=0;o0||l.length>0;){for(;s.length>0;){var d=s.pop();if(u[d]!==-a){u[d]=a;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]=a))}}}var m=l;l=s,s=m,l.length=0,a=-a}var v=o(c,u,e);return r?v.concat(n.boundary):v}var l=t("binary-search-bounds");e.exports=s,n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var i=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],a]),f-=1;c.length=f,c.push(a);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],a]),f-=1;p.length=f,p.push(a)}}function l(t,e){var r;return(r=t.a[0]v[0]&&l.push(new a(v,d,m,f),new a(d,v,g,f))}l.sort(i);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===m?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,m=2;e.exports=f},{"binary-search-bounds":47,"robust-orientation":179}],46:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function a(t,e,r){for(var n=1,a=t.length;n=0}}(),s.removeTriangle=function(t,e,r){var n=this.stars;a(n[t],e,r),a(n[e],r,t),a(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,a=r.length;n>>1,x=a[m]"];return a?e.indexOf("c")<0?i.push(";if(x===y){return m}else if(x<=y){"):i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):i.push(";if(",e,"){i=m;"),r?i.push("l=m+1}else{h=m-1}"):i.push("h=m-1}else{l=m+1}"),i.push("}"),a?i.push("return -1};"):i.push("return i};"),i.join("")}function a(t,e,r,a){return new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:a(">=",!1,"GE"),gt:a(">",!1,"GT"),lt:a("<",!0,"LT"),le:a("<=",!0,"LE"),eq:a("-",!0,"EQ",!0)}},{}],48:[function(t,e,r){function n(t,e,r){return er?r:t:te?e:t}e.exports=n},{}],49:[function(t,e,r){"use strict";function n(t){var e=_(t);return[A(e,-1/0),A(e,1/0)]}function a(t,e){for(var r=new Array(e.length),n=0;n=0;--i){var p=n[i];o=p[0];var g=e[o],m=g[0],v=g[1],y=t[m],A=t[v];if((y[0]-A[0]||y[1]-A[1])<0){var M=m;m=v,v=M}g[0]=m;var T,E=g[1]=p[1];for(a&&(T=g[2]);i>0&&n[i-1][0]===o;){var p=n[--i],L=p[1];a?e.push([E,L,T]):e.push([E,L]),E=L}a?e.push([E,v,T]):e.push([E,v])}return s}function u(t,e,r){for(var a=e.length,i=new m(a),o=[],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 g(t,e,r){var n;if(r){n=e;for(var a=new Array(e.length),i=0;i>>24,n=(16711680&t)>>>16,a=(65280&t)>>>8,i=255&t;return!1===e?[r,n,a,i]:[r/255,n/255,a/255,i/255]}var i=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=a},{clamp:48}],52:[function(t,e,r){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],53:[function(t,e,r){"use strict";function n(t){var e,r,n=[],s=1;if("string"==typeof t)if(a[t])n=a[t].slice(),r="rgb";else if("transparent"===t)s=0,r="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var l=t.slice(1),u=l.length,c=u<=4;s=1,c?(n=[parseInt(l[0]+l[0],16),parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16)],4===u&&(s=parseInt(l[3]+l[3],16)/255)):(n=[parseInt(l[0]+l[1],16),parseInt(l[2]+l[3],16),parseInt(l[4]+l[5],16)],8===u&&(s=parseInt(l[6]+l[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),r="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var f=e[1],l=f.replace(/a$/,"");r=l;var u="cmyk"===l?4:"gray"===l?1:3;n=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===u?parseFloat(t)/100:"rgb"===l?255*parseFloat(t)/100:parseFloat(t);if("h"===l[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),f===l&&n.push(1),s=void 0===n[u]?1:n[u],n=n.slice(0,u)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):i(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var a=t("color-name"),i=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":52,"is-plain-obj":154}],54:[function(t,e,r){"use strict";var n=t("color-parse"),a=t("color-space/hsl"),i=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,i=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,a[u]=255*i;return a}},n.hsl=function(t){var e,r,n,a=t[0]/255,i=t[1]/255,o=t[2]/255,s=Math.min(a,i,o),l=Math.max(a,i,o),u=l-s;return l===s?e=0:a===l?e=(i-o)/u:i===l?e=2+(o-a)/u:o===l&&(e=4+(a-i)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":56}],56:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],57:[function(t,e,r){"use strict";function n(t,e,r){var n=s(t[0],-e[0]),a=s(t[1],-e[1]),i=s(r[0],-e[0]),o=s(r[1],-e[1]),c=u(l(n,i),l(a,o));return c[c.length-1]>=0}function a(t,e,r,a){var s=i(e,r,a);if(0===s){var l=o(i(t,e,r)),u=o(i(t,e,a));if(l===u){if(0===l){var c=n(t,e,r);return c===n(t,e,a)?0:c?1:-1}return 0}return 0===u?l>0?-1:n(t,e,a)?-1:1:0===l?u>0?1:n(t,e,r)?1:-1:o(u-l)}var f=i(t,e,r);return f>0?s>0&&i(t,e,a)>0?1:-1:f<0?s>0||i(t,e,a)>0?1:-1:i(t,e,a)>0?1:n(t,e,r)?1:-1}e.exports=a;var i=t("robust-orientation"),o=t("signum"),s=t("two-sum"),l=t("robust-product"),u=t("robust-sum")},{"robust-orientation":179,"robust-product":180,"robust-sum":184,signum:185,"two-sum":201}],58:[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 a(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 a=0;a0)throw new Error("cwise: pre() block may not reference array args");if(a0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===o)e.scalarArgs.push(a),e.shimArgs.push("scalar"+a);else if("index"===o){if(e.indexArgs.push(a),a0)throw new Error("cwise: pre() block may not reference array index");if(a0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===o){if(e.shapeArgs.push(a),ar.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,i(e)}var i=t("./lib/thunk.js");e.exports=a},{"./lib/thunk.js":60}],59:[function(t,e,r){"use strict";function n(t,e,r){var n,a,i=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],u=[],c=0,f=0;for(n=0;n0&&l.push("var "+u.join(",")),n=i-1;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 a(t,e,r,a){for(var i=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;f0&&x.push("var "+_.join(","));for(var f=0;f3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),E=i(m);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("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:204}],60:[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 i=[],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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ce?1:t>=e?0:NaN}function i(t){return null===t?NaN:+t}function o(t){return!isNaN(t)}function s(t){return{left:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)<0?n=i+1:a=i}return n},right:function(e,r,n,a){for(arguments.length<3&&(n=0),arguments.length<4&&(a=e.length);n>>1;t(e[i],r)>0?a=i:n=i+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 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 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=a+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Ro.get(t);return u&&(t=u,l=Q),s?e?a:n:e?A:i}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-"+ ++Po,a="click"+r,i=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(i.on(r,null),Do&&(o[Do]=s),t){var e=function(){i.on(a,null)};i.on(a,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 a=r.createSVGPoint();if(zo<0){var i=n(t);if(i.scrollX||i.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?(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 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?Uo:t<-1?-Uo:Math.asin(t)}function at(t){return((t=Math.exp(t))-1/t)/2}function it(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?i+(o-i)*t/60:t<180?o:t<240?i+(o-i)*(240-t)/60:i}function a(t){return Math.round(255*n(t))}var i,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,i=2*r-o,new bt(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 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,a=n+e/500,i=n-r/200;return a=mt(a)*Ko,n=mt(n)*Jo,i=mt(i)*ts,new bt(yt(3.2404542*a-1.5371385*n-.4985314*i),yt(-.969266*a+1.8760108*n+.041556*i),yt(.0556434*a-.2040259*n+1.0572252*i))}function gt(t,e,r){return t>0?new ft(Math.atan2(r,e)*Go,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 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,a,i,o=0,s=0,l=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(Et(a[0]),Et(a[1]),Et(a[2]))}return(i=ns.get(t))?e(i.r,i.g,i.b):(null==t||"#"!==t.charAt(0)||isNaN(i=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&i)>>4,o|=o>>4,s=240&i,s|=s>>4,l=15&i,l|=l<<4):7===t.length&&(o=(16711680&i)>>16,s=(65280&i)>>8,l=255&i)),e(o,s,l))}function kt(t,e,r){var n,a,i=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-i,l=(o+i)/2;return s?(a=l<.5?s/(o+i):s/(2-o-i),n=t==o?(e-r)/s+(e0&&l<1?0:n),new ut(n,a,l)}function Mt(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/Ko),a=vt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*a-16,500*(n-a),200*(a-vt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 a(){var t,e=l.status;if(!e&&It(l)||e>=200&&e<300||304===e){try{t=r.call(i,l)}catch(t){return void o.error.call(i,t)}o.load.call(i,t)}else o.error.call(i,l)}var i={},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=a:l.onreadystatechange=function(){l.readyState>3&&a()},l.onprogress=function(t){var e=uo.event;uo.event=t;try{o.progress.call(i,l)}finally{uo.event=e}},i.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",i)},i.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",i):e},i.responseType=function(t){return arguments.length?(u=t,i):u},i.response=function(t){return r=t,i},["get","post"].forEach(function(t){i[t]=function(){return i.send.apply(i,[t].concat(fo(arguments)))}}),i.send=function(r,n,a){if(2===arguments.length&&"function"==typeof n&&(a=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!=a&&i.on("error",a).on("load",function(t){a(null,t)}),o.beforesend.call(i,l),l.send(null==n?null:n),i},i.abort=function(){return l.abort(),i},uo.rebind(i,o,"on"),null==n?i:i.get(Ot(n))}function Ot(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 Rt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var a=r+e,i={c:t,t:a,n:null};return is?is.n=i:as=i,is=i,os||(ss=clearTimeout(ss),os=1,ls(Dt)),i}function Dt(){var t=Pt(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Dt,e)),os=0):(os=1,ls(Dt))}function Pt(){for(var t=Date.now(),e=as;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=as,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,a=t.currency,i=n&&r?function(t,e){for(var a=t.length,i=[],o=0,s=n[0],l=0;a>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),i.push(t.substring(a-=s,a+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return i.reverse().join(r)}:x;return function(t){var r=cs.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="",m="",v=!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,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,h=0;break;case"s":p=-1,d="r"}"$"===l&&(g=a[0],m=a[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=fs.get(d)||jt;var b=u&&f;return function(t){var r=m;if(v&&t%1)return"";var a=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+m}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=i(x,1/0));var k=g.length+x.length+_.length+(b?0:a.length),M=k"===o?M+a+t:"^"===o?M.substring(0,k>>=1)+a+t+M.substring(k):a+(b?t:M+t))+r}}}function jt(t){return t+""}function Ht(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ut(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1)for(;o=u)return-1;if(37===(a=e.charCodeAt(s++))){if(o=e.charAt(s++),!(i=S[o in gs?e.charAt(s++):o])||(n=i(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=A.get(n[0].toLowerCase()),r+n[0].length):-1}function a(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.w=_.get(n[0].toLowerCase()),r+n[0].length):-1}function i(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,m=t.shortDays,v=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ht;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ht;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Yt(g),w=Xt(m),A=Yt(m),k=Xt(v),M=Yt(v),T=Xt(y),E=Yt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var L={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 qt(t.getDate(),e,2)},e:function(t,e){return qt(t.getDate(),e,2)},H:function(t,e){return qt(t.getHours(),e,2)},I:function(t,e){return qt(t.getHours()%12||12,e,2)},j:function(t,e){return qt(1+hs.dayOfYear(t),e,3)},L:function(t,e){return qt(t.getMilliseconds(),e,3)},m:function(t,e){return qt(t.getMonth()+1,e,2)},M:function(t,e){return qt(t.getMinutes(),e,2)},p:function(t){return p[+(t.getHours()>=12)]},S:function(t,e){return qt(t.getSeconds(),e,2)},U:function(t,e){return qt(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return qt(hs.mondayOfYear(t),e,2)},x:e(h),X:e(d),y:function(t,e){return qt(t.getFullYear()%100,e,2)},Y:function(t,e){return qt(t.getFullYear()%1e4,e,4)},Z:le,"%":function(){return"%"}},S={a:n,A:a,b:i,B:o,c:s,d:re,e:re,H:ae,I:ae,j:ne,L:se,m:ee,M:ie,p:c,S:oe,U:Zt,w:Wt,W:Qt,x:l,X:u,y:Kt,Y:$t,Z:Jt,"%":ue};return e}function qt(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3)}function ee(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ae(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ie(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){ms.lastIndex=0;var n=ms.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){ms.lastIndex=0;var n=ms.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,a=xo(e)%60;return r+qt(n,"0",2)+qt(a,"0",2)}function ue(t,e,r){vs.lastIndex=0;var n=vs.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=i*u,f=a*l+c*Math.cos(s),h=c*o*Math.sin(s);As.add(Math.atan2(h,f)),n=t,a=l,i=u}var e,r,n,a,i;ks.point=function(o,s){ks.point=t,n=(e=o)*Vo,a=Math.cos(s=(r=s)*Vo/2+Bo/4),i=Math.sin(s)},ks.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 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)a.point((f=c[s])[0],f[1])}else n(d.x,d.p.x,-1,a);d=d.p}d=d.o,c=d.z,p=!p}while(!d.v);a.lineEnd()}}}function Re(t){if(e=t.length){for(var e,r,n=0,a=t[0];++n0){for(_||(i.polygonStart(),_=!0),i.lineStart();++o1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(ze))}var d,p,g,m=e(i),v=a.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=Ue(v,p);d.length?(_||(i.polygonStart(),_=!0),Ie(d,Fe,t,r,i)):t&&(_||(i.polygonStart(),_=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),_&&(i.polygonEnd(),_=!1),d=p=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}},b=Ne(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function Ne(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd: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]-Uo-No:Uo-t[1])-((e=e.x)[0]<0?e[1]-Uo-No:Uo-e[1])}function Be(t){var e,r=NaN,n=NaN,a=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,o){var s=i>0?Bo:-Bo,l=xo(i-r);xo(l-Bo)0?Uo:-Uo),t.point(a,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(i,n),e=0):a!==s&&l>=Bo&&(xo(r-a)No?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}function He(t,e,r,n){var a;if(null==t)a=r*Uo,n.point(-Bo,a),n.point(0,a),n.point(Bo,a),n.point(Bo,0),n.point(Bo,-a),n.point(0,-a),n.point(-Bo,-a),n.point(-Bo,0),n.point(-Bo,a);else if(xo(t[0]-e[0])>No){var i=t[0]=0?1:-1,A=w*_,k=A>Bo,M=p*b;if(As.add(Math.atan2(M*w*Math.sin(A),g*x+M*Math.cos(A))),i+=k?_+w*jo:_,k^h>=r^v>=r){var T=be(ve(f),ve(t));we(T);var E=be(a,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(!m++)break;h=v,p=b,g=x,f=t}}return(i<-No||ii}function r(t){var r,i,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(f,h){var d,p=[f,h],g=e(f,h),m=o?g?0:a(f,h):g?a(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]+=No,p[1]+=No,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&i||!(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&&ke(r,p)||t.point(p[0],p[1]),r=p,l=g,i=m},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ve(t),a=ve(e),o=[1,0,0],s=be(n,a),l=ye(s,s),u=s[0],c=l-u*u;if(!c)return!r&&t;var f=i*l/c,h=-i*u/c,d=be(o,s),p=_e(o,f);xe(p,_e(s,h));var g=d,m=ye(p,g),v=ye(g,g),y=m*m-v*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-m-b)/v);if(xe(x,p),x=Ae(x),!r)return x;var _,w=t[0],A=e[0],k=t[1],M=e[1];A0^x[1]<(xo(x[0]-w)Bo^(w<=x[0]&&x[0]<=A)){var S=_e(g,(-m+b)/v);return xe(S,p),[x,Ae(S)]}}}function a(e,r){var n=o?t:Bo-t,a=0;return e<-n?a|=1:e>n&&(a|=2),r<-n?a|=4:r>n&&(a|=8),a}var i=Math.cos(t),o=i>0,s=xo(i)>No;return Pe(e,r,mr(t,6*Vo),o?[0,-t]:[-Bo,t-Bo])}function Ge(t,e,r,n){return function(a){var i,o=a.a,s=a.b,l=o.x,u=o.y,c=s.x,f=s.y,h=0,d=1,p=c-l,g=f-u;if(i=t-l,p||!(i>0)){if(i/=p,p<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=r-l,p||!(i<0)){if(i/=p,p<0){if(i>d)return;i>h&&(h=i)}else if(p>0){if(i0)){if(i/=g,g<0){if(i0){if(i>d)return;i>h&&(h=i)}if(i=n-u,g||!(i<0)){if(i/=g,g<0){if(i>d)return;i>h&&(h=i)}else if(g>0){if(i0&&(a.a={x:l+h*p,y:u+h*g}),d<1&&(a.b={x:l+d*p,y:u+d*g}),a}}}}}}function qe(t,e,r,n){function a(n,a){return xo(n[0]-t)0?0:3:xo(n[0]-r)0?2:1:xo(n[1]-e)0?1:0:a>0?3:2}function i(t,e){return o(t.x,e.x)}function o(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(s){function l(t){for(var e=0,r=m.length,n=t[1],a=0;an&&et(u,i,t)>0&&++e:i[1]<=n&&et(u,i,t)<0&&--e,u=i;return 0!==e}function u(i,s,l,u){var c=0,f=0;if(null==i||(c=a(i,l))!==(f=a(s,l))||o(i,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(a,i){return t<=a&&a<=r&&e<=i&&i<=n}function f(t,e){c(t,e)&&s.point(t,e)}function h(){S.point=p,m&&m.push(v=[]),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(-Fs,Math.min(Fs,t)),e=Math.max(-Fs,Math.min(Fs,e));var r=c(t,e);if(m&&v.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,m,v,y,b,x,_,w,A,k,M,T=s,E=Ne(),L=Ge(t,e,r,n),S={point:f,lineStart:h,lineEnd:d,polygonStart:function(){s=E,g=[],m=[],M=!0},polygonEnd:function(){s=T,g=uo.merge(g);var e=l([t,n]),r=M&&e,a=g.length;(r||a)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),a&&Ie(g,i,e,u,s),s.polygonEnd()),g=m=v=null}};return S}}function Xe(t){var e=0,r=Bo/3,n=lr(t),a=n(e,r);return a.parallels=function(t){return arguments.length?n(e=t[0]*Bo/180,r=t[1]*Bo/180):[e/Bo*180,r/Bo*180]},a}function Ye(t,e){function r(t,e){var r=Math.sqrt(i-2*a*Math.sin(e))/a;return[r*Math.sin(t*=a),o-r*Math.cos(t)]}var n=Math.sin(t),a=(n+Math.sin(e))/2,i=1+n*(2*a-n),o=Math.sqrt(i)/a;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/a,nt((i-(t*t+r*r)*a*a)/(2*a))]},r}function We(){function t(t,e){js+=a*t-n*e,n=t,a=e}var e,r,n,a;qs.point=function(i,o){qs.point=t,e=n=i,r=a=o},qs.lineEnd=function(){t(e,r)}}function Ze(t,e){tVs&&(Vs=t),eGs&&(Gs=e)}function Qe(){function t(t,e){o.push("M",t,",",e,i)}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 a(){o.push("Z")}var i=$e(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return i=$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){Es+=t,Ls+=e,++Ss}function Je(){function t(t,n){var a=t-e,i=n-r,o=Math.sqrt(a*a+i*i);Cs+=o*(e+t)/2,Os+=o*(r+n)/2,Is+=o,Ke(e=t,r=n)}var e,r;Ys.point=function(n,a){Ys.point=t,Ke(e=n,r=a)}}function tr(){Ys.point=Ke}function er(){function t(t,e){var r=t-n,i=e-a,o=Math.sqrt(r*r+i*i);Cs+=o*(n+t)/2,Os+=o*(a+e)/2,Is+=o,o=a*t-n*e,Rs+=o*(n+t),Ds+=o*(a+e),Ps+=3*o,Ke(n=t,a=e)}var e,r,n,a;Ys.point=function(i,o){Ys.point=t,Ke(e=n=i,r=a=o)},Ys.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 a(){s.point=e}function i(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:a,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=a,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=i,e.lineStart()}function i(r,n){var i=ve([r,n]),o=t(r,n);a(b,x,y,_,w,A,b=o[0],x=o[1],y=r,_=i[0],w=i[1],A=i[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){i(f=t,h=e),d=b,p=x,g=_,m=w,v=A,k.point=i}function c(){a(b,x,y,_,w,A,d,p,f,g,m,v,s,e),k.lineEnd=o,o()}var f,h,d,p,g,m,v,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 a(e,r,n,s,l,u,c,f,h,d,p,g,m,v){var y=c-e,b=f-r,x=y*y+b*b;if(x>4*i&&m--){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)i||xo((y*C+b*O)/x-.5)>.3||s*d+l*p+u*g0&&16,e):Math.sqrt(i)},e}function ar(t){var e=nr(function(e,r){return t([e*Go,r*Go])});return function(t){return ur(e(t))}}function ir(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[0]*Go,t[1]*Go]}function n(){s=Ce(o=hr(v,y,b),i);var t=i(g,m);return l=d-t[0]*h,u=p+t[1]*h,a()}function a(){return c&&(c.valid=!1,c=null),e}var i,o,s,l,u,c,f=nr(function(t,e){return t=i(t,e),[t[0]*h+l,u-t[1]*h]}),h=150,d=480,p=250,g=0,m=0,v=0,y=0,b=0,_=Ns,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,Ns):Ve((A=+t)*Vo),a()):A},e.clipExtent=function(t){return arguments.length?(k=t,w=t?qe(t[0][0],t[0][1],t[1][0],t[1][1]):x,a()):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,m=t[1]%360*Vo,n()):[g*Go,m*Go]},e.rotate=function(t){return arguments.length?(v=t[0]%360*Vo,y=t[1]%360*Vo,b=t.length>2?t[2]%360*Vo:0,n()):[v*Go,y*Go,b*Go]},uo.rebind(e,f,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.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*a;return[Math.atan2(l*i-c*o,s*n-u*a),nt(c*i+l*o)]}var n=Math.cos(t),a=Math.sin(t),i=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*i-l*o;return[Math.atan2(l*i+u*o,s*n+c*a),nt(c*n-s*a)]},r}function mr(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;null!=a?(a=vr(r,a),i=vr(r,i),(o>0?ai)&&(a+=o*jo)):(a=t+o*jo,i=t-.5*l);for(var u,c=a;o>0?c>i:c0?e<-Uo+No&&(e=-Uo+No):e>Uo-No&&(e=Uo-No);var r=o/Math.pow(a(e),i);return[r*Math.sin(i*t),o-r*Math.cos(i*t)]}var n=Math.cos(t),a=function(t){return Math.tan(Bo/4+t/2)},i=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(a(e)/a(t)),o=n*Math.pow(a(t),i)/i;return i?(r.invert=function(t,e){var r=o-e,n=tt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(o/n,1/i))-Uo]},r):Er}function Tr(t,e){function r(t,e){var r=i-e;return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}var n=Math.cos(t),a=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),i=n/a+t;return xo(a)1&&et(t[r[n-2]],t[r[n-1]],t[a])<=0;)--n;r[n++]=a}return r.slice(0,n)}function Rr(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 Pr(t,e,r,n){var a=t[0],i=r[0],o=e[0]-a,s=n[0]-i,l=t[1],u=r[1],c=e[1]-l,f=n[1]-u,h=(s*(l-u)-f*(a-i))/(f*o-s*c);return[a+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 Nr(){an(this),this.edge=this.site=this.circle=null}function Fr(t){var e=sl.pop()||new Nr;return e.site=t,e}function Br(t){Zr(t),al.remove(t),sl.push(t),an(t)}function jr(t){var e=t.circle,r=e.x,n=e.cy,a={x:r,y:n},i=t.P,o=t.N,s=[t];Br(t);for(var l=i;l.circle&&xo(r-l.circle.x)No)s=s.L;else{if(!((a=i-Vr(s,o))>No)){n>-No?(e=s.P,r=s):a>-No?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=Fr(t);if(al.insert(e,l),e||r){if(e===r)return Zr(e),r=Fr(e.site),al.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,m=p.y-f,v=2*(h*m-d*g),y=h*h+d*d,b=g*g+m*m,x={x:(m*y-d*b)/v+c,y:(h*b-g*y)/v+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 Ur(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-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/i-1/u,h=c/u;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n:(n+s)/2}function Vr(t,e){var r=t.N;if(r)return Ur(r,e);var n=t.site;return n.y===e?n.x:1/0}function Gr(t){this.site=t,this.edges=[]}function qr(t){for(var e,r,n,a,i,o,s,l,u,c,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],g=nl,m=g.length;m--;)if((i=g[m])&&i.prepare())for(s=i.edges,l=s.length,o=0;oNo||xo(a-r)>No)&&(s.splice(o,0,new rn(tn(i.site,c,xo(n-f)No?{x:f,y:xo(e-f)No?{x:xo(r-p)No?{x:h,y:xo(e-h)No?{x:xo(r-d)=-Fo)){var d=l*l+u*u,p=c*c+f*f,g=(f*d-u*p)/h,m=(l*p-c*d)/h,f=m+s,v=ll.pop()||new Yr;v.arc=t,v.site=a,v.x=g+o,v.y=f+Math.sqrt(g*g+m*m),v.cy=f,t.circle=v;for(var y=null,b=ol._;b;)if(v.y=s)return;if(h>p){if(i){if(i.y>=u)return}else i={x:m,y:l};r={x:m,y:u}}else{if(i){if(i.y1)if(h>p){if(i){if(i.y>=u)return}else i={x:(l-a)/n,y:l};r={x:(u-a)/n,y:u}}else{if(i){if(i.y=s)return}else i={x:o,y:n*o+a};r={x:s,y:n*s+a}}else{if(i){if(i.xi||f>o||h=x,A=r>=_,k=A<<1|w,M=k+4;ki&&(a=e.slice(i,a),s[o]?s[o]+=a:s[++o]=a),(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)})),i=fl.lastIndex;return i=0&&!(r=uo.interpolators[n](t,e)););return r}function wn(t,e){var r,n=[],a=[],i=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*Uo)}function On(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Rn(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 Dn(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function Pn(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,a=t.l,i=e.h-r,o=e.c-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ht(r+i*t,n+o*t,a+s*t)+""}}function Nn(t,e){t=uo.hsl(t),e=uo.hsl(e);var r=t.h,n=t.s,a=t.l,i=e.h-r,o=e.s-n,s=e.l-a;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(i)?(i=0,r=isNaN(r)?e.h:r):i>180?i-=360:i<-180&&(i+=360),function(t){return ct(r+i*t,n+o*t,a+s*t)+""}}function Fn(t,e){t=uo.lab(t),e=uo.lab(e);var r=t.l,n=t.a,a=t.b,i=e.l-r,o=e.a-n,s=e.b-a;return function(t){return pt(r+i*t,n+o*t,a+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=Un(e),a=Hn(e,r),i=Un(Vn(r,e,-a))||0;e[0]*r[1]180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(Gn(r)+"rotate(",null,")")-2,x:bn(t,e)})):e&&r.push(Gn(r)+"rotate("+e+")")}function Yn(t,e,r,n){t!==e?n.push({i:r.push(Gn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Gn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Gn(r)+"scale(",null,",",null,")");n.push({i:a-4,x:bn(t[0],e[0])},{i:a-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Gn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),qn(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,a=-1,i=n.length;++a=0;)r.push(a[n])}function la(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(i=t.children)&&(a=i.length))for(var a,i,o=-1;++oa&&(n=r,a=e);return n}function ba(t){return t.reduce(xa,0)}function xa(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,i=[];++r<=e;)i[r]=a*r+n;return i}function Aa(t){return[uo.min(t),uo.max(t)]}function ka(t,e){return t.value-e.value}function Ma(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 Ea(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 La(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,a,i,o,s,l,u,c=1/0,f=-1/0,h=1/0,d=-1/0;if(r.forEach(Sa),n=r[0],n.x=-n.r,n.y=0,e(n),u>1&&(a=r[1],a.x=a.r,a.y=0,e(a),u>2))for(i=r[2],Ia(n,a,i),e(i),Ma(n,i),n._pack_prev=i,Ma(i,a),a=n._pack_next,o=3;o=0;)e=a[i],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 Ba(t){return 1+uo.max(t,function(t){return t.y})}function ja(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function Ha(t){var e=t.children;return e&&e.length?Ha(e[0]):t}function Ua(t){var e,r=t.children;return r&&(e=r.length)?Ua(r[e-1]):t}function Va(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ga(t,e){var r=t.x+e[3],n=t.y+e[0],a=t.dx-e[1]-e[3],i=t.dy-e[0]-e[2];return a<0&&(r+=a/2,a=0),i<0&&(n+=i/2,i=0),{x:r,y:n,dx:a,dy:i}}function qa(t){var e=t[0],r=t[t.length-1];return e2?Qa:Ya,l=n?$n:Qn;return o=a(t,e,l,r),s=a(e,t,l,_n),i}function i(t){return o(t)}var o,s;return i.invert=function(t){return s(t)},i.domain=function(e){return arguments.length?(t=e.map(Number),a()):t},i.range=function(t){return arguments.length?(e=t,a()):e},i.rangeRound=function(t){return i.range(t).interpolate(Bn)},i.clamp=function(t){return arguments.length?(n=t,a()):n},i.interpolate=function(t){return arguments.length?(r=t,a()):r},i.ticks=function(e){return ei(t,e)},i.tickFormat=function(e,r){return ri(t,e,r)},i.nice=function(e){return Ja(t,e),a()},i.copy=function(){return $a(t,e,r,n)},a()}function Ka(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function Ja(t,e){return Wa(t,Za(ti(t,e)[2])),Wa(t,Za(ti(t,e)[2])),t}function ti(t,e){null==e&&(e=10);var r=qa(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),i=e/n*a;return i<=.15?a*=10:i<=.35?a*=5:i<=.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 ei(t,e){return uo.range.apply(uo,ti(t,e))}function ri(t,e,r){var n=ti(t,e);if(r){var a=cs.exec(r);if(a.shift(),"s"===a[8]){var i=uo.formatPrefix(Math.max(xo(n[0]),xo(n[1])));return a[7]||(a[7]="."+ni(i.scale(n[2]))),a[8]="f",r=uo.format(a.join("")),function(t){return r(i.scale(t))+i.symbol}}a[7]||(a[7]="."+ai(a[8],n)),r=a.join("")}else r=",."+ni(n[2])+"f";return uo.format(r)}function ni(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ai(t,e){var r=ni(e[2]);return t in Al?Math.abs(r-ni(Math.max(xo(e[0]),xo(e[1]))))+ +("e"!==t):r-2*("%"===t)}function ii(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 i(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(a(e))}return o.invert=function(e){return i(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(a)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(a)),o):e},o.nice=function(){var e=Wa(n.map(a),r?Math:Ml);return t.domain(e),n=e.map(i),o},o.ticks=function(){var t=qa(n),o=[],s=t[0],l=t[1],u=Math.floor(a(s)),c=Math.ceil(a(l)),f=e%1?2:e;if(isFinite(c-u)){if(r){for(;u0;h--)o.push(i(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 kl;arguments.length<2?r=kl:"function"!=typeof r&&(r=uo.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/i(Math.round(a(t)));return o*e0?s[r-1]:t[0],r0?0:1}function xi(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,c=t[0]+l,f=t[1]+u,h=e[0]+l,d=e[1]+u,p=(c+h)/2,g=(f+d)/2,m=h-c,v=d-f,y=m*m+v*v,b=r-n,x=c*d-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-m*_)/y,A=(-x*m-v*_)/y,k=(x*v+m*_)/y,M=(-x*m+v*_)/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 _i(t){function e(e){function o(){u.push("M",i(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 Ai(t){return t.join("L")+"Z"}function ki(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 Mi(t){for(var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];++e1){s=e[1],i=t[l],l++,n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;u9&&(a=3*e/Math.sqrt(a),o[s]=a*r,o[s+1]=a*n));for(s=-1;++s<=l;)a=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),i.push([a||0,o[s]*a||0]);return i}function Hi(t){return t.length<3?wi(t):t[0]+Ci(t,ji(t))}function Ui(t){for(var e,r,n,a=-1,i=t.length;++a0;)d[--s].call(t,o);if(i>=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=a.time,u=Rt(i,0,l),g=p[n]={tween:new f,time:l,timer:u,delay:a.delay,duration:a.duration,ease:a.ease,index:e},a=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 ao(t){return t.toISOString()}function io(t,e,r){function n(e){return t(e)}function a(t,r){var n=t[1]-t[0],a=n/r,i=uo.bisect(Ql,a);return i==Ql.length?[e.year,ti(t.map(function(t){return t/31536e6}),r)[2]]:i?e[a/Ql[i-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=qa(n.domain()),i=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return i&&(t=i[0],e=i[1]),t.range(r[0],oo(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return io(t.copy(),e,r)},Ka(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,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=a,uo.descending=function(t,e){return et?1:e>=t?0:NaN},uo.min=function(t,e){var r,n,a=-1,i=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},uo.max=function(t,e){var r,n,a=-1,i=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},uo.extent=function(t,e){var r,n,a,i=-1,o=t.length;if(1===arguments.length){for(;++i=n){r=a=n;break}for(;++in&&(r=n),a=n){r=a=n;break}for(;++in&&(r=n),a1)return l/(c-1)},uo.deviation=function(){var t=uo.variance.apply(this,arguments);return t?Math.sqrt(t):t};var bo=s(a);uo.bisectLeft=bo.left,uo.bisect=uo.bisectRight=bo.right,uo.bisector=function(t){return s(1===t.length?function(e,r){return a(t(e),r)}:t)},uo.shuffle=function(t,e,r){(i=arguments.length)<3&&(r=t.length,i<2&&(e=0));for(var n,a,i=r-e;i;)a=Math.random()*i--|0,n=t[i+e],t[i+e]=t[a+e],t[a+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=0,r=t.length-1,n=t[0],a=new Array(r<0?0:r);e=0;)for(n=t[a],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,a=[],i=u(xo(r)),o=-1;if(t*=i,e*=i,r*=i,r<0)for(;(n=t+r*++o)>e;)a.push(n/i);else for(;(n=t+r*++o)=i.length)return n?n.call(a,o):r?o.sort(r):o;for(var l,u,c,h,d=-1,p=o.length,g=i[s++],m=new f;++d=i.length)return t;var n=[],a=o[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={},i=[],o=[];return a.map=function(e,r){return t(r,e,0)},a.entries=function(r){return e(t(uo.map,r,0),0)},a.key=function(t){return i.push(t),a},a.sortKeys=function(t){return o[i.length-1]=t,a},a.sortValues=function(t){return r=t,a},a.rollup=function(t){return n=t,a},a},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,a,i=[];t=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),Oo.hasOwnProperty(r)?{space:Oo[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=P(t)).length,a=-1;if(e=r.classList){for(;++a=0;)(r=n[a])&&(i&&i!==r.nextSibling&&i.parentNode.insertBefore(r,i),i=r);return this},So.sort=function(t){t=G.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"}),m=null)}function f(){function t(){s=1,i(uo.mouse(a),h),u(o)}function r(){f.on(I,null).on(R,null),d(s),c(o)}var a=this,o=P.of(a,arguments),s=0,f=uo.select(n(a)).on(I,t).on(R,r),h=e(uo.mouse(a)),d=$(a);jl.call(a),l(o)}function h(){function t(){var t=uo.touches(p);return d=k.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(x,n).on(_,s),w.push(e);for(var r=uo.event.changedTouches,a=0,i=r.length;a1){var c=l[0],f=l[1],h=c[0]-f[0],d=c[1]-f[1];v=h*h+d*d}}function n(){var t,e,r,n,o=uo.touches(p);jl.call(p);for(var s=0,l=o.length;s=u)return o;if(a)return a=!1,i;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,fs=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,Nt(t,e))).toFixed(Math.max(0,Math.min(20,Nt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=Date;Ht.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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Ut(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Ut(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Ut(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},ms=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Bt(t),timeFormat:Gt(t)}};var ys=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=ys.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&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={Feature:function(t,e){de(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,a=r.length;++nd&&(d=e)}function e(e,r){var n=ve([e*Vo,r*Vo]);if(v){var a=be(v,n),i=[a[1],-a[0],0],o=be(i,a);we(o),o=Ae(o);var l=e-p,u=l>0?1:-1,g=o[0]*Go*u,m=xo(l)>180;if(m^(u*pd&&(d=y)}else if(g=(g+360)%360-180,m^(u*pd&&(d=r);m?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);v=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=h,_.point=t,v=null}function a(t,r){if(v){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else g=t,m=r;ks.point(t,r),e(t,r)}function i(){ks.lineStart()}function o(){a(g,m),ks.lineEnd(),xo(y)>No&&(c=-(h=180)),x[0]=c,x[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]:tNo?d=90:y<-No&&(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,a=b[0],i=[a];ns(a[0],a[1])&&(a[1]=r[1]),s(r[0],a[1])>s(a[0],a[1])&&(a[0]=r[0])):i.push(a=r);for(var o,r,p=-1/0,e=i.length-1,n=0,a=i[e];n<=e;a=r,++n)r=i[n],(o=s(a[1],r[0]))>p&&(p=o,c=r[0],h=a[1])}return b=x=null,c===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){ +Ms=Ts=Es=Ls=Ss=Cs=Os=Is=Rs=Ds=Ps=0,uo.geo.stream(t,zs);var e=Rs,r=Ds,n=Ps,a=e*e+r*r+n*n;return a=.12&&a<.234&&n>=-.425&&n<-.214?o:a>=.166&&a<.234&&n>=-.214&&n<-.115?s:i).invert(t)},t.stream=function(t){var e=i.stream(t),r=o.stream(t),n=s.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?(i.precision(e),o.precision(e),s.precision(e),t):i.precision()},t.scale=function(e){return arguments.length?(i.scale(e),o.scale(.35*e),s.scale(e),t.translate(i.translate())):i.scale()},t.translate=function(e){if(!arguments.length)return i.translate();var u=i.scale(),c=+e[0],f=+e[1];return r=i.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+No,f+.12*u+No],[c-.214*u-No,f+.234*u-No]]).stream(l).point,a=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+No,f+.166*u+No],[c-.115*u-No,f+.234*u-No]]).stream(l).point,t},t.scale(1070)};var Bs,js,Hs,Us,Vs,Gs,qs={point:A,lineStart:A,lineEnd:A,polygonStart:function(){js=0,qs.lineStart=We},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=A,Bs+=xo(js/2)}},Xs={point:Ze,lineStart:A,lineEnd:A,polygonStart:A,polygonEnd:A},Ys={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ys.lineStart=er},polygonEnd:function(){Ys.point=Ke,Ys.lineStart=Je,Ys.lineEnd=tr}};uo.geo.path=function(){function t(t){return t&&("function"==typeof s&&i.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=a(i)),uo.geo.stream(t,o)),i.result()}function e(){return o=null,t}var r,n,a,i,o,s=4.5;return t.area=function(t){return Bs=0,uo.geo.stream(t,a(qs)),Bs},t.centroid=function(t){return Es=Ls=Ss=Cs=Os=Is=Rs=Ds=Ps=0,uo.geo.stream(t,a(Ys)),Ps?[Rs/Ps,Ds/Ps]:Is?[Cs/Is,Os/Is]:Ss?[Es/Ss,Ls/Ss]:[NaN,NaN]},t.bounds=function(t){return Vs=Gs=-(Hs=Us=1/0),uo.geo.stream(t,a(Xs)),[[Hs,Us],[Vs,Gs]]},t.projection=function(t){return arguments.length?(a=(r=t)?t.stream||ar(t):x,e()):r},t.context=function(t){return arguments.length?(i=null==(n=t)?new Qe:new rr(t),"function"!=typeof s&&i.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(i.pointRadius(+e),+e),t):s},t.projection(uo.geo.albersUsa()).context(null)},uo.geo.transform=function(t){return{stream:function(e){var r=new ir(e);for(var n in t)r[n]=t[n];return r}}},ir.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]*=Go,e[1]*=Go,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]*=Go,e[1]*=Go,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,a=[];return r(null,null,1,{point:function(t,r){a.push(t=e(t,r)),t[0]*=Go,t[1]*=Go}}),{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)*Vo,a*Vo),t):e},t.precision=function(n){return arguments.length?(r=mr(e*Vo,(a=+n)*Vo),t):a},t.angle(90)},uo.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Vo,a=t[1]*Vo,i=e[1]*Vo,o=Math.sin(n),s=Math.cos(n),l=Math.sin(a),u=Math.cos(a),c=Math.sin(i),f=Math.cos(i);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(i/m)*m,a,m).map(h).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 xo(t%m)>No}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%v)>No}).map(f))}var r,n,a,i,o,s,l,u,c,f,h,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:[h(i).concat(d(l).slice(1),h(a).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?(i=+e[0][0],a=+e[1][0],u=+e[0][1],l=+e[1][1],i>a&&(e=i,i=a,a=e),u>l&&(e=u,u=l,l=e),t.precision(y)):[[i,u],[a,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),f=br(n,r,y),h=yr(u,l,90),d=br(i,a,y),t):y},t.majorExtent([[-180,-90+No],[180,90-No]]).minorExtent([[-180,-80-No],[180,80+No]])},uo.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||a.apply(this,arguments)]}}var e,r,n=xr,a=_r;return t.distance=function(){return uo.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},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 Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:A,point:A,lineStart:Ar,lineEnd:A,polygonStart:A,polygonEnd:A},Qs=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(Mr)}).raw=Mr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Uo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er;var Js=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Sr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Uo]},(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,a=Lt(r),i=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<=i&&u.y>=a&&u.y<=o?[[n,o],[i,o],[i,a],[n,a]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(i(t,e)/No)*No,y:Math.round(o(t,e)/No)*No,i:e}})}var n=Cr,a=Or,i=n,o=a,s=ul;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 a,i=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===i?u.r:u.l;++s=u,h=n>=c,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]=pn()),f?a=u:s=u,h?o=c:l=c,i(t,e,r,n,a,o,s,l)}var c,f,h,d,p,g,m,v,y,b=Lt(s),x=Lt(l);if(null!=e)g=e,m=r,v=n,y=a;else if(v=y=-(g=m=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=_),w>y&&(y=w),f.push(_),h.push(w)}var A=v-g,k=y-m;A>k?y=m+A:v=g+k;var M=pn();if(M.add=function(t){i(M,t,+b(t,++d),+x(t,d),g,m,v,y)},M.visit=function(t){gn(t,M,g,m,v,y)},M.find=function(t){return mn(M,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=dl.get(r)||hl,n=pl.get(n)||x,An(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Nn,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:gl)})(t)},jn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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?a=t:(r.c=null,r.t=NaN,r=null,u.end({type:"end",alpha:a=0})):t>0&&(u.start({type:"start",alpha:a=t}),r=Rt(l.tick)),l):a},l.start=function(){function t(t,n){if(!r){for(r=new Array(a),l=0;l=0;)o.push(c=u[l]),c.parent=i,c.depth=i.depth+1;n&&(i.value=0),i.children=u}else n&&(i.value=+n.call(t,i,i.depth)||0),delete i.children;return la(a,function(t){var r,a;e&&(r=t.children)&&r.sort(e),n&&(a=t.parent)&&(a.value+=t.value)}),s}var e=fa,r=ua,n=ca;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&&(sa(e,function(t){t.children&&(t.value=0)}),la(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,a){var i=e.children;if(e.x=r,e.y=e.depth*a,e.dx=n,e.dy=a,i&&(o=i.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(i=-1;++i=c[0]&&s<=c[1]&&(o=l[uo.bisect(f,s,1,d)-1],o.y+=p,o.push(t[i]));return l}var e=!0,r=Number,n=Aa,a=_a;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?(a="number"==typeof e?function(t){return wa(t,e)}:Lt(e),t):a},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},uo.layout.pack=function(){function t(t,i){var o=r.call(this,t,i),s=o[0],l=a[0],u=a[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,la(s,function(t){t.r=+c(t.value)}),la(s,La),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;la(s,function(t){t.r+=f}),la(s,La),la(s,function(t){t.r-=f})}return Oa(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(ka),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},oa(t,r)},uo.layout.tree=function(){function t(t,a){var c=o.call(this,t,a),f=c[0],h=e(f);if(la(h,r),h.parent.m=-h.z,sa(h,n),u)sa(f,i);else{var d=f,p=f,g=f;sa(f,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);sa(f,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 a,i=e.children,o=0,s=i.length;o0&&(za(Fa(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=a.m,h+=l.m,c+=i.m;o&&!Pa(i)&&(i.t=o,i.m+=f-c),a&&!Da(l)&&(l.t=a,l.m+=u-h,r=t)}return r}function i(t){t.x*=l[0],t.y=t.depth*l[1]}var o=uo.layout.hierarchy().sort(null).value(null),s=Ra,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)?i:null,t):u?null:l},t.nodeSize=function(e){return arguments.length?(u=null==(l=e)?null:i,t):u?l:null},oa(t,o)},uo.layout.cluster=function(){function t(t,i){var o,s=e.call(this,t,i),l=s[0],u=0;la(l,function(t){var e=t.children;e&&e.length?(t.x=ja(e),t.y=Ba(e)):(t.x=o?u+=r(t,o):0,t.y=0,o=t)});var c=Ha(l),f=Ua(l),h=c.x-r(c,f)/2,d=f.x+r(f,c)/2;return la(l,a?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=Ra,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},oa(t,e)},uo.layout.treemap=function(){function t(t,e){for(var r,n,a=-1,i=t.length;++a0;)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,a(c,g,u,!1),g=Math.min(u.dx,u.dy),c.length=c.area=0,p=1/0);c.length&&(a(c,g,u,!0),c.length=c.area=0),i.forEach(e)}}function r(e){var n=e.children;if(n&&n.length){var i,o=f(e),s=n.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;i=s.pop();)l.push(i),l.area+=i.area,null!=i.z&&(a(l,i.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,a=0,i=1/0,o=-1,s=t.length;++oa&&(a=r));return n*=n,e*=e,n?Math.max(e*a*p/n,n/(e*i*p)):1/0}function a(t,e,r,n){var a,i=-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);++ir.dx)&&(c=r.dx);++i1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},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=Ho)return e(u,d)+(t?e(t,1-d):"")+"Z";var p,g,m,v,y,b,x,_,w,A,k,M,T=0,E=0,L=[];if((v=(+l.apply(this,arguments)||0)/2)&&(m=i===Cl?Math.sqrt(t*t+u*u):+i.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),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&&bi(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 O=Math.abs(c-f+2*T)<=Bo?0:1;if(T&&bi(w,A,k,M)===1-d^O){var I=(c+f)/2;w=t*Math.cos(I),A=t*Math.sin(I),k=M=null}}else w=A=0;if(h>No&&(p=Math.min(Math.abs(u-t)/2,+a.apply(this,arguments)))>.001){g=tBo)+",1 "+e}function a(t,e,r,n){return"Q 0,0 "+n}var i=xr,o=_r,s=Gi,l=mi,u=vi;return t.radius=function(e){return arguments.length?(s=Lt(e),t):s},t.source=function(e){return arguments.length?(i=Lt(e),t):i},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,a){var i=e.call(this,t,a),o=r.call(this,t,a),s=(i.y+o.y)/2,l=[i,{x:i.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=qi;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=qi,r=t.projection;return t.projection=function(t){return arguments.length?r(Xi(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Pl.get(e.call(this,t,n))||Zi)(r.call(this,t,n))}var e=Wi,r=Yi;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 Pl=uo.map({circle:Zi,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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Pl.keys();var zl=Math.sqrt(3),Nl=Math.tan(30*Vo);So.transition=function(t){for(var e,r,n=Fl||++Ul,a=to(t),i=[],o=Bl||{time:Date.now(),ease:Ln,delay:0,duration:250},s=-1,l=this.length;++srect,.s>rect").attr("width",f[1]-f[0])}function a(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function i(){function i(){32==uo.event.keyCode&&(S||(b=null,O[0]-=f[1],O[1]-=h[1],S=2),T())}function g(){32==uo.event.keyCode&&2==S&&(O[0]+=f[1],O[1]+=h[1],S=0,T())}function m(){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]),O[0]=f[+(t[0]>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),a=1048575&n;return 2146435072&n&&(a+=1<<20),[r,a]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:40}],64:[function(t,e,r){"use strict";function n(t,e,r){var a=0|t[r];if(a<=0)return[];var i,o=new Array(a);if(r===t.length-1)for(i=0;i0)return a(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=i},{}],65:[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(!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,i,s;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],i=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(o(r)){for(s=i;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;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){return 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)}},{}],68:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],69:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),o=t.family||"sans-serif",s=t.shape||[512,512],l=t.step||[32,32],u=parseFloat(t.size)||16,c=t.chars||[32,126],f=Math.floor((l[0]-u)/2),h=t.radius||1.5*f,d=new i(u,f,h,0,o),p=null==t.align?"optical":t.align,g=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(c)){if(2===c.length&&"number"==typeof c[0]&&"number"==typeof c[1]){var m=[];for(e=c[0],r=0;e<=c[1];e++)m[r++]=String.fromCharCode(e);c=m}}else c=String(c).split("");s=s.slice(),n.width=s[0],n.height=s[1];var v=n.getContext("2d");v.fillStyle="#000",v.fillRect(0,0,n.width,n.height),v.textBaseline="middle";var y=l[0],b=l[1],x=0,_=0,w=u/b,A=Math.min(c.length,Math.floor(s[0]/y)*Math.ceil(s[1]/b)),k=d.ctx.textAlign,M=d.buffer,T=d.middle;for(d.ctx.textAlign="center",d.buffer=d.size/2,e=0;es[0]-l[0]&&(x=0,_+=l[1])}return d.ctx.textAlign=k,d.buffer=M,d.middle=T,n}function a(t,e,r){if(s[e]&&s[e][t])return s[e][t];var n=200*r,a=o(t,{size:200,fontSize:n,fontFamily:e});s[e]||(s[e]={});var i={center:[a.center[0]/200,a.center[1]/200],bounds:a.bounds.map(function(t){return t/200}),radius:a.radius/200};return s[e][t]=i,i}var i=t("tiny-sdf"),o=t("optical-properties");e.exports=n;var s={}},{"optical-properties":162,"tiny-sdf":196}],70:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._color=t,this.key=e,this.value=r,this.left=n,this.right=a,this._count=i}function a(t){return new n(t._color,t.key,t.value,t.left,t.right,t._count)}function i(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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=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,a){var i,o=r(t,a.key),s=r(e,a.key);if(o<=0){if(a.left&&(i=c(t,e,r,n,a.left)))return i;if(s>0&&(i=n(a.key,a.value)))return i}if(s>0&&a.right)return c(t,e,r,n,a.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=v);if(r=t[l-1],r.left===e){if(n=r.right,n.right&&n.right._color===m){if(n=r.right=a(n),s=n.right=a(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=a(n),s=n.left=a(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=i(m,n));r.right=i(m,n);continue}if(n=a(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=a(n),s=n.right=a(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=i(m,n));r.left=i(m,n);continue}if(n=a(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,a=this.root,l=[],u=[];a;){var c=r(t,a.key);l.push(a),u.push(c),a=c<=0?a.left:a.right}l.push(new n(m,t,e,null,null,1));for(var f=l.length-2;f>=0;--f){var a=l[f];u[f]<=0?l[f]=new n(a._color,a.key,a.value,l[f+1],a.right,a._count+1):l[f]=new n(a._color,a.key,a.value,a.left,l[f+1],a._count+1)}for(var f=l.length-1;f>1;--f){var h=l[f-1],a=l[f];if(h._color===v||a._color===v)break;var d=l[f-2];if(d.left===h)if(h.left===a){var p=d.right;if(!p||p._color!==m){if(d._color=m,d.left=h.right,h._color=v,h.right=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.left===d?g.left=h:g.right=h}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else{var p=d.right;if(!p||p._color!==m){if(h.right=a.left,d._color=m,d.left=a.right,a._color=v,a.left=h,a.right=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.left===d?g.left=a:g.right=a}break}h._color=v,d.right=i(v,p),d._color=m,f-=1}else if(h.right===a){var p=d.left;if(!p||p._color!==m){if(d._color=m,d.right=h.left,h._color=v,h.left=d,l[f-2]=h,l[f-1]=a,o(d),o(h),f>=3){var g=l[f-3];g.right===d?g.right=h:g.left=h}break}h._color=v,d.left=i(v,p),d._color=m,f-=1}else{var p=d.left;if(!p||p._color!==m){if(h.left=a.right,d._color=m,d.right=a.left,a._color=v,a.right=h,a.left=d,l[f-2]=a,l[f-1]=h,o(d),o(h),o(a),f>=3){var g=l[f-3];g.right===d?g.right=a:g.left=a}break}h._color=v,d.left=i(v,p),d._color=m,f-=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 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=[],a=0;r;){var i=e(t,r.key);n.push(r),i<=0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.gt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i<0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.lt=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>0&&(a=n.length),r=i<=0?r.left:r.right}return n.length=a,new f(this,n)},y.le=function(t){for(var e=this._compare,r=this.root,n=[],a=0;r;){var i=e(t,r.key);n.push(r),i>=0&&(a=n.length),r=i<0?r.left:r.right}return n.length=a,new f(this,n)},y.find=function(t){for(var e=this._compare,r=this.root,n=[];r;){var a=e(t,r.key);if(n.push(r),0===a)return new f(this,n);r=a<=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 a=t.length-2;a>=0;--a){var r=t[a];r.left===t[a+1]?e[a]=new n(r._color,r.key,r.value,e[a+1],r.right,r._count):e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var i=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var o=e[i-1];e.push(new n(r._color,o.key,o.value,r.left,r.right,r._count)),e[i-1].key=r.key,e[i-1].value=r.value;for(var a=e.length-2;a>=i;--a)r=e[a],e[a]=new n(r._color,r.key,r.value,r.left,e[a+1],r._count);e[i-1].left=e[i]}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 a=0;a0)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),a=e[e.length-1];r[r.length-1]=new n(a._color,a.key,t,a.left,a.right,a._count);for(var i=e.length-2;i>=0;--i)a=e[i],a.left===e[i+1]?r[i]=new n(a._color,a.key,a.value,r[i+1],a.right,a._count):r[i]=new n(a._color,a.key,a.value,a.left,r[i+1],a._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}})},{}],71:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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],i=1;i<9;i++)r+=a[i]/(e+i);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],72:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,a=e;try{var i=[t];0===t.indexOf("webgl")&&i.push("experimental-"+t);for(var o=0;or)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,i,a),r}function i(t,e){for(var r=l.malloc(t.length,e),n=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}function s(t,e,r,a){if(r=r||t.ARRAY_BUFFER,a=a||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(a!==t.DYNAMIC_DRAW&&a!==t.STATIC_DRAW&&a!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=t.createBuffer(),o=new n(t,r,i,0,a);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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&o(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=a(this.gl,this.type,this.length,this.usage,t.data,e):this.length=a(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?a(this.gl,this.type,this.length,this.usage,n,e):a(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?i(t,"uint16"):i(t,"float32"),this.length=e<0?a(this.gl,this.type,this.length,this.usage,h,e):a(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=a(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:160,"ndarray-ops":159,"typedarray-pool":202}],74:[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"}},{}],75:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":74}],76:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.fillShader=r,this.positionBuffer=n,this.colorBuffer=a,this.idBuffer=i,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 a(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 i(t,e){var r=t.gl,a=s(r,p.vertex,p.fragment),i=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,a,i,o,u,c,f,h);return d.update(e),t.addObject(d),d}e.exports=i;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,m=[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,a=this.plot,i=this.shader,o=this.fillShader,s=this.bounds,l=this.numVertices,u=this.fillVerts,c=a.gl,f=a.viewBox,h=a.dataBox,d=s[2]-s[0],p=s[3]-s[1],g=h[2]-h[0],m=h[3]-h[1];if(t[0]=2*d/g,t[4]=2*p/m,t[6]=2*(s[0]-h[0])/g-1,t[7]=2*(s[1]-h[1])/m-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=i.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){i.bind();var v=this.lineWidth*a.pixelRatio;r=i.uniforms,r.viewTransform=t,r.screenShape=e,r.lineWidth=v,r.pointSize=1e3,n=i.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=v,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 a=n-r;return Math.abs(a)<1e-6?e:Math.floor(e)+Math.max(.001,Math.min(.999,(t-r)/a))}t=t||{};var r=t.shape||[0,0],n=t.x||o(r[0]),i=t.y||o(r[1]),s=t.z||new Float32Array(r[0]*r[1]),l=t.levels||[],p=t.levelColors||[],g=this.bounds,v=g[0]=n[0],y=g[1]=i[0],b=g[2]=n[n.length-1],x=g[3]=i[i.length-1];v===b&&(g[2]+=1,b+=1),y===x&&(g[3]+=1,x+=1);var _=1/(b-v),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 O=c(A,C),I=255*p[4*S]|0,R=255*p[4*S+1]|0,D=255*p[4*S+2]|0,P=255*p[4*S+3]|0,z=O.cells,N=O.positions,F=Array(N.length),B=0;B1)){var V,G=U[0],q=U[1],X=A.get(Math.floor(G),Math.floor(q)),Y=A.get(Math.floor(G),Math.ceil(q)),W=A.get(Math.ceil(G),Math.floor(q)),Z=A.get(Math.ceil(G),Math.ceil(q));0===Math.floor(U[0])&&X<=C!=Y>1;for(e=0;e0&&(T*=_),E<0?E*=w:E>0&&(E*=A),m[b++]=h*(r-p+T),m[b++]=d*(n-g+E),m[b++]=o*M[2]+(l+o)*M[4],m[b++]=o*M[3]+(l+o)*M[5]}}for(e=0;e1&&h.drawBuffersWEBGL(y[f]);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 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 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(i),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))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(s>1){if(!a)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(s>t.getParameter(a.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,a)}var d=t("gl-texture2d");e.exports=h;var p,g,m,v,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*d&255;this.pickOffset=r,a.bind();var p=a.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var g=a.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,a=this.shape[0]*this.shape[1];if(r=n+a)return null;var i=r-n,o=this.xData,s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/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]),a=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],m=f[3]=n[n.length-1],v=1/(g-d),y=1/(m-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(h.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),A=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),M=s.mallocUint32(_),T=0,E=0;E2&&!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,i),x.color=c,x.radius=s*u,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,a/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 a=this.setProjectionModel(),i=this.plot,o=this.width,s=i.gl,l=i.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,a),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,a=this.numPoints;if(r=n+a)return null;var i=r-n,o=this.data;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},h.update=function(t){t=t||{};var e,r,n,i,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=a(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 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 M=--n;i=g[2*n],o=g[2*n+1];var T=M-1,E=g[2*T],L=g[2*T+1];if(!(isNaN(i)||isNaN(o)||isNaN(E)||isNaN(L))){k+=1,i=(i-m[0])/(m[2]-m[0]),o=(o-m[1])/(m[3]-m[1]),E=(E-m[0])/(m[2]-m[0]),L=(L-m[1])/(m[3]-m[1]);var S=E-i,C=L-o,O=M|1<<24,I=M-1,R=M,D=M-1|1<<24;y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=C,y[--w]=S,y[--w]=L,y[--w]=E,_[--A]=R,_[--A]=D,y[--w]=-C,y[--w]=-S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I,y[--w]=C,y[--w]=S,y[--w]=o,y[--w]=i,_[--A]=O,_[--A]=I}}for(e=0;es[k]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n],i.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n]&&A&&(e[1^n]-=T*d*b[n],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n],i.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]&&(i.uniforms.dataAxis=t,i.uniforms.screenOffset=e,i.uniforms.color=m[n+2],i.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[k],s[M]-s[k]))),y[n+2]&&A&&(e[1^n]+=T*d*b[n+2],i.uniforms.dataAxis=r,i.uniforms.screenOffset=e,i.uniforms.color=x[n+2],i.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,a=r.gl,i=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-i[c])/(i[2+c]-i[c])-1;n.bind(),n.uniforms.dataAxis=t,n.uniforms.screenOffset=e,n.uniforms.angle=s,n.uniforms.color=l,a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,a=this.shader,i=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;a.bind();for(var u=0;u<2;++u){var c=i[u],f=i[u+2],h=f-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],b=s[u+2],x=b-y;e[u]=2*h/p*v/x,t[u]=2*(c-d)/p*v/x}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),a.uniforms.dataScale=e,a.uniforms.dataShift=t,a.uniforms.textScale=r,this.vbo.bind(),a.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,a,i,o=[],l=t.ticks,u=t.bounds;for(i=0;i<2;++i){var c=[Math.floor(o.length/3)],f=[-1/0],h=l[i];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);i(),d._relink=i,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=i},{"./lib/GLError":96,"./lib/create-attributes":97,"./lib/create-uniforms":98,"./lib/reflect":99,"./lib/runtime-reflect":100,"./lib/shader-cache":101}],96:[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},{}],97:[function(t,e,r){"use strict";function n(t,e,r,n,a,i){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=a,this._constFunc=i}function a(t,e,r,a,i,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);a(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);i(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 a=this,i=a._gl,o=a._locations[a._index];i.vertexAttribPointer(o,a._dimension,t||i.FLOAT,!!e,r||0,n||0),i.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":96}],98:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function a(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"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new s("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new s("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new 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 a=e[n],i=t;parseInt(n)+""===n?i+="["+n+"]":i+="."+n,"object"==typeof a?r.push.apply(r,c(i,a)):r.push([i,a])}return r}function f(e){for(var n=["return function updateProperty(obj){"],a=c("",e),o=0;o4)throw new s("","Invalid data type");return"b"===t.charAt(0)?a(r,!1):a(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 a(r*r,0)}throw new s("","Unknown uniform data type for "+name+": "+t)}}function d(t,e,a){if("object"==typeof a){var o=p(a);Object.defineProperty(t,e,{get:n(o),set:f(a),enumerable:!0,configurable:!1})}else i[a]?Object.defineProperty(t,e,{get:l(a),set:f(a),enumerable:!0,configurable:!1}):t[e]=h(r[a].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]&&i<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}function i(t,e){var r=t.gl,a=s(r),i=s(r),l=o(r,u.pointVertex,u.pointFragment),c=o(r,u.pickVertex,u.pickFragment),f=new n(t,a,i,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=i;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,a=t.positions instanceof Float32Array,i=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=a?o:l.mallocFloat32(o.length),u=i?t.idToIndex:l.mallocInt32(n);if(a||s.set(o),!i)for(s.set(o),r=0;r>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),i.attributes.pickId.pointer(o.UNSIGNED_BYTE),i.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,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}}},{"./lib/shader":103,"gl-buffer":73,"gl-shader":104,"typedarray-pool":202}],112:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n", +fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],113:[function(t,e,r){arguments[4][47][0].apply(r,arguments)},{dup:47}],114:[function(t,e,r){arguments[4][95][0].apply(r,arguments)},{"./lib/GLError":115,"./lib/create-attributes":116,"./lib/create-uniforms":117,"./lib/reflect":118,"./lib/runtime-reflect":119,"./lib/shader-cache":120,dup:95}],115:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],116:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{"./GLError":115,dup:97}],117:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{"./GLError":115,"./reflect":118,dup:98}],118:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],119:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{dup:100}],120:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{"./GLError":115,dup:101,"gl-format-compiler-error":82,"weakmap-shim":209}],121:[function(t,e,r){"use strict";function n(t,e,r,n,i){i<=4*h?a(0,i-1,t,e,r,n):f(0,i-1,t,e,r,n)}function a(t,e,r,n,a,i){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=a[o],f=i[o],h=o;h>t;){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],a[h]=a[h-1],i[h]=i[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=u,a[h]=c,i[h]=f}}function i(t,e,r,n,a,i){var o=r[t],s=n[2*t],l=n[2*t+1],u=a[t],c=i[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,a[e]=u,i[e]=c}function o(t,e,r,n,a,i){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],a[t]=a[e],i[t]=i[e]}function s(t,e,r,n,a,i,o){var s=n[t],l=a[2*t],u=a[2*t+1],c=i[t],f=o[t];n[t]=n[e],a[2*t]=a[2*e],a[2*t+1]=a[2*e+1],i[t]=i[e],o[t]=o[e],n[e]=n[r],a[2*e]=a[2*r],a[2*e+1]=a[2*r+1],i[e]=i[r],o[e]=o[r],n[r]=s,a[2*r]=l,a[2*r+1]=u,i[r]=c,o[r]=f}function l(t,e,r,n,a,i,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]=a,u[e]=i,c[e]=o}function u(t,e,r,n,a){return(r[t]-r[e]||n[2*e]-n[2*t]||a[t]-a[e])<0}function c(t,e,r,n,a,i,o,s){return(e-i[t]||o[2*t]-r||a-s[t])<0}function f(t,e,r,n,d,p){var g=(e-t+1)/6|0,m=t+g,v=e-g,y=t+e>>1,b=y-g,x=y+g,_=m,w=b,A=y,k=x,M=v,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],O=n[2*w+1],I=d[w],R=p[w],D=r[k],P=n[2*k],z=n[2*k+1],N=d[k],F=p[k],B=_,j=A,H=M,U=m,V=y,G=v,q=r[B],X=r[j],Y=r[H];r[U]=q,r[V]=X,r[G]=Y;for(var W=0;W<2;++W){var Z=n[2*B+W],Q=n[2*j+W],$=n[2*H+W];n[2*U+W]=Z,n[2*V+W]=Q,n[2*G+W]=$}var K=d[B],J=d[j],tt=d[H];d[U]=K,d[V]=J,d[G]=tt;var et=p[B],rt=p[j],nt=p[H];p[U]=et,p[V]=rt,p[G]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var at=T;at<=E;++at)if(c(at,S,C,O,I,r,n,d))at!==T&&i(at,T,r,n,d,p),++T;else if(!c(at,D,P,z,N,r,n,d))for(;;){if(c(E,D,P,z,N,r,n,d)){c(E,S,C,O,I,r,n,d)?(s(at,T,E,r,n,d,p),++T,--E):(i(at,E,r,n,d,p),--E);break}if(--E=Math.max(.9*d,32)){var b=u+s>>>1;l(m,v,f,h,b,c+1),h=b}l(m,v,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)*v,t[2*_+1]=(t[2*_+1]-f)*y;var M=x[_];M!==A&&(w.push(new a(b*Math.pow(.5,M),_+1,k-(_+1))),k=_+1,A=M)}return w.push(new a(b*Math.pow(.5,M+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=i},{"./lib/sort":121,"typedarray-pool":202}],123:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=a,this.colorBuffer=i,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=g(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=g(this.plot.gl,[256,1])}function a(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,a=r[2]-r[0],i=r[3]-r[1],u=2/a,c=2/i,f=-r[0]-.5*a,h=-r[1]-.5*i;_[0]=u,w[0]=u-_[0],_[1]=c,w[1]=c-_[1],A[0]=f,k[0]=f-A[0],A[1]=h,k[1]=h-A[1];var d=e[2]-e[0],p=e[3]-e[1];o=Math.min(a/d,i/p),M[0]=2*n/d,M[1]=2*n/p,s=r[0],l=r[2]}function i(t,e){var r=t.gl,a=u(r,h.vertex,h.fragment),i=u(r,h.pickVertex,h.pickFragment),o=c(r),s=c(r),l=c(r),f=c(r),d=c(r),p=new n(t,a,i,o,s,l,f,d);return p.update(e),t.addObject(p),p}e.exports=i;var o,s,l,u=t("gl-shader"),c=t("gl-buffer"),f=t("typedarray-pool"),h=t("./lib/shaders"),d=t("snap-points-2d"),p=t("font-atlas-sdf"),g=t("gl-texture2d"),m=t("color-id"),v=t("ndarray"),y=t("clamp"),b=t("binary-search-bounds"),x=n.prototype,_=new Float32Array([0,0]),w=new Float32Array([0,0]),A=new Float32Array([0,0]),k=new Float32Array([0,0]),M=[0,0],T=[0,0,0,0];x.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,i=n>this.snapThreshold;if(!n)return t;a.call(this);var u=r.gl,c=e?this.pickShader:this.shader,f=u.isEnabled(u.BLEND);if(c.bind(),e){this.pickOffset=t;for(var h=0;h<4;++h)T[h]=t>>8*h&255;c.uniforms.pickOffset=T,this.idBuffer.bind(),c.attributes.id.pointer(u.UNSIGNED_BYTE,!1)}else u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.blendColor(0,0,0,1),f||u.enable(u.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(u.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(u.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(u.FLOAT,!1,8,0),e||c.attributes.border.pointer(u.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(u.FLOAT,!1,16,0),c.attributes.positionLo.pointer(u.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=_,c.uniforms.scaleLo=w,c.uniforms.translateHi=A,c.uniforms.translateLo=k,c.uniforms.viewBox=r.viewBox;var d=this.scales;if(i)for(var p=d.length-1;p>=0;p--){var g=d[p];if(!(g.pixelSize&&g.pixelSize<1.25*o&&p>1)){var m=g.offset,v=g.count+m,y=b.ge(this.xCoords,s,m,v-1),x=b.lt(this.xCoords,l,y,v-1)+1;x>y&&u.drawArrays(u.POINTS,y,x-y)}}else u.drawArrays(u.POINTS,0,n);if(e)return t+n;f?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.disable(u.BLEND)},x.draw=x.drawPick,x.pick=function(t,e,r){var n=this.pickOffset,a=this.pointCount;if(r=n+a)return null;var i=r-n,o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}},x.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],a=t.sizes||[],i=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,l=this.points.length/2,u=l>this.snapThreshold;var c=f.mallocFloat32(2*l),h=f.mallocFloat64(2*l),g=f.mallocUint32(l),b=f.mallocFloat32(4*l);h.set(this.points),u&&(this.i2idx&&f.free(this.i2idx),this.i2idx=f.mallocInt32(l),this.scales=d(h,this.i2idx,c)),this.pointCount=l;for(var x=0;xN&&(N=a[x]);var F=this.charStep;this.charStep=y(Math.ceil(4*N),128,768);var B=Object.keys(P),j=this.charStep,H=Math.floor(j/2),U=s.getParameter(s.MAX_TEXTURE_SIZE),V=U/j*(U/j),G=Math.min(U,j*B.length),q=Math.min(U,j*Math.ceil(j*B.length/U)),X=Math.floor(G/j);B.length>V&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==B+""&&this.charStep==F||(this.charCanvas=p({canvas:this.charCanvas,family:"sans-serif",size:H,shape:[G,q],step:[j,j],chars:B,align:!0,fit:this.charFit}),this.chars=B);for(var x=0;x>>1,n=u.mallocInt32(r),a=u.mallocFloat32(r),i=u.mallocFloat64(2*r);if(i.set(this.points),this.snapPoints)this.scales=l(i,n,a,this.bounds);else{this.bounds=h(i,2),f(i,2,this.bounds);for(var o=0;o>8&255,y[2]=t>>16&255,y[3]=t>>24&255,n.uniforms.pickOffset=y,s.bind(),n.attributes.pickId.pointer(f.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var O=!0;if(this.snapPoints)for(var I=a.length-1;I>=0;I--){var R=a[I];if(!(R.pixelSize1)){var D=this.getVisibleRange(R),P=D[0],z=D[1];z>P&&f.drawArrays(f.POINTS,P,z-P),!e&&O&&(O=!1,n.uniforms.useWeight=0)}}else f.drawArrays(f.POINTS,0,this.pointCount);return t+this.pointCount},d.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,a=this.size,i=this.plot.pixelRatio,o=r[2]-r[0];r[3],r[1];if(!t)for(var t,l=this.scales.length-1;l>=0&&(t=this.scales[l],t.pixelSize1);l--);var u=this.xCoords,c=(e[0]-r[0]-n*a*i)/o,f=(e[2]-r[0]+n*a*i)/o,h=t.offset,d=t.count+h,p=s.ge(u,c,h,d-1);return[p,s.lt(u,f,p,d-1)+1]},d.drawPick=d.draw,d.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":124,"array-bounds":11,"array-normalize":12,"binary-search-bounds":125,"gl-buffer":73,"gl-shader":132,"snap-points-2d":127,"typedarray-pool":202}],129:[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"},{}],130:[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 a(t,e){var r=t.gl,a=o(r,[0,0,0,1,1,0,1,1]),l=i(r,s.boxVertex,s.boxFragment),u=new n(t,a,l);return u.update(e),t.addOverlay(u),u}var i=t("gl-shader"),o=t("gl-buffer"),s=t("./lib/shaders");e.exports=a;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),a=(this.outerFill,this.outerColor),i=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 v=r*c;o.drawBox(f-v,h-v,d+v,h+v,i),o.drawBox(f-v,p-v,d+v,p+v,i),o.drawBox(f-v,h-v,f+v,p+v,i),o.drawBox(d-v,h-v,d+v,p+v,i)}}}},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":129,"gl-buffer":73,"gl-shader":132}],131:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.coord=[t,e],this.id=r,this.value=n,this.distance=a}function a(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 i(t,e){return new a(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}e.exports=i;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)),a=0;a=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);i(),d._relink=i,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=i},{"./lib/GLError":133,"./lib/create-attributes":134,"./lib/create-uniforms":135,"./lib/reflect":136,"./lib/runtime-reflect":137,"./lib/shader-cache":138}],133:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{dup:96}],134:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{"./GLError":133,dup:97}],135:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{"./GLError":133,"./reflect":136,dup:98}],136:[function(t,e,r){arguments[4][99][0].apply(r,arguments)},{dup:99}],137:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{dup:100}],138:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{"./GLError":133,dup:101,"gl-format-compiler-error":82,"weakmap-shim":209}],139:[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 a(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r}e.exports=a;var i=n.prototype;i.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()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,a=this.plot,i=a.line,o=a.dataBox,s=a.viewBox;if(i.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]&&i.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&i.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&i.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&i.drawLine(l,u,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],140:[function(t,e,r){"use strict";function n(t){v=[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 a(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 i(t,e,r){var n=t.gl,a=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)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,a,i){this.gl=t,this.handle=e,this.format=a,this.type=i,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,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,a,i,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");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}c[2]}if(h!==t.LUMINANCE&&h!==t.ALPHA||a!==t.LUMINANCE&&a!==t.ALPHA||(h=a),h!==a)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var v=l.size,y=o.indexOf(n)<0;if(y&&o.push(n), +f===i&&d)0===l.offset&&l.data.length===v?y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data):y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,l.data.subarray(l.offset,l.offset+v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,l.data.subarray(l.offset,l.offset+v));else{var b;b=i===t.FLOAT?m.mallocFloat32(v):m.mallocUint8(v);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&i===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,a,c[0],c[1],0,a,i,b.subarray(0,v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],a,i,b.subarray(0,v)),i===t.FLOAT?m.freeFloat32(b):m.freeUint8(b)}}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,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i)throw new Error("gl-texture2d: Invalid texture shape");if(a===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null),new o(t,s,e,r,n,a)}function f(t,e,r,n,a,i){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,a,a,i,e),new o(t,s,r,n,a,i)}function h(t,e){var r=e.dtype,n=e.shape.slice(),a=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>a||n[1]<0||n[1]>a)throw new Error("gl-texture2d: Invalid texture size");var i=s(n,e.stride.slice()),l=0;"float32"===r?l=t.FLOAT:"float64"===r?(l=t.FLOAT,i=!1,r="float32"):"uint8"===r?l=t.UNSIGNED_BYTE:(l=t.UNSIGNED_BYTE,i=!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,i=!1);var f,h,d=e.size;if(i)f=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];h=m.malloc(d,r);var y=p(h,n,v,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),i||m.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(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],r=a(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,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"),m=t("typedarray-pool");e.exports=d;var v=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&&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(),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 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}}}),_.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 i=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=a(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,o)}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(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:160,"ndarray-ops":159,"typedarray-pool":202}],141:[function(t,e,r){function n(t){for(var e=Array.isArray(t)?t:a(t),r=0;r0)continue;n=t.slice(0,1).join("")}return e(n),q+=n.length,H=H.slice(n.length),H.length}}function O(){return/[^a-fA-F0-9]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function I(){return"."===P?(H.push(P),j=m,z=P,F+1):/[eE]/.test(P)?(H.push(P),j=m,z=P,F+1):"x"===P&&1===H.length&&"0"===H[0]?(j=w,H.push(P),z=P,F+1):/[^\d]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function R(){return"f"===P&&(H.push(P),z=P,F+=1),/[eE]/.test(P)?(H.push(P),z=P,F+1):"-"===P&&/[eE]/.test(z)?(H.push(P),z=P,F+1):/[^\d]/.test(P)?(e(H.join("")),j=u,F):(H.push(P),z=P,F+1)}function D(){if(/[^\d\w_]/.test(P)){var t=H.join("");return j=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:v,e(H.join("")),j=u,F}return H.push(P),z=P,F+1}var P,z,N,F=0,B=0,j=u,H=[],U=[],V=1,G=0,q=0,X=!1,Y=!1,W="";t=t||{};var Z=o,Q=a;return"300 es"===t.version&&(Z=l,Q=s),function(t){return U=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):n()}}e.exports=n;var a=t("./lib/literals"),i=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,m=5,v=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":144,"./lib/builtins-300es":143,"./lib/literals":146,"./lib/literals-300es":145,"./lib/operators":147}],143:[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":144}],144:[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"]},{}],145:[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":146}],146:[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"]},{}],147:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],148:[function(t,e,r){function n(t,e){var r=a(e),n=[];return n=n.concat(r(t)),n=n.concat(r(null))}var a=t("./index");e.exports=n},{"./index":142}],149:[function(t,e,r){r.read=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,c=-7,f=r?a-1:0,h=r?-1:1,d=t[e+f];for(f+=h,i=d&(1<<-c)-1,d>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===i)i=1-u;else{if(i===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),i-=u}return(d?-1:1)*o*Math.pow(2,i-n)},r.write=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,h=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-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,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+d]=255&s,d+=p,s/=256,a-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,u-=8);t[r+d-p]|=128*g}},{}],150:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=a,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function a(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 i(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),i(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?y:(r.splice(n,1),i(t,r),b)}function l(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a)return a}}function c(t,e){for(var r=0;r>1],i=[],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,h),n=v.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,i=this.left;i.right;)n=i,i=i.right;if(n===this)i.right=this.right;else{var o=this.left,r=this.right;n.count-=i.count,n.right=i.left,i.left=o,i.right=r}a(this,i),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?a(this,this.left):a(this,this.right);return b}for(var o=v.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":30}],151:[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+"+"+m(_)+"]");x.push(v(0));for(var _=0;_0){",h(x[t]),"=1;"),D(t-1,e|1<0&&q.push(s(H,x[U-1])+"*"+o(x[U-1])),B.push(d(H,x[U])+"=("+q.join("-")+")|0")}for(var H=0;H=0;--H)X.push(o(x[H]));B.push(M+"=("+X.join("*")+")|0",A+"=mallocUint32("+M+")",w+"=mallocUint32("+M+")",T+"=0"),B.push(p(0)+"=0");for(var U=1;U<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 i=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,a,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",A="P",k="N",M="Q",T="X",E="T"},{"typedarray-pool":202}],159:[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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=i({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]=i({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=i({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]=i({ +args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=i({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=i({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=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=i({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":58}],160:[function(t,e,r){function n(t,e){return t[0]-e[0]}function a(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+u.join(",")+",v){"),n?i.push("return this.data.set("+c+",v)}"):i.push("return this.data["+c+"]=v}"),i.push("proto.get=function "+r+"_get("+u.join(",")+"){"),n?i.push("return this.data.get("+c+")}"):i.push("return this.data["+c+"]}"),i.push("proto.index=function "+r+"_index(",u.join(),"){return "+c+"}"),i.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+"]"});i.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}");i.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),i.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+"])}");i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",i.join("\n"));return o(f[t],a)}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 a=f.array[0];return a([])}"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,a.pack(n,r)}var a=t("double-bits"),i=Math.pow(2,-1074),o=-1>>>0;e.exports=n},{"double-bits":63}],162:[function(t,e,r){"use strict";function n(t,e){var r,n,o;return"string"==typeof t?(r=a(t,e),n=r.width,o=r.height):t instanceof HTMLCanvasElement?(n=t.width,o=t.height,t=t.getContext("2d"),r=t.getImageData(0,0,n,o)):t instanceof ImageData&&(n=t.width,o=t.height,r=t),i(r)}function a(t,e){e||(e={});var r=e.family||"sans-serif",n=l.width,a=l.height,i=e.width||e.height||e.size;i&&i!=n&&(n=a=l.width=l.height=i);var o=e.fontSize||n/2;return u.fillStyle="#000",u.fillRect(0,0,n,a),u.font=o+"px "+r,u.textBaseline="middle",u.textAlign="center",u.fillStyle="white",u.fillText(t,n/2,a/2),u.getImageData(0,0,n,a)}function i(t){var e,r,n,a,i,l,u,c,f,h,d,p,g,m=t.data,v=t.width,y=t.height,b=Array(y),x=Array(y),_=0,w=0,A=v,k=0,M=0,T=Array(y);for(r=0;rk&&(k=d[1]),T[r]=d}for(l=0,c=0,u=0,r=0;rM&&(M=g);return{center:[f,h],bounds:[A,_,k,w+1],radius:Math.sqrt(M)}}function o(t,e){var r=0,n=t.length,a=0;for(e||(e=4);!t[a]&&ar;)a-=e;return n=a,[r/e,n/e]}function s(t,e){return t*t+e*e}e.exports=n;var l=document.createElement("canvas"),u=l.getContext("2d");l.width=200,l.height=200,n.canvas=l},{}],163:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":177}],164:[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}},{}],165:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e0;--a)n=l[a],r=s[a],s[a]=s[n],s[n]=r,l[a]=l[r],l[r]=n,u=(u+r)*a;return i.freeUint32(l),i.freeUint32(s),u}function a(t,e,r){switch(t){case 0:return r||[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}r=r||new Array(t);var n,a,i,o=1;for(r[0]=0,i=1;i0;--i)n=e/o|0,e=e-n*o|0,o=o/i|0,a=0|r[i],r[i]=0|r[n],r[n]=0|a;return r}var i=t("typedarray-pool"),o=t("invert-permutation");r.rank=n,r.unrank=a},{"invert-permutation":151,"typedarray-pool":202}],167:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,i){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return i?l:(o&&r(o,u),l)}for(var i=0|e.length,o=t.length,s=[new Array(i),new Array(i)],l=0;l0;){var d=(s[0][l].length,function(t,i){var o=s[i][t][0],l=[t];r(o,i);for(var u=o[1^i];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(a(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var a=t("compare-angle")},{"compare-angle":57}],168:[function(t,e,r){"use strict";function n(t,e){for(var r=a(t,e.length),n=new Array(e.length),i=new Array(e.length),o=[],s=0;s0;){var u=o.pop();n[u]=!1;for(var c=r[u],s=0;s0}function i(t){for(var e=t.length,r=0;r0;){var H=B.pop(),U=I[H];f(U,function(t,e){return t-e});var V,G=U.length,q=j[H];if(0===q){var T=v[H];V=[T]}for(var m=0;m=0)&&(j[X]=1^q,B.push(X),0===q)){var T=v[X];i(T)||(T.reverse(),V.push(T))}}0===q&&d.push(V)}return d}e.exports=i;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":168,"edges-to-adjacency-list":65,"planar-dual":167,"point-in-big-polygon":170,"robust-sum":184,"two-product":200,uniq:204}],170:[function(t,e,r){function n(){return!0}function a(t){return function(e,r){var a=t[e];return!!a&&!!a.queryPoint(r,n)}}function i(t){for(var e={},r=0;r0&&e[n]===r[0]))return 1;a=t[n-1]}for(var i=1;a;){var o=a.key,s=f(r,o[0],o[1]);if(o[0][0]0))return 0;i=-1,a=a.right}else if(s>0)a=a.left;else{if(!(s<0))return 0;i=1,a=a.right}}return i}}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=[],a=0;a1)for(var r=1;r=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")}function l(t,r,a){r.indexOf(t)<0&&e("invalid value"+n(a)+". must be one of: "+r)}function u(t){Object.keys(t).forEach(function(t){te.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+te)})}function c(t,e){for(t+="";t.length0&&e.push(new d("unknown",0,t))}}),e}function y(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}function b(t,e,n,a,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(e),s=a===t.FRAGMENT_SHADER?"fragment":"vertex";T(n,"string",s+" shader source must be a string",i);var l=m(n,i),u=v(o);y(l,u),Object.keys(l).forEach(function(t){function e(t,e){n.push(t),a.push(e||"")}var r=l[t];if(r.hasErrors){var n=[""],a=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var a=n.message,i=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(i){var o=i[1];switch(a=i[2],o){case"assign":o="="}r=Math.max(t.line.indexOf(o,r),0)}else r=0;e(c("| ",6)),e(c("^^^",r+3)+"\n","font-weight:bold"),e(c("| ",6)),e(a+"\n","font-weight:bold")}),e(c("| ",6)+"\n")}else e(c(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(a[0]=n.join("%c"),console.log.apply(console,a)):console.log(n.join(""))}}),r.raise("Error compiling "+s+" shader, "+l[0].name)}}function x(t,e,n,a,i){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=m(n,i),l=m(a,i),u='Error linking program with vertex shader, "'+l[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+o),r.raise(u)}}function _(t){t._commandRef=p()}function w(t,e,r,n){function a(t){return t?n.id(t):0}function i(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}_(t),t._fragId=a(t.static.frag),t._vertId=a(t.static.vert);var o=t._uniformSet={};i(o,e.static),i(o,e.dynamic);var s=t._attributeSet={};i(s,r.static),i(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function A(t,r){var n=g();e(t+" in command "+(r||p())+("unknown"===n?"":" called from "+n))}function k(t,e,r){t||A(e,r||p())}function M(t,e,r,a){t in e||A("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),a||p())}function T(t,e,r,a){typeof t!==e&&A("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,a||p())}function E(t){t()}function L(t,e,r){t.texture?l(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):l(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}function S(t,e){return t===ue||t===le||t===ce?2:t===fe?4:he[t]*e}function C(t){return!(t&t-1||!t)}function O(t,e,n){var a,i=e.width,o=e.height,s=e.channels;r(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ee&&t.wrapT===ee||r(C(i)&&C(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==i&&1!==o&&r(t.minFilter!==ne&&t.minFilter!==ie&&t.minFilter!==ae&&t.minFilter!==oe,"min filter requires mipmap"):(r(C(i)&&C(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),e.type===se&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===re&&t.magFilter===re,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(a=0;a<16;++a)if(l[a]){var u=i>>a,c=o>>a;r(e.mipmask&1<0&&i<=a.maxTextureSize&&o>0&&o<=a.maxTextureSize,"invalid texture shape"),r(i===o,"cube map must be square"),r(e.wrapS===ee&&e.wrapT===ee,"wrap mode not supported by cube map");for(var l=0;l>f,p=o>>f;r(u.mipmask&1<1&&e===r&&('"'===e||"'"===e))return['"'+D(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return P(t.substr(0,n.index)).concat(P(n[1])).concat(P(t.substr(n.index+n[0].length)));var a=t.split(".");if(1===a.length)return['"'+D(t)+'"'];for(var i=[],o=0;o0,"invalid pixel ratio"))):de.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!a){if(!n){de("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=H(r||document.body,f,u);if(!d)return null;n=d.canvas,h=d.onDestroy}a=U(n,o)}return a?{gl:a,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:u,profile:c,onDone:f,onDestroy:h}:(h(),f("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function W(t,e){function r(e){de.type(e,"string","extension name must be string");var r,a=e.toLowerCase();try{r=n[a]=t.getExtension(a)}catch(t){}return!!r}for(var n={},a=0;a65535)<<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)|t>>1}function J(t){var e=$(t),r=Le[K(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function tt(t){Le[K(t.byteLength)>>2].push(t)}function et(t,e){var r=null;switch(t){case _e:r=new Int8Array(J(e),0,e);break;case we:r=new Uint8Array(J(e),0,e);break;case Ae:r=new Int16Array(J(2*e),0,e);break;case ke:r=new Uint16Array(J(2*e),0,e);break;case Me:r=new Int32Array(J(4*e),0,e);break;case Te:r=new Uint32Array(J(4*e),0,e);break;case Ee:r=new Float32Array(J(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r}function rt(t){tt(t.buffer)}function nt(t,e,r){for(var n=0;n0){var l;if(Array.isArray(e[0])){s=De(e);for(var u=1,c=1;c0)if("number"==typeof t[0]){var a=Se.allocType(p.dtype,t.length);ct(a,t),f(a,n),Se.freeType(a)}else if(Array.isArray(t[0])||Kt(t[0])){r=De(t);var i=Re(t,r,p.dtype);f(i,n),Se.freeType(i)}else de.raise("invalid buffer data")}else if(Kt(t))f(t,n);else if(Z(t)){r=t.shape;var o=t.stride,s=0,l=0,u=0,h=0;1===r.length?(s=r[0],l=1,u=o[0],h=0):2===r.length?(s=r[0],l=r[1],u=o[0],h=o[1]):de.raise("invalid shape");var d=Array.isArray(t.data)?p.dtype:ut(t.data),g=Se.allocType(d,s*l);ft(g,t.data,s,l,u,h,t.offset),f(g,n),Se.freeType(g)}else de.raise("invalid data for buffer subdata");return c}e.bufferCount++;var p=new n(i);return h[p.id]=p,o||c(a),c._reglType="buffer",c._buffer=p,c.subdata=d,r.profile&&(c.stats=p.stats),c.destroy=function(){l(p)},c}function c(){xe(h).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}var f=0,h={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){l(this)};var d=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:u,createStream:a,destroyStream:i,clear:function(){xe(h).forEach(l),d.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:c,_initBuffer:s}}function dt(t,e,r,n){function a(t){this.id=f++,c[this.id]=this,this.buffer=t,this.primType=Ve,this.vertCount=0,this.type=0}function i(t){var e=d.pop();return e||(e=new a(r.create(null,Qe,!0,!1)._buffer)),s(e,t,$e,-1,-1,0,0),e}function o(t){d.push(t)}function s(n,a,i,o,s,l,u){if(n.buffer.bind(),a){var c=u;u||Kt(a)&&(!Z(a)||Kt(a.data))||(c=e.oes_element_index_uint?Ze:Ye),r._initBuffer(n.buffer,a,i,c,3)}else t.bufferData(Qe,l,i),n.buffer.dtype=f||qe,n.buffer.usage=i,n.buffer.dimension=3,n.buffer.byteLength=l;var f=u;if(!u){switch(n.buffer.dtype){case qe:case Ge:f=qe;break;case Ye:case Xe:f=Ye;break;case Ze:case We:f=Ze;break;default:de.raise("unsupported type for element array")}n.buffer.dtype=f}n.type=f,de(f!==Ze||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var h=s;h<0&&(h=n.buffer.byteLength,f===Ye?h>>=1:f===Ze&&(h>>=2)),n.vertCount=h;var d=o;if(o<0){d=Ve;var p=n.buffer.dimension;1===p&&(d=He),2===p&&(d=Ue),3===p&&(d=Ve)}n.primType=d}function l(t){n.elementsCount--,de(null!==t.buffer,"must not double destroy elements"),delete c[t.id],t.buffer.destroy(),t.buffer=null}function u(t,e){function i(t){if(t)if("number"==typeof t)o(t),u.primType=Ve,u.vertCount=0|t,u.type=qe;else{var e=null,r=Ke,n=-1,a=-1,l=0,c=0;Array.isArray(t)||Kt(t)||Z(t)?e=t:(de.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,de(Array.isArray(e)||Kt(e)||Z(e),"invalid data for element buffer")),"usage"in t&&(de.parameter(t.usage,Ie,"invalid element buffer usage"),r=Ie[t.usage]),"primitive"in t&&(de.parameter(t.primitive,je,"invalid element buffer primitive"),n=je[t.primitive]),"count"in t&&(de("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),a=0|t.count),"type"in t&&(de.parameter(t.type,h,"invalid buffer type"),c=h[t.type]),"length"in t?l=0|t.length:(l=a,c===Ye||c===Xe?l*=2:c!==Ze&&c!==We||(l*=4))),s(u,e,r,n,a,l,c)}else o(),u.primType=Ve,u.vertCount=0,u.type=qe;return i}var o=r.create(null,Qe,!0),u=new a(o._buffer);return n.elementsCount++,i(t),i._reglType="elements",i._elements=u,i.subdata=function(t,e){return o.subdata(t,e),i},i.destroy=function(){l(u)},i}var c={},f=0,h={uint8:qe,uint16:Ye};e.oes_element_index_uint&&(h.uint32=Ze),a.prototype.bind=function(){this.buffer.bind()};var d=[];return{create:u,createStream:i,destroyStream:o,getElements:function(t){return"function"==typeof t&&t._elements instanceof a?t._elements:null},clear:function(){xe(c).forEach(l)}}}function pt(t){for(var e=Se.allocType(er,t.length),r=0;r>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)e[r]=a;else if(i<-14){var s=-14-i;e[r]=a+(o+1024>>s)}else e[r]=i>15?a+31744:a+(i+15<<10)+o}return e}function gt(t){return Array.isArray(t)||Kt(t)}function mt(t){return"[object "+t+"]"}function vt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function yt(t){return!!Array.isArray(t)&&!(0===t.length||!gt(t[0]))}function bt(t){return Object.prototype.toString.call(t)}function xt(t){return bt(t)===dn}function _t(t){return bt(t)===pn}function wt(t){return bt(t)===gn}function At(t){return bt(t)===mn}function kt(t){if(!t)return!1;var e=bt(t);return vn.indexOf(e)>=0||(vt(t)||yt(t)||Z(t))}function Mt(t){return 0|$t[Object.prototype.toString.call(t)]}function Tt(t,e){var r=e.length;switch(t.type){case Pr:case zr:case Nr:case Fr:var n=Se.allocType(t.type,r);n.set(e),t.data=n;break;case wr:t.data=pt(e);break;default:de.raise("unsupported texture type, must specify a typed array")}}function Et(t,e){return Se.allocType(t.type===wr?Fr:t.type,e)}function Lt(t,e){t.type===wr?(t.data=pt(e),Se.freeType(e)):t.data=e}function St(t,e,r,n,a,i){for(var o=t.width,s=t.height,l=t.channels,u=o*s*l,c=Et(t,u),f=0,h=0;h=1;)s+=o*l*l,l/=2;return s}return o*r*n}function Ot(t,e,r,n,a,i,o){function s(){this.internalformat=or,this.format=or,this.type=Pr,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function u(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(de.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(de.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(de.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(de.parameter(n.colorSpace,F,"invalid colorSpace"),t.colorSpace=F[n.colorSpace]),"type"in n){var a=n.type;de(e.oes_texture_float||!("float"===a||"float32"===a),"you must enable the OES_texture_float extension in order to use floating point textures."),de(e.oes_texture_half_float||!("half float"===a||"float16"===a),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),de(e.webgl_depth_texture||!("uint16"===a||"uint32"===a||"depth stencil"===a),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(a,B,"invalid texture type"),t.type=B[a]}var i=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(de(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),i=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],de(s>0&&s<=4,"invalid number of channels"),l=!0),de(i>=0&&i<=r.maxTextureSize,"invalid width"),de(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(i=o=n.radius,de(i>=0&&i<=r.maxTextureSize,"invalid radius")),"width"in n&&(i=n.width,de(i>=0&&i<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,de(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,de(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|i,t.height=0|o,t.channels=0|s;var u=!1;if("format"in n){var c=n.format;de(e.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(c,j,"invalid texture format");var f=t.internalformat=j[c];t.format=Q[f],c in B&&("type"in n||(t.type=B[c])),c in H&&(t.compressed=!0),u=!0}!l&&u?t.channels=hn[t.format]:l&&!u?t.channels!==fn[t.format]&&(t.format=t.internalformat=fn[t.channels]):u&&l&&de(t.channels===hn[t.format],"number of channels inconsistent with specified format")}}function c(e){t.pixelStorei(an,e.flipY),t.pixelStorei(on,e.premultiplyAlpha),t.pixelStorei(sn,e.colorSpace),t.pixelStorei(nn,e.unpackAlignment)}function f(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function h(t,e){var n=null;if(kt(e)?n=e:e&&(de.type(e,"object","invalid pixel data type"),u(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),kt(e.data)&&(n=e.data)),de(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){de(!n,"can not specify copy and data field for the same texture");var i=a.viewportWidth,o=a.viewportHeight;t.width=t.width||i-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,de(t.xOffset>=0&&t.xOffset=0&&t.yOffset0&&t.width<=i&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(Kt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Pr||(t.type=Mt(n));else if(vt(n))t.channels=t.channels||4,Tt(t,n),t.alignment=1,t.needsFree=!0;else if(Z(n)){var s=n.data;Array.isArray(s)||t.type!==Pr||(t.type=Mt(s));var l,c,f,h,d,p,g=n.shape,m=n.stride;3===g.length?(f=g[2],p=m[2]):(de(2===g.length,"invalid ndarray pixel data, must be 2 or 3D"),f=1,p=1),l=g[0],c=g[1],h=m[0],d=m[1],t.alignment=1,t.width=l,t.height=c,t.channels=f,t.format=t.internalformat=fn[f],t.needsFree=!0,St(t,s,h,d,p,n.offset)}else if(xt(n)||_t(n))xt(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(wt(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(At(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(yt(n)){var v=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=gt(n[0][0])?b||n[0][0].length:b||1;for(var x=Ce.shape(n),_=1,w=0;w=0,"oes_texture_float extension not enabled"):t.type===wr&&de(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,a){var i=e.element,o=e.data,s=e.internalformat,l=e.format,u=e.type,f=e.width,h=e.height;c(e),i?t.texImage2D(r,a,l,l,u,i):e.compressed?t.compressedTexImage2D(r,a,s,f,h,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,a,l,e.xOffset,e.yOffset,f,h,0)):t.texImage2D(r,a,l,f,h,0,l,u,o)}function p(e,r,a,i,o){var s=e.element,l=e.data,u=e.internalformat,f=e.format,h=e.type,d=e.width,p=e.height;c(e),s?t.texSubImage2D(r,o,a,i,f,h,s):e.compressed?t.compressedTexSubImage2D(r,o,a,i,u,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,a,i,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,a,i,d,p,f,h,l)}function g(){return $.pop()||new f}function m(t){t.needsFree&&Se.freeType(t.data),f.call(t),$.push(t)}function v(){s.call(this),this.genMipmaps=!1,this.mipmapHint=Jr,this.mipmask=0,this.images=Array(16)}function y(t,e,r){var n=t.images[0]=g();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function b(t,e){var r=null;if(kt(e))r=t.images[0]=g(),l(r,t),h(r,e),t.mipmask=1;else if(u(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,a=0;a>=a,r.height>>=a,h(r,n[a]),t.mipmask|=1<=0&&(t.genMipmaps=!0)}if("mag"in e){var a=e.mag;de.parameter(a,z),t.magFilter=z[a]}var i=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(de.parameter(s,P),i=o=P[s]):Array.isArray(s)&&(de.parameter(s[0],P),de.parameter(s[1],P),i=P[s[0]],o=P[s[1]])}else{if("wrapS"in e){var l=e.wrapS;de.parameter(l,P),i=P[l]}if("wrapT"in e){var u=e.wrapT;de.parameter(u,P),o=P[u]}}if(t.wrapS=i,t.wrapT=o,"anisotropic"in e){var c=e.anisotropic;de("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var f=!1;switch(typeof e.mipmap){case"string":de.parameter(e.mipmap,D,"invalid mipmap hint"),t.mipmapHint=D[e.mipmap],t.genMipmaps=!0,f=!0;break;case"boolean":f=t.genMipmaps=e.mipmap;break;case"object":de(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,f=!0;break;default:de.raise("invalid mipmap type")}!f||"min"in e||(t.minFilter=Wr)}}function M(r,n){t.texParameteri(n,qr,r.minFilter),t.texParameteri(n,Gr,r.magFilter),t.texParameteri(n,Br,r.wrapS),t.texParameteri(n,jr,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,rn,r.anisotropic),r.genMipmaps&&(t.hint(Kr,r.mipmapHint),t.generateMipmap(n))}function T(e){s.call(this),this.mipmask=0,this.internalformat=or,this.id=J++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new A,o.profile&&(this.stats={size:0})}function E(e){t.activeTexture(un),t.bindTexture(e.target,e.texture)}function L(){var e=rt[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(nr,null)}function S(e){var r=e.texture;de(r,"must not double destroy texture");var n=e.unit,a=e.target;n>=0&&(t.activeTexture(un+n),t.bindTexture(a,null),rt[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete tt[e.id],i.textureCount--}function C(e,n){function a(t,e){var n=c.texInfo;A.call(n);var i=_();return"number"==typeof t?"number"==typeof e?y(i,0|t,0|e):y(i,0|t,0|t):t?(de.type(t,"object","invalid arguments to regl.texture"),k(n,t),b(i,t)):y(i,1,1),n.genMipmaps&&(i.mipmask=(i.width<<1)-1),c.mipmask=i.mipmask,l(c,i),de.texture2D(n,i,r),c.internalformat=i.internalformat,a.width=i.width,a.height=i.height,E(c),x(i,nr),M(n,nr),L(),w(i),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,i.width,i.height,n.genMipmaps,!1)),a.format=G[c.internalformat],a.type=q[c.type],a.mag=X[n.magFilter],a.min=Y[n.minFilter],a.wrapS=W[n.wrapS],a.wrapT=W[n.wrapT],a}function s(t,e,r,n){de(!!t,"must specify image data");var i=0|e,o=0|r,s=0|n,u=g();return l(u,c),u.width=0,u.height=0,h(u,t),u.width=u.width||(c.width>>s)-i,u.height=u.height||(c.height>>s)-o,de(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),de(c.mipmask&1<>s;++s)t.texImage2D(nr,s,c.format,n>>s,i>>s,0,c.format,c.type,null);return L(),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,n,i,!1,!1)),a}var c=new T(nr);return tt[c.id]=c,i.textureCount++,a(e,n),a.subimage=s,a.resize=u,a._reglType="texture2d",a._texture=c,o.profile&&(a.stats=c.stats),a.destroy=function(){c.decRef()},a}function O(e,n,a,s,c,f){function d(t,e,n,a,i,s){var c,f=C.texInfo;for(A.call(f),c=0;c<6;++c)O[c]=_();if("number"!=typeof t&&t)if("object"==typeof t)if(e)b(O[0],t),b(O[1],e),b(O[2],n),b(O[3],a),b(O[4],i),b(O[5],s);else if(k(f,t),u(C,t),"faces"in t){var h=t.faces;for(de(Array.isArray(h)&&6===h.length,"cube faces must be a length 6 array"),c=0;c<6;++c)de("object"==typeof h[c]&&!!h[c],"invalid input for cube map face"),l(O[c],C),b(O[c],h[c])}else for(c=0;c<6;++c)b(O[c],t);else de.raise("invalid arguments to cube map");else{var p=0|t||1;for(c=0;c<6;++c)y(O[c],p,p)}for(l(C,O[0]),f.genMipmaps?C.mipmask=(O[0].width<<1)-1:C.mipmask=O[0].mipmask,de.textureCube(C,f,O,r),C.internalformat=O[0].internalformat,d.width=O[0].width,d.height=O[0].height,E(C),c=0;c<6;++c)x(O[c],ir+c);for(M(f,ar),L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,f.genMipmaps,!0)),d.format=G[C.internalformat],d.type=q[C.type],d.mag=X[f.magFilter],d.min=Y[f.minFilter],d.wrapS=W[f.wrapS],d.wrapT=W[f.wrapT],c=0;c<6;++c)w(O[c]);return d}function v(t,e,r,n,a){de(!!e,"must specify image data"),de("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var i=0|r,o=0|n,s=0|a,u=g();return l(u,C),u.width=0,u.height=0,h(u,e),u.width=u.width||(C.width>>s)-i,u.height=u.height||(C.height>>s)-o,de(C.type===u.type&&C.format===u.format&&C.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(i>=0&&o>=0&&i+u.width<=C.width&&o+u.height<=C.height,"texture.subimage write out of bounds"),de(C.mipmask&1<>a;++a)t.texImage2D(ir+n,a,C.format,r>>a,r>>a,0,C.format,C.type,null);return L(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,!1,!0)),d}}var C=new T(ar);tt[C.id]=C,i.cubeCount++;var O=new Array(6);return d(e,n,a,s,c,f),d.subimage=v,d.resize=S,d._reglType="textureCube",d._texture=C,o.profile&&(d.stats=C.stats),d.destroy=function(){C.decRef()},d}function I(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(ir+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);M(e.texInfo,e.target)})}var D={"don't care":Jr,"dont care":Jr,nice:en,fast:tn},P={repeat:Hr,clamp:Ur,mirror:Vr},z={nearest:Xr,linear:Yr},N=Jt({mipmap:$r,"nearest mipmap nearest":Wr,"linear mipmap nearest":Zr,"nearest mipmap linear":Qr,"linear mipmap linear":$r},z),F={none:0,browser:ln},B={uint8:Pr,rgba4:pr,rgb565:mr,"rgb5 a1":gr},j={alpha:sr,luminance:ur,"luminance alpha":cr,rgb:lr,rgba:or,rgba4:fr,"rgb5 a1":hr,rgb565:dr},H={};e.ext_srgb&&(j.srgb=xr,j.srgba=_r),e.oes_texture_float&&(B.float32=B.float=Fr),e.oes_texture_half_float&&(B.float16=B["half float"]=wr),e.webgl_depth_texture&&(Jt(j,{depth:yr,"depth stencil":br}),Jt(B,{uint16:zr,uint32:Nr,"depth stencil":vr})),e.webgl_compressed_texture_s3tc&&Jt(H,{"rgb s3tc dxt1":Ar,"rgba s3tc dxt1":kr,"rgba s3tc dxt3":Mr,"rgba s3tc dxt5":Tr}),e.webgl_compressed_texture_atc&&Jt(H,{"rgb atc":Er,"rgba atc explicit alpha":Lr,"rgba atc interpolated alpha":Sr}),e.webgl_compressed_texture_pvrtc&&Jt(H,{"rgb pvrtc 4bppv1":Cr,"rgb pvrtc 2bppv1":Or,"rgba pvrtc 4bppv1":Ir,"rgba pvrtc 2bppv1":Rr}),e.webgl_compressed_texture_etc1&&(H["rgb etc1"]=Dr);var U=Array.prototype.slice.call(t.getParameter(rr));Object.keys(H).forEach(function(t){var e=H[t];U.indexOf(e)>=0&&(j[t]=e)});var V=Object.keys(j);r.textureFormats=V;var G=[];Object.keys(j).forEach(function(t){var e=j[t];G[e]=t});var q=[];Object.keys(B).forEach(function(t){var e=B[t];q[e]=t});var X=[];Object.keys(z).forEach(function(t){var e=z[t];X[e]=t});var Y=[];Object.keys(N).forEach(function(t){var e=N[t];Y[e]=t});var W=[];Object.keys(P).forEach(function(t){var e=P[t];W[e]=t});var Q=V.reduce(function(t,e){var r=j[e];return r===ur||r===sr||r===ur||r===cr||r===yr||r===br?t[r]=r:r===hr||e.indexOf("rgba")>=0?t[r]=or:t[r]=lr,t},{}),$=[],K=[],J=0,tt={},et=r.maxTextureUnits,rt=Array(et).map(function(){return null});return Jt(T.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;a.unit=-1}rt[n]=e,r=n;break}r>=et&&de.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits=En&&e=2,"invalid shape for framebuffer"),u=I[0],d=I[1]}else"radius"in O&&(u=d=O.radius),"width"in O&&(u=O.width),"height"in O&&(d=O.height);("color"in O||"colors"in O)&&(y=O.color||O.colors,Array.isArray(y)&&de(1===y.length||o,"multiple render targets not supported")),y||("colorCount"in O&&(T=0|O.colorCount,de(T>0,"invalid color buffer count")),"colorTexture"in O&&(b=!!O.colorTexture,x="rgba4"),"colorType"in O&&(M=O.colorType,b?(de(e.oes_texture_float||!("float"===M||"float32"===M),"you must enable OES_texture_float in order to use floating point framebuffer objects"),de(e.oes_texture_half_float||!("half float"===M||"float16"===M),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===M||"float16"===M?(de(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==M&&"float32"!==M||(de(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),de.oneOf(M,k,"invalid color type")),"colorFormat"in O&&(x=O.colorFormat,w.indexOf(x)>=0?b=!0:A.indexOf(x)>=0?b=!1:b?de.oneOf(O.colorFormat,w,"invalid color format for texture"):de.oneOf(O.colorFormat,A,"invalid color format for renderbuffer"))),("depthTexture"in O||"depthStencilTexture"in O)&&(C=!(!O.depthTexture&&!O.depthStencilTexture),de(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in O&&("boolean"==typeof O.depth?p=O.depth:(E=O.depth,m=!1)),"stencil"in O&&("boolean"==typeof O.stencil?m=O.stencil:(L=O.stencil,p=!1)),"depthStencil"in O&&("boolean"==typeof O.depthStencil?p=m=O.depthStencil:(S=O.depthStencil,p=!1,m=!1))}else u=d=1;var R=null,D=null,P=null,z=null;if(Array.isArray(y))R=y.map(c);else if(y)R=[c(y)];else for(R=new Array(T),i=0;i=0||R[i].renderbuffer&&jn.indexOf(R[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),R[i]&&R[i].texture){var F=Pn[R[i].texture._texture.format]*zn[R[i].texture._texture.type];null===N?N=F:de(N===F,"all color attachments much have the same number of bits per pixel.")}return l(D,u,d),de(!D||D.texture&&D.texture._texture.format===Rn||D.renderbuffer&&D.renderbuffer._renderbuffer.format===Nn,"invalid depth attachment for framebuffer object"),l(P,u,d),de(!P||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Fn,"invalid stencil attachment for framebuffer object"),l(z,u,d),de(!z||z.texture&&z.texture._texture.format===Bn||z.renderbuffer&&z.renderbuffer._renderbuffer.format===Bn,"invalid depth-stencil attachment for framebuffer object"),g(s),s.width=u,s.height=d,s.colorAttachments=R,s.depthAttachment=D,s.stencilAttachment=P,s.depthStencilAttachment=z,a.color=R.map(h),a.depth=h(D),a.stencil=h(P),a.depthStencil=h(z),a.width=s.width,a.height=s.height,v(s),a}function o(t,e){de(_.next!==s,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===s.width&&n===s.height)return a;for(var i=s.colorAttachments,o=0;o=2,"invalid shape for framebuffer"),de(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&de(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(u=d.color||d.colors,Array.isArray(u)&&de(1===u.length||i,"multiple render targets not supported")),u||("colorCount"in d&&(h=0|d.colorCount,de(h>0,"invalid color buffer count")),"colorType"in d&&(de.oneOf(d.colorType,k,"invalid color type"),f=d.colorType),"colorFormat"in d&&(c=d.colorFormat,de.oneOf(d.colorFormat,w,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var g;if(u)if(Array.isArray(u))for(g=[],r=0;r0&&(s.depth=o[0].depth,s.stencil=o[0].stencil,s.depthStencil=o[0].depthStencil),o[r]?o[r](s):o[r]=y(s)}return Jt(a,{width:l,height:l,color:g})}function i(t){var e,n=0|t;if(de(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var i=a.color;for(e=0;e1)for(var g=0;gt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);xe(c).forEach(e),c={},xe(f).forEach(e),f={},d.forEach(function(e){t.deleteProgram(e.program)}),d.length=0,h={},r.shaderCount=0},program:function(t,e,n){de.command(t>=0,"missing vertex shader",n),de.command(e>=0,"missing fragment shader",n);var a=h[e];a||(a=h[e]={});var i=a[t];return i||(i=new s(e,t),r.shaderCount++,l(i,n),a[t]=i,d.push(i)),i},restore:u,shader:o,frag:-1,vert:-1}}function Nt(t,e,r,n,a,i){function o(o){var s;null===e.next?(de(a.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Wn):(de(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,i.oes_texture_float?de(s===Wn||s===Qn,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):de(s===Wn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,u=0,c=n.framebufferWidth,f=n.framebufferHeight,h=null;Kt(o)?h=o:o&&(de.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,u=0|o.y,de(l>=0&&l=0&&u0&&c+l<=n.framebufferWidth,"invalid width for read pixels"),de(f>0&&f+u<=n.framebufferHeight,"invalid height for read pixels"),r();var d=c*f*4;return h||(s===Wn?h=new Uint8Array(d):s===Qn&&(h=h||new Float32Array(d))),de.isTypedArray(h,"data buffer for regl.read() must be a typedarray"),de(h.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(Zn,4),t.readPixels(l,u,c,f,Yn,s,h),h}function s(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}function l(t){return t&&"framebuffer"in t?s(t):o(t)}return l}function Ft(t){return Array.prototype.slice.call(t)}function Bt(t){return Ft(t).join("")}function jt(){function t(t){for(var e=0;e0&&(r.push(t,"="),r.push.apply(r,Ft(arguments)),r.push(";")),t}var r=[],n=[];return Jt(t,{def:e,toString:function(){return Bt([n.length>0?"var "+n+";":"",Bt(r)])}})}function r(){function t(t,e){n(t,e,"=",r.def(t,e),";")}var r=e(),n=e(),a=r.toString,i=n.toString;return Jt(function(){r.apply(r,Ft(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,a){t(e,n),r(e,n,"=",a,";")},toString:function(){return a()+i()}})}function n(){var t=Bt(arguments),e=r(),n=r(),a=e.toString,i=n.toString;return Jt(e,{then:function(){return e.apply(e,Ft(arguments)),this},else:function(){return n.apply(n,Ft(arguments)),this},toString:function(){var e=i();return e&&(e="else{"+e+"}"),Bt(["if(",t,"){",a(),"}",e])}})}function a(t,e){function n(){var t="a"+a.length;return a.push(t),t}var a=[];e=e||0;for(var i=0;i=1,n>=2,e)}if(r===ia){var a=t.data;return new Vt(a.thisDep,a.contextDep,a.propDep,e)}return new Vt(r===aa,r===na,r===ra,e)}function Yt(t,e,r,n,a,i,o,s,l,u,c,f,h,d,p){function g(t){return t.replace(".","_")}function m(t,e,r){var n=g(t);et.push(t),tt[n]=J[n]=!!r,rt[n]=e}function v(t,e,r){var n=g(t);et.push(t),Array.isArray(r)?(J[n]=r.slice(),tt[n]=r.slice()):J[n]=tt[n]=r,nt[n]=e}function y(){var t=jt(),r=t.link,n=t.global;t.id=ot++,t.batchId="0";var a=r(at),i=t.shared={props:"a0"};Object.keys(at).forEach(function(t){i[t]=n.def(a,".",t)}),de.optional(function(){t.CHECK=r(de),t.commandStr=de.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},it.invalidBlendCombinations=Hi});var o=t.next={},s=t.current={};Object.keys(nt).forEach(function(t){Array.isArray(J[t])&&(o[t]=n.def(i.next,".",t),s[t]=n.def(i.current,".",t))});var l=t.constants={};Object.keys(it).forEach(function(t){l[t]=n.def(JSON.stringify(it[t]))}),t.invoke=function(e,n){switch(n.type){case ea:var a=["this",i.context,i.props,t.batchId];return e.def(r(n.data),".call(",a.slice(0,Math.max(n.data.length+1,4)),")");case ra:return e.def(i.props,n.data);case na:return e.def(i.context,n.data);case aa:return e.def("this",n.data);case ia:return n.data.append(t,e),n.data.ref}},t.attribCache={};var c={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in c)return c[n];var a=u.scope[n];return a||(a=u.scope[n]=new W),c[n]=r(a)},t}function b(t){var e,r=t.static,n=t.dynamic;if(Ra in r){var a=!!r[Ra];e=qt(function(t,e){return a}),e.enable=a}else if(Ra in n){var i=n[Ra];e=Xt(i,function(t,e){return t.invoke(e,i)})}return e}function x(t,e){var r=t.static,n=t.dynamic;if(Da in r){var a=r[Da];return a?(a=s.getFramebuffer(a),de.command(a,"invalid framebuffer object"),qt(function(t,e){var r=t.link(a),n=t.shared;e.set(n.framebuffer,".next",r);var i=n.context;return e.set(i,"."+Ua,r+".width"),e.set(i,"."+Va,r+".height"),r})):qt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Ua,n+"."+Xa),e.set(n,"."+Va,n+"."+Ya),"null"})}if(Da in n){var i=n[Da];return Xt(i,function(t,e){var r=t.invoke(e,i),n=t.shared,a=n.framebuffer,o=e.def(a,".getFramebuffer(",r,")");de.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(a,".next",o);var s=n.context;return e.set(s,"."+Ua,o+"?"+o+".width:"+s+"."+Xa),e.set(s,"."+Va,o+"?"+o+".height:"+s+"."+Ya),o})}return null}function _(t,e,r){function n(t){if(t in a){var n=a[t];de.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,u=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,de.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,de.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new Vt(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,a=o;"width"in n||(a=e.def(r,".",Ua,"-",u));var i=s;return"height"in n||(i=e.def(r,".",Va,"-",c)),[u,c,a,i]})}if(t in i){var f=i[t],h=Xt(f,function(e,r){var n=e.invoke(r,f);de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var a=e.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Ua,"-",i,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",Va,"-",o,")");return de.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[i,o,s,l]});return e&&(h.thisDep=h.thisDep||e.thisDep,h.contextDep=h.contextDep||e.contextDep,h.propDep=h.propDep||e.propDep),h}return e?new Vt(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Ua),e.def(r,".",Va)]}):null}var a=t.static,i=t.dynamic,o=n(Ia);if(o){var s=o;o=new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+Ga,r[2]),e.set(n,"."+qa,r[3]),r})}return{viewport:o,scissor_box:n(Oa)}}function w(t){function r(t){if(t in a){var r=e.id(a[t]);de.optional(function(){c.shader(Gi[t],r,de.guessCommand())});var n=qt(function(){return r});return n.id=r,n}if(t in i){var o=i[t];return Xt(o,function(e,r){var n=e.invoke(r,o),a=r.def(e.shared.strings,".id(",n,")");return de.optional(function(){r(e.shared.shader,".shader(",Gi[t],",",a,",",e.command,");")}),a})}return null}var n,a=t.static,i=t.dynamic,o=r(za),s=r(Pa),l=null;return Gt(o)&&Gt(s)?(l=c.program(s.id,o.id),n=qt(function(t,e){return t.link(l)})):n=new Vt(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",za);var a;a=s?s.append(t,e):e.def(n,".",Pa);var i=n+".program("+a+","+r;return de.optional(function(){i+=","+t.command}),e.def(i+")")}),{frag:o,vert:s,progVar:n,program:l}}function A(t,e){function r(t,r){if(t in n){var i=0|n[t];return de.command(!r||i>=0,"invalid "+t,e.commandStr),qt(function(t,e){return r&&(t.OFFSET=i),i})}if(t in a){var s=a[t];return Xt(s,function(e,n){var a=e.invoke(n,s);return r&&(e.OFFSET=a,de.optional(function(){e.assert(n,a+">=0","invalid "+t)})),a})}return r&&o?qt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,a=t.dynamic,o=function(){if(Na in n){var t=n[Na];Ht(t)?t=i.getElements(i.create(t,!0)):t&&(t=i.getElements(t),de.command(t,"invalid elements",e.commandStr));var r=qt(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Na in a){var o=a[Na];return Xt(o,function(t,e){var r=t.shared,n=r.isBufferArgs,a=r.elements,i=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",i,")"),u=t.cond(l).then(s,"=",a,".createStream(",i,");").else(s,"=",a,".getElements(",i,");");return de.optional(function(){t.assert(u.else,"!"+i+"||"+s,"invalid elements")}),e.entry(u),e.exit(t.cond(l).then(a,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(ja,!0);return{elements:o,primitive:function(){if(Fa in n){var t=n[Fa];return de.commandParameter(t,je,"invalid primitve",e.commandStr),qt(function(e,r){return je[t]})}if(Fa in a){var r=a[Fa];return Xt(r,function(t,e){var n=t.constants.primTypes,a=t.invoke(e,r);return de.optional(function(){t.assert(e,a+" in "+n,"invalid primitive, must be one of "+Object.keys(je))}),e.def(n,"[",a,"]")})}return o?Gt(o)?qt(o.value?function(t,e){return e.def(t.ELEMENTS,".primType")}:function(){return Mi}):new Vt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Mi)}):null}(),count:function(){if(Ba in n){var t=0|n[Ba];return de.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),qt(function(){return t})}if(Ba in a){var r=a[Ba];return Xt(r,function(t,e){var n=t.invoke(e,r);return de.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(Gt(o)){if(o)return s?new Vt(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return de.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):qt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var i=qt(function(){return-1});return de.optional(function(){i.MISSING=!0}),i}var l=new Vt(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return de.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Ha,!1),offset:s}}function k(t,e){var r=t.static,a=t.dynamic,i={};return et.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);i[s]=qt(function(){return o})}else if(t in a){var l=a[t];i[s]=Xt(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=g(t);switch(t){case ma:case sa:case oa:case Ma:case fa:case Ca:case xa:case wa:case Aa:case pa:return o(function(r){return de.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return de.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case ha:return o(function(r){return de.commandParameter(r,Ui,"invalid "+t,e.commandStr),Ui[r]},function(e,r,n){var a=e.constants.compareFuncs;return de.optional(function(){e.assert(r,n+" in "+a,"invalid "+t+", must be one of "+Object.keys(Ui))}),r.def(a,"[",n,"]")});case da:return o(function(t){return de.command(gt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case ca:return o(function(t){de.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,a="dstRGB"in t?t.dstRGB:t.dst,i="dstAlpha"in t?t.dstAlpha:t.dst;return de.commandParameter(r,ji,s+".srcRGB",e.commandStr),de.commandParameter(n,ji,s+".srcAlpha",e.commandStr),de.commandParameter(a,ji,s+".dstRGB",e.commandStr),de.commandParameter(i,ji,s+".dstAlpha",e.commandStr),de.command(-1===Hi.indexOf(r+", "+a),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",e.commandStr),[ji[r],ji[a],ji[n],ji[i]]},function(e,r,n){function a(a,o){var s=r.def('"',a,o,'" in ',n,"?",n,".",a,o,":",n,".",a);return de.optional(function(){e.assert(r,s+" in "+i,"invalid "+t+"."+a+o+", must be one of "+Object.keys(ji))}),s}var i=e.constants.blendFuncs;de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=a("src","RGB"),s=a("dst","RGB");de.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(i,"[",o,"]"),u=r.def(i,"[",a("src","Alpha"),"]");return[l,r.def(i,"[",s,"]"),u,r.def(i,"[",a("dst","Alpha"),"]")]});case ua:return o(function(r){return"string"==typeof r?(de.commandParameter(r,Z,"invalid "+t,e.commandStr),[Z[r],Z[r]]):"object"==typeof r?(de.commandParameter(r.rgb,Z,t+".rgb",e.commandStr),de.commandParameter(r.alpha,Z,t+".alpha",e.commandStr),[Z[r.rgb],Z[r.alpha]]):void de.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var a=e.constants.blendEquations,i=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return de.optional(function(){function r(t,r,n){e.assert(t,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(Z))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(i,"=",o,"=",a,"[",n,"];"),s.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(s),[i,o]});case la:return o(function(t){return de.command(gt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),Q(4,function(e){return+t[e]})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),Q(4,function(t){return e.def("+",r,"[",t,"]")})});case Ta:return o(function(t){return de.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Ea:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return de.commandParameter(n,Ui,t+".cmp",e.commandStr),de.commandType(a,"number",t+".ref",e.commandStr),de.commandType(i,"number",t+".mask",e.commandStr),[Ui[n],a,i]},function(t,e,r){var n=t.constants.compareFuncs;return de.optional(function(){function a(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ri),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case La:case Sa:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return de.commandParameter(n,Vi,t+".fail",e.commandStr),de.commandParameter(a,Vi,t+".zfail",e.commandStr),de.commandParameter(i,Vi,t+".zpass",e.commandStr),[t===Sa?Ei:Ti,Vi[n],Vi[a],Vi[i]]},function(e,r,n){function a(a){return de.optional(function(){e.assert(r,'!("'+a+'" in '+n+")||("+n+"."+a+" in "+i+")","invalid "+t+"."+a+", must be one of "+Object.keys(Vi))}),r.def('"',a,'" in ',n,"?",i,"[",n,".",a,"]:",Ri)}var i=e.constants.stencilOps;return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Sa?Ei:Ti,a("fail"),a("zfail"),a("zpass")]});case _a:return o(function(t){de.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return de.commandType(r,"number",s+".factor",e.commandStr),de.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case va:return o(function(t){var r=0;return"front"===t?r=Ti:"back"===t&&(r=Ei),de.command(!!r,s,e.commandStr),r},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Ti,":",Ei)});case ba:return o(function(t){return de.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case ya:return o(function(t){return de.commandParameter(t,qi,s,e.commandStr),qi[t]},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Li+":"+Si)});case ga:return o(function(t){return de.command(gt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),Q(4,function(t){return"!!"+r+"["+t+"]"})});case ka:return o(function(t){de.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return de.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return de.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),i}function M(t,e){var r=t.static,n=t.dynamic,a={};return Object.keys(r).forEach(function(t){var n,i=r[t];if("number"==typeof i||"boolean"==typeof i)n=qt(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=qt(function(t){return t.link(i)}):"framebuffer"===o||"framebufferCube"===o?(de.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=qt(function(t){return t.link(i.color[0])})):de.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else gt(i)?n=qt(function(e){return e.global.def("[",Q(i.length,function(r){return de.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+t,e.commandStr),i[r]}),"]")}):de.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=i,a[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];a[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),a}function T(t,r){var n=t.static,i=t.dynamic,o={};return Object.keys(n).forEach(function(t){var i=n[t],s=e.id(t),l=new W;if(Ht(i))l.state=Jn,l.buffer=a.getBuffer(a.create(i,Za,!1,!0)),l.type=0;else{var u=a.getBuffer(i);if(u)l.state=Jn,l.buffer=u,l.type=0;else if(de.command("object"==typeof i&&i,"invalid data for attribute "+t,r.commandStr),i.constant){var c=i.constant;l.buffer="null",l.state=ta,"number"==typeof c?l.x=c:(de.command(gt(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,r.commandStr),$n.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',r.commandStr);var h=0|i.stride;de.command(h>=0&&h<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|i.size;de.command(!("size"in i)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!i.normalized,g=0;"type"in i&&(de.commandParameter(i.type,Oe,"invalid type for attribute "+t,r.commandStr),g=Oe[i.type]);var m=0|i.divisor;"divisor"in i&&(de.command(0===m||$,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),de.command(m>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),de.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach(function(r){de.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=u,l.state=Jn,l.size=d,l.normalized=p,l.type=g||u.dtype,l.offset=f,l.stride=h,l.divisor=m}}o[t]=qt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(i).forEach(function(t){function e(e,n){function a(t){n(u[t],"=",i,".",t,"|0;")}var i=e.invoke(n,r),o=e.shared,s=o.isBufferArgs,l=o.buffer;de.optional(function(){e.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+s+"("+i+")||"+l+".getBuffer("+i+")||"+l+".getBuffer("+i+".buffer)||"+s+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+t+'"')});var u={isStream:n.def(!1)},c=new W;c.state=Jn,Object.keys(c).forEach(function(t){u[t]=n.def(""+c[t])});var f=u.buffer,h=u.type;return n("if(",s,"(",i,")){",u.isStream,"=true;",f,"=",l,".createStream(",Za,",",i,");",h,"=",f,".dtype;","}else{",f,"=",l,".getBuffer(",i,");","if(",f,"){",h,"=",f,".dtype;",'}else if("constant" in ',i,"){",u.state,"=",ta,";","if(typeof "+i+'.constant === "number"){',u[$n[0]],"=",i,".constant;",$n.slice(1).map(function(t){return u[t]}).join("="),"=0;","}else{",$n.map(function(t,e){return u[t]+"="+i+".constant.length>="+e+"?"+i+".constant["+e+"]:0;" +}).join(""),"}}else{","if(",s,"(",i,".buffer)){",f,"=",l,".createStream(",Za,",",i,".buffer);","}else{",f,"=",l,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",f,".dtype;",u.normalized,"=!!",i,".normalized;"),a("size"),a("offset"),a("stride"),a("divisor"),n("}}"),n.exit("if(",u.isStream,"){",l,".destroyStream(",f,");","}"),u}var r=i[t];o[t]=Xt(r,e)}),o}function E(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=qt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=Xt(e,function(t,r){return t.invoke(r,e)})}),n}function L(t,e,r,n,a){function i(t){var e=u[t];e&&(f[t]=e)}var o=t.static,s=t.dynamic;de.optional(function(){function t(t){Object.keys(t).forEach(function(t){de.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',a.commandStr)})}var e=[Da,Pa,za,Na,Fa,ja,Ba,Ha,Ra].concat(et);t(o),t(s)});var l=x(t,a),u=_(t,l,a),c=A(t,a),f=k(t,a),h=w(t,a);i(Ia),i(g(Oa));var d=Object.keys(f).length>0,p={framebuffer:l,draw:c,shader:h,state:f,dirty:d};return p.profile=b(t,a),p.uniforms=M(r,a),p.attributes=T(e,a),p.context=E(n,a),p}function S(t,e,r){var n=t.shared,a=n.context,i=t.scope();Object.keys(r).forEach(function(n){e.save(a,"."+n);var o=r[n];i(a,".",n,"=",o.append(t,e),";")}),e(i)}function C(t,e,r,n){var a,i=t.shared,o=i.gl,s=i.framebuffer;K&&(a=e.def(i.extensions,".webgl_draw_buffers"));var l,u=t.constants,c=u.drawBuffer,f=u.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",Fi,",",l,".framebuffer);"),K&&e(a,".drawBuffersWEBGL(",c,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",Fi,",null);"),K&&e(a,".drawBuffersWEBGL(",f,");"),e("}",s,".cur=",l,";"),n||e("}")}function O(t,e,r){var n=t.shared,a=n.gl,i=t.current,o=t.next,s=n.current,l=n.next,u=t.cond(s,".dirty");et.forEach(function(e){var n=g(e);if(!(n in r.state)){var c,f;if(n in o){c=o[n],f=i[n];var h=Q(J[n].length,function(t){return u.def(c,"[",t,"]")});u(t.cond(h.map(function(t,e){return t+"!=="+f+"["+e+"]"}).join("||")).then(a,".",nt[n],"(",h,");",h.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";"))}else{c=u.def(l,".",n);var d=t.cond(c,"!==",s,".",n);u(d),n in rt?d(t.cond(c).then(a,".enable(",rt[n],");").else(a,".disable(",rt[n],");"),s,".",n,"=",c,";"):d(a,".",nt[n],"(",c,");",s,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&u(s,".dirty=false;"),e(u)}function I(t,e,r,n){var a=t.shared,i=t.current,o=a.current,s=a.gl;Ut(Object.keys(r)).forEach(function(a){var l=r[a];if(!n||n(l)){var u=l.append(t,e);if(rt[a]){var c=rt[a];Gt(l)?u?e(s,".enable(",c,");"):e(s,".disable(",c,");"):e(t.cond(u).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(o,".",a,"=",u,";")}else if(gt(u)){var f=i[a];e(s,".",nt[a],"(",u,");",u.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";")}else e(s,".",nt[a],"(",u,");",o,".",a,"=",u,";")}})}function R(t,e){$&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function D(t,e,r,n,a){function i(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){u=e.def(),t(u,"=",i(),";"),"string"==typeof a?t(p,".count+=",a,";"):t(p,".count++;"),d&&(n?(c=e.def(),t(c,"=",m,".getNumPendingQueries();")):t(m,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",i(),"-",u,";"),d&&(n?t(m,".pushScopeStats(",c,",",m,".getNumPendingQueries(),",p,");"):t(m,".endQuery();"))}function l(t){var r=e.def(g,".profile");e(g,".profile=",t,";"),e.exit(g,".profile=",r,";")}var u,c,f,h=t.shared,p=t.stats,g=h.current,m=h.timer,v=r.profile;if(v){if(Gt(v))return void(v.enable?(o(e),s(e.exit),l("true")):l("false"));f=v.append(t,e),l(f)}else f=e.def(g,".profile");var y=t.block();o(y),e("if(",f,"){",y,"}");var b=t.block();s(b),e.exit("if(",f,"){",b,"}")}function P(t,e,r,n,a){function i(t){switch(t){case ui:case di:case vi:return 2;case ci:case pi:case yi:return 3;case fi:case gi:case bi:return 4;default:return 1}}function o(r,n,a){function i(){e("if(!",c,".buffer){",l,".enableVertexAttribArray(",u,");}");var r,i=a.type;if(r=a.size?e.def(a.size,"||",n):n,e("if(",c,".type!==",i,"||",c,".size!==",r,"||",p.map(function(t){return c+"."+t+"!=="+a[t]}).join("||"),"){",l,".bindBuffer(",Za,",",h,".buffer);",l,".vertexAttribPointer(",[u,r,i,a.normalized,a.stride,a.offset],");",c,".type=",i,";",c,".size=",r,";",p.map(function(t){return c+"."+t+"="+a[t]+";"}).join(""),"}"),$){var o=a.divisor;e("if(",c,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,o],");",c,".divisor=",o,";}")}}function o(){e("if(",c,".buffer){",l,".disableVertexAttribArray(",u,");","}if(",$n.map(function(t,e){return c+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",u,",",d,");",$n.map(function(t,e){return c+"."+t+"="+d[e]+";"}).join(""),"}")}var l=s.gl,u=e.def(r,".location"),c=e.def(s.attributes,"[",u,"]"),f=a.state,h=a.buffer,d=[a.x,a.y,a.z,a.w],p=["buffer","normalized","offset","stride"];f===Jn?i():f===ta?o():(e("if(",f,"===",Jn,"){"),i(),e("}else{"),o(),e("}"))}var s=t.shared;n.forEach(function(n){var s,l=n.name,u=r.attributes[l];if(u){if(!a(u))return;s=u.append(t,e)}else{if(!a(Xi))return;var c=t.scopeAttrib(l);de.optional(function(){t.assert(e,c+".state","missing attribute "+l)}),s={},Object.keys(new W).forEach(function(t){s[t]=e.def(c,".",t)})}o(t.link(n),i(n.info.type),s)})}function z(t,r,n,a,i){for(var o,s=t.shared,l=s.gl,u=0;u1?Q(_,function(t){return c+"["+t+"]"}):c);r(");")}}function N(t,e,r,n){function a(a){var i=c[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(t,r):i.append(t,e):e.def(u,".",a)}function i(){function t(){r(m,".drawElementsInstancedANGLE(",[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)",g],");")}function e(){r(m,".drawArraysInstancedANGLE(",[h,d,p,g],");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[h,p,v,d+"<<(("+v+"-"+Kn+")>>1)"]+");")}function e(){r(l+".drawArrays("+[h,d,p]+");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,f=function(){var a,i=c.elements,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o)):a=o.def(u,".",Na),a&&o("if("+a+")"+l+".bindBuffer("+Qa+","+a+".buffer.buffer);"),a}(),h=a(Fa),d=a(ja),p=function(){var a,i=c.count,o=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(t,o),de.optional(function(){i.MISSING&&t.assert(e,"false","missing vertex count"),i.DYNAMIC&&t.assert(o,a+">=0","missing vertex count")})):(a=o.def(u,".",Ba),de.optional(function(){t.assert(o,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var g,m;$&&(g=a(Ha),m=t.instancing);var v=f+".type",y=c.elements&&Gt(c.elements);$&&("number"!=typeof g||g>=0)?"string"==typeof g?(r("if(",g,">0){"),i(),r("}else if(",g,"<0){"),o(),r("}")):i():o()}function F(t,e,r,n,a){var i=y(),o=i.proc("body",a);return de.optional(function(){i.commandStr=e.commandStr,i.command=i.link(e.commandStr)}),$&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),t(i,o,r,n),i.compile().body}function B(t,e,r,n){R(t,e),P(t,e,r,n.attributes,function(){return!0}),z(t,e,r,n.uniforms,function(){return!0}),N(t,e,e,r)}function j(t,e){var r=t.proc("draw",1);R(t,r),S(t,r,e.context),C(t,r,e.framebuffer),O(t,r,e),I(t,r,e.state),D(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)B(t,r,e,e.shader.program);else{var a=t.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",t.link(function(r){return F(B,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function H(t,e,r,n){function a(){return!0}t.batchId="a1",R(t,e),P(t,e,r,n.attributes,a),z(t,e,r,n.uniforms,a),N(t,e,e,r)}function U(t,e,r,n){function a(t){return t.contextDep&&o||t.propDep}function i(t){return!a(t)}R(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();if(e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&S(t,c,r.context),r.needsFramebuffer&&C(t,c,r.framebuffer),I(t,c,r.state,a),r.profile&&a(r.profile)&&D(t,c,r,!1,!0),n)P(t,u,r,n.attributes,i),P(t,c,r,n.attributes,a),z(t,u,r,n.uniforms,i),z(t,c,r,n.uniforms,a),N(t,u,c,r);else{var f=t.global.def("{}"),h=r.shader.progVar.append(t,c),d=c.def(h,".id"),p=c.def(f,"[",d,"]");c(t.shared.gl,".useProgram(",h,".program);","if(!",p,"){",p,"=",f,"[",d,"]=",t.link(function(e){return F(H,t,r,e,2)}),"(",h,");}",p,".call(this,a0[",s,"],",s,");")}}function V(t,e){function r(t){return t.contextDep&&a||t.propDep}var n=t.proc("batch",2);t.batchId="0",R(t,n);var a=!1,i=!0;Object.keys(e.context).forEach(function(t){a=a||e.context[t].propDep}),a||(S(t,n,e.context),i=!1);var o=e.framebuffer,s=!1;o?(o.propDep?a=s=!0:o.contextDep&&a&&(s=!0),s||C(t,n,o)):C(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(a=!0),O(t,n,e),I(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||D(t,n,e,!1,"a1"),e.contextDep=a,e.needsContext=i,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&a||l.propDep)U(t,n,e,null);else{var u=l.append(t,n);if(n(t.shared.gl,".useProgram(",u,".program);"),e.shader.program)U(t,n,e,e.shader.program);else{var c=t.global.def("{}"),f=n.def(u,".id"),h=n.def(c,"[",f,"]");n(t.cond(h).then(h,".call(this,a0,a1);").else(h,"=",c,"[",f,"]=",t.link(function(r){return F(U,t,e,r,2)}),"(",u,");",h,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}function G(t,r){function n(e){var n=r.shader[e];n&&a.set(i.shader,"."+e,n.append(t,a))}var a=t.proc("scope",3);t.batchId="a2";var i=t.shared,o=i.current;S(t,a,r.context),r.framebuffer&&r.framebuffer.append(t,a),Ut(Object.keys(r.state)).forEach(function(e){var n=r.state[e],o=n.append(t,a);gt(o)?o.forEach(function(r,n){a.set(t.next[e],"["+n+"]",r)}):a.set(i.next,"."+e,o)}),D(t,a,r,!0,!0),[Na,ja,Ba,Ha,Fa].forEach(function(e){var n=r.draw[e];n&&a.set(i.draw,"."+e,""+n.append(t,a))}),Object.keys(r.uniforms).forEach(function(n){a.set(i.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,a))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,a),i=t.scopeAttrib(e);Object.keys(new W).forEach(function(t){a.set(i,"."+t,n[t])})}),n(Pa),n(za),Object.keys(r.state).length>0&&(a(o,".dirty=true;"),a.exit(o,".dirty=true;")),a("a1(",t.shared.context,",a0,",t.batchId,");")}function q(t){if("object"==typeof t&&!gt(t)){for(var e=Object.keys(t),r=0;r=0;--t){var r=G[t];r&&r(L,null,0)}v.flush(),k&&k.update()}function r(){!Q&&G.length>0&&(Q=ve.next(e))}function n(){Q&&(ve.cancel(e),Q=null)}function a(t){t.preventDefault(),b=!0,n(),q.forEach(function(t){t()})}function i(t){v.getError(),b=!1,x.restore(),P.restore(),I.restore(),z.restore(),N.restore(),F.restore(),k&&k.restore(),B.procs.refresh(),r(),X.forEach(function(t){t()})}function o(){G.length=0,n(),V&&(V.removeEventListener(eo,a),V.removeEventListener(ro,i)),P.clear(),F.clear(),N.clear(),z.clear(),R.clear(),I.clear(),k&&k.clear(),Z.forEach(function(t){t()})}function s(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var a=t[n];me.isDynamic(a)?r[n]=me.unbox(a,n):e[n]=a}),{dynamic:r,static:e}}function r(t){for(;d.length0)return f.call(this,r(0|t),0|t)}else{if(!Array.isArray(t))return c.call(this,t);if(t.length)return f.call(this,t,t.length)}}de(!!t,"invalid args to regl({...})"),de.type(t,"object","invalid args to regl({...})");var a=e(t.context||{}),i=e(t.uniforms||{}),o=e(t.attributes||{}),s=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=Jt({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),l={gpuTime:0,cpuTime:0,count:0},u=B.compile(s,o,i,a,l),c=u.draw,f=u.batch,h=u.scope,d=[];return Jt(n,{stats:l})}function l(t,e){var r=0;B.procs.poll();var n=e.color;n&&(v.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=$i),"depth"in e&&(v.clearDepth(+e.depth),r|=Ki),"stencil"in e&&(v.clearStencil(0|e.stencil),r|=Ji),de(!!r,"called regl.clear with no buffer specified"),v.clear(r)}function u(t){if(de("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)$(Jt({framebuffer:t.framebuffer.faces[e]},t),l);else $(t,l);else l(null,t)}function c(t){function e(){function e(){var t=Zt(G,e);G[t]=G[G.length-1],G.length-=1,G.length<=0&&n()}var r=Zt(G,t);de(r>=0,"cannot cancel a frame twice"),G[r]=e}return de.type(t,"function","regl.frame() callback must be a function"),G.push(t),r(),{cancel:e}}function f(){var t=U.viewport,e=U.scissor_box;t[0]=t[1]=e[0]=e[1]=0,L.viewportWidth=L.framebufferWidth=L.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,L.viewportHeight=L.framebufferHeight=L.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function h(){L.tick+=1,L.time=p(),f(),B.procs.poll()}function d(){f(),B.procs.refresh(),k&&k.update()}function p(){return(ye()-M)/1e3}function g(t,e){de.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return c(e);case"lost":r=q;break;case"restore":r=X;break;case"destroy":r=Z;break;default:de.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:H,destroy:o,_gl:v,_refresh:d,poll:function(){h(),k&&k.update()},now:p,stats:w});return m.onDone(null,K),K}var $t={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Kt=function(t){return Object.prototype.toString.call(t)in $t},Jt=function(t,e){for(var r=Object.keys(e),n=0;n=2,"invalid renderbuffer shape"),i=0|d[0],o=0|d[1]}else"radius"in h&&(i=o=0|h.radius),"width"in h&&(i=0|h.width),"height"in h&&(o=0|h.height);"format"in h&&(de.parameter(h.format,u,"invalid renderbuffer format"),l=u[h.format])}else"number"==typeof e?(i=0|e,o="number"==typeof n?0|n:i):e?de.raise("invalid arguments to renderbuffer constructor"):i=o=1;if(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),i!==f.width||o!==f.height||l!==f.format)return s.width=f.width=i,s.height=f.height=o,f.format=l,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,l,i,o),a.profile&&(f.stats.size=It(f.format,f.width,f.height)),s.format=c[f.format],s}function l(e,n){var i=0|e,o=0|n||i;return i===f.width&&o===f.height?s:(de(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=f.width=i,s.height=f.height=o,t.bindRenderbuffer(xn,f.renderbuffer),t.renderbufferStorage(xn,f.format,i,o),a.profile&&(f.stats.size=It(f.format,f.width,f.height)),s)}var f=new i(t.createRenderbuffer());return h[f.id]=f,n.renderbufferCount++,s(e,o),s.resize=l,s._reglType="renderbuffer",s._renderbuffer=f,a.profile&&(s.stats=f.stats),s.destroy=function(){f.decRef()},s}function l(){xe(h).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(xn,e.renderbuffer),t.renderbufferStorage(xn,e.format,e.width,e.height)}),t.bindRenderbuffer(xn,null)}var u={rgba4:_n,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(u.srgba=35907),e.ext_color_buffer_half_float&&(u.rgba16f=34842,u.rgb16f=34843),e.webgl_color_buffer_float&&(u.rgba32f=34836);var c=[];Object.keys(u).forEach(function(t){var e=u[t];c[e]=t});var f=0,h={};return i.prototype.decRef=function(){--this.refCount<=0&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(h).forEach(function(e){t+=h[e].stats.size}),t}),{create:s,clear:function(){xe(h).forEach(o)},restore:l}},kn=36160,Mn=36161,Tn=3553,En=34069,Ln=36064,Sn=36096,Cn=36128,On=33306,In=36053,Rn=6402,Dn=[6408],Pn=[];Pn[6408]=4;var zn=[];zn[5121]=1,zn[5126]=4,zn[36193]=2;var Nn=33189,Fn=36168,Bn=34041,jn=[32854,32855,36194,35907,34842,34843,34836],Hn={};Hn[In]="complete",Hn[36054]="incomplete attachment",Hn[36057]="incomplete dimensions",Hn[36055]="incomplete, missing attachment",Hn[36061]="unsupported";var Un=5126,Vn=35632,Gn=35633,qn=35718,Xn=35721,Yn=6408,Wn=5121,Zn=3333,Qn=5126,$n="xyzw".split(""),Kn=5121,Jn=1,ta=2,ea=0,ra=1,na=2,aa=3,ia=4,oa="dither",sa="blend.enable",la="blend.color",ua="blend.equation",ca="blend.func",fa="depth.enable",ha="depth.func",da="depth.range",pa="depth.mask",ga="colorMask",ma="cull.enable",va="cull.face",ya="frontFace",ba="lineWidth",xa="polygonOffset.enable",_a="polygonOffset.offset",wa="sample.alpha",Aa="sample.enable",ka="sample.coverage",Ma="stencil.enable",Ta="stencil.mask",Ea="stencil.func",La="stencil.opFront",Sa="stencil.opBack",Ca="scissor.enable",Oa="scissor.box",Ia="viewport",Ra="profile",Da="framebuffer",Pa="vert",za="frag",Na="elements",Fa="primitive",Ba="count",ja="offset",Ha="instances",Ua=Da+"Width",Va=Da+"Height",Ga=Ia+"Width",qa=Ia+"Height",Xa="drawingBufferWidth",Ya="drawingBufferHeight",Wa=[ca,ua,Ea,La,Sa,ka,Ia,Oa,_a],Za=34962,Qa=34963,$a=3553,Ka=34067,Ja=2884,ti=3042,ei=3024,ri=2960,ni=2929,ai=3089,ii=32823,oi=32926,si=32928,li=5126,ui=35664,ci=35665,fi=35666,hi=5124,di=35667,pi=35668,gi=35669,mi=35670,vi=35671,yi=35672,bi=35673,xi=35674,_i=35675,wi=35676,Ai=35678,ki=35680,Mi=4,Ti=1028,Ei=1029,Li=2304,Si=2305,Ci=32775,Oi=32776,Ii=519,Ri=7680,Di=0,Pi=1,zi=32774,Ni=513,Fi=36160,Bi=36064,ji={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771, +"one minus constant alpha":32772,"src alpha saturate":776},Hi=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Ui={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Vi={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Gi={frag:35632,vert:35633},qi={cw:Li,ccw:Si},Xi=new Vt(!1,!1,!1,function(){}),Yi=34918,Wi=34919,Zi=35007,Qi=function(t,e){function r(){return h.pop()||f.createQueryEXT()}function n(t){h.push(t)}function a(t){var e=r();f.beginQueryEXT(Zi,e),d.push(e),u(d.length-1,d.length,t)}function i(){f.endQueryEXT(Zi)}function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}function s(){return p.pop()||new o}function l(t){p.push(t)}function u(t,e,r){var n=s();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,g.push(n)}function c(){var t,e,r=d.length;if(0!==r){v.length=Math.max(v.length,r+1),m.length=Math.max(m.length,r+1),m[0]=0,v[0]=0;var a=0;for(t=0,e=0;e=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+=t,i=i.substr(0,r)}var a,i="";e.exports=n},{}],178:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n>1;return["sum(",i(t.slice(0,e)),",",i(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!0&t?"-":""}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(i<=0)return o;n=a+i}else{if(!(a<0))return o;if(i>=0)return o;n=-(a+i)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(t,e,r)},function(t,e,r,n){var a=t[0]-n[0],i=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=i*u,p=o*l,g=o*s,v=a*u,y=a*l,b=i*s,x=c*(d-p)+f*(g-v)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:m(t,e,r,n)}];!function(){for(;v.length<=p;)v.push(l(v.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");a.push("}var s=new Array(arguments.length);for(var i=0;i0&&s>0||o<0&&s<0)return!1;var l=i(r,t,e),u=i(a,t,e);return!(l>0&&u>0||l<0&&u<0)&&(0!==o||0!==s||0!==l||0!==u||n(t,e,r,a))}e.exports=a;var i=t("robust-orientation")[3]},{"robust-orientation":179}],183:[function(t,e,r){"use strict";function n(t,e){var r=t+e,n=r-t,a=r-n,i=e-n,o=t-a,s=o+i;return s?[s,r]:[r]}function a(t,e){var r=0|t.length,a=0|e.length;if(1===r&&1===a)return n(t[0],-e[0]);var i,o,s=r+a,l=new Array(s),u=0,c=0,f=0,h=Math.abs,d=t[c],p=h(d),g=-e[f],m=h(g);p=a?(i=d,(c+=1)=a?(i=d,(c+=1)0?1:0}},{}],186:[function(t,e,r){arguments[4][31][0].apply(r,arguments)},{dup:31}],187:[function(t,e,r){"use strict";"use restrict";function n(t){for(var e=0,r=Math.max,n=0,a=t.length;n>1,s=o(t[i],e);s<=0?(0===s&&(a=i),r=i+1):s>0&&(n=i-1)}return a}function f(t,e){for(var r=new Array(t.length),n=0,a=r.length;n=t.length||0!==o(t[g],i))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(a[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,a=2*(t+1),o=t;if(n0;){var r=l(t);if(r>=0){if(e0){var t=k[0];return i(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=k[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(t,e){if(t[e]<0)return e;var r=e,n=e;do{var a=t[n];if(!b[n]||a<0||a===n)break;if(n=a,a=t[n],!b[n]||a<0||a===n)break;n=a,r=t[r]}while(r!==n);for(var i=e;i!==n;i=t[i])t[i]=n;return n}for(var p=e.length,g=t.length,m=new Array(p),v=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=m[t],r=v[t];m[r]>=0&&(m[r]=e),v[e]>=0&&(v[e]=r),M[e]>=0&&h(M[e],a(e)),M[r]>=0&&h(M[r],a(r))}}(E)}for(var L=[],x=0;x=0&&r>=0&&e!==r){var n=M[e],a=M[r];n!==a&&S.push([n,a])}}),o.unique(o.normalize(S)),{positions:L,edges:S}}e.exports=a;var i=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":179,"simplicial-complex":187}],190:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]e[1][0])){var a=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?a-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],a=e[0]}var o,s;if(t[0][0]t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=i(r,a,s),u=i(r,a,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=i(s,o,a),u=i(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 a[0]-s[0]}e.exports=a;var i=t("robust-orientation")},{"robust-orientation":179}],191:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function a(t,e){return t.y-e}function i(t,e){for(var r=null;t;){var n,a,o=t.key;o[0][0]0)if(e[0]!==o[1][0])r=t,t=t.right;else{var l=i(t.right,e);if(l)return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l=i(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,a=new Array(r),i=0;i0){var s=i(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],a);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":190,"binary-search-bounds":30,"functional-red-black-tree":70,"robust-orientation":179}],192:[function(e,r,n){!function(){"use strict";function e(t){return a(i(t),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}function a(t,r){var n,a,i,s,l,u,c,f,h,d=1,p=t.length,g="";for(a=0;a=0),s[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,s[6]?parseInt(s[6]):0);break;case"e":n=s[7]?parseFloat(n).toExponential(s[7]):parseFloat(n).toExponential();break;case"f":n=s[7]?parseFloat(n).toFixed(s[7]):parseFloat(n);break;case"g":n=s[7]?String(Number(n.toPrecision(s[7]))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=s[7]?n.substring(0,s[7]):n;break;case"t":n=String(!!n),n=s[7]?n.substring(0,s[7]):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=s[7]?n.substring(0,s[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=s[7]?n.substring(0,s[7]):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}o.json.test(s[8])?g+=n:(!o.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",n=n.toString().replace(o.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(h+n).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?h+n+l:"0"===u?h+l+n:l+h+n)}return g}function i(t){if(s[t])return s[t];for(var e,r=t,n=[],a=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){a|=1;var i=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(i.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))i.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");i.push(u[1])}e[2]=i}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(e)}r=r.substring(e[0].length)}return s[t]=n}var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},s=Object.create(null);void 0!==n&&(n.sprintf=e,n.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r,"function"==typeof t&&t.amd&&t(function(){return{sprintf:e,vsprintf:r}}))}()},{}],193:[function(t,e,r){"use strict";function n(t){return t.split("").map(function(t){return t in a?a[t]:""}).join("")}e.exports=n;var a={" ":" ",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"}},{}],194:[function(t,e,r){"use strict";function n(t,e){var r=t.length,n=["'use strict';"],a="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 i=[],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),m=new Array(r),v=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(M="+"+m[x]+"*c");var T=p[x].length/y*.5,E=.5+v[x]/y*.5;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,m=-.5*h,d=0;d=0?1.2:1))}function a(t,e,r,n,a,o,s){for(var l=0;l.5?l/(2-i-o):l/(i+o),i){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 a,i,o;if(t=E(t,360),e=E(e,100),r=E(r,100),0===e)a=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;a=n(l,s,t+1/3),i=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*a,g:255*i,b:255*o}}function l(t,e,r){t=E(t,255),e=E(e,255),r=E(r,255);var n,a,i=G(t,e,r),o=V(t,e,r),s=i,l=i-o;if(a=0===i?0:l/i,i==o)n=0;else{switch(i){case t:n=(e-r)/l+(e>1)+720)%360;--e;)a.h=(a.h+i)%360,o.push(n(a));return o}function M(t,e){e=e||6;for(var r=n(t).toHsv(),a=r.h,i=r.s,o=r.v,s=[],l=1/e;e--;)s.push(n({h:a,s:i,v:o})),o=(o+l)%1;return s}function T(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){C(t)&&(t="100%");var n=O(t);return t=V(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 V(1,G(0,t))}function S(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function O(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function R(t){return t<=1&&(t=100*t+"%"),t}function D(t){return e.round(255*parseFloat(t)).toString(16)}function P(t){return S(t)/255}function z(t){return!!W.CSS_UNIT.exec(t)}function N(t){t=t.replace(B,"").replace(j,"").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:P(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:P(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+/,j=/\s+$/,H=0,U=e.round,V=e.min,G=e.max,q=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,i,o,s=this.toRgb();return t=s.r/255,r=s.g/255,n=s.b/255,a=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),i=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*a+.7152*i+.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),r=U(100*t.s),n=U(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=o(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=o(this._r,this._g,this._b),e=U(360*t.h),r=U(100*t.s),n=U(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return c(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(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*E(this._r,255))+"%",g:U(100*E(this._g,255))+"%",b:U(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+U(100*E(this._r,255))+"%, "+U(100*E(this._g,255))+"%, "+U(100*E(this._b,255))+"%)":"rgba("+U(100*E(this._r,255))+"%, "+U(100*E(this._g,255))+"%, "+U(100*E(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,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);r="#"+h(i._r,i._g,i._b,i._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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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 a in t)t.hasOwnProperty(a)&&(r[a]="a"===a?t[a]:R(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:q(),g:q(),b:q()})},n.mix=function(t,e,r){r=0===r?0:r||50;var a=n(t).toRgb(),i=n(e).toRgb(),o=r/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var a=n(t),i=n(r);return(e.max(a.getLuminance(),i.getLuminance())+.05)/(e.min(a.getLuminance(),i.getLuminance())+.05)},n.isReadable=function(t,e,r){var a,i,o=n.readability(t,e);switch(i=!1,a=F(r),a.level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,e,r){var a,i,o,s,l=null,u=0;r=r||{},i=r.includeFallbackColors,o=r.level,s=r.size;for(var c=0;cu&&(u=a,l=n(e[c]));return n.isReadable(t,l,{level:o,size:s})||!i?l:(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"},Y=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],198:[function(t,e,r){"use strict";function n(t,e){var r=o(getComputedStyle(t).getPropertyValue(e));return r[0]*i(r[1],t)}function a(t,e){var r=document.createElement("div");r.style["font-size"]="128"+t,e.appendChild(r);var a=n(r,"font-size")/128;return e.removeChild(r),a}function i(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 a(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=i;var s=96},{"parse-unit":164}],199:[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 m(t){return new DataView(o(t),0,t)}function v(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=i,r.freeArrayBuffer=a,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 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=f,r.mallocInt32=h,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,A[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":31,buffer:40,dup:64}],203:[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 i=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":58}],212:[function(t,e,r){"use strict";function n(t,e){var r=[];return e=+e||0,a(t.hi(t.shape[0]-1),r,e),r}e.exports=n;var a=t("./lib/zc-core")},{"./lib/zc-core":211}],213:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,o,r,a)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;i(t,e,r,u);for(var h=e.showarrow,d=["x","y"],p=[-10,-30],g={_fullLayout:r},m=0;m<2;m++){var v=d[m],y=a.coerceRef(t,e,g,v,"","paper");if(a.coercePosition(e,g,u,y,v,.5),h){var b="a"+v,x=a.coerceRef(t,e,g,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[m]:.4;a.coercePosition(e,g,u,x,b,_)}u(v+"anchor"),u(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=u("xclick"),A=u("yclick");e._xclick=void 0===w?e.x:a.cleanPosition(w,g,e.xref),e._yclick=void 0===A?e.y:a.cleanPosition(A,g,e.yref)}return e}},{"../../lib":346,"../../plots/cartesian/axes":384,"./attributes":215,"./common_defaults":218}],214:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],215:[function(t,e,r){"use strict";var n=t("./arrow_paths"),a=t("../../plots/font_attributes"),i=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({},a,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},ax:{valType:"any"},ay:{valType:"any"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()]},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()]},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()]},x:{valType:"any"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},a,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":340,"../../plots/cartesian/constants":389,"../../plots/font_attributes":408,"./arrow_paths":214}],216:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;a.filterVisible(e.annotations).forEach(function(e){var r,n,a=i.getFromId(t,e.xref),o=i.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;a&&a.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(i.expand(a,[a.r2c(e.x)],{ppadplus:r,ppadminus:n}),i.expand(a,[a.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):i.expand(a,[a.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(i.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),i.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):i.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=!0,s[t.yref]=!0});if(i.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return a.syncOrAsync([o,n],t)}}},{"../../lib":346,"../../plots/cartesian/axes":384,"./draw":221}],217:[function(t,e,r){"use strict";function n(t,e){var r=i(t,e);return r.on.length>0||r.explicitOff.length>0}function a(t,e){var r,n=i(t,e),a=n.on,o=n.off.concat(n.explicitOff),l={};if(a.length||o.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var s=z.selectAll("a");if(1===s.size()&&s.text()===z.text()){L.insert("a",":first-child").attr({"xlink:xlink:href":s.attr("xlink:href"),"xlink:xlink:show":s.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(I.node())}var u=L.select(".annotation-text-math-group"),f=!u.empty(),p=d.bBox((f?u:z).node()),b=p.width,C=p.height,P=e.width||b,N=e.height||C,F=Math.round(P+2*O),B=Math.round(N+2*O);e._w=P,e._h=N;for(var j=!1,H=["x","y"],U=0;U1)&&(Q===Z?((it=$.r2fraction(e["a"+W]))<0||it>1)&&(j=!0):j=!0,j))continue;V=$._offset+$.r2p(e[W]),X=.5}else"x"===W?(q=e[W],V=w.l+w.w*q):(q=1-e[W],V=w.t+w.h*q),X=e.showarrow?.5:q;if(e.showarrow){at.head=V;var ot=e["a"+W];Y=J*r(.5,e.xanchor)-tt*r(.5,e.yanchor),Q===Z?(at.tail=$._offset+$.r2p(ot),G=Y):(at.tail=V+ot,G=Y+ot),at.text=at.tail+Y;var st=_["x"===W?"width":"height"];if("paper"===Z&&(at.head=c.constrain(at.head,1,st-1)),"pixel"===Q){var lt=-Math.max(at.tail-3,at.text),ut=Math.min(at.tail+3,at.text)-st;lt>0?(at.tail+=lt,at.text+=lt):ut>0&&(at.tail-=ut,at.text-=ut)}at.tail+=nt,at.head+=nt}else Y=et*r(X,rt),G=Y,at.text=V+Y;at.text+=nt,Y+=nt,G+=nt,e["_"+W+"padplus"]=et/2+G,e["_"+W+"padminus"]=et/2-G,e["_"+W+"size"]=et,e["_"+W+"shift"]=Y}if(j)return void L.remove();var ct=0,ft=0;if("left"!==e.align&&(ct=(P-b)*("center"===e.align?.5:1)), +"top"!==e.valign&&(ft=(N-C)*("middle"===e.valign?.5:1)),f)u.select("svg").attr({x:O+ct-1,y:O+ft}).call(d.setClipUrl,R?A:null);else{var ht=O+ft-p.top,dt=O+ct-p.left;z.call(g.positionText,dt,ht).call(d.setClipUrl,R?A:null)}D.select("rect").call(d.setRect,O,O,P,N),I.call(d.setRect,S/2,S/2,F-S,B-S),L.call(d.setTranslate,Math.round(k.x.text-F/2),Math.round(k.y.text-B/2)),E.attr({transform:"rotate("+M+","+k.x.text+","+k.y.text+")"});var pt=function(r,s){T.selectAll(".annotation-arrow-g").remove();var u=k.x.head,f=k.y.head,p=k.x.tail+r,g=k.y.tail+s,m=k.x.text+r,b=k.y.text+s,_=c.rotationXYMatrix(M,m,b),A=c.apply2DTransform(_),S=c.apply2DTransform2(_),C=+I.attr("width"),O=+I.attr("height"),R=m-.5*C,D=R+C,P=b-.5*O,z=P+O,N=[[R,P,R,z],[R,z,D,z],[D,z,D,P],[D,P,R,P]].map(S);if(!N.reduce(function(t,e){return t^!!o(u,f,u+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){N.forEach(function(t){var e=o(p,g,u,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,g=e.y)});var F=e.arrowwidth,B=e.arrowcolor,j=T.append("g").style({opacity:h.opacity(B)}).classed("annotation-arrow-g",!0),H=j.append("path").attr("d","M"+p+","+g+"L"+u+","+f).style("stroke-width",F+"px").call(h.stroke,h.rgb(B));if(y(H,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&H.node().parentNode&&!n){var U=u,V=f;if(e.standoff){var G=Math.sqrt(Math.pow(u-p,2)+Math.pow(f-g,2));U+=e.standoff*(p-u)/G,V+=e.standoff*(g-f)/G}var q,X,Y,W=j.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-U)+","+(g-V),transform:"translate("+U+","+V+")"}).style("stroke-width",F+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");v.init({element:W.node(),gd:t,prepFn:function(){var t=d.getTranslate(L);X=t.x,Y=t.y,q={},a&&a.autorange&&(q[a._name+".autorange"]=!0),i&&i.autorange&&(q[i._name+".autorange"]=!0)},moveFn:function(t,r){var n=A(X,Y),o=n[0]+t,s=n[1]+r;L.call(d.setTranslate,o,s),q[x+".x"]=a?a.p2r(a.r2p(e.x)+t):e.x+t/w.w,q[x+".y"]=i?i.p2r(i.r2p(e.y)+r):e.y-r/w.h,e.axref===e.xref&&(q[x+".ax"]=a.p2r(a.r2p(e.ax)+t)),e.ayref===e.yref&&(q[x+".ay"]=i.p2r(i.r2p(e.ay)+r)),j.attr("transform","translate("+t+","+r+")"),E.attr({transform:"rotate("+M+","+o+","+s+")"})},doneFn:function(e){if(e){l.relayout(t,q);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var gt,mt;v.init({element:L.node(),gd:t,prepFn:function(){mt=E.attr("transform"),gt={}},moveFn:function(t,r){var o="pointer";if(e.showarrow)e.axref===e.xref?gt[x+".ax"]=a.p2r(a.r2p(e.ax)+t):gt[x+".ax"]=e.ax+t,e.ayref===e.yref?gt[x+".ay"]=i.p2r(i.r2p(e.ay)+r):gt[x+".ay"]=e.ay+r,pt(t,r);else{if(n)return;if(a)gt[x+".x"]=e.x+t/a._m;else{var s=e._xsize/w.w,l=e.x+(e._xshift-e.xshift)/w.w-s/2;gt[x+".x"]=v.align(l+t/w.w,s,0,1,e.xanchor)}if(i)gt[x+".y"]=e.y+r/i._m;else{var u=e._ysize/w.h,c=e.y-(e._yshift+e.yshift)/w.h-u/2;gt[x+".y"]=v.align(c-r/w.h,u,0,1,e.yanchor)}a&&i||(o=v.getCursor(a?.5:gt[x+".x"],i?.5:gt[x+".y"],e.xanchor,e.yanchor))}E.attr({transform:"translate("+t+","+r+")"+mt}),m(L,o)},doneFn:function(e){if(m(L),e){l.relayout(t,gt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x,_=t._fullLayout,w=t._fullLayout._size;n?(b="annotation-"+n,x=n+".annotations["+r+"]"):(b="annotation",x="annotations["+r+"]"),_._infolayer.selectAll("."+b+'[data-index="'+r+'"]').remove();var A="clip"+_._uid+"_ann"+r;if(!e._input||!1===e.visible)return void s.selectAll("#"+A).remove();var k={x:{},y:{}},M=+e.textangle||0,T=_._infolayer.append("g").classed(b,!0).attr("data-index",String(r)).style("opacity",e.opacity),E=T.append("g").classed("annotation-text-g",!0),L=E.append("g").style("pointer-events",e.captureevents?"all":null).call(m,"default").on("click",function(){t._dragging=!1;var a={index:r,annotation:e._input,fullAnnotation:e,event:s.event};n&&(a.subplotId=n),t.emit("plotly_clickannotation",a)});e.hovertext&&L.on("mouseover",function(){var r=e.hoverlabel,n=r.font,a=this.getBoundingClientRect(),i=t.getBoundingClientRect();p.loneHover({x0:a.left-i.left,x1:a.right-i.left,y:(a.top+a.bottom)/2-i.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var S=e.borderwidth,C=e.borderpad,O=S+C,I=L.append("rect").attr("class","bg").style("stroke-width",S+"px").call(h.stroke,e.bordercolor).call(h.fill,e.bgcolor),R=e.width||e.height,D=_._defs.select(".clips").selectAll("#"+A).data(R?[0]:[]);D.enter().append("clipPath").classed("annclip",!0).attr("id",A).append("rect"),D.exit().remove();var P=e.font,z=L.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?z.call(g.makeEditable,{delegate:L,gd:t}).call(u).on("edit",function(r){e.text=r,this.call(u);var n={};n[x+".text"]=e.text,a&&a.autorange&&(n[a._name+".autorange"]=!0),i&&i.autorange&&(n[i._name+".autorange"]=!0),l.relayout(t,n)}):z.call(u)}function o(t,e,r,n,a,i,o,s){var l=r-t,u=a-t,c=o-a,f=n-e,h=i-e,d=s-i,p=l*d-c*f;if(0===p)return null;var g=(u*d-c*h)/p,m=(u*f-l*h)/p;return m<0||m>1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}var s=t("d3"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../fx"),g=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),v=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:n,drawOne:a,drawRaw:i}},{"../../lib":346,"../../lib/setcursor":361,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/cartesian/axes":384,"../../plots/plots":417,"../color":230,"../dragelement":251,"../drawing":254,"../fx":271,"./draw_arrow_head":222,d3:62}],222:[function(t,e,r){"use strict";var n=t("d3"),a=t("fast-isnumeric"),i=t("../color"),o=t("../drawing"),s=t("./arrow_paths");e.exports=function(t,e,r,l,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,a){d.path&&(e>5&&(a=0),n.select(h.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*a/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}a(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,m,v,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||i.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,A=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-g.x,M=p.y-g.y;if(m=Math.atan2(M,k),v=m+Math.PI,A){if(A*A>k*k+M*M)return void c();var T=A*Math.cos(m),E=A*Math.sin(m);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var L=h.getTotalLength(),S="";if(L1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=a(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":414,"../annotations/draw":221}],228:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":224,"./convert":225,"./defaults":226,"./draw":227}],229:[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},{}],230:[function(t,e,r){"use strict";function n(t){if(i(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 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 a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}var a=t("tinycolor2"),i=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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(a(t))},o.opacity=function(t){return t?a(t).getAlpha():0},o.addOpacity=function(t,e){var r=a(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=a(t).toRgb();if(1===r.a)return a(t).toRgbString();var n=a(e||u).toRgb(),i=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},o={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return a(o).toRgbString()},o.contrast=function(t,e,r){var n=a(t);return 1!==n.getAlpha()&&(n=a(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).toString()},o.stroke=function(t,e){var r=a(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=a(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,a,i,s=Object.keys(t);for(e=0;es&&(i[1]-=(ut-s)/2):r.node()&&!r.classed("js-placeholder")&&(ut=d.bBox(r.node()).height),ut){if(ut+=5,"top"===A.titleside)et.domain[1]-=ut/L.h,i[1]*=-1;else{et.domain[0]+=ut/L.h;var u=m.lineCount(r);i[1]+=(1-u)*s}e.attr("transform","translate("+i+")"),et.setScale()}}st.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(L.h*(1-et.domain[1]))+")");var f=st.select(".cbfills").selectAll("rect.cbfill").data(I);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?C[0]:(I[e]+I[e-1])/2,e===I.length-1?C[1]:(I[e]+I[e+1])/2].map(et.c2p).map(Math.round);e!==I.length-1&&(r[1]+=r[1]>r[0]?1:-1);var i=D(t).replace("e-",""),o=a(i).toHexString();n.select(this).attr({x:Z,width:Math.max(U,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=st.select(".cblines").selectAll("path.cbline").data(A.line.color&&A.line.width?O:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Z+","+(Math.round(et.c2p(t))+A.line.width/2%1)+"h"+U).call(d.lineGroupStyle,A.line.width,R(t),A.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=Z+U+(A.outlinewidth||0)/2-("outside"===A.ticks?1:0),et.side="right",c.syncOrAsync([function(){return l.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(A.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,a=L.l+(et.position||0)*L.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));M("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:A.titleside,offsetLeft:L.l,offsetTop:L.t,maxShift:E.width},attributes:{x:a,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,a=w();n=s.traceIs(a,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var i={propContainer:et,propName:n,traceIndex:a.index,dfltName:"colorscale",containerGroup:st.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;st.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(i,r||{}))}function T(){var r=U+A.outlinewidth/2+d.bBox(et._axislayer.node()).width;if(B=lt.select("text"),B.node()&&!B.classed("js-placeholder")){var n,a=lt.select(".h"+et._id+"title-math-group").node();n=a&&-1!==["top","bottom"].indexOf(A.titleside)?d.bBox(a).width:d.bBox(lt.node()).right-Z-L.l,r=Math.max(r,n)}var i=2*A.xpad+r+A.borderwidth+A.outlinewidth/2,s=K-J;st.select(".cbbg").attr({x:Z-A.xpad-(A.borderwidth+A.outlinewidth)/2,y:J-Y,width:Math.max(i,2),height:Math.max(s+2*Y,2)}).call(p.fill,A.bgcolor).call(p.stroke,A.bordercolor).style({"stroke-width":A.borderwidth}),st.selectAll(".cboutline").attr({x:Z,y:J+A.ypad+("top"===A.titleside?ut:0),width:Math.max(U,2),height:Math.max(s-2*A.ypad-ut,2)}).call(p.stroke,A.outlinecolor).style({fill:"None","stroke-width":A.outlinewidth});var l=({center:.5,right:1}[A.xanchor]||0)*i;st.attr("transform","translate("+(L.l-l)+","+L.t+")"),o.autoMargin(t,e,{x:A.x,y:A.y,l:i*({right:1,center:.5}[A.xanchor]||0),r:i*({left:1,center:.5}[A.xanchor]||0),t:s*({bottom:1,middle:.5}[A.yanchor]||0),b:s*({top:1,middle:.5}[A.yanchor]||0)})}var E=t._fullLayout,L=E._size;if("function"!=typeof A.fillcolor&&"function"!=typeof A.line.color)return void E._infolayer.selectAll("g."+e).remove();var S,C=n.extent(("function"==typeof A.fillcolor?A.fillcolor:A.line.color).domain()),O=[],I=[],R="function"==typeof A.line.color?A.line.color:function(){return A.line.color},D="function"==typeof A.fillcolor?A.fillcolor:function(){return A.fillcolor},P=A.levels.end+A.levels.size/100,z=A.levels.size,N=1.001*C[0]-.001*C[1],F=1.001*C[1]-.001*C[0];for(S=A.levels.start;(S-P)*z<0;S+=z)S>N&&SC[0]&&S1){var ot=Math.pow(10,Math.floor(Math.log(it)/Math.LN10));nt*=ot*c.roundUp(it/ot,[2,5,10]),(Math.abs(A.levels.start)/A.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[$+W,$+q-W],et.setScale();var st=E._infolayer.selectAll("g."+e).data([0]);st.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)}),st.attr("transform","translate("+Math.round(L.l)+","+Math.round(L.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(L.l)+",-"+Math.round(L.t)+")");et._axislayer=st.select(".cbaxis");var ut=0;if(-1!==["top","bottom"].indexOf(A.titleside)){var ct,ft=L.l+(A.x+X)*L.w,ht=et.titlefont.size;ct="top"===A.titleside?(1-($+q-W))*L.h+L.t+3+.75*ht:(1-($+W))*L.h+L.t-3-.25*ht,M(et._id+"title",{attributes:{x:ft,y:ct,"text-anchor":"start"}})}var dt=c.syncOrAsync([o.previousPromises,k,o.previousPromises,T],t);if(dt&&dt.then&&(t._promises||[]).push(dt),t._context.editable){var pt,gt,mt;u.init({element:st.node(),gd:t,prepFn:function(){pt=st.attr("transform"),h(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),gt=u.align(Q+t/L.w,V,0,1,A.xanchor),mt=u.align($-e/L.h,q,0,1,A.yanchor);var r=u.getCursor(gt,mt,A.xanchor,A.yanchor);h(st,r)},doneFn:function(e){h(st),e&&void 0!==gt&&void 0!==mt&&i.restyle(t,{"colorbar.x":gt,"colorbar.y":mt},w().index)}})}return dt}function w(){var r,n,a=e.substr(2);for(r=0;r=0?a.Reds:a.Blues,l.colorscale=g,s.reversescale&&(g=i(g)),s.colorscale=g)}},{"../../lib":346,"./flip_scale":241,"./scales":248}],237:[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":340,"./attributes":235,"./scales.js":248}],238:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":248}],239:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=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?a.nestedProperty(t,d).get()||{}:t,g=f?a.nestedProperty(e,d).get()||{}:e,m=p[h+"min"],v=p[h+"max"],y=p.colorscale;u(f+h+"auto",!(n(m)&&n(v)&&m=0;a--,i++)e=t[a],n[i]=[1-e[0],e[1]];return n}},{}],242:[function(t,e,r){"use strict";var n=t("./scales"),a=t("./default_scale"),i=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()),i(t)?t:e):e}},{"./default_scale":238,"./is_valid_scale_array":246,"./scales":248}],243:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("./is_valid_scale");e.exports=function(t,e){var r=e?a.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(Array.isArray(o))for(var l=0;l4/3-s?o:s}},{}],250:[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,i){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===i?0:"middle"===i?1:"top"===i?2:n.constrain(Math.floor(3*e),0,2),a[e][t]}},{"../../lib":346}],251:[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&&i.plot(t)}var i=t("../../plotly"),o=t("../../lib"),s=t("../../plots/cartesian/constants"),l=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return g._dragged=!1,g._dragging=!0,c=e.clientX,f=e.clientY,p=e.target,h=(new Date).getTime(),h-g._mouseDownTimev&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(g._dragged,m,e),!g._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return a(g),g._dragged=!1,o.pauseEvent(e)}var c,f,h,d,p,g=t.gd,m=1,v=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=n},{"../../constants/interactions":329,"../../lib":346,"../../plotly":379,"../../plots/cartesian/constants":389,"./align":249,"./cursor":250,"./unhover":252}],252:[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,a=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&a&&t.emit("plotly_unhover",{event:e,points:a}))}},{"../../lib/events":339}],253:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],254:[function(t,e,r){"use strict";function n(t,e,r,n,a,i,o,s){if(u.traceIs(r,"symbols")){var l=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===i.size?3:v.isBubble(r)?l(t.ms):(i.size||6)/2,t.mrc=e;var n=b.symbolNumber(t.mx||i.symbol)||0,a=n%100;return t.om=n%200>=100,b.symbolFuncs[a](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||i.opacity+1)-1})}var f,h,d,p=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=i.outliercolor):(d=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(o.color)?c.defaultLine:o.color,Array.isArray(i.color)&&(f=c.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):i.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var g=i.gradient,m=t.mgt;if(m?p=!0:m=g&&g.type,m&&"none"!==m){var x=t.mgc;x?p=!0:x=g.color;var _="g"+s._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(b.gradient,s,_,m,f,x)}else e.call(c.fill,f);d&&e.call(c.stroke,h)}}function a(t,e,r,n){var a=t[0]-e[0],i=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(a*a+i*i,T/2),c=Math.pow(s*s+l*l,T/2),f=(c*c*a-u*u*s)*n,h=(c*c*i-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[o.round(e[0]+(d&&f/d),2),o.round(e[1]+(d&&h/d),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&h/p),2)]]}function i(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var o=t("d3"),s=t("fast-isnumeric"),l=t("tinycolor2"),u=t("../../registry"),c=t("../color"),f=t("../colorscale"),h=t("../../lib"),d=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),m=g.LINE_SPACING,v=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),b=e.exports={};b.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(c.fill,n)},b.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},b.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},b.setRect=function(t,e,r,n,a){t.call(b.setPosition,e,r).call(b.setSize,n,a)},b.translatePoint=function(t,e,r,n){var a=t.xp||r.c2p(t.x),i=t.yp||n.c2p(t.y);return!!(s(a)&&s(i)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",i):e.attr("transform","translate("+a+","+i+")"),!0)},b.translatePoints=function(t,e,r,n){t.each(function(t){var a=o.select(this);b.translatePoint(t,a,e,r,n)})},b.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},b.crispRound=function(t,e,r){return e&&s(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},b.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,s=a||i.dash||"";c.stroke(e,n||i.color),b.dashLine(e,s,o)},b.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},i=e||a.width||0,s=n||a.dash||"";o.select(this).call(c.stroke,r||a.color).call(b.dashLine,s,i)})},b.dashLine=function(t,e,r){r=+r||0,e=b.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},b.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},b.singleFillStyle=function(t){var e=o.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(c.fill,n)},b.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){h.error(e,t),r.remove()}})};var x=t("./symbol_defs");b.symbolNames=[],b.symbolFuncs=[],b.symbolNeedLines={},b.symbolNoDot={},b.symbolList=[],Object.keys(x).forEach(function(t){var e=x[t];b.symbolList=b.symbolList.concat([e.n,t,e.n+100,t+"-open"]),b.symbolNames[e.n]=t,b.symbolFuncs[e.n]=e.f,e.needLine&&(b.symbolNeedLines[e.n]=!0),e.noDot?b.symbolNoDot[e.n]=!0:b.symbolList=b.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=b.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";b.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=b.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var A={x1:1,x2:0,y1:0,y2:0},k={x1:0,x2:0,y1:1,y2:0};b.gradient=function(t,e,r,n,a,i){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+a+i],h.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(A):"vertical"===n&&t.attr(k),t.attr("id",r);var e=l(a),s=l(i);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},b.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},b.singlePointStyle=function(t,e,r,a,i,o){var s=r.marker;n(t,e,r,a,i,s,s.line,o)},b.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,a=b.tryColorscale(n,""),i=b.tryColorscale(n,"line");t.each(function(t){b.singlePointStyle(t,o.select(this),e,a,i,r)})}},b.tryColorscale=function(t,e){var r=e?h.nestedProperty(t,e).get():t,n=r.colorscale,a=r.color;return n&&Array.isArray(a)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):h.identity};var M={start:1,end:-1,middle:0,bottom:1,top:-1};b.textPointStyle=function(t,e,r){t.each(function(t){var n=o.select(this),a=t.tx||e.text;if(!a||Array.isArray(a))return void n.remove();var i=t.tp||e.textposition,l=-1!==i.indexOf("top")?"top":-1!==i.indexOf("bottom")?"bottom":"middle",u=-1!==i.indexOf("left")?"end":-1!==i.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=s(c)&&c>0?c:0,n.call(b.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",u).text(a).call(d.convertToTspans,r);var h=o.select(this.parentNode),p=(d.lineCount(n)-1)*m+1,g=M[u]*f,v=.75*c+M[l]*f+(M[l]-1)*p*c/2;h.attr("transform","translate("+g+","+v+")")})};var T=.5;b.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(b.savedBBoxes={},S=0),e&&(b.savedBBoxes[e]=m),S++,h.extendFlat({},m)},b.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},b.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}},b.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";return e=e||0,r=r||0,o=o.replace(n,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[i]("transform",o),o},b.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}},b.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";return e=e||1,r=r||1,o=o.replace(n,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[i]("transform",o),o},b.setPointGroupScale=function(t,e,r){var n,a,i;return e=e||1,r=r||1,a=1===e&&1===r?"":" scale("+e+","+r+")",i=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(i,""),n+=a,n=n.trim(),this.setAttribute("transform",n)}),a};var C=/translate\([^)]*\)\s*$/;b.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),a=n.select("text"),i=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(n.attr("transform")||"").match(C);t=1===e&&1===r?[]:["translate("+i+","+s+")","scale("+e+","+r+")","translate("+-i+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":326,"../../constants/xmlns_namespaces":332,"../../lib":346,"../../lib/svg_text_utils":365,"../../registry":424,"../../traces/scatter/make_bubble_size_func":494,"../../traces/scatter/subtypes":499,"../color":230,"../colorscale":244,"./symbol_defs":255,d3:62,"fast-isnumeric":68,tinycolor2:197}],255:[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,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),a=n.round(-t,2),i=n.round(-.309*t,2);return"M"+e+","+i+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.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),i=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+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),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),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),a=n.round(1.6*t,2),i=n.round(4*t,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(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:62}],256:[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"}}}},{}],257:[function(t,e,r){"use strict";function n(t,e,r,n){var i=e["error_"+n]||{},l=i.visible&&-1!==["linear","log"].indexOf(r.type),u=[];if(l){for(var c=s(i),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=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);c&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),g.each(function(t){var e=a.select(this),o=n(t,l,u);if(!p||t.vis){var f;if(d.visible&&i(o.x)&&i(o.yh)&&i(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 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",f)}if(h.visible&&i(o.y)&&i(o.xh)&&i(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(r.duration).ease(r.easing)),y.attr("d",f)}}})}})}},{"../../traces/scatter/subtypes":499,d3:62,"fast-isnumeric":68}],262:[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||{},i=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color),i.copy_ystyle&&(i=r),o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)})}},{"../color":230,d3:62}],263:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},a.family,{arrayOk:!0}),size:n({},a.size,{arrayOk:!0}),color:n({},a.color,{arrayOk:!0})}}}},{"../../lib/extend":340,"../../plots/font_attributes":408}],264:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||a.identity,Array.isArray(t)&&(e[0][r]=n(t))}var a=t("../../lib"),i=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,o=0;o=0&&r.indexK.width||Q<0||Q>K.height)return b.unhoverRaw(t,e)}if(D="xval"in e?w.flat(h,e.xval):w.p2c(E,Z),P="yval"in e?w.flat(h,e.yval):w.p2c(L,Q),!f(D[0])||!f(P[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var J=1/0;for(N=0;NX&&(Y.splice(0,X),J=Y[0].distance)}if(0===Y.length)return b.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var at=t._hoverdata,it=[];for(z=0;z1,ut=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ct={hovermode:R,rotateLabels:lt,bgColor:ut,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=a(Y,ct,t);if(i(Y,lt?"xa":"ya"),o(ft,lt),e.target&&e.target.tagName){var ht=_.getComponentMethod("annotations","hasClickToShow")(t,it);m(c.select(e.target),ht?"pointer":"")}e.target&&!n&&u(t,e,at)&&(at&&t.emit("plotly_unhover",{event:e,points:at}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:E,yaxes:L,xvals:D,yvals:P}))}function a(t,e,r){var n,a,i=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||A.HOVERFONT,d=e.fontSize||A.HOVERFONTSIZE,p=t[0],m=p.xa,b=p.ya,x="y"===i?"yLabel":"xLabel",_=p[x],w=(String(_)||"").split(" ")[0],M=u.node().getBoundingClientRect(),T=M.top,E=M.width,L=M.height,O=p.distance<=A.MAXDIST&&("x"===i||"y"===i);for(n=0;n15&&(n=n.substr(0,12)+"...")),void 0!==t.extraText&&(a+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(a+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(a+="y: "+t.yLabel+"
"),a+=(a?"z: ":"")+t.zLabel):O&&t[i+"Label"]===_?a=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(a=t.yLabel):a=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(a+=(a?"
":"")+t.text),""===a&&(""===n&&e.remove(),a=n);var p=e.select("text.nums").call(v.font,t.fontFamily||h,t.fontSize||d,t.fontColor||f).text(a).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),m=e.select("text.name"),b=0;n&&n!==a?(m.call(v.font,t.fontFamily||h,t.fontSize||d,u).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),b=m.node().getBoundingClientRect().width+2*C):(m.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var x,w,A=p.node().getBoundingClientRect(),M=t.xa._offset+(t.x0+t.x1)/2,I=t.ya._offset+(t.y0+t.y1)/2,R=Math.abs(t.x1-t.x0),D=Math.abs(t.y1-t.y0),P=A.width+S+C+b;t.ty0=T-A.top,t.bx=A.width+2*C,t.by=A.height+2*C,t.anchor="start",t.txwidth=A.width,t.tx2width=b,t.offset=0,o?(t.pos=M,x=I+D/2+P<=L,w=I-D/2-P>=0,"top"!==t.idealAlign&&x||!w?x?(I+=D/2,t.anchor="start"):t.anchor="middle":(I-=D/2,t.anchor="end")):(t.pos=I,x=M+R/2+P<=E,w=M-R/2-P>=0,"left"!==t.idealAlign&&x||!w?x?(M+=R/2,t.anchor="start"):t.anchor="middle":(M-=R/2,t.anchor="end")),p.attr("text-anchor",t.anchor),b&&m.attr("text-anchor",t.anchor),e.attr("transform","translate("+M+","+I+")"+(o?"rotate("+k+")":""))}),D}function i(t,e){function r(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,i=r.pos+r.dp+r.size-e.pmax,a>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=a;n=!1}if(!(i<.01)){if(a<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=i;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-=i;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,a,i,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)?T: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+=a;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(i=u/h.length,s=h.length-1;s>=0;s--)h[s].dp-=i;n=!1}else o++}f.forEach(r)}for(o=f.length-1;o>=0;o--){var m=f[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 o(t,e){t.each(function(t){var r=c.select(this);if(t.del)return void r.remove();var n="end"===t.anchor?-1:1,a=r.select("text.nums"),i={start:1,end:-1,middle:0}[t.anchor],o=i*(S+C),s=o+i*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-L,l=t.offset*E),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*S+l)+","+(S+u)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+l)+"V"+(u-S)+"Z"),a.call(g.positionText,o+l,u+t.ty0-t.by/2+C),t.tx2width&&(r.select("text.name").call(g.positionText,s+i*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(v.setRect,s+(i-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(i[r])s=i[r];else if(a[r]){var l=a[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},a=t.cd[0],i=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r=e.hovermode,n=e.container,a=t[0],i=a.xa,o=a.ya,s=i.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=i._offset+(a.x0+a.x1)/2,f=o._offset+(a.y0+a.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(a.color,d)<1.5?y.contrast(d):a.color;if(l){var g=o.spikemode,m=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber))return!0}return!1}var c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),m=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),A=t("./constants"),k=A.YANGLE,M=Math.PI*k/180,T=1/Math.sin(M),E=Math.cos(M),L=Math.sin(M),S=A.HOVERARROWSIZE,C=A.HOVERTEXTPAD;r.hover=function(t,e,r,a){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+A.HOVERMINTIME)return n(t,e,r,a),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,a),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},A.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),i=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:i},l=a([r],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":346,"../../lib/events":339,"../../lib/override_cursor":355,"../../lib/svg_text_utils":365,"../../plots/cartesian/axes":384,"../../registry":424,"../color":230,"../dragelement":251,"../drawing":254,"./constants":266,"./helpers":268,d3:62,"fast-isnumeric":68,tinycolor2:197}],270:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,a){a=a||{},r("hoverlabel.bgcolor",a.bgcolor),r("hoverlabel.bordercolor",a.bordercolor),n.coerceFont(r,"hoverlabel.font",a.font)}},{"../../lib":346}],271:[function(t,e,r){"use strict";function n(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function a(t,e,r){return s.castOption(t,e,"hoverlabel."+r)}function i(t,e,r){function n(r){return s.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return s.castOption(t,r,"hoverinfo",n)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:a,castHoverinfo:i,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":346,"../dragelement":251,"./attributes":263,"./calc":264,"./click":265,"./constants":266,"./defaults":267,"./helpers":268,"./hover":269,"./layout_attributes":272,"./layout_defaults":273,"./layout_global_defaults":274,d3:62}],272:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,a=t("../../plots/font_attributes"),i=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},a.family,{dflt:i.HOVERFONT}),size:n({},a.size,{dflt:i.HOVERFONTSIZE}),color:n({},a.color)}}}},{"../../lib/extend":340,"../../plots/font_attributes":408,"./constants":266}],273:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],281:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.defaultLine},borderwidth:{valType:"number",min:0,dflt:0},font:i({},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":340,"../../plots/font_attributes":408,"../color/attributes":229}],282:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],283:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("../../lib"),i=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return a.coerce(d,p,i,t,e)}for(var u,c,f,h,d=t.legend||{},p=e.legend={},g=0,m="normal",v=0;v1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),a.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(u=0,f="left",c=1.1,h="bottom"):(u=0,f="left",c=-.1,h="top")}l("traceorder",m),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",u),l("xanchor",f),l("y",c),l("yanchor",h),a.noneOrAll(d,p,["x","y"])}}},{"../../lib":346,"../../plots/layout_attributes":415,"../../registry":424,"./attributes":281,"./helpers":286}],284:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],a=e._fullLayout,i=n.trace,s=p.traceIs(i,"pie"),l=i.index,u=s?n.label:i.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(m.font,a.legend.font).text(u),e._context.editable&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var a,i=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(i.type)){var o=n.trace.transforms;a=o[o.length-1].direction+".name"}else a="name";f.restyle(e,a,t,l)}):c.call(r)}function a(t,e){var r,n=1,a=t.selectAll("rect").data([0]);a.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),a.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeE&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){i(t,e,n)},E):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,i(t,e,n))}})}function i(t,e,r){if(!e._dragged&&!e._editing){var n,a,i=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,g=i.indexOf(d);1===r?-1===g?i.push(d):i.splice(g,1):2===r&&(i=[],e.calcdata[0].forEach(function(t){d!==t.label&&i.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===i.length&&-1===g&&(i=[])),f.relayout(e,"hiddenlabels",i)}else{var m,v=[],y=[];for(m=0;mn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,a.height=a.height+g,g=0),m.setTranslate(this,i+y,5+i+e.height/2+p),a.width+=o+r,a.height=Math.max(a.height,e.height),y+=o+r,g=Math.max(e.height,g)}),a.width+=2*i,a.height+=10+2*i,a.width=Math.ceil(a.width),a.height=Math.ceil(a.height),r.each(function(e){var r=e[0];c.select(this).select(".legendtoggle").call(m.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";M.isRightAnchor(r)?n="right":M.isCenterAnchor(r)&&(n="center");var a="top";M.isBottomAnchor(r)?a="bottom":M.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 u(t){var e=t._fullLayout,r=e.legend,n="left";M.isRightAnchor(r)?n="right":M.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),m=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),A=t("./style"),k=t("./helpers"),M=t("./anchor_utils"),T=!0,E=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){S.attr("data-scroll",e).call(m.setTranslate,0,e),C.call(m.setRect,B,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var L=k.selectAll("rect.bg").data([0]);L.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),L.call(v.stroke,y.bordercolor),L.call(v.fill,y.bgcolor),L.style("stroke-width",y.borderwidth+"px");var S=k.selectAll("g.scrollbox").data([0]);S.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(v.fill,"#808BA4");var O=S.selectAll("g.groups").data(x);O.enter().append("g").attr("class","groups"),O.exit().remove();var I=O.selectAll("g.traces").data(h.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.call(A,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(a,t)});var R=0!==k.enter().size();R&&(s(t,O,I),l(t));var D=r.width,P=r.height;s(t,O,I),y.height>P?u(t):l(t);var z=r._size,N=z.l+z.w*y.x,F=z.t+z.h*(1-y.y);M.isRightAnchor(y)?N-=y.width:M.isCenterAnchor(y)&&(N-=y.width/2),M.isBottomAnchor(y)?F-=y.height:M.isMiddleAnchor(y)&&(F-=y.height/2);var B=y.width,j=z.w;B>j?(N=z.l,B=j):(N+B>D&&(N=D-B),N<0&&(N=0), +B=Math.min(D-N,y.width));var H=y.height,U=z.h;H>U?(F=z.t,H=U):(F+H>P&&(F=P-H),F<0&&(F=0),H=Math.min(P-F,y.height)),m.setTranslate(k,N,F);var V,G,q=H-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-H;if(y.height<=H||t._context.staticPlot)L.attr({width:B-y.borderwidth,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),m.setTranslate(S,0,0),T.select("rect").attr({width:B-2*y.borderwidth,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),S.call(m.setClipUrl,o);else{V=b.scrollBarMargin,G=S.attr("data-scroll")||0,L.attr({width:B-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:B-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:H-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-G}),S.call(m.setClipUrl,o),R&&e(V,G),k.on("wheel",null),k.on("wheel",function(){G=h.constrain(S.attr("data-scroll")-c.event.deltaY/q*X,-X,0),V=b.scrollBarMargin-G/X*q,e(V,G),0!==G&&G!==-X&&c.event.preventDefault()}),C.on(".drag",null),S.on(".drag",null);var Y=c.behavior.drag().on("drag",function(){V=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+q),G=-(V-b.scrollBarMargin)/q*X,e(V,G)});C.call(Y),S.call(Y)}if(t._context.editable){var W,Z,Q,$;k.classed("cursor-move",!0),g.init({element:k.node(),gd:t,prepFn:function(){var t=m.getTranslate(k);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;m.setTranslate(k,r,n),W=g.align(r,0,z.l,z.l+z.w,y.xanchor),Z=g.align(n,0,z.t+z.h,z.t,y.yanchor)},doneFn:function(e,n,a){if(e&&void 0!==W&&void 0!==Z)f.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return a.clientX>=t.left&&a.clientX<=t.right&&a.clientY>=t.top&&a.clientY<=t.bottom});o.size()>0&&(1===n?k._clickTimeout=setTimeout(function(){i(o,t,n)},E):2===n&&(k._clickTimeout&&clearTimeout(k._clickTimeout),i(o,t,n)))}}})}}}},{"../../constants/alignment":326,"../../constants/interactions":329,"../../lib":346,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":417,"../../registry":424,"../color":230,"../dragelement":251,"../drawing":254,"./anchor_utils":280,"./constants":282,"./get_legend_data":285,"./helpers":286,"./style":288,d3:62}],285:[function(t,e,r){"use strict";var n=t("../../registry"),a=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&a.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var i,o,s={},l=[],u=!1,c={},f=0;for(i=0;ir[1])return r[1]}return a}function a(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var g={},m={};h&&(g.mc=r("marker.color",a),g.mo=r("marker.opacity",i.mean,[.2,1]),g.ms=r("marker.size",i.mean,[2,16]),g.mlc=r("marker.line.color",a),g.mlw=r("marker.line.width",i.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(m.line={width:r("line.width",a,[0,10])}),d&&(g.tx="Aa",g.tp=r("textposition",a),g.ts=10,g.tc=r("textfont.color",a),g.tf=r("textfont.family",a)),s=[i.minExtend(c,g)],u=i.minExtend(f,m)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var b=v.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,r=e.marker||{},i=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),a=t[0],o=(a.mlw+1||i.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,a.mc||r.color),o&&e.call(s.stroke,a.mlc||i.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var a=r.selectAll("g.legendsymbols").data([t]);a.enter().append("g").classed("legendsymbols",!0),a.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(r).each(c)}},{"../../lib":346,"../../registry":424,"../../traces/pie/style_one":473,"../../traces/scatter/subtypes":499,"../color":230,"../drawing":254,d3:62}],289:[function(t,e,r){"use strict";function n(t,e){var r,n,a=e.currentTarget,i=a.getAttribute("data-attr"),o=a.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===i){var d,p="in"===o?.5:2,g=(1+p)/2,m=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(m,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),h&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=a(s),y=[];return((u||p)&&!v||g)&&(y=["zoom2d","pan2d"]),(u||g||p)&&i(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(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(m,r)}function a(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=a(e,r,l);f("x",p[0]),f("y",p[1]),i.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),i.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":346,"../color":230,"./attributes":293,"./button_attributes":294,"./constants":295}],297:[function(t,e,r){"use strict";function n(t){for(var e=v.list(t,"x",!0),r=[],n=0;np&&(p=h)));return p>=d?[d,p]:void 0}}var a=t("../../lib"),i=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=a.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;sX&&n>Y&&!t.shiftKey?p.getCursor(a/r,1-i/n):"move";g(e,o),q=o.split("-")[0]}function i(e){B=f.getFromId(t,r.xref),j=f.getFromId(t,r.yref),H=v.getDataToPixel(t,B),U=v.getDataToPixel(t,j,!0),V=v.getPixelToData(t,B),G=v.getPixelToData(t,j,!0);var i="shapes["+n+"]";"path"===r.type?(N=r.path,F=i+".path"):(m=H(r.x0),y=U(r.y0),b=H(r.x1),x=U(r.y1),_=i+".x0",w=i+".y0",A=i+".x1",k=i+".y1"),mY&&(d[S]=r[R]=G(u),d[C]=r[D]=G(c)),h-f>X&&(d[O]=r[P]=V(f),d[I]=r[z]=V(h))}e.attr("d",o(t,r))}var d,m,y,b,x,_,w,A,k,M,T,E,L,S,C,O,I,R,D,P,z,N,F,B,j,H,U,V,G,q,X=10,Y=10,W={element:e.node(),gd:t,prepFn:i,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W),e.node().onmousemove=a}function o(t,e){var r,n,a,i,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=v.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(a=v.shapePositionToRange(u),i=function(t){return u._offset+u.r2p(a(t,!0))}):i=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=v.decodeDate(n)),u&&"date"===u.type&&(i=v.decodeDate(i)),s(e.path,n,i);var h=n(e.x0),d=n(e.x1),p=i(e.y0),g=i(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var m=(h+d)/2,y=(p+g)/2,b=Math.abs(m-h),x=Math.abs(y-p),_="A"+b+","+x,w=m+b+","+y;return"M"+w+_+" 0 1,1 "+m+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a],l=t.substr(1).replace(m.paramRE,function(t){return i[n]?t=e(t):o[n]&&(t=r(t)),n++,n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),c.log("Ignoring extra params in segment "+t)),a+l})}function l(t,e,r){return t.replace(m.segmentRE,function(t){var n=0,a=t.charAt(0),i=m.paramIsX[a],o=m.paramIsY[a],s=m.numParams[a];return a+t.substr(1).replace(m.paramRE,function(t){return n>=s?t:(i[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),m=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:a}},{"../../lib":346,"../../lib/setcursor":361,"../../plotly":379,"../../plots/cartesian/axes":384,"../color":230,"../dragelement":251,"../drawing":254,"./constants":308,"./helpers":311}],311:[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,i=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);a=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(a=r.decodeDate(a))}else a=n?function(t){return i.t+i.h*(1-t)}:function(t){return i.l+i.w*t};return a},r.getPixelToData=function(t,e,n){var a,i=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);a=function(t){return o(e.p2r(t-e._offset))}}else a=n?function(t){return 1-(t-i.t)/i.h}:function(t){return(t-i.l)/i.w};return a}},{}],312:[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":306,"./calc_autorange":307,"./defaults":309,"./draw":310}],313:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../../plots/cartesian/axes"),i=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function u(r,a){return n.coerce(t,e,i,r,a)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},m=a.coerceRef(t,e,g,p,"","paper");if("path"!==f){var v,y,b;"paper"!==m?(v=a.getFromId(g,m),b=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],A=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),a.coercePosition(e,g,u,m,x,.25),a.coercePosition(e,g,u,m,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=A}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":346,"../../plots/cartesian/axes":384,"./attributes":306,"./helpers":311}],314:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../../plots/pad_attributes"),i=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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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({},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: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:i({},n,{})},font:i({},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":340,"../../plots/animation_attributes":380,"../../plots/font_attributes":408,"../../plots/pad_attributes":416,"./constants":315}],315:[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,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}},{}],316:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("x"),n("y"),i.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"),i.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),i.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 i.coerce(n,a,c,t,e)}for(var n,a,o=t.steps||[],s=e.steps=[],l=0;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),M.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(m,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,a,i=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-L.currentValueInset-e.currentValueMaxWidth,a="left";break;case"center":n=.5*e.inputAreaLength,a="middle";break;default:n=L.currentValueInset,a="left"}i.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":a,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),i.call(M.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(i),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*S;return T.positionText(i,n,l),i}}function l(t,e,r){var n=t.selectAll("rect."+L.gripRectClass).data([0]);n.enter().append("rect").classed(L.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:L.gripWidth,height:L.gripHeight,rx:L.gripRadius,ry:L.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(M.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+L.labelsClass).data([0]);r.enter().append("g").classed(L.labelsClass,!0);var n=r.selectAll("g."+L.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(L.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),M.setTranslate(r,v(e,t.fraction),L.tickOffset+e.ticklen+e.font.size*S+L.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,a){var i=Math.round(n*(r.steps.length-1));i!==r.active&&h(t,e,r,i,!0,a)}function h(t,e,r,n,a,i){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(m,r,r.active/(r.steps.length-1),i),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:o}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=i):(e._nextMethod={step:l,doCallback:a,doTransition:i},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&A.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var a=r.node(),i=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+L.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(a)[0]);f(e,r,t,s,!0),t._dragging=!0,i.on("mousemove",function(){var t=n(),i=y(t,w.mouse(a)[0]);f(e,r,t,i,!1)}),i.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),i.on("mouseup",null),i.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+L.tickRectClass).data(e.steps);r.enter().append("rect").classed(L.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,a=w.select(this);a.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),M.setTranslate(a,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?L.tickOffset:L.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(i-.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 b(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),M.setTranslate(n,0,r.currentValueTotalHeight)}function x(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"),M.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,a);l.enter().append("g").classed(L.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,A.autoMargin(t,L.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+g+")")}}}var m=r.propContainer,v=r.propName,y=r.traceIndex,b=r.dfltName,x=r.avoid||{},_=r.attributes,w=r.transform,A=r.containerGroup,k=t._fullLayout,M=m.titlefont.family,T=m.titlefont.size,E=m.titlefont.color,L=1,S=!1,C=m.title.trim(),O=t._context.editable;""===C&&(L=0),C.match(h)&&(L=.2,S=!0,O||(C=""));var I=C||O;A||(A=k._infolayer.selectAll(".g-"+e).data([0]),A.enter().append("g").classed("g-"+e,!0));var R=A.selectAll("text").data(I?[0]:[]);if(R.enter().append("text"),R.text(C).attr("class",e),R.exit().remove(),I){R.call(d);var D="Click to enter "+b+" title";O&&(C?R.on(".opacity",null):function(){L=0,S=!0,C=D,R.text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),R.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?i.restyle(t,v,e,y):i.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,_.x,_.y)})),R.classed("js-placeholder",S)}}},{"../../constants/interactions":329,"../../lib":346,"../../lib/svg_text_utils":365,"../../plotly":379,"../../plots/plots":417,"../color":230,"../drawing":254,d3:62,"fast-isnumeric":68}],320:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),a=t("../color/attributes"),i=t("../../lib/extend").extendFlat,o=t("../../plots/pad_attributes"),s={_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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:i({},o,{}),font:i({},n,{}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1}}},{"../../lib/extend":340,"../../plots/font_attributes":408,"../../plots/pad_attributes":416,"../color/attributes":229}],321:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16, +rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],322:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}n("visible",a(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}function a(t,e){function r(t,e){return i.coerce(n,a,c,t,e)}for(var n,a,o=t.buttons||[],s=e.buttons=[],l=0;l0?[0]:[]);if(i.enter().append("g").classed(S.containerClassName,!0).style("cursor","pointer"),i.exit().remove(),i.exit().size()&&_(t),0!==r.length){var c=i.selectAll("g."+S.headerGroupClassName).data(r,a);c.enter().append("g").classed(S.headerGroupClassName,!0);var f=i.selectAll("g."+S.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(S.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hA,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,L=p,S=m+v;S+E>u&&(S=u-E);var C=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,n.barColor),M?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:L,y:S,width:T,height:E}),this._hbarXMin=L+T/2,this._hbarTranslateMax=A-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var O=v>k,I=n.barWidth+2*n.barPad,R=n.barLength+2*n.barPad,D=p+g,P=m;D+I>l&&(D=l-I);var z=this.container.selectAll("rect.scrollbar-vertical").data(O?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,n.barColor),O?(this.vbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:D,y:P,width:I,height:R}),this._vbarYMin=P+R/2,this._vbarTranslateMax=k-R):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var N=this.id,F=c-.5,B=O?f+I+.5:f+.5,j=h-.5,H=M?d+E+.5:d+.5,U=s._topdefs.selectAll("#"+N).data(M||O?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",N).append("rect"),M||O?(this._clipRect=U.select("rect").attr({x:Math.floor(F),y:Math.floor(j),width:Math.ceil(B)-Math.floor(F),height:Math.ceil(H)-Math.floor(j)}),this.container.call(o.setClipUrl,N),this.bg.attr({x:p,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),M||O){var V=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(V);var G=a.behavior.drag().on("dragstart",function(){a.event.sourceEvent.preventDefault(),a.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));M&&this.hbar.on(".drag",null).call(G),O&&this.vbar.on(".drag",null).call(G)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=a.event.dx),this.vbar&&(e-=a.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=a.event.deltaY),this.vbar&&(e+=a.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(a.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var i=e+this._vbarYMin,o=i+this._vbarTranslateMax;e=(s.constrain(a.event.y,i,o)-i)/(o-i)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var a=t/r;this.hbar.call(o.setTranslate,t+a*this._hbarTranslateMax,e)}if(this.vbar){var i=e/n;this.vbar.call(o.setTranslate,t,e+i*this._vbarTranslateMax)}}},{"../../lib":346,"../color":230,"../drawing":254,d3:62}],326:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],327:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],328:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,a={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},i={},o=Object.keys(a),s=0;s",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],332:[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}},{}],333:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":223,"./components/annotations3d":228,"./components/fx":271,"./components/images":279,"./components/legend":287,"./components/rangeselector":299,"./components/rangeslider":305,"./components/shapes":312,"./components/sliders":318,"./components/updatemenus":324,"./fonts/mathjax_config":334,"./lib/queue":358,"./plot_api/plot_schema":373,"./plot_api/register":374,"./plot_api/set_plot_config":375,"./plot_api/to_image":377,"./plot_api/validate":378,"./plotly":379,"./snapshot":429,"./snapshot/download":426,"./traces/scatter":489,d3:62,"es6-promise":66}],334:[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},{}],335:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../constants/numerical").BADNUM,i=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(i,"")),n(t)?Number(t):a}},{"../constants/numerical":330,"fast-isnumeric":68}],336:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("tinycolor2"),i=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(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),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;na.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;!0!==n.strict&&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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);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(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var a=t.split("+"),i=0;i0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),m=t("../constants/numerical"),v=m.BADNUM,y=m.ONEDAY,b=m.ONEHOUR,x=m.ONEMIN,_=m.ONESEC,w=m.EPOCHJD,A=t("../registry"),k=h.time.format.utc,M=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,E=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?A.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:A.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?A.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var L,S;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=L&&t<=S?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var a=n(e),i=t.charAt(0);!a||"G"!==i&&"g"!==i||(t=t.substr(1),e="");var o=a&&"chinese"===e.substr(0,7),s=t.match(o?T:M);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(a){if(2===l.length)return v;l=Number(l);var p;try{var g=A.getComponentMethod("calendars","getCal")(e);if(o){var m="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,m),c)}else p=g.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*b+h*x+d*_:v}l=2===l.length?(Number(l)+2e3-E)%100+E:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*_},L=r.MIN_MS=r.dateTime2ms("-9999"),S=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var C=90*y,O=3*b,I=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=L&&t<=S))return v;e||(e=0);var a,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{a=A.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){a=k("G%Y-%m-%d")(new Date(h))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=L+y&&t<=S-y))return v;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return i(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,a){if(r.isJSDate(t)||"number"==typeof t){if(n(a))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,a))return p("unrecognized date",t),e;return t};var R=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],P=k("%Y"),z=k("%b %Y"),N=k("%b %-d"),F=k("%b %-d, %Y");r.formatDate=function(t,e,r,a){var i,h;if(a=n(a)&&a,e)return o(e,t,a);if(a)try{var d=Math.floor((t+.05)/y)+w,p=A.getComponentMethod("calendars","getCal")(a).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(i=l(p),h=c(p)):(i=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=P(g):"m"===r?h=z(g):"d"===r?(i=P(g),h=N(g)):(i=F(g),h=s(t,r))}return h+(i?"\n"+i:"")};var B=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var a=g(t,y);if(t=Math.round(t-a),r)try{var i=Math.round(t/y)+w,o=A.getComponentMethod("calendars","getCal")(r),s=o.fromJD(i);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+a}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+B);return l.setUTCMonth(l.getUTCMonth()+e)+a-B},r.findExactDates=function(t,e){for(var r,a,i=0,o=0,s=0,l=0,u=n(e)&&A.getComponentMethod("calendars","getCal")(e),c=0;c",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}function i(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(no?s:a(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var a=0;ar?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var a=t.length,i=new Array(a),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,a,i,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(a-=s*Math.floor(a/s)),a<0?a=-1-a:a>=o&&(a=s-1-a),i+=t[a]*u[n];c[r]=i}return c},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var a,i;t.length;)if(i=t.splice(0,1)[0],(a=i(e))&&a.then)return a.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,a,i=!1,o=!0;for(n=0;n1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+i+"$2");return s+l}},{"../constants/numerical":330,"./clean_number":335,"./coerce":336,"./dates":337,"./ensure_array":338,"./extend":340,"./filter_unique":341,"./filter_visible":342,"./identity":345,"./is_array":347,"./is_plain_object":348,"./loggers":349,"./matrix":350,"./mod":351,"./nested_property":352,"./noop":353,"./notifier":354,"./push_unique":357,"./relink_private":359,"./search":360,"./stats":363,"./to_log_range":366,d3:62,"fast-isnumeric":68}],347:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],348:[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}},{}],349:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],i=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)a(n[r],o(i,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)a(n[s[r]],o(i,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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,a,o,s=0,l=e.split(".");s/g),s=0;so||n===a||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===a||ro||u===a||ul)return!1;var c,f,h,d,p,g=n.length,m=n[0][0],v=n[0][1],y=0;for(c=1;cMath.max(f,m)||u>Math.max(h,v)))if(uc||Math.abs(n(o,h))>a)return!0;return!1};i.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=a;n.splice(i+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":330,"./matrix":350}],357:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--)},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:a:r?o:i;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,a=e[n]-e[0]||1,i=a/(n||1)/1e4,o=[e[0]],s=0;se[s]+i&&(a=Math.min(a,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:a}},r.roundUp=function(t,e,r){for(var n,a=0,i=e.length-1,o=0,s=r?0:1,l=r?1:0,u=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":68}],364:[function(t,e,r){"use strict";function n(t){var e=a(t);return e.length?e:[0,0,0,1]}var a=t("color-rgba");e.exports=n},{"color-rgba":54}],365:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function a(t){return t.replace(v,"\\lt ").replace(y,"\\gt ")}function i(t,e,r){var n="math-output-"+h.randstr([],64),i=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,i.node()],function(){var e=f.select("body").select("#MathJax_SVG_glyphs");if(i.select(".MathJax_SVG").empty()||!i.select("svg").node())h.log("There was an error in the tex syntax.",t),r();else{var n=i.select("svg").node().getBoundingClientRect();r(i.select(".MathJax_SVG"),e,n)}i.remove()})}function o(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",e),i=u[u.length-1].node}(k);else{var P=y[4],z={type:k},N=o(P,C);if(N?(N=N.replace(D,"$1 fill:"),M&&(N+=";"+M)):M&&(N=M),N&&(z.style=N),"a"===k){s=!0;var F=o(P,O);if(F){var B=document.createElement("a");B.href=F,-1!==A.indexOf(B.protocol)&&(z.href=F,z.target=o(P,I)||"_blank",z.popup=o(P,R))}}n(z)}}return s}function c(t,e,r){var n,a,i,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return a="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},i="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:a()-u.top+"px",left:i()-u.left+"px","z-index":1e3}),this}}var f=t("d3"),h=t("../lib"),d=t("../constants/xmlns_namespaces"),p=t("../constants/string_mappings"),g=t("../constants/alignment").LINE_SPACING,m=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(m),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};i(l[2],r,function(r,i,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),i&&i.node()&&u.node().insertBefore(i.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),g=n(u,"height"),m=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||n(t,"height"),y=-v/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-g/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:m,y:+t.attr("y")+y-g/2}),a&&a.call(t,f),e(f)})})):o(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",A=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),M=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,E=/(<[^<>]*>)/,L=/<(\/?)([^ >]*)(\s+(.*))?>/i,S=//i,C=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,O=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,I=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,R=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,D=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(k," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),a=t("x",e),i=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:a,y:i})})},r.makeEditable=function(t,e){function r(){a(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(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 r=f.select(i),a=r.select(".svg-container"),o=a.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,a,e)).on("blur",function(){i._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;i._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(i._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,a,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var i=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),f.rebind(t,s,"on")}},{"../constants/alignment":326,"../constants/string_mappings":331,"../constants/xmlns_namespaces":332,"../lib":346,d3:62}],366:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":68}],367:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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=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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(m,v),d(t),!0)}var b,x,_,w,A,k,M,T=Object.keys(r).map(Number).sort(s),E=e.get(),L=E||[],S=n(v,f).get(),C=[],O=-1,I=L.length;for(b=0;bL.length-(M?0:1))o.warn("index out of range",f,_);else if(void 0!==k)A.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?C.push(_):M?("add"===k&&(k={}),L.splice(_,0,k),S&&S.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,k),-1===O&&(O=_);else for(x=0;x=0;b--)L.splice(C[b],1),S&&S.splice(C[b],1);if(L.length?E||e.set(L):e.set(null),g)return!1;if(h(m,v),p!==i){var R;if(-1===O)R=T;else{for(I=Math.max(L.length,I),R=[],b=0;b=O);b++)R.push(_);for(b=O;b=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 l(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function u(t,e,r){var n,a;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lU.range[0]?[1,2]:[2,1]);else{var q=U.range[0],X=U.range[1];V?(q<=0&&X<=0&&r(z+".autorange",!0),q<=0?q=X/1e6:X<=0&&(X=q/1e6),r(z+".range[0]",Math.log(q)/Math.LN10),r(z+".range[1]",Math.log(X)/Math.LN10)):(r(z+".range[0]",Math.pow(10,q)),r(z+".range[1]",Math.pow(10,X)))}else r(z+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,B,E,r),w.getComponentMethod("images","convertCoords")(t,B,E,r)}else r(z+".autorange",!0);b.nestedProperty(u,z+"._inputRange").set(null)}else if(D.match(R.AX_NAME_PATTERN)){var Y=b.nestedProperty(u,M).get(),W=(E||{}).type;W&&"-"!==W||(W="linear"),w.getComponentMethod("annotations","convertCoords")(t,Y,W,r),w.getComponentMethod("images","convertCoords")(t,Y,W,r)}var Z=C.containerArrayMatch(M);if(Z){i=Z.array,o=Z.index;var Q=Z.property,$=b.nestedProperty(l,i),K=($||[])[o]||{};if(""===o)-1===M.indexOf("updatemenus")&&(v.docalc=!0);else if(""===Q){var J=E;C.isAddVal(E)?_[M]=null:C.isRemoveVal(E)?(_[M]=K,J=K):b.warn("unrecognized full object value",e),(n(J,"x")||n(J,"y")&&-1===M.indexOf("updatemenus"))&&(v.docalc=!0)}else!n(K,"x")&&!n(K,"y")||b.containsAny(M,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);h[i]||(h[i]={});var tt=h[i][o];tt||(tt=h[i][o]={}),tt[Q]=E,delete e[M]}else if("reverse"===D)F.range?F.range.reverse():(r(z+".autorange",!0),F.range=[1,0]),B.autorange?v.docalc=!0:v.doplot=!0;else{var et=String(T.parts[1]||"");0===I.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===I.indexOf("geo")?v.doplot=!0:0===I.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===M?v.doplot=!0:"margin"===I||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==M.indexOf("calendar")||M.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||-1===M.indexOf("axis")&&"plot_bgcolor"!==M?!u._has("gl2d")||"dragmode"!==M||"lasso"!==E&&"select"!==E||"lasso"===j||"select"===j?"hiddenlabels"===M?v.docalc=!0:-1!==I.indexOf("legend")?v.dolegend=!0:-1!==M.indexOf("title")?v.doticks=!0:-1!==I.indexOf("bgcolor")?v.dolayoutstyle=!0:L>1&&b.containsAny(et,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==M.indexOf(".linewidth")&&-1!==M.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:L>1&&-1!==et.indexOf("line")?v.dolayoutstyle=!0:L>1&&"mirror"===et?v.doticks=v.dolayoutstyle=!0:"margin.pad"===M?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(M)||-1!==M.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(M)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(E)}}}for(i in h){C.applyContainerArrayChanges(t,b.nestedProperty(l,i),h[i],v)||(v.doplot=!0)}var rt=u._axisConstraintGroups;for(m in k)for(o=0;o=s.length?s[0]:s[t]:s}function a(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function i(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=O.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,A.transition(t,e.frame.data,e.frame.layout,O.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?m>=s.length?t.transitionOpts=s[m]:t.transitionOpts=s[0]:t.transitionOpts=s,m++,t}var p,g,m=0,v=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&M.push(g);v=M}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;a--)if(b.isPlainObject(e[a])){var h=(u[e[a].name]||{}).name,d=e[a].name;h&&d&&"number"==typeof d&&u[h]&&(n++,b.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:A.supplyFrameDefaults(e[a]),index:r&&void 0!==r[a]&&null!==r[a]?r[a]:c+a})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;a--){if(i=f[a].frame,"number"==typeof i.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;u[i.name="frame "+t._transitionData._counter++];);if(u[i.name]){for(o=0;o=0;r--)n=e[r],i.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:a[n]});var s=A.modifyFrames,l=A.modifyFrames,u=[t,o],c=[t,i];return _&&_.add(t,s,u,l,c),A.modifyFrames(t,i)},y.purge=function(t){t=O.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":254,"../components/errorbars":260,"../constants/xmlns_namespaces":332,"../lib":346,"../lib/events":339,"../lib/queue":358,"../lib/svg_text_utils":365,"../plotly":379,"../plots/cartesian/axis_ids":387,"../plots/cartesian/constants":389,"../plots/cartesian/constraints":391,"../plots/cartesian/graph_interact":393,"../plots/plots":417,"../plots/polar":420,"../registry":424,"./helpers":369,"./manage_arrays":370,"./subroutines":376,d3:62,"fast-isnumeric":68}],372:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],373:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var a={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var i={};w(i,e.layoutAttributes),a.layoutAttributes=s(i)}return a}function a(){var t={};return w(t,m),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function i(t){var e=d.transformsRegistry[t],r=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(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)):!0===t.arrayOk&&(a[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(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 _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),a=w({},e.layoutAttributes);a[A]=!0,n.set(a)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),m=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,A="_isSubplotObj",k="_isLinkedToArray",M=[A,k,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=A,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=M,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]=i(t)}),{defs:{valObjects:p.valObjects,metaKeys:M.concat(["description","role"])},traces:t,layout:a(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var a=n||0;Object.keys(t).forEach(function(n){var i=t[n];-1===M.indexOf(n)&&(e(i,n,t,a),r.isValObject(i)||p.isPlainObject(i)&&r.crawl(i,e,a+1))})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,o,s){if(i=i.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)){var l=n(i),u=p.nestedProperty(t,l).get();Array.isArray(u)&&a.push(l)}}function n(t){return t.join(".")}var a=[],i=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||a[1]<=t[0])&&(i[0]e[0]))return!0}return!1}var a=t("d3"),i=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),f=t("../components/titles"),h=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=i.Axes.list(t);for(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.gd;p.style.position="absolute",p.style.left="-5000px",document.body.appendChild(p);var g=s.getRedrawFunc(p);i.plot(p,d.data,d.layout,d.config).then(g).then(f).then(function(t){r(t)}).catch(function(t){n(t)})})}var a=t("fast-isnumeric"),i=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":346,"../plotly":379,"../snapshot/cloneplot":425,"../snapshot/helpers":428,"../snapshot/svgtoimg":430,"../snapshot/tosvg":432,"fast-isnumeric":68}],378:[function(t,e,r){"use strict";function n(t,e,r,a,i,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,m=r.length,v=0;v.3*f||i(n)||i(a))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));i.exactYears>.8&&o%12==0?t=D.tickIncrement(t,"M6","reverse")+1.5*C:i.exactMonths>.8?t=D.tickIncrement(t,"M1","reverse")+15.5*C:t-=C/2;var s=D.tickIncrement(t,r);if(s<=n)return s}return t}function i(t){var e,r,n=t.tickvals,a=t.ticktext,i=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(a)||(a=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=C&&a<=10||e>=15*C)t._tickround="d";else if(e>=I&&a<=16||e>=O)t._tickround="M";else if(e>=R&&a<=19||e>=I)t._tickround="S";else{var i=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,i)-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 l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var a=t._tickround,i=r&&t.hoverformat||t.tickformat;n&&(a=b(a)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[a]);var o,s=_.formatDate(e.x,i,a,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===a?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(t,e,r,n,a){var i=t.dtick,o=e.x;if(!n||"string"==typeof i&&"L"===i.charAt(0)||(i="L3"),t.tickformat||"string"==typeof i&&"L"===i.charAt(0))e.text=d(Math.pow(10,o),t,a,n);else if(b(i)||"D"===i.charAt(0)&&_.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(Math.pow(10,o),t,"","fakehover"),"D1"===i&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6);else{if("D"!==i.charAt(0))throw"unrecognized dtick "+String(i);e.text=String(Math.round(Math.pow(10,_.mod(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 f(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}function h(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,o=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]};s(f),i=(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,-i)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=V[l/3+5])}return a?"\u2212"+t:t}function p(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},D.getAutoRange=function(t){var e,r=[],n=t._min[0].val,a=t._max[0].val;for(e=1;e0&&c>0&&f/c>h&&(l=o,u=s,h=f/c);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 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(),_.simpleMap(r,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},D.saveRangeInitial=function(t,e){for(var r=D.list(t,"",!0),n=!1,a=0;a=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var i,o,s,l,u,c,f,h,d,p,g,m=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type);v&&"domain"===t.constrain&&t._inputDomain&&(v*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),A=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(i=0;i<6;i++)a(i);for(i=m-1;i>5;i--)a(i)}},D.autoBin=function(t,e,r,i,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,i?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},D.setConvert(d),D.autoTicks(d,u);var p,g=D.tickIncrement(D.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=a(g,t,d.dtick,s,o)),p=g;p<=l;)p=D.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},D.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),D.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return i(t);t._tmin=D.tickFirst(t);var a=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=D.tickIncrement(u,t.dtick,a,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,N)):n>S?(e/=S,t.dtick="M"+o(e,1,F)):n>C?(t.dtick=o(e,C,j),t.tick0=_.dateTick0(t.calendar,!0)):n>O?t.dtick=o(e,O,F):n>I?t.dtick=o(e,I,B):n>R?t.dtick=o(e,R,B):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,N))}else if("log"===t.type){t.tick0=0;var a=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(a[1]-a[0])<1){var i=1.5*Math.abs((a[1]-a[0])/e);e=Math.abs(Math.pow(10,a[1])-Math.pow(10,a[0]))/i,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(e,r,N)}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=o(e,r,N));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)}},D.tickIncrement=function(t,e,r,n){var a=r?-1:1;if(b(e))return t+a*e;var i=e.charAt(0),o=a*Number(e.substr(1));if("M"===i)return _.incrementMonth(t,o,n);if("L"===i)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===i){var s="D2"===e?U:H,l=t+.01*a,u=_.roundUp(_.mod(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=_.simpleMap(t.range,e),n=r[1]1&&e2*a}function i(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,a=0,i=0;i2*n}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../constants/numerical").BADNUM;e.exports=function(t,e){return a(t,e)?"date":i(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":330,"../../lib":346,"fast-isnumeric":68}],386:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,a=t("../../registry"),i=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,g){function m(r,n){return i.coerce2(t,e,s,r,n)}var v=p.letter,y=p.font||{},b="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?d(v,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),A=w===t.color?w:y.color;r("title",b),i.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:A}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var k=m("linecolor",w),M=m("linewidth"),T=r("showline",!!k||!!M);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var E=m("gridcolor",n(w,p.bgColor,o).toRgbString()),L=m("gridwidth");r("showgrid",p.showGrid||!!E||!!L)||(delete e.gridcolor,delete e.gridwidth);var S=m("zerolinecolor",w),C=m("zerolinewidth");return r("zeroline",p.showGrid||!!S||!!C)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":229,"../../lib":346,"../../registry":424,"./category_order_defaults":388,"./layout_attributes":395,"./ordered_categories":397,"./set_convert":401,"./tick_label_defaults":402,"./tick_mark_defaults":403,"./tick_value_defaults":404,tinycolor2:197}],387:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),a=/^[xyz]axis[0-9]*/,i=[],o=0;o0;i&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),i||"array"!==o||(e.categoryorder="trace")}}},{}],389:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],390:[function(t,e,r){"use strict";function n(t,e,r,n){var a,i,s,l,u=n[o(e)].type,c=[];for(i=0;io*v)||_)for(r=0;rO&&RS&&(S=R);var z=(S-L)/(2*C);f/=z,L=l.l2r(L),S=l.l2r(S),l.range=l._input.range=M=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),a||(t.transition().style("fill",i>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function m(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function v(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,a,i,o,s,l,u=!1,c={},f={};for(n=0;nF||s>F?(kt="xy",o/it>s/ot?(s=o*ot/it,bt>i?xt.t=bt-s:xt.b=bt+s):(o=s*it/ot,yt>a?xt.l=yt-o:xt.r=yt+o),Tt.attr("d",y(xt))):n():!lt||szoom back out","long"),B=!1)}function Y(e,r){var n=1===(H+U).length;if(e)K();else if(2!==r||n){if(1===r&&n){var a=H?rt[0]:et[0],o="s"===H||"w"===U?0:1,s=a._name+".range["+o+"]",l=i(a,o),u="left",c="middle";if(a.fixedrange)return;H?(c="n"===H?"top":"bottom","right"===a.side&&(u="right")):"e"===U&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(mt).call(M.makeEditable,{gd:t,immediate:!0,background:dt.paper_bgcolor,text:String(l),fill:a.tickfont?a.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=a.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else $()}function W(e){function r(t,e,r){function n(e){return t.l2r(i+(e-i)*r)}if(!t.fixedrange){var a=k.simpleMap(t.range,t.r2l),i=a[0]+(a[1]-a[0])*e;t.range=a.map(n)}}if(t._context.scrollZoom||dt._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var n=t.querySelector(".plotly");if(V(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(St);var a=-e.deltaY;if(isFinite(a)||(a=e.wheelDelta/10),!isFinite(a))return void k.log("Did not find wheel motion attributes: ",e);var i,o=Math.exp(-Math.min(Math.max(a,-20),20)/100),s=Ot.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(U||ct){for(U||(l=.5),i=0;ic[1]-.01&&(e.domain=[0,1]),a.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":346,"fast-isnumeric":68}],399:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var a=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=a[0]+(a[1]-a[0])*r;t.range=t._input.range=[t.l2r(i+(a[0]-i)*e),t.l2r(i+(a[1]-i)*e)]}},{"../../constants/alignment":326}],400:[function(t,e,r){"use strict";function n(t){return t._id}function a(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)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*w*Math.abs(n-a))}return d}function f(e,r,n){var a=u(e,n||t.calendar);if(a===d){if(!i(e))return d;a=u(new Date(+e))}return a}function m(e,r,n){return l(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(i(e))return+e}function x(e){return i(e)?a.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:c,t.l2c="log"===t.type?n:c,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=_,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=_,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=m,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return m(_(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,a=o.nestedProperty(t,e).get(),s=(t._id||"x").charAt(0);if(n="date"===t.type?o.dfltRange(t.calendar):"y"===s?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!a||2!==a.length)return void o.nestedProperty(t,e).set(n);for("date"===t.type&&(a[0]=o.cleanDate(a[0],d,t.calendar),a[1]=o.cleanDate(a[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(a[r],t.calendar)){t[e]=n;break}if(t.r2l(a[0])===t.r2l(a[1])){var l=o.constrain(t.r2l(a[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);a[0]=t.l2r(l-1e3),a[1]=t.l2r(l+1e3);break}}else{if(!i(a[r])){if(!i(a[1-r])){t[e]=n;break}a[r]=a[1-r]*(r?10:.1)}if(a[r]<-h?a[r]=-h:a[r]>h&&(a[r]=h),a[0]===a[1]){ +var u=Math.max(1,Math.abs(1e-6*a[0]));a[0]-=u,a[1]+=u}}},t.setScale=function(r){var n=e._size,a=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var i=g.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var s=r&&t._r?"_r":"range",l=t.calendar;t.cleanRange(s);var u=t.r2l(t[s][0],l),c=t.r2l(t[s][1],l);if("y"===a?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,a,i,o="date"===t.type&&e[r+"calendar"];if(r in e)for(n=e[r],a=new Array(n.length),i=0;i0?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?a.dateTick0(e.calendar):0,p=r("tick0",d);"date"===o?e.tick0=a.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":330,"../../lib":346,"fast-isnumeric":68}],405:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plotly"),i=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r){for(a=0;ar.duration?(d(),k=window.cancelAnimationFrame(g)):k=window.requestAnimationFrame(g)}var m=t._fullLayout,v=[],y=function(t){var e,r,n,a,i,o={};for(e in t)if(r=e.split("."),n=r[0].match(l)){var s=n[1],u=s+"axis";if(a=m[u],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=u,i.length=a._length,v.push(s),o[s]=i}return o}(e),b=Object.keys(y),x=function(t,e,r){var n,a,i,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){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(),a=r[u]?r[u].to:f,i=r[c]?r[c].to:h,f[0]===a[0]&&f[1]===a[1]&&h[0]===i[0]&&h[1]===i[1]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(m,b,y);if(!x.length)return!1;var _;u&&(_=u());var w,A,k,M=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(k),k=null,p()}),w=Date.now(),k=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":254,"../../plotly":379,"../../registry":424,"./axes":384,d3:62}],406:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var u=a(e,r,n);if(u){if("histogram"===u.type&&n==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=n+"calendar",f=u[c];if(o(u,n)){for(var h,d=i(u),p=[],g=0;g0?".":"")+a;u.isPlainObject(i)?s(i,e,o,n+1):e(o,a,i)}})}var l=t("../plotly"),u=t("../lib");r.manageCommandObserver=function(t,e,a,i){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var l=r.hasSimpleAPICommandBindings(t,a,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&&i&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(i({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(f)?(u.boxEnd[1]=u.boxStart[1]+Math.abs(c)*w*(f>=0?1:-1),u.boxEnd[1]h[3]&&(u.boxEnd[1]=h[3],u.boxEnd[0]=u.boxStart[0]+(h[3]-u.boxStart[1])/Math.abs(w))):(u.boxEnd[0]=u.boxStart[0]+Math.abs(f)/w*(c>=0?1:-1),u.boxEnd[0]h[2]&&(u.boxEnd[0]=h[2],u.boxEnd[1]=u.boxStart[1]+(h[2]-u.boxStart[0])*Math.abs(w)))}}else u.boxEnabled?(c=u.boxStart[0]!==u.boxEnd[0],f=u.boxStart[1]!==u.boxEnd[1],c||f?(c&&(o(0,u.boxStart[0],u.boxEnd[0]),t.xaxis.autorange=!1),f&&(o(1,u.boxStart[1],u.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),u.boxEnabled=!1,u.boxInited=!1):u.boxInited&&(u.boxInited=!1);break;case"pan":u.boxEnabled=!1,u.boxInited=!1,n?(u.panning||(u.dragStart[0]=a,u.dragStart[1]=i),Math.abs(u.dragStart[0]-a)h[p+2]&&(h[p]=-1,h[p+2]=1),d=this[_[p]],d._length=o.viewBox[p+2]-o.viewBox[p],l.doAutoRange(d),d.setScale();b(s),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},w.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,a=t.r2l,i=e.r2l;return[a(r[0]),i(n[0]),a(r[1]),i(n[1])]},w.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,a=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[a(t[1]),a(t[3])]},w.updateTraces=function(t,e){var r,n,a,i=Object.keys(this.traces);this.fullData=t;t:for(r=0;r=e.width-20?(i["text-anchor"]="start",i.x=5):(i["text-anchor"]="end",i.x=e._paper.attr("width")-7),r.attr(i);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),s.text(o.text()&&u.text()?" - ":"")}},m.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=l.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).node().value=m.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},m.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},i=t.layout||{},o=t._fullData||[],s=t._fullData=[],l=t.data||[];if(t._transitionData||m.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;m.supplyLayoutGlobalDefaults(i,n),i.width||(n.width=u),i.height||(n.height=f)}else{m.supplyLayoutGlobalDefaults(i,n);var h=!i.width||!i.height,d=n.autosize,p=t._context&&t._context.autosizable;h&&(d||p)?m.plotAutoSize(t,i,n):h&&m.sanitizeMargins(t),!d&&h&&(i.width=n.width,i.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,m.supplyDataDefaults(l,s,i,n),n._has=m._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var c=o(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,p=1-2*s,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),a=Math.round(p*(g.height-h))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,a=parseFloat(v.height)||r.height}var y=m.layoutAttributes.width.min,b=m.layoutAttributes.height.min;n1,_=!e.height&&Math.abs(r.height-a)>1;(_||x)&&(x&&(r.width=n),_&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),m.sanitizeMargins(r)},m.supplyLayoutModuleDefaults=function(t,e,r,n){var a,i;c.Axes.supplyLayoutDefaults(t,e,r);var o=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];n._replotting||m.doAutoMargin(t)}},m.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),a=Math.max(e.margin.l||0,0),i=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(!1!==e.margin.autoexpand){l.base={l:{val:0,size:a},r:{val:1,size:i},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(l),h=0;hm){var k=(v*w+(A-e.width)*m)/(w-m),M=(A*(1-m)+(v-e.width)*(1-w))/(w-m);k>=0&&M>=0&&k+M>a+i&&(a=k,i=M)}}if(u(b)&&l[_].t){var T=l[_].t.val,E=l[_].t.size;if(T>y){var L=(b*T+(E-e.height)*y)/(T-y),S=(E*(1-y)+(b-e.height)*(1-T))/(T-y);L>=0&&S>=0&&L+S>s+o&&(s=L,o=S)}}}}if(r.l=Math.round(a),r.r=Math.round(i),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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},m.graphJson=function(t,e,r,n,a){function i(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,a={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;a[e]=i(t[e])}return a}return Array.isArray(t)?t.map(i):d.isJSDate(t)?d.ms2DateTimeLocal(+t):t}(a&&e&&!t._fullData||a&&!e&&!t._fullLayout)&&m.supplyDefaults(t);var o=a?t._fullData:t.data,s=a?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=i(t);return e&&delete r.fit,r})};return e||(u.layout=i(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=i(l)),"object"===n?u:JSON.stringify(u)},m.modifyFrames=function(t,e){var r,n,a,i=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){x=!0}),a.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,h=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=E?f.angularAxis.domain:n.extent(A),S=Math.abs(A[1]-A[0]);M&&!k&&(S=0);var C=L.slice();T&&k&&(C[1]+=S);var O=f.angularAxis.ticksCount||4;O>8&&(O=O/(O/8)+O%8),f.angularAxis.ticksStep&&(O=(C[1]-C[0])/O);var I=f.angularAxis.ticksStep||(C[1]-C[0])/(O*(f.minorTicks+1));w&&(I=Math.max(Math.round(I),1)),C[2]||(C[2]=I);var R=n.range.apply(this,C);if(R=R.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?S:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var D=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),P=this.appendChild(this.ownerDocument.importNode(D.documentElement,!0));e=n.select(P)}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 z,N=e.select(".chart-group"),F={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){z=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var j=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=void 0===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:i({},o.Legend.defaultConfig().legendConfig,{container:z,elements:j,reverseOrder:f.legend.reverseOrder})})();var H=z.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],a.range([0,b]),c.layout.radialAxis.domain=a.domain(),z.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else z=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),N.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(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(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 V=e.select("g.title-group text").style(B).text(f.title),G=V.node().getBBox();V.attr({x:_[0]-G.width/2,y:_[1]-b-20})}var q=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=q.selectAll("circle.grid-circle").data(a.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(F),X.attr("r",a),X.exit().remove()}q.select("circle.outside-circle").attr({r:b}).style(F);var Y=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var W=n.svg.axis().scale(a).ticks(5).tickSize(5);q.call(W).attr({transform:"rotate("+f.radialAxis.orientation+")"}),q.selectAll(".domain").style(F),q.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"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var Z=e.select(".angular.axis-group").selectAll("g.angular-tick").data(R),Q=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),Z.exit().remove(),Q.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(F),Q.selectAll(".minor").style({stroke:f.minorTickColor}),Z.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(B);var $=Z.select("text.axis-text").attr({x:b+f.labelOffset,dy:".35em",transform:function(t,e){ +var r=l(t,e),n=b+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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(B);f.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(N.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));z.attr({transform:"translate("+[b+K,f.margin.top]+")"});var J=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||J){var et=[];d.forEach(function(t,e){var r={};r.radialScale=a,r.angularScale=s,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.forEach(function(t,e){var r;r=Array.isArray(t)?t[0].geometryConfig.geometry:t.geometryConfig.geometry;var n=t.map(function(t,e){return i(o[r].defaultConfig(),t)});o[r]().config(n)()})}var at,it,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ft=ot.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(Y).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;at=s.invert(n);var a=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(at)).move([a[0]+_[0],a[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});N.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(Y).radius;ht.attr({r:r}).style({opacity:.5}),it=a.invert(o.util.getMousePos(Y).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ut.text(o.util.round(it)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.hide()}),e.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,r){var a=n.select(this),i=a.style("fill"),s="black",l=a.style("opacity")||1;if(a.attr({"data-opacity":l}),"none"!=i){a.attr({"data-fill":i}),s=n.hsl(i).darker().toString(),a.style({fill:s,opacity:1});var u={t:o.util.round(t[0]),r:o.util.round(t[1])};k&&(u.t=w[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-U[0]-h.left,f.top+f.height/2-U[1]-h.top];ct.config({color:s}).text(c),ct.move(d)}else i=a.style("stroke"),a.attr({"data-stroke":i}),s=n.hsl(i).darker().toString(),a.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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")})})}),h}var e,r,a,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]={}),i(l.data[e],o.Axis.defaultConfig().data[0]),i(l.data[e],t)}),i(l.layout,o.Axis.defaultConfig().layout),i(l.layout,e.layout),this},h.getLiveConfig=function(){return c},h.getinputConfig=function(){return u},h.radialScale=function(t){return a},h.angularScale=function(t){return s},h.svg=function(){return e},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var a=e||6,i=[],o=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180,a=t(n);i.push(e),o.push(a)});var s={t:i,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],a=e[1],i={};return i.x=r,i.y=a,i.pos=e,i.angle=180*(Math.atan2(a,r)+Math.PI)/Math.PI,i.radius=Math.sqrt(r*r+a*a),i},o.util.duplicatesCount=function(t){for(var e,r={},n={},a=0,i=t.length;a0)){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 m.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return m.stroke(r,a,i)},"stroke-width":function(t,e){return m["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return m["stroke-dasharray"](r,a,i)},opacity:function(t,e){return m.opacity(r,a,i)},display:function(t,e){return m.display(r,a,i)}})}};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,a){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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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(f[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),i(e[r],o.PolyChart.defaultConfig()),i(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=i({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||void 0===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),m=n.scale[c?"linear":"ordinal"]().domain(g).range(l),v=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":-1!=n.svg.symbolTypes.indexOf(t)?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,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return m(e)}}),x.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?(i(e,t),this):e},n.rebind(t,r,"on"),t},o.Legend.defaultConfig=function(t,e){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=function(){t=a.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:a.padding+10,dy:.3*+a.fontSize}),l};return l.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(c);var f=a.padding,h=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,g=h.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[a.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return i(a,t),l},l},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=i({},t);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=i({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":346,d3:62}],422:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../lib"),i=t("../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=a.extendDeepAll,u=e.exports={};u.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?l(r,e):e,i||(i=o.Axis()),c=o.adapter.plotly().convert(r),i.config(c).render(f),t.data=r.data,t.layout=r.layout,u.fillLayout(t),r}var r,a,i,c,f,h=new s;return e.isPolar=!0,e.svg=function(){return i.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:i.angularScale(),r:i.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,a),a=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"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../components/color":230,"../../lib":346,"./micropolar":421,"./undo_manager":423,d3:62}],423:[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-1!==n},hasRedo:function(){return n-1}var i=t("../lib"),o=t("../plots/plots"),s=i.extendFlat,l=i.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,i=t.data,u=t.layout,c=l([],i),f=l({},u,n(e.tileClass)),h=t._context||{};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")?"":e.html(t).text()});return e.remove(),r}function a(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var i=t("d3"),o=t("../components/drawing"),s=t("../components/color"),l=t("../constants/xmlns_namespaces"),u=/"/g,c=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,h=f._paper,d=f._toppaper;h.insert("rect",":first-child").call(o.setRect,0,0,f.width,f.height).call(s.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(r=0;rs.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),i(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var u=s.start,c=s.end,f=e._input.contours;if(u>c&&(s.start=f.start=c,c=s.end=f.end=u,u=s.start),!(s.size>0)){var h;h=u===c?1:n(u,c,e.ncontours).dtick,f.size=s.size=h}}return r}},{"../../lib":346,"../../plots/cartesian/axes":384,"../heatmap/calc":444}],435:[function(t,e,r){"use strict";var n=t("../../plots/plots"),a=t("../../components/colorbar/draw"),i=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void n.autoMargin(t,s);var l=a(t,s);e[0].t.cb=l;var u=r.contours,c=r.line,f=u.size||1,h=u.coloring,d=i(r,{isColorbar:!0});"heatmap"===h&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===h||"heatmap"===h?d:"").line({color:"lines"===h?d:c.color,width:!1!==u.showlines?c.width:0,dash:c.dash}).levels({start:u.start,end:o(u),size:f}).options(r.colorbar)()}},{"../../components/colorbar/draw":233,"../../plots/plots":417,"./end_plus":438,"./make_color_map":439}],436:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){var i,o=n.coerce2(t,e,a,"contours.start"),s=n.coerce2(t,e,a,"contours.end"),l=!1===o||!1===s,u=r("contours.size");!(i=l?e.autocontour=!0:r("autocontour",!1))&&u||r("ncontours")}},{"../../lib":346,"./attributes":433}],437:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("../heatmap/has_columns"),i=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,a){return n.coerce(t,e,l,r,a)}if(!i(t,e,c,u))return void(e.visible=!1);c("text"),c("connectgaps",a(e)),o(t,e,c),s(t,e,c,u)}},{"../../lib":346,"../heatmap/has_columns":450,"../heatmap/xyz_defaults":454,"./attributes":433,"./contours_defaults":436,"./style_defaults":440}],438:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],439:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../components/colorscale"),i=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=i(e),s=e.size||1,l=Math.floor((o-r)/s)+1,u="lines"===e.coloring?0:1;isFinite(s)||(s=1,l=1);var c,f,h=t.colorscale,d=h.length,p=new Array(d),g=new Array(d);if("heatmap"===e.coloring){for(t.zauto&&!1===t.autocontour&&(t.zmin=r-s/2,t.zmax=t.zmin+l*s),f=0;fO){r("x scale is not linear");break}}if(y.length&&"fast"===L){var I=(y[y.length-1]-y[0])/(y.length-1),R=Math.abs(I/100);for(w=0;wR){r("y scale is not linear");break}}}var D=c(_),P="scaled"===e.xtype?"":g,z=p(e,P,m,v,D,A),N="scaled"===e.ytype?"":y,F=p(e,N,b,x,_.length,k);E||(i.expand(A,z),i.expand(k,F));var B={x:z,y:F,z:_,text:e.text};if(s(e,_,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};B.xfill=p(j,P,m,v,D,A),B.yfill=p(j,N,b,x,_.length,k)}return[B]}},{"../../components/colorscale/calc":236,"../../lib":346,"../../plots/cartesian/axes":384,"../../registry":424,"../histogram2d/calc":462,"./clean_2d_array":445,"./convert_column_xyz":447,"./find_empties":449,"./has_columns":450,"./interp2d":451,"./make_bound_array":452,"./max_row_length":453}],445:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,a,i,o,s,l;if(e){for(r=0,s=0;s=0;o--)i=h[o],r=i[0],a=i[1],(s=((f[[r-1,a]]||g)[2]+(f[[r+1,a]]||g)[2]+(f[[r,a-1]]||g)[2]+(f[[r,a+1]]||g)[2])/20)&&(l[i]=[r,a,s],h.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(i in l)f[i]=l[i],c.push(l[i])}return c.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":453}],450:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],451:[function(t,e,r){"use strict";function n(t){return.5-.25*Math.min(1,.5*t)}function a(t,e,r){var n,a,i,s,l,u,c,f,h,d,p,g,m,v=0;for(s=0;sg&&(v=Math.max(v,Math.abs(t[a][i]-p)/(m-g))))}return v}var i=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o.01;o++)l=a(t,e,n(l));return l>.01&&i.log("interp2d didn't converge quickly",l),t}},{"../../lib":346}],452:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,a,i,o){var s,l,u,c=[],f=n.traceIs(t,"contour"),h=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!h&&"category"!==o.type){var p=e.length;if(!(p<=i))return f?e.slice(0,i):e.slice(0,i+1);if(f||d)c=e.slice(0,i);else if(1===i)c=[e[0]-.5,e[0]+.5];else{for(c=[1.5*e[0]-.5*e[1]],u=1;u0&&(n=!0);for(var s=0;si){var o=i-r[t];return r[t]=i,o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){if(i=Number(i),!n(r[t]))return r[t]=i,i;if(r[t]0?Number(h):f;else if("string"!=typeof h)u.size=f;else{var d=h.charAt(0),p=h.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==i||"M"!==d||p!==Math.round(p))&&(u.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=!((u.start||0===u.start)&&(u.end||0===u.end))),t[g]||delete t["nbins"+r]}},{"../../constants/numerical":330,"../../lib":346,"fast-isnumeric":68}],461:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,a=0;ak&&g.splice(k,g.length-k),v.length>k&&v.splice(k,v.length-k),!e.autobinx&&"xbins"in e||(e.xbins=a.autoBin(g,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(a.tickIncrement(x(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(a.tickIncrement(x(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=a.autoBin(v,m,e.nbinsy,"2d",b),"histogram2dcontour"===e.type&&(e.ybins.start=A(a.tickIncrement(_(e.ybins.start),e.ybins.size,!0,b)),e.ybins.end=A(a.tickIncrement(_(e.ybins.end),e.ybins.size,!1,b))),e._input.ybins=e.ybins),h=[];var M,T,E=[],L=[],S="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,O=S?[]:e.xbins,I=C?[]:e.ybins,R=0,D=[],P=e.histnorm,z=e.histfunc,N=-1!==P.indexOf("density"),F="max"===z||"min"===z,B=F?null:0,j=i.count,H=o[P],U=!1,V=[],G=[],q="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";q&&"count"!==z&&(U="avg"===z,j=i[z]);var X=e.xbins,Y=x(X.start),W=x(X.end)+(Y-a.tickIncrement(Y,X.size,!1,y))/1e6;for(d=Y;d=0&&M=0&&T<$&&(R+=j(M,d,h[T],q,D[T]));if(U)for(T=0;T<$;T++)R+=s(h[T],D[T]);if(H)for(T=0;T<$;T++)H(h[T],R,V,G[T]);return{x:g,x0:r,dx:u,y:v,y0:c,dy:f,z:h}}},{"../../lib":346,"../../plots/cartesian/axes":384,"../histogram/average":458,"../histogram/bin_functions":459,"../histogram/clean_bins":460,"../histogram/norm_functions":461}],463:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),a=t("../../components/colorbar/attributes"),i=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendDeep,u=t("../../lib/extend").extendFlat;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]}},labelfont:u({},s,{}),tickfont:u({},s,{}),rangefont:u({},s,{}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string"},tickvals:o.tickvals,ticktext:o.ticktext,tickformat:{valType:"string",dflt:"3s"},visible:{valType:"boolean",dflt:!0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},constraintrange:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},values:{valType:"data_array",dflt:[]}},line:u({},l({},n("line"),{colorscale:l({},n("line").colorscale,{dflt:i.Viridis}),autocolorscale:l({},n("line").autocolorscale,{dflt:!1})}),{showscale:{valType:"boolean",dflt:!1},colorbar:a})}},{"../../components/colorbar/attributes":231,"../../components/colorscale/color_attributes":237,"../../components/colorscale/scales":248,"../../lib/extend":340,"../../plots/cartesian/layout_attributes":395,"../../plots/font_attributes":408}],464:[function(t,e,r){"use strict";var n=t("d3"),a=t("../../plots/plots"),i=t("./plot"),o=t("../../constants/xmlns_namespaces"),s=t("./constants");r.name="parcoords",r.attr="type",r.plot=function(t){var e=a.getSubplotCalcData(t.calcdata,"parcoords","parcoords");e.length&&i(t,e)},r.clean=function(t,e,r,n){var a=n._has&&n._has("parcoords"),i=e._has&&e._has("parcoords");a&&!i&&(n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){function e(e){var n=this,a=n.toDataURL("image/png"),i=r.append("svg:image"),l=t._fullLayout._size,u=t._fullData[e.model.key].domain;i.attr({xmlns:o.svg,"xlink:href":a,x:l.l+l.w*u.x[0]-s.overdrag,y:l.t+l.h*(1-u.y[1]),width:(u.x[1]-u.x[0])*l.w+2*s.overdrag,height:(u.y[1]-u.y[0])*l.h,preserveAspectRatio:"none"})}var r=t._fullLayout._glimages,a=n.selectAll(".svg-container");a.filter(function(t,e){return e===a.size()-1}).selectAll(".parcoords-lines.context, .parcoords-lines.focus").each(e),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":332,"../../plots/plots":417,"./constants":467,"./plot":472,d3:62}],465:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("../../lib");e.exports=function(t,e){var r=!!e.line.colorscale&&i.isArray(e.line.color),o=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),s=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&a(e,e.line.color,"line","c"),[{lineColor:o,cscale:s}]}},{"../../components/colorscale/calc":236,"../../components/colorscale/has_colorscale":243,"../../lib":346}],466:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.line,u="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+u).remove(),void 0===l||!l.showscale)return void i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.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":233,"../../components/colorscale":244,"../../lib":346,"../../plots/plots":417,"fast-isnumeric":68}],467:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0}}},{}],468:[function(t,e,r){"use strict";function n(t,e,r,n,a){a("line.color",r),s(t,"line")&&i.isArray(t.line.color)?(a("line.colorscale"),l(t,e,n,a,{prefix:"line.",cLetter:"c"})):a("line.color",r)}function a(t,e){function r(t,e){return i.coerce(n,a,o.dimensions,t,e)}var n,a,s,l=t.dimensions||[],c=e.dimensions=[],f=1/0;for(l.length>u&&(i.log("parcoords traces support up to "+u+" dimensions at the moment"),l.splice(u)),s=0;s0);d&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),f=Math.min(f,a.values.length)),a._index=s,c.push(a)}if(isFinite(f))for(s=0;sf&&(a.values=a.values.slice(0,f));return c}var i=t("../../lib"),o=t("./attributes"),s=t("../../components/colorscale/has_colorscale"),l=t("../../components/colorscale/defaults"),u=t("./constants").maxDimensionCount;e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}var u=a(t,e);n(t,e,r,s,l),l("domain.x"),l("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var c={family:s.font.family,size:Math.round(s.font.size*(10/12)),color:s.font.color};i.coerceFont(l,"labelfont",c),i.coerceFont(l,"tickfont",c),i.coerceFont(l,"rangefont",c)}},{"../../components/colorscale/defaults":239,"../../components/colorscale/has_colorscale":243,"../../lib":346,"./attributes":463,"./constants":467}],469:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","noOpacity"],n.meta={},e.exports=n},{"./attributes":463,"./base_plot":464,"./calc":465,"./colorbar":466,"./defaults":468,"./plot":472}],470:[function(t,e,r){"use strict";function n(t){t.read({x:0,y:0,width:1,height:1,data:x})}function a(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST),i.scissor(e,r,n,a),t.clear({color:[0,0,0,0],depth:1})}function i(t,e,r,i,o,s){function l(n){var c;c=Math.min(i,o-n*i),s.offset=v*n*i,s.count=v*c,0===n&&(window.cancelAnimationFrame(r.currentRafs[u]),delete r.currentRafs[u],a(t,s.scissorX,s.scissorY,s.scissorWidth,s.viewBoxSize[1])),r.clearOnly||(e(s),n*i+c>>8*e)%256/255}function u(t,e,r,n){for(var a=[],i=0;i=m-4?l(i,m-2-s):.5);return a}function c(t,e,r){var n,a,i,o=[];for(a=0;ah&&(h=t[l].dim2.canvasX,c=l),t[l].dim1.canvasXa)return i;a=o,i=n[r]}return n[n.length-1]}function l(t,e,r){var n=o(r);return r.tickvals?_.scale.ordinal().domain(r.tickvals).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):_.scale.linear().domain(n).range([t-e,e])}function u(t,e){return _.scale.linear().range([t-e,e])}function c(t){return _.scale.linear().domain(o(t))}function f(t){var e=o(t);return t.tickvals&&_.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}function h(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}),n=r.map(function(t){return _.rgb(t)}),a=function(t){return function(e){return e[t]}},i="rgb".split("").map(function(t){return _.scale.linear().clamp(!0).domain(e).range(n.map(a(t)))});return function(t){return i.map(function(e){return e(t)})}}function d(t){return t[0]}function p(t,e,r){var n=d(e),a=n.trace,o=n.lineColor,s=n.cscale,l=a.line,u=a.domain,f=a.dimensions,p=t.width,g=a.labelfont,m=a.tickfont,v=a.rangefont,y=x.extendDeep({},l,{color:o.map(c({values:o,range:[l.cmin,l.cmax]})),blockLineCount:b.blockLineCount,canvasOverdrag:b.overdrag*b.canvasPixelRatio}),_=Math.floor(p*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),A=t.margin||{l:80,r:80,t:100,b:80},k=_,M=w;return{key:r,colCount:f.filter(i).length,dimensions:f,tickDistance:b.tickDistance,unitToColor:h(s),lines:y,labelFont:g,tickFont:m,rangeFont:v,translateX:u.x[0]*p,translateY:t.height-u.y[1]*t.height,pad:A,canvasWidth:k*b.canvasPixelRatio+2*y.canvasOverdrag,canvasHeight:M*b.canvasPixelRatio,width:k,height:M,canvasPixelRatio:b.canvasPixelRatio}}function g(t){var e=t.width,r=t.height,n=t.dimensions,a=t.canvasPixelRatio,o=function(r){return e*r/Math.max(1,t.colCount-1)},s=b.verticalPadding/(r*a),h=1-2*s,d=function(t){return s+h*t},p={key:t.key,xScale:o,model:t},g={};return p.dimensions=n.filter(i).map(function(e,n){var i=c(e),s=g[e.label];return g[e.label]=(s||0)+1,{key:e.label+(s?"__"+s:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:b.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(i).map(d),xScale:o,x:o(n),canvasX:o(n)*a,unitScale:u(r,b.verticalPadding),domainScale:l(r,b.verticalPadding,e),ordinalScale:f(e),domainToUnitScale:i,filter:e.constraintrange?e.constraintrange.map(i):[0,1],parent:p,model:t}}),p}function m(t){return b.layers.map(function(e){return{key:e,context:"contextLineLayer"===e,pick:"pickLineLayer"===e,viewModel:t,model:t.model}})}function v(t){t.classed("axisExtentText",!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var y=t("./lines"),b=t("./constants"),x=t("../../lib"),_=t("d3"),w=t("../../components/drawing");e.exports=function(t,e,r,i,o){function l(t){var e=t.selectAll("defs").data(a,n);e.enter().append("defs");var r=e.selectAll("#filterBarPattern").data(a,n);r.enter().append("pattern").attr("id","filterBarPattern").attr("patternUnits","userSpaceOnUse"),r.attr("x",-b.bar.width).attr("width",b.bar.capturewidth).attr("height",function(t){return t.model.height});var i=r.selectAll("rect").data(a,n);i.enter().append("rect").attr("shape-rendering","crispEdges"),i.attr("height",function(t){return t.model.height}).attr("width",b.bar.width).attr("x",b.bar.width/2).attr("fill",b.bar.fillcolor).attr("fill-opacity",b.bar.fillopacity).attr("stroke",b.bar.strokecolor).attr("stroke-opacity",b.bar.strokeopacity).attr("stroke-width",b.bar.strokewidth)}function u(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function c(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),a=n.length-1,i=0;i<1;i++)for(var o=0;o=r||s>=n)return;var l=t.lineLayer.readPixel(i,n-1-s),u=0!==l[3],c=u?l[2]+256*(l[1]+256*l[0]):null,f={x:i,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};c!==I&&(u?o.hover(f):o.unhover&&o.unhover(f),I=c)}}),C.style("margin",function(t){var e=t.model.pad;return e.t+"px "+e.r+"px "+e.b+"px "+e.l+"px"}).attr("width",function(t){return t.model.canvasWidth}).attr("height",function(t){return t.model.canvasHeight}).style("width",function(t){return t.model.width+2*b.overdrag+"px"}).style("height",function(t){return t.model.height+"px"}).style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var R=e.selectAll(".parcoords").data(L,n);R.exit().remove(),R.enter().append("g").classed("parcoords",!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(l),R.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var D=R.selectAll(".parcoordsControlView").data(a,n);D.enter().append("g").classed("parcoordsControlView",!0).style("box-sizing","content-box"),D.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var P=D.selectAll(".yAxis").data(function(t){return t.dimensions},n);P.enter().append("g").classed("yAxis",!0).each(function(t){O.dimensions.push(t)}),D.each(function(t){h(P,t)}),C.each(function(t){t.lineLayer=y(this,t.model.lines,t.model.canvasWidth,t.model.canvasHeight,t.viewModel.dimensions,t.viewModel.panels,t.model.unitToColor,t.context,t.pick,b.scatter),t.viewModel[t.key]=t.lineLayer,O.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}),P.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),P.call(_.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;E=!1,T||(t.x=Math.max(-b.overdrag,Math.min(t.model.width+b.overdrag,_.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,P.sort(function(t,e){return t.x-e.x}).each(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio}),h(P,e),P.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),_.select(this).attr("transform","translate("+t.x+", 0)"),P.each(function(r,n,a){a===t.parent.key&&(e.dimensions[n]=r)}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer.render&&e.focusLineLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;if(T)return void("ending"===T&&(T=!1));t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,h(P,e),_.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer&&e.focusLineLayer.render(e.panels),e.pickLineLayer&&e.pickLineLayer.render(e.panels,!0),E=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex}))})),P.exit().remove();var z=P.selectAll(".axisOverlays").data(a,n);z.enter().append("g").classed("axisOverlays",!0),z.selectAll(".axis").remove();var N=z.selectAll(".axis").data(a,n);N.enter().append("g").classed("axis",!0),N.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain(),a=t.ticktext;_.select(this).call(_.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n.map(function(t,e){return a&&a[e]||t}):null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),w.font(N.selectAll("text"),t.model.tickFont)}),N.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),N.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var F=z.selectAll(".axisHeading").data(a,n);F.enter().append("g").classed("axisHeading",!0);var B=F.selectAll(".axisTitle").data(a,n);B.enter().append("text").classed("axisTitle",!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),B.attr("transform","translate(0,"+-b.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){w.font(B,t.model.labelFont)});var j=z.selectAll(".axisExtent").data(a,n);j.enter().append("g").classed("axisExtent",!0);var H=j.selectAll(".axisExtentTop").data(a,n);H.enter().append("g").classed("axisExtentTop",!0),H.attr("transform","translate(0,"+-b.axisExtentOffset+")");var U=H.selectAll(".axisExtentTopText").data(a,n);U.enter().append("text").classed("axisExtentTopText",!0).attr("alignment-baseline","after-edge").call(v),U.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){w.font(U,t.model.rangeFont)});var V=j.selectAll(".axisExtentBottom").data(a,n);V.enter().append("g").classed("axisExtentBottom",!0),V.attr("transform",function(t){return"translate(0,"+(t.model.height+b.axisExtentOffset)+")"});var G=V.selectAll(".axisExtentBottomText").data(a,n);G.enter().append("text").classed("axisExtentBottomText",!0).attr("alignment-baseline","before-edge").call(v),G.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){w.font(G,t.model.rangeFont)});var q=z.selectAll(".axisBrush").data(a,n),X=q.enter().append("g").classed("axisBrush",!0);q.each(function(t){t.brush||(t.brush=_.svg.brush().y(t.unitScale).on("brushstart",A).on("brush",k).on("brushend",M),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),_.select(this).call(t.brush))}),X.selectAll("rect").attr("x",-b.bar.capturewidth/2).attr("width",b.bar.capturewidth),X.selectAll("rect.extent").attr("fill","url(#filterBarPattern)").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),X.selectAll(".resize rect").attr("height",b.bar.handleheight).attr("opacity",0).style("visibility","visible"),X.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",b.bar.handleoverlap-b.bar.handleheight),X.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",b.bar.handleoverlap);var Y=!1,W=!1;return O}},{"../../components/drawing":254,"../../lib":346,"./constants":467,"./lines":470,d3:62}],472:[function(t,e,r){"use strict";var n=t("./parcoords");e.exports=function(t,e){var r=t._fullLayout,a=r._paper,i=r._paperdiv,o={},s={},l=r._size;e.forEach(function(e,r){o[r]=t.data[r].dimensions,s[r]=t.data[r].dimensions.slice()});var u=function(e,r,n){var a=s[e][r],i=a.constraintrange;i&&2===i.length||(i=a.constraintrange=[]),i[0]=n[0],i[1]=n[1],t.emit("plotly_restyle")},c=function(e){t.emit("plotly_hover",e)},f=function(e){t.emit("plotly_unhover",e)},h=function(e,r){function n(t){return!("visible"in t)||t.visible}function a(t,e,r){var n=e.indexOf(r),a=t.indexOf(n);return-1===a&&(a+=e.length),a}var i=function(t){return function(e,n){return a(r,t,e)-a(r,t,n)}}(s[e].filter(n));o[e].sort(i),s[e].filter(function(t){return!n(t)}).sort(function(t){return s[e].indexOf(t)}).forEach(function(t){o[e].splice(o[e].indexOf(t),1),o[e].splice(s[e].indexOf(t),0,t)}),t.emit("plotly_restyle")};n(i,a,e,{width:l.w,height:l.h,margin:{t:l.t,r:l.r,b:l.b,l:l.l}},{filterChanged:u,hover:c,unhover:f,axesMoved:h})}},{"./parcoords":471}],473:[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 i=r.marker.line.width||0;Array.isArray(i)&&(i=i[e.i]||0),t.style({"stroke-width":i}).call(n.fill,e.color).call(n.stroke,a)}},{"../../components/color":230}],474:[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":503}],475:[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=i(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}function a(t,e){var r=new n(t,e.uid);return r.update(e),r}var i=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.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=s(t,{})},u.updateFast=function(t){var e,r,n,a,i,s,l=this.xData=this.pickXData=t.x,u=this.yData=this.pickYData=t.y,c=this.pickXYData=t.xy,f=t.xbounds&&t.ybounds,h=t.indices,d=this.bounds;if(c){if(n=c,e=c.length>>>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]=a),id[3]&&(d[3]=i);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=a),id[3]&&(d[3]=i);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){v=l.length<100||u.length<100}this.pointcloudOptions.blend=v,g[3]*=m,this.pointcloudOptions.borderColor=g;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},u.expandAxesFast=function(t,e){for(var r,n,a,i=e||.5,o=0;o<2;o++)r=this.scene[l[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:i}),a=r._max,a||(a=[]),a.push({val:t[o+2],pad:i})},u.dispose=function(){this.pointcloud.dispose()},e.exports=a},{"../../lib/str2rgbarray":364,"../scatter/get_trace_color":487,"gl-pointcloud2d":111}],476:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes");e.exports=function(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("x"),i("y"),i("xbounds"),i("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),i("text"),i("marker.color",r),i("marker.opacity"),i("marker.blend"),i("marker.sizemin"),i("marker.sizemax"),i("marker.border.color",r),i("marker.border.arearatio")}},{"../../lib":346,"./attributes":474}],477:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":412,"../scatter3d/calc":502,"./attributes":474,"./convert":475,"./defaults":476}],478:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rg&&d.splice(g,d.length-g),p.length>g&&p.splice(g,p.length-g);var m={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};a.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>g&&u.splice(g,u.length-g)}var b,x=1.6*(e.marker.sizeref||1);b="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=v.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,a.expand(f,d,m),a.expand(h,p,v);var _=new Array(g);for(c=0;c=0;a--){var i=t[a];if("scatter"===i.type&&i.xaxis===r.xaxis&&i.yaxis===r.yaxis){i.opacity=void 0;break}}}}}},{}],482:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),a=t("../../lib"),i=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 i.autoMargin(t,u);var c=l.color,f=l.cmin,h=l.cmax;n(f)||(f=a.aggNums(Math.min,null,c)),n(h)||(h=a.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":233,"../../components/colorscale":244,"../../lib":346,"../../plots/plots":417,"fast-isnumeric":68}],483:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/calc"),i=t("./subtypes");e.exports=function(t){i.hasLines(t)&&n(t,"line")&&a(t,t.line.color,"line","c"),i.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":236,"../../components/colorscale/has_colorscale":243,"./subtypes":499}],484:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],485:[function(t,e,r){"use strict";var n=t("../../lib"),a=t("./attributes"),i=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,i){return n.coerce(t,e,a,r,i)}var m=s(t,e,p,g),v=mU!=D>=U&&(O=S[E-1][0],I=S[E][0],C=O+(I-O)*(U-R)/(D-R),F=Math.min(F,C),B=Math.max(B,C));F=Math.max(F,0),B=Math.min(B,h._length);var V=s.defaultLine;return s.opacity(f.fillcolor)?V=f.fillcolor:s.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:l+10,x0:F,x1:B,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":230,"../../components/errorbars":260,"../../components/fx":271,"../../lib":346,"./get_trace_color":487}],489:[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":394,"./arrays_to_calcdata":478,"./attributes":479,"./calc":480,"./clean_data":481,"./colorbar":482,"./defaults":485,"./hover":488,"./plot":496,"./select":497,"./style":498,"./subtypes":499}],490:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,i,o,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))a(t,e,i,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":239,"../../components/colorscale/has_colorscale":243}],491:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),a=w.c2p(t[e].y);return r!==n&&a!==n&&[r,a]}function a(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*M}var i,o,s,l,u,c,f,h,d,p,g,m,v,y,b,x,_=e.xaxis,w=e.yaxis,A=e.simplify,k=e.connectGaps,M=e.baseTolerance,T=e.linear,E=[],L=.2,S=new Array(t.length),C=0;for(A||(M=L=-1),i=0;ia(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>g?(g=v,l=c,h=!1):v=t.length||!c)break;S[C++]=c,o=c}}else S[C++]=l}E.push(S.slice(0,C))}return E}},{"../../constants/numerical":330}],492:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],493:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,a,i=null,o=0;o0?Math.max(e,a):0}}},{"fast-isnumeric":68}],495:[function(t,e,r){"use strict";var n=t("../../components/color"),a=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",r),a(t,"marker")&&i(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?n.background:n.defaultLine,l("marker.line.color",c),a(t,"marker.line")&&i(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":230,"../../components/colorscale/defaults":239,"../../components/colorscale/has_colorscale":243,"./subtypes":499}],496:[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 a(t,e,r,n,a,h,p){function g(t){return A?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function b(){return!1}function x(e){var r,n,a,i=e[0].trace,u=o.select(this),f=c.hasMarkers(i),h=c.hasText(i),d=y(i),p=b,v=b;f&&(p=i.marker.maxdisplayed||i._needsCull?m:s.identity),h&&(v=i.marker.maxdisplayed||i._needsCull?m:s.identity),n=u.selectAll("path.point"),r=n.data(p,d);var x=r.enter().append("path").classed("point",!0);A&&x.call(l.pointStyle,i,t).call(l.translatePoints,k,M,i).style("opacity",0).transition().style("opacity",1);var _=f&&l.tryColorscale(i.marker,""),w=f&&l.tryColorscale(i.marker,"line");r.order(),r.each(function(e){var r=o.select(this),n=g(r);a=l.translatePoint(e,n,k,M),a?(l.singlePointStyle(e,n,i,_,w,t),i.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):n.remove()}),A?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=u.selectAll("g"),r=n.data(v,d),r.enter().append("g").classed("textpoint",!0).append("text"),r.order(),r.each(function(t){var e=o.select(this),r=g(e.select("text"));(a=l.translatePoint(t,r,k,M))||e.remove()}),r.selectAll("text").call(l.textPointStyle,i,t).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||M.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){g(o.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;i(t,e,r,n,a);var A=!!p&&p.duration>0,k=r.xaxis,M=r.yaxis,T=n[0].trace,E=T.line,L=o.select(h);if(L.call(u.plot,r,p),!0===T.visible){g(L).style("opacity",T.opacity);var S,C,O=T.fill.charAt(T.fill.length-1);"x"!==O&&"y"!==O&&(O=""),n[0].node3=L;var I="",R=[],D=T._prevtrace;D&&(I=D._prevRevpath||"",C=D._nextFill,R=D._polygons);var P,z,N,F,B,j,H,U,V,G="",q="",X=[],Y=[],W=s.noop;if(S=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(C&&C.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(E.shape)?(N=l.steps(E.shape),F=l.steps(E.shape.split("").reverse().join(""))):N=F="spline"===E.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),E.smoothing):l.smoothopen(t,E.smoothing)}:function(t){return"M"+t.join("L")},B=function(t){return F(t.reverse())},X=f(n,{xaxis:k,yaxis:M,connectGaps:T.connectgaps,baseTolerance:Math.max(E.width||1,3)/4,linear:"linear"===E.shape,simplify:E.simplify}),V=T._polygons=new Array(X.length),w=0;w1}),W=function(t){return function(e){if(P=N(e),z=B(e),G?O?(G+="L"+P.substr(1),q=z+"L"+q.substr(1)):(G+="Z"+P,q=z+"Z"+q):(G=P,q=z),c.hasLines(T)&&e.length>1){var r=o.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",P).call(l.lineGroupStyle)).style("opacity",1);else{var a=g(r);a.attr("d",P),l.singleLineStyle(n,a)}}}}}var Z=L.selectAll(".js-line").data(Y);g(Z.exit()).style("opacity",0).remove(),Z.each(W(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),X.length&&(S?j&&U&&(O?("y"===O?j[1]=U[1]=M.c2p(0,!0):"x"===O&&(j[0]=U[0]=k.c2p(0,!0)),g(S).attr("d","M"+U+"L"+j+"L"+G.substr(1)).call(l.singleFillStyle)):g(S).attr("d",G+"Z").call(l.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&G&&I&&("tonext"===T.fill?g(C).attr("d",G+"Z"+I+"Z").call(l.singleFillStyle):g(C).attr("d",G+"L"+I.substr(1)+"Z").call(l.singleFillStyle),T._polygons=T._polygons.concat(R)),T._prevRevpath=q,T._prevPolygons=V);var Q=L.selectAll(".points");_=Q.data([n]),Q.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove()}}function i(t,e,r,n,a){var i=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(i.range,i.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=n[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),m=0;a.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),h(t,e,r),n(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),m){s&&(d=s());o.transition().duration(i.duration).ease(i.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).each(function(){p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)})})}else p.selectAll("g.trace").each(function(n,o){a(t,o,e,n,r,this,i)});g&&f.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":254,"../../components/errorbars":260,"../../lib":346,"../../lib/polygon":356,"./line_points":491,"./link_traces":493,"./subtypes":499,d3:62}],497:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,a,i,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace,h=f.marker,d=!n.hasMarkers(f)&&!n.hasText(f);if(!0===f.visible&&!d){var p=Array.isArray(h.opacity)?1:h.opacity;if(!1===e)for(r=0;r=e.length?a:e[i]);return n}function o(t,e,r){return l(P(t,r),D(e,r),r)}function s(t,e,r,n){var a=k(t,e,n);return a=Array.isArray(a[0])?a:i(y.identity,[a],n),l(a,D(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),a=0;aZ?W-Z:0),!G||V.noBorder||V.noFill?c(this.scatter.options.colors,X,h,j,q):c(this.scatter.options.colors,I,h,0),c(this.scatter.options.borderColors,Y,h,j,q);B?(this.scatter.options.positions=null,this.fancyScatter.update(),this.scatter.options.positions=k):this.fancyScatter.update()}else this.fancyScatter.clear();this.scatter.clear(),this.expandAxesFancy(l,f,F)},R.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var a=0,i=this.xData,s=this.yData;for(n=new Float64Array(2*i.length),r=0;r0) { - throw new Error("cwise: pre() block may not reference array args") - } - if(i < proc.post.args.length && proc.post.args[i].count>0) { - throw new Error("cwise: post() block may not reference array args") - } - } else if(arg_type === "scalar") { - proc.scalarArgs.push(i) - proc.shimArgs.push("scalar" + i) - } else if(arg_type === "index") { - proc.indexArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { - throw new Error("cwise: pre() block may not reference array index") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array index") - } - if(i < proc.post.args.length && proc.post.args[i].count > 0) { - throw new Error("cwise: post() block may not reference array index") - } - } else if(arg_type === "shape") { - proc.shapeArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { - throw new Error("cwise: pre() block may not write to array shape") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array shape") - } - if(i < proc.post.args.length && proc.post.args[i].lvalue) { - throw new Error("cwise: post() block may not write to array shape") - } - } else if(typeof arg_type === "object" && arg_type.offset) { - proc.argTypes[i] = "offset" - proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) - proc.offsetArgIndex.push(i) - } else { - throw new Error("cwise: Unknown argument type " + proc_args[i]) - } - } - - //Make sure at least one array argument was specified - if(proc.arrayArgs.length <= 0) { - throw new Error("cwise: No array arguments specified") - } - - //Make sure arguments are correct - if(proc.pre.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in pre() block") - } - if(proc.body.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in body() block") - } - if(proc.post.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in post() block") - } - - //Check debug flag - proc.debug = !!user_args.printCode || !!user_args.debug - - //Retrieve name - proc.funcName = user_args.funcName || "cwise" - - //Read in block size - proc.blockSize = user_args.blockSize || 64 - - return createThunk(proc) -} - -module.exports = compileCwise +"use strict" + +var createThunk = require("./lib/thunk.js") + +function Procedure() { + this.argTypes = [] + this.shimArgs = [] + this.arrayArgs = [] + this.arrayBlockIndices = [] + this.scalarArgs = [] + this.offsetArgs = [] + this.offsetArgIndex = [] + this.indexArgs = [] + this.shapeArgs = [] + this.funcName = "" + this.pre = null + this.body = null + this.post = null + this.debug = false +} + +function compileCwise(user_args) { + //Create procedure + var proc = new Procedure() + + //Parse blocks + proc.pre = user_args.pre + proc.body = user_args.body + proc.post = user_args.post + + //Parse arguments + var proc_args = user_args.args.slice(0) + proc.argTypes = proc_args + for(var i=0; i0) { + throw new Error("cwise: pre() block may not reference array args") + } + if(i < proc.post.args.length && proc.post.args[i].count>0) { + throw new Error("cwise: post() block may not reference array args") + } + } else if(arg_type === "scalar") { + proc.scalarArgs.push(i) + proc.shimArgs.push("scalar" + i) + } else if(arg_type === "index") { + proc.indexArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { + throw new Error("cwise: pre() block may not reference array index") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array index") + } + if(i < proc.post.args.length && proc.post.args[i].count > 0) { + throw new Error("cwise: post() block may not reference array index") + } + } else if(arg_type === "shape") { + proc.shapeArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { + throw new Error("cwise: pre() block may not write to array shape") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array shape") + } + if(i < proc.post.args.length && proc.post.args[i].lvalue) { + throw new Error("cwise: post() block may not write to array shape") + } + } else if(typeof arg_type === "object" && arg_type.offset) { + proc.argTypes[i] = "offset" + proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) + proc.offsetArgIndex.push(i) + } else { + throw new Error("cwise: Unknown argument type " + proc_args[i]) + } + } + + //Make sure at least one array argument was specified + if(proc.arrayArgs.length <= 0) { + throw new Error("cwise: No array arguments specified") + } + + //Make sure arguments are correct + if(proc.pre.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in pre() block") + } + if(proc.body.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in body() block") + } + if(proc.post.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in post() block") + } + + //Check debug flag + proc.debug = !!user_args.printCode || !!user_args.debug + + //Retrieve name + proc.funcName = user_args.funcName || "cwise" + + //Read in block size + proc.blockSize = user_args.blockSize || 64 + + return createThunk(proc) +} + +module.exports = compileCwise },{"./lib/thunk.js":77}],76:[function(require,module,exports){ -"use strict" - -var uniq = require("uniq") - -// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) -// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. -function innerFill(order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , has_index = proc.indexArgs.length>0 - , code = [] - , vars = [] - , idx=0, pidx=0, i, j - for(i=0; i=0; --i) { // Start at largest stride and work your way inwards - idx = order[i] - code.push(["for(i",i,"=0;i",i," 0) { - code.push(["index[",pidx,"]-=s",pidx].join("")) - } - code.push(["++index[",idx,"]"].join("")) - } - code.push("}") - } - return code.join("\n") -} - -// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. -// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. -// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. -function outerFill(matched, order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , blockSize = proc.blockSize - , has_index = proc.indexArgs.length > 0 - , code = [] - for(var i=0; i0;){"].join("")) // Iterate back to front - code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). - code.push(["s",order[i],"=j",i].join("")) - code.push(["j",i,"=0"].join("")) - code.push(["}else{s",order[i],"=",blockSize].join("")) - code.push(["j",i,"-=",blockSize,"}"].join("")) - if(has_index) { - code.push(["index[",order[i],"]=j",i].join("")) - } - } - for(var i=0; i 0) { - allEqual = allEqual && summary[i] === summary[i-1] - } - } - if(allEqual) { - return summary[0] - } - return summary.join("") -} - -//Generates a cwise operator -function generateCWiseOp(proc, typesig) { - - //Compute dimension - // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. - var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 - var orders = new Array(proc.arrayArgs.length) - var dtypes = new Array(proc.arrayArgs.length) - for(var i=0; i 0) { - vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) - } - if(proc.indexArgs.length > 0) { - // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. - var zeros = new Array(dimension) - for(var i=0; i 3) { - code.push(processBlock(proc.pre, proc, dtypes)) - } - - //Process body - var body = processBlock(proc.body, proc, dtypes) - var matched = countMatches(loopOrders) - if(matched < dimension) { - code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. - } else { - code.push(innerFill(loopOrders[0], proc, body)) - } - - //Inline epilog - if(proc.post.body.length > 3) { - code.push(processBlock(proc.post, proc, dtypes)) - } - - if(proc.debug) { - console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") - } - - var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") - var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) - return f() -} -module.exports = generateCWiseOp +"use strict" -},{"uniq":257}],77:[function(require,module,exports){ -"use strict" - -// The function below is called when constructing a cwise function object, and does the following: -// A function object is constructed which accepts as argument a compilation function and returns another function. -// It is this other function that is eventually returned by createThunk, and this function is the one that actually -// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. -// The compilation passed to the first function object is used for compiling new functions. -// Once this function object is created, it is called with compile as argument, where the first argument of compile -// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). -// So createThunk roughly works like this: -// function createThunk(proc) { -// var thunk = function(compileBound) { -// var CACHED = {} -// return function(arrays and scalars) { -// if (dtype and order of arrays in CACHED) { -// var func = CACHED[dtype and order of arrays] -// } else { -// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) -// } -// return func(arrays and scalars) -// } -// } -// return thunk(compile.bind1(proc)) -// } - -var compile = require("./compile.js") - -function createThunk(proc) { - var code = ["'use strict'", "var CACHED={}"] - var vars = [] - var thunkName = proc.funcName + "_cwise_thunk" - - //Build thunk - code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) - var typesig = [] - var string_typesig = [] - var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). - Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] - var shapeLengthConditions = [], shapeConditions = [] - // Process array arguments - for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) - shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) - shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") - } - } - // Check for shape equality - if (proc.arrayArgs.length > 1) { - code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") - code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") - code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") - code.push("}") - } - // Process scalar arguments - for(var i=0; i0 + , code = [] + , vars = [] + , idx=0, pidx=0, i, j + for(i=0; i 0) { + code.push("var " + vars.join(",")) + } + //Scan loop + for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards + idx = order[i] + code.push(["for(i",i,"=0;i",i," 0) { + code.push(["index[",pidx,"]-=s",pidx].join("")) + } + code.push(["++index[",idx,"]"].join("")) + } + code.push("}") + } + return code.join("\n") +} + +// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. +// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. +// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. +function outerFill(matched, order, proc, body) { + var dimension = order.length + , nargs = proc.arrayArgs.length + , blockSize = proc.blockSize + , has_index = proc.indexArgs.length > 0 + , code = [] + for(var i=0; i0;){"].join("")) // Iterate back to front + code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). + code.push(["s",order[i],"=j",i].join("")) + code.push(["j",i,"=0"].join("")) + code.push(["}else{s",order[i],"=",blockSize].join("")) + code.push(["j",i,"-=",blockSize,"}"].join("")) + if(has_index) { + code.push(["index[",order[i],"]=j",i].join("")) + } + } + for(var i=0; i 0) { + allEqual = allEqual && summary[i] === summary[i-1] + } + } + if(allEqual) { + return summary[0] + } + return summary.join("") +} + +//Generates a cwise operator +function generateCWiseOp(proc, typesig) { + + //Compute dimension + // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. + var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 + var orders = new Array(proc.arrayArgs.length) + var dtypes = new Array(proc.arrayArgs.length) + for(var i=0; i 0) { + vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) + } + if(proc.indexArgs.length > 0) { + // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. + var zeros = new Array(dimension) + for(var i=0; i 0) { + code.push("var " + vars.join(",")) + } + for(var i=0; i 3) { + code.push(processBlock(proc.pre, proc, dtypes)) + } + + //Process body + var body = processBlock(proc.body, proc, dtypes) + var matched = countMatches(loopOrders) + if(matched < dimension) { + code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. + } else { + code.push(innerFill(loopOrders[0], proc, body)) + } + + //Inline epilog + if(proc.post.body.length > 3) { + code.push(processBlock(proc.post, proc, dtypes)) + } + + if(proc.debug) { + console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") + } + + var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") + var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) + return f() +} +module.exports = generateCWiseOp + +},{"uniq":258}],77:[function(require,module,exports){ +"use strict" + +// The function below is called when constructing a cwise function object, and does the following: +// A function object is constructed which accepts as argument a compilation function and returns another function. +// It is this other function that is eventually returned by createThunk, and this function is the one that actually +// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. +// The compilation passed to the first function object is used for compiling new functions. +// Once this function object is created, it is called with compile as argument, where the first argument of compile +// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). +// So createThunk roughly works like this: +// function createThunk(proc) { +// var thunk = function(compileBound) { +// var CACHED = {} +// return function(arrays and scalars) { +// if (dtype and order of arrays in CACHED) { +// var func = CACHED[dtype and order of arrays] +// } else { +// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) +// } +// return func(arrays and scalars) +// } +// } +// return thunk(compile.bind1(proc)) +// } + +var compile = require("./compile.js") + +function createThunk(proc) { + var code = ["'use strict'", "var CACHED={}"] + var vars = [] + var thunkName = proc.funcName + "_cwise_thunk" + + //Build thunk + code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) + var typesig = [] + var string_typesig = [] + var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). + Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] + var shapeLengthConditions = [], shapeConditions = [] + // Process array arguments + for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) + shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) + shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") + } + } + // Check for shape equality + if (proc.arrayArgs.length > 1) { + code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") + code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") + code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") + code.push("}") + } + // Process scalar arguments + for(var i=0; i>=' @@ -35745,7 +35770,7 @@ module.exports = [ , '}' ] -},{}],169:[function(require,module,exports){ +},{}],170:[function(require,module,exports){ var tokenize = require('./index') module.exports = tokenizeString @@ -35760,7 +35785,7 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":163}],170:[function(require,module,exports){ +},{"./index":164}],171:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -35846,7 +35871,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],171:[function(require,module,exports){ +},{}],172:[function(require,module,exports){ "use strict" //High level idea: @@ -36293,7 +36318,7 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":228,"simplicial-complex":238}],172:[function(require,module,exports){ +},{"robust-orientation":229,"simplicial-complex":239}],173:[function(require,module,exports){ "use strict" var bounds = require("binary-search-bounds") @@ -36660,7 +36685,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":34}],173:[function(require,module,exports){ +},{"binary-search-bounds":34}],174:[function(require,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -36672,7 +36697,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],174:[function(require,module,exports){ +},{}],175:[function(require,module,exports){ "use strict" function iota(n) { @@ -36684,7 +36709,7 @@ function iota(n) { } module.exports = iota -},{}],175:[function(require,module,exports){ +},{}],176:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -36707,7 +36732,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],176:[function(require,module,exports){ +},{}],177:[function(require,module,exports){ module.exports = isMobile; function isMobile (ua) { @@ -36721,7 +36746,7 @@ function isMobile (ua) { } -},{}],177:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -36730,7 +36755,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],178:[function(require,module,exports){ +},{}],179:[function(require,module,exports){ 'use strict' module.exports = createTable @@ -36796,7 +36821,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":70}],179:[function(require,module,exports){ +},{"convex-hull":70}],180:[function(require,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -36976,7 +37001,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":180,"gl-mat4/clone":111,"gl-mat4/create":112,"gl-mat4/determinant":113,"gl-mat4/invert":117,"gl-mat4/transpose":127,"gl-vec3/cross":155,"gl-vec3/dot":156,"gl-vec3/length":157,"gl-vec3/normalize":159}],180:[function(require,module,exports){ +},{"./normalize":181,"gl-mat4/clone":112,"gl-mat4/create":113,"gl-mat4/determinant":114,"gl-mat4/invert":118,"gl-mat4/transpose":128,"gl-vec3/cross":156,"gl-vec3/dot":157,"gl-vec3/length":158,"gl-vec3/normalize":160}],181:[function(require,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -36987,7 +37012,7 @@ module.exports = function normalize(out, mat) { out[i] = mat[i] * scale return true } -},{}],181:[function(require,module,exports){ +},{}],182:[function(require,module,exports){ var lerp = require('gl-vec3/lerp') var recompose = require('mat4-recompose') @@ -37040,7 +37065,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":113,"gl-vec3/lerp":158,"mat4-decompose":179,"mat4-recompose":182,"quat-slerp":215}],182:[function(require,module,exports){ +},{"gl-mat4/determinant":114,"gl-vec3/lerp":159,"mat4-decompose":180,"mat4-recompose":183,"quat-slerp":216}],183:[function(require,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -37101,7 +37126,7 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":112,"gl-mat4/fromRotationTranslation":115,"gl-mat4/identity":116,"gl-mat4/multiply":119,"gl-mat4/scale":125,"gl-mat4/translate":126}],183:[function(require,module,exports){ +},{"gl-mat4/create":113,"gl-mat4/fromRotationTranslation":116,"gl-mat4/identity":117,"gl-mat4/multiply":120,"gl-mat4/scale":126,"gl-mat4/translate":127}],184:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -37301,7 +37326,7 @@ function createMatrixCameraController(options) { return new MatrixCameraController(matrix) } -},{"binary-search-bounds":34,"gl-mat4/invert":117,"gl-mat4/lookAt":118,"gl-mat4/rotateX":122,"gl-mat4/rotateY":123,"gl-mat4/rotateZ":124,"gl-mat4/scale":125,"gl-mat4/translate":126,"gl-vec3/normalize":159,"mat4-interpolate":181}],184:[function(require,module,exports){ +},{"binary-search-bounds":34,"gl-mat4/invert":118,"gl-mat4/lookAt":119,"gl-mat4/rotateX":123,"gl-mat4/rotateY":124,"gl-mat4/rotateZ":125,"gl-mat4/scale":126,"gl-mat4/translate":127,"gl-vec3/normalize":160,"mat4-interpolate":182}],185:[function(require,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -37383,7 +37408,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":228}],185:[function(require,module,exports){ +},{"robust-orientation":229}],186:[function(require,module,exports){ 'use strict' module.exports = mouseListen @@ -37590,7 +37615,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":187}],186:[function(require,module,exports){ +},{"mouse-event":188}],187:[function(require,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -37617,7 +37642,7 @@ function getBoundingClientOffset (element) { } } -},{}],187:[function(require,module,exports){ +},{}],188:[function(require,module,exports){ 'use strict' function mouseButtons(ev) { @@ -37679,7 +37704,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],188:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ 'use strict' var toPX = require('to-px') @@ -37721,7 +37746,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":250}],189:[function(require,module,exports){ +},{"to-px":251}],190:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -38137,19 +38162,19 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":255}],190:[function(require,module,exports){ +},{"typedarray-pool":256}],191:[function(require,module,exports){ "use strict" -var fill = require('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":false,"rvalue":true,"count":1},{"name":"_inline_7_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_7_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) +var fill = require('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":false,"rvalue":true,"count":1},{"name":"_inline_4_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_4_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) module.exports = function(array, f) { fill(array, f) return array } -},{"cwise/lib/wrapper":78}],191:[function(require,module,exports){ +},{"cwise/lib/wrapper":78}],192:[function(require,module,exports){ 'use strict' module.exports = gradient @@ -38447,7 +38472,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":75,"dup":82}],192:[function(require,module,exports){ +},{"cwise-compiler":75,"dup":82}],193:[function(require,module,exports){ 'use strict' var warp = require('ndarray-warp') @@ -38477,7 +38502,7 @@ function applyHomography(dest, src, Xi) { }) return dest } -},{"gl-matrix-invert":128,"ndarray-warp":199}],193:[function(require,module,exports){ +},{"gl-matrix-invert":129,"ndarray-warp":200}],194:[function(require,module,exports){ "use strict" function interp1d(arr, x) { @@ -38588,7 +38613,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],194:[function(require,module,exports){ +},{}],195:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -39051,7 +39076,7 @@ exports.equals = compile({ -},{"cwise-compiler":75}],195:[function(require,module,exports){ +},{"cwise-compiler":75}],196:[function(require,module,exports){ "use strict" var ndarray = require("ndarray") @@ -39074,10 +39099,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":196,"ndarray":200}],196:[function(require,module,exports){ +},{"./doConvert.js":197,"ndarray":201}],197:[function(require,module,exports){ module.exports=require('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":75}],197:[function(require,module,exports){ +},{"cwise-compiler":75}],198:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -39806,7 +39831,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":255}],198:[function(require,module,exports){ +},{"typedarray-pool":256}],199:[function(require,module,exports){ "use strict" var compile = require("./lib/compile_sort.js") @@ -39826,19 +39851,19 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":197}],199:[function(require,module,exports){ +},{"./lib/compile_sort.js":198}],200:[function(require,module,exports){ 'use strict' var interp = require('ndarray-linear-interpolate') -var do_warp = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_33_arg4_)}","args":[{"name":"_inline_33_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg4_","lvalue":false,"rvalue":true,"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":false,"rvalue":true,"count":1},{"name":"_inline_34_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_34_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) +var do_warp = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_21_arg4_)}","args":[{"name":"_inline_21_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg4_","lvalue":false,"rvalue":true,"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":false,"rvalue":true,"count":1},{"name":"_inline_22_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_22_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) -var do_warp_1 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_37_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_37_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) +var do_warp_1 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_25_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_25_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) -var do_warp_2 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_40_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_40_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) +var do_warp_2 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_28_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_28_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) -var do_warp_3 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_43_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_43_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) +var do_warp_3 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_31_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_31_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) module.exports = function warp(dest, src, func) { switch(src.shape.length) { @@ -39858,7 +39883,7 @@ module.exports = function warp(dest, src, func) { return dest } -},{"cwise/lib/wrapper":78,"ndarray-linear-interpolate":193}],200:[function(require,module,exports){ +},{"cwise/lib/wrapper":78,"ndarray-linear-interpolate":194}],201:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -40203,7 +40228,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":174,"is-buffer":175}],201:[function(require,module,exports){ +},{"iota-array":175,"is-buffer":176}],202:[function(require,module,exports){ "use strict" var doubleBits = require("double-bits") @@ -40246,7 +40271,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":81}],202:[function(require,module,exports){ +},{"double-bits":81}],203:[function(require,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -40371,7 +40396,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],203:[function(require,module,exports){ +},{}],204:[function(require,module,exports){ 'use strict' module.exports = quatFromFrame @@ -40413,7 +40438,7 @@ function quatFromFrame( } return out } -},{}],204:[function(require,module,exports){ +},{}],205:[function(require,module,exports){ 'use strict' module.exports = createOrbitController @@ -40807,7 +40832,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":203,"filtered-vector":88,"gl-mat4/fromQuat":114,"gl-mat4/invert":117,"gl-mat4/lookAt":118}],205:[function(require,module,exports){ +},{"./lib/quatFromFrame":204,"filtered-vector":88,"gl-mat4/fromQuat":115,"gl-mat4/invert":118,"gl-mat4/lookAt":119}],206:[function(require,module,exports){ /*! * pad-left * @@ -40823,7 +40848,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":221}],206:[function(require,module,exports){ +},{"repeat-string":222}],207:[function(require,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -40834,7 +40859,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],207:[function(require,module,exports){ +},{}],208:[function(require,module,exports){ "use strict" module.exports = permutationSign @@ -40886,7 +40911,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":255}],208:[function(require,module,exports){ +},{"typedarray-pool":256}],209:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -40973,7 +40998,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":173,"typedarray-pool":255}],209:[function(require,module,exports){ +},{"invert-permutation":174,"typedarray-pool":256}],210:[function(require,module,exports){ "use strict" module.exports = planarDual @@ -41104,7 +41129,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":67}],210:[function(require,module,exports){ +},{"compare-angle":67}],211:[function(require,module,exports){ 'use strict' module.exports = trimLeaves @@ -41160,7 +41185,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":83}],211:[function(require,module,exports){ +},{"edges-to-adjacency-list":83}],212:[function(require,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -41365,7 +41390,7 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":210,"edges-to-adjacency-list":83,"planar-dual":209,"point-in-big-polygon":212,"robust-sum":233,"two-product":253,"uniq":257}],212:[function(require,module,exports){ +},{"./lib/trim-leaves":211,"edges-to-adjacency-list":83,"planar-dual":210,"point-in-big-polygon":213,"robust-sum":234,"two-product":254,"uniq":258}],213:[function(require,module,exports){ module.exports = preprocessPolygon var orient = require('robust-orientation')[3] @@ -41517,7 +41542,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":34,"interval-tree-1d":172,"robust-orientation":228,"slab-decomposition":244}],213:[function(require,module,exports){ +},{"binary-search-bounds":34,"interval-tree-1d":173,"robust-orientation":229,"slab-decomposition":245}],214:[function(require,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -41715,7 +41740,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],214:[function(require,module,exports){ +},{}],215:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -41886,6 +41911,10 @@ process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -41897,9 +41926,9 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],215:[function(require,module,exports){ +},{}],216:[function(require,module,exports){ module.exports = require('gl-quat/slerp') -},{"gl-quat/slerp":134}],216:[function(require,module,exports){ +},{"gl-quat/slerp":135}],217:[function(require,module,exports){ 'use strict' var bnadd = require('big-rat/add') @@ -41915,7 +41944,7 @@ function add (a, b) { return r } -},{"big-rat/add":18}],217:[function(require,module,exports){ +},{"big-rat/add":18}],218:[function(require,module,exports){ 'use strict' module.exports = float2rat @@ -41930,7 +41959,7 @@ function float2rat(v) { return result } -},{"big-rat":21}],218:[function(require,module,exports){ +},{"big-rat":21}],219:[function(require,module,exports){ 'use strict' var rat = require('big-rat') @@ -41948,7 +41977,7 @@ function muls(a, x) { return r } -},{"big-rat":21,"big-rat/mul":30}],219:[function(require,module,exports){ +},{"big-rat":21,"big-rat/mul":30}],220:[function(require,module,exports){ 'use strict' var bnsub = require('big-rat/sub') @@ -41964,7 +41993,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":32}],220:[function(require,module,exports){ +},{"big-rat/sub":32}],221:[function(require,module,exports){ 'use strict' var compareCell = require('compare-cell') @@ -41997,7 +42026,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":53,"compare-cell":68,"compare-oriented-cell":69}],221:[function(require,module,exports){ +},{"cell-orientation":53,"compare-cell":68,"compare-oriented-cell":69}],222:[function(require,module,exports){ /*! * repeat-string * @@ -42069,7 +42098,7 @@ function repeat(str, num) { return res; } -},{}],222:[function(require,module,exports){ +},{}],223:[function(require,module,exports){ (function (global){ module.exports = global.performance && @@ -42080,7 +42109,7 @@ module.exports = } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],223:[function(require,module,exports){ +},{}],224:[function(require,module,exports){ "use strict" module.exports = compressExpansion @@ -42115,7 +42144,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],224:[function(require,module,exports){ +},{}],225:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -42219,7 +42248,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":223,"robust-scale":230,"robust-sum":233,"two-product":253}],225:[function(require,module,exports){ +},{"robust-compress":224,"robust-scale":231,"robust-sum":234,"two-product":254}],226:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -42234,7 +42263,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":233,"two-product":253}],226:[function(require,module,exports){ +},{"robust-sum":234,"two-product":254}],227:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -42402,7 +42431,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":230,"robust-subtract":232,"robust-sum":233,"two-product":253}],227:[function(require,module,exports){ +},{"robust-scale":231,"robust-subtract":233,"robust-sum":234,"two-product":254}],228:[function(require,module,exports){ "use strict" var determinant = require("robust-determinant") @@ -42474,7 +42503,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":224}],228:[function(require,module,exports){ +},{"robust-determinant":225}],229:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -42665,7 +42694,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":230,"robust-subtract":232,"robust-sum":233,"two-product":253}],229:[function(require,module,exports){ +},{"robust-scale":231,"robust-subtract":233,"robust-sum":234,"two-product":254}],230:[function(require,module,exports){ "use strict" var robustSum = require("robust-sum") @@ -42695,7 +42724,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":230,"robust-sum":233}],230:[function(require,module,exports){ +},{"robust-scale":231,"robust-sum":234}],231:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -42746,7 +42775,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":253,"two-sum":254}],231:[function(require,module,exports){ +},{"two-product":254,"two-sum":255}],232:[function(require,module,exports){ "use strict" module.exports = segmentsIntersect @@ -42794,7 +42823,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":228}],232:[function(require,module,exports){ +},{"robust-orientation":229}],233:[function(require,module,exports){ "use strict" module.exports = robustSubtract @@ -42951,7 +42980,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],233:[function(require,module,exports){ +},{}],234:[function(require,module,exports){ "use strict" module.exports = linearExpansionSum @@ -43108,7 +43137,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],234:[function(require,module,exports){ +},{}],235:[function(require,module,exports){ "use strict" module.exports = function signum(x) { @@ -43116,7 +43145,7 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],235:[function(require,module,exports){ +},{}],236:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -43128,7 +43157,7 @@ function boundary(cells) { return reduce(bnd(cells)) } -},{"boundary-cells":37,"reduce-simplicial-complex":220}],236:[function(require,module,exports){ +},{"boundary-cells":37,"reduce-simplicial-complex":221}],237:[function(require,module,exports){ 'use strict' module.exports = extractContour @@ -43291,7 +43320,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":237,"ndarray":200,"ndarray-sort":198,"typedarray-pool":255}],237:[function(require,module,exports){ +},{"./lib/codegen":238,"ndarray":201,"ndarray-sort":199,"typedarray-pool":256}],238:[function(require,module,exports){ 'use strict' module.exports = getPolygonizer @@ -43388,7 +43417,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":178,"typedarray-pool":255}],238:[function(require,module,exports){ +},{"marching-simplex-table":179,"typedarray-pool":256}],239:[function(require,module,exports){ "use strict"; "use restrict"; var bits = require("bit-twiddle") @@ -43732,11 +43761,11 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":35,"union-find":256}],239:[function(require,module,exports){ +},{"bit-twiddle":35,"union-find":257}],240:[function(require,module,exports){ arguments[4][35][0].apply(exports,arguments) -},{"dup":35}],240:[function(require,module,exports){ -arguments[4][238][0].apply(exports,arguments) -},{"bit-twiddle":239,"dup":238,"union-find":241}],241:[function(require,module,exports){ +},{"dup":35}],241:[function(require,module,exports){ +arguments[4][239][0].apply(exports,arguments) +},{"bit-twiddle":240,"dup":239,"union-find":242}],242:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -43793,7 +43822,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],242:[function(require,module,exports){ +},{}],243:[function(require,module,exports){ "use strict" module.exports = simplifyPolygon @@ -44065,7 +44094,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":228,"simplicial-complex":240}],243:[function(require,module,exports){ +},{"robust-orientation":229,"simplicial-complex":241}],244:[function(require,module,exports){ "use strict" module.exports = orderSegments @@ -44161,7 +44190,7 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":228}],244:[function(require,module,exports){ +},{"robust-orientation":229}],245:[function(require,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -44392,7 +44421,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":243,"binary-search-bounds":34,"functional-red-black-tree":89,"robust-orientation":228}],245:[function(require,module,exports){ +},{"./lib/order-segments":244,"binary-search-bounds":34,"functional-red-black-tree":89,"robust-orientation":229}],246:[function(require,module,exports){ "use strict" var robustDot = require("robust-dot-product") @@ -44484,44 +44513,52 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":225,"robust-sum":233}],246:[function(require,module,exports){ -(function(window) { +},{"robust-dot-product":226,"robust-sum":234}],247:[function(require,module,exports){ +/* global window, exports, define */ + +!function() { + 'use strict' + var re = { not_string: /[^s]/, + not_bool: /[^t]/, + not_type: /[^T]/, + not_primitive: /[^v]/, number: /[diefg]/, + numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[\+\-]/ } - function sprintf() { - var key = arguments[0], cache = sprintf.cache - if (!(cache[key] && cache.hasOwnProperty(key))) { - cache[key] = sprintf.parse(key) - } - return sprintf.format.call(null, cache[key], arguments) + function sprintf(key) { + // `arguments` is not an array, but should be fine for this call + return sprintf_format(sprintf_parse(key), arguments) + } + + function vsprintf(fmt, argv) { + return sprintf.apply(null, [fmt].concat(argv || [])) } - sprintf.format = function(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + function sprintf_format(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign for (i = 0; i < tree_length; i++) { - node_type = get_type(parse_tree[i]) - if (node_type === "string") { - output[output.length] = parse_tree[i] + if (typeof parse_tree[i] === 'string') { + output += parse_tree[i] } - else if (node_type === "array") { + else if (Array.isArray(parse_tree[i])) { match = parse_tree[i] // convenience purposes only if (match[2]) { // keyword argument arg = argv[cursor] for (k = 0; k < match[2].length; k++) { if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) } arg = arg[match[2][k]] } @@ -44533,12 +44570,12 @@ function negative(points, plane) { arg = argv[cursor++] } - if (get_type(arg) == "function") { + if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) { arg = arg() } - if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { - throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) { + throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) } if (re.number.test(match[8])) { @@ -44546,96 +44583,113 @@ function negative(points, plane) { } switch (match[8]) { - case "b": - arg = arg.toString(2) - break - case "c": - arg = String.fromCharCode(arg) - break - case "d": - case "i": + case 'b': + arg = parseInt(arg, 10).toString(2) + break + case 'c': + arg = String.fromCharCode(parseInt(arg, 10)) + break + case 'd': + case 'i': arg = parseInt(arg, 10) - break - case "j": + break + case 'j': arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) - break - case "e": - arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() - break - case "f": + break + case 'e': + arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() + break + case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) - break - case "g": - arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) - break - case "o": - arg = arg.toString(8) - break - case "s": - arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) - break - case "u": - arg = arg >>> 0 - break - case "x": - arg = arg.toString(16) - break - case "X": - arg = arg.toString(16).toUpperCase() - break + break + case 'g': + arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg) + break + case 'o': + arg = (parseInt(arg, 10) >>> 0).toString(8) + break + case 's': + arg = String(arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 't': + arg = String(!!arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'T': + arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'u': + arg = parseInt(arg, 10) >>> 0 + break + case 'v': + arg = arg.valueOf() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'x': + arg = (parseInt(arg, 10) >>> 0).toString(16) + break + case 'X': + arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() + break } if (re.json.test(match[8])) { - output[output.length] = arg + output += arg } else { if (re.number.test(match[8]) && (!is_positive || match[3])) { - sign = is_positive ? "+" : "-" - arg = arg.toString().replace(re.sign, "") + sign = is_positive ? '+' : '-' + arg = arg.toString().replace(re.sign, '') } else { - sign = "" + sign = '' } - pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' pad_length = match[6] - (sign + arg).length - pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" - output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' + output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) } } } - return output.join("") + return output } - sprintf.cache = {} + var sprintf_cache = Object.create(null) + + function sprintf_parse(fmt) { + if (sprintf_cache[fmt]) { + return sprintf_cache[fmt] + } - sprintf.parse = function(fmt) { - var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + var _fmt = fmt, match, parse_tree = [], arg_names = 0 while (_fmt) { if ((match = re.text.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = match[0] + parse_tree.push(match[0]) } else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = "%" + parse_tree.push('%') } else if ((match = re.placeholder.exec(_fmt)) !== null) { if (match[2]) { arg_names |= 1 var field_list = [], replacement_field = match[2], field_match = [] if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + field_list.push(field_match[1]) + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } } } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } match[2] = field_list } @@ -44643,58 +44697,43 @@ function negative(points, plane) { arg_names |= 2 } if (arg_names === 3) { - throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') } - parse_tree[parse_tree.length] = match + parse_tree.push(match) } else { - throw new SyntaxError("[sprintf] unexpected placeholder") + throw new SyntaxError('[sprintf] unexpected placeholder') } _fmt = _fmt.substring(match[0].length) } - return parse_tree - } - - var vsprintf = function(fmt, argv, _argv) { - _argv = (argv || []).slice(0) - _argv.splice(0, 0, fmt) - return sprintf.apply(null, _argv) - } - - /** - * helpers - */ - function get_type(variable) { - return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() - } - - function str_repeat(input, multiplier) { - return Array(multiplier + 1).join(input) + return sprintf_cache[fmt] = parse_tree } /** * export to either browser or node.js */ - if (typeof exports !== "undefined") { - exports.sprintf = sprintf - exports.vsprintf = vsprintf + /* eslint-disable quote-props */ + if (typeof exports !== 'undefined') { + exports['sprintf'] = sprintf + exports['vsprintf'] = vsprintf } - else { - window.sprintf = sprintf - window.vsprintf = vsprintf + if (typeof window !== 'undefined') { + window['sprintf'] = sprintf + window['vsprintf'] = vsprintf - if (typeof define === "function" && define.amd) { + if (typeof define === 'function' && define['amd']) { define(function() { return { - sprintf: sprintf, - vsprintf: vsprintf + 'sprintf': sprintf, + 'vsprintf': vsprintf } }) } } -})(typeof window === "undefined" ? this : window); + /* eslint-enable quote-props */ +}() -},{}],247:[function(require,module,exports){ +},{}],248:[function(require,module,exports){ 'use strict' module.exports = toSuperScript @@ -44749,7 +44788,7 @@ function toSuperScript(x) { }).join('') } -},{}],248:[function(require,module,exports){ +},{}],249:[function(require,module,exports){ "use strict" module.exports = surfaceNets @@ -44957,7 +44996,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":189,"triangulate-hypercube":251,"zero-crossings":266}],249:[function(require,module,exports){ +},{"ndarray-extract-contour":190,"triangulate-hypercube":252,"zero-crossings":267}],250:[function(require,module,exports){ // TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -46154,7 +46193,7 @@ else { })(Math); -},{}],250:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ 'use strict' var parseUnit = require('parse-unit') @@ -46215,7 +46254,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":206}],251:[function(require,module,exports){ +},{"parse-unit":207}],252:[function(require,module,exports){ "use strict" module.exports = triangulateCube @@ -46249,7 +46288,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":90,"permutation-parity":207,"permutation-rank":208}],252:[function(require,module,exports){ +},{"gamma":90,"permutation-parity":208,"permutation-rank":209}],253:[function(require,module,exports){ 'use strict' module.exports = createTurntableController @@ -46822,7 +46861,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":88,"gl-mat4/invert":117,"gl-mat4/rotate":121,"gl-vec3/cross":155,"gl-vec3/dot":156,"gl-vec3/normalize":159}],253:[function(require,module,exports){ +},{"filtered-vector":88,"gl-mat4/invert":118,"gl-mat4/rotate":122,"gl-vec3/cross":156,"gl-vec3/dot":157,"gl-vec3/normalize":160}],254:[function(require,module,exports){ "use strict" module.exports = twoProduct @@ -46856,7 +46895,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],254:[function(require,module,exports){ +},{}],255:[function(require,module,exports){ "use strict" module.exports = fastTwoSum @@ -46874,7 +46913,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],255:[function(require,module,exports){ +},{}],256:[function(require,module,exports){ (function (global,Buffer){ 'use strict' @@ -47091,7 +47130,7 @@ exports.clearCache = function clearCache() { } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bit-twiddle":35,"buffer":45,"dup":82}],256:[function(require,module,exports){ +},{"bit-twiddle":35,"buffer":45,"dup":82}],257:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -47154,7 +47193,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],257:[function(require,module,exports){ +},{}],258:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -47213,7 +47252,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],258:[function(require,module,exports){ +},{}],259:[function(require,module,exports){ "use strict" module.exports = createText @@ -47240,7 +47279,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":259}],259:[function(require,module,exports){ +},{"./lib/vtext":260}],260:[function(require,module,exports){ "use strict" module.exports = vectorizeText @@ -47446,7 +47485,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":47,"clean-pslg":57,"ndarray":200,"planar-graph-to-polyline":211,"simplify-planar-graph":242,"surface-nets":248}],260:[function(require,module,exports){ +},{"cdt2d":47,"clean-pslg":57,"ndarray":201,"planar-graph-to-polyline":212,"simplify-planar-graph":243,"surface-nets":249}],261:[function(require,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -48133,7 +48172,7 @@ function vectorizeText(str, canvas, context, options) { } })(); -},{}],261:[function(require,module,exports){ +},{}],262:[function(require,module,exports){ var hiddenStore = require('./hidden-store.js'); module.exports = createStore; @@ -48154,7 +48193,7 @@ function createStore() { }; } -},{"./hidden-store.js":262}],262:[function(require,module,exports){ +},{"./hidden-store.js":263}],263:[function(require,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -48172,7 +48211,7 @@ function hiddenStore(obj, key) { return store; } -},{}],263:[function(require,module,exports){ +},{}],264:[function(require,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -48203,14 +48242,14 @@ function weakMap() { } } -},{"./create-store.js":261}],264:[function(require,module,exports){ +},{"./create-store.js":262}],265:[function(require,module,exports){ var getContext = require('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":91}],265:[function(require,module,exports){ +},{"get-canvas-context":91}],266:[function(require,module,exports){ module.exports = require('cwise-compiler')({ args: ['array', { offset: [1], @@ -48262,7 +48301,7 @@ module.exports = require('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":75}],266:[function(require,module,exports){ +},{"cwise-compiler":75}],267:[function(require,module,exports){ "use strict" module.exports = findZeroCrossings @@ -48275,7 +48314,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":265}],267:[function(require,module,exports){ +},{"./lib/zc-core":266}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48288,9 +48327,8 @@ function findZeroCrossings(array, level) { 'use strict'; var Lib = require('../../lib'); -var Color = require('../color'); var Axes = require('../../plots/cartesian/axes'); - +var handleAnnotationCommonDefaults = require('./common_defaults'); var attributes = require('./attributes'); @@ -48307,26 +48345,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op if(!(visible || clickToShow)) return annOut; - coerce('opacity'); - var bgColor = coerce('bgcolor'); - - var borderColor = coerce('bordercolor'), - borderOpacity = Color.opacity(borderColor); - - coerce('borderpad'); - - var borderWidth = coerce('borderwidth'); - var showArrow = coerce('showarrow'); - - coerce('text', showArrow ? ' ' : 'new text'); - coerce('textangle'); - Lib.coerceFont(coerce, 'font', fullLayout.font); - - coerce('width'); - coerce('align'); + handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); - var h = coerce('height'); - if(h) coerce('valign'); + var showArrow = annOut.showarrow; // positioning var axLetters = ['x', 'y'], @@ -48368,14 +48389,8 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + // if you have one part of arrow length you should have both if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('standoff'); - - // if you have one part of arrow length you should have both Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); } @@ -48385,34 +48400,18 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // put the actual click data to bind to into private attributes // so we don't have to do this little bit of logic on every hover event - annOut._xclick = (xClick === undefined) ? annOut.x : xClick; - annOut._yclick = (yClick === undefined) ? annOut.y : yClick; + annOut._xclick = (xClick === undefined) ? + annOut.x : + Axes.cleanPosition(xClick, gdMock, annOut.xref); + annOut._yclick = (yClick === undefined) ? + annOut.y : + Axes.cleanPosition(yClick, gdMock, annOut.yref); } - var hoverText = coerce('hovertext'); - var globalHoverLabel = fullLayout.hoverlabel || {}; - - if(hoverText) { - var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || - (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) - ); - - var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || - Color.contrast(hoverBG) - ); - - Lib.coerceFont(coerce, 'hoverlabel.font', { - family: globalHoverLabel.font.family, - size: globalHoverLabel.font.size, - color: globalHoverLabel.font.color || hoverBorder - }); - } - coerce('captureevents', !!hoverText); - return annOut; }; -},{"../../lib":393,"../../plots/cartesian/axes":430,"../color":278,"./attributes":269}],268:[function(require,module,exports){ +},{"../../lib":401,"../../plots/cartesian/axes":438,"./attributes":270,"./common_defaults":273}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48477,7 +48476,7 @@ module.exports = [ } ]; -},{}],269:[function(require,module,exports){ +},{}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48757,7 +48756,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/cartesian/constants":435,"../../plots/font_attributes":454,"./arrow_paths":268}],270:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/cartesian/constants":443,"../../plots/font_attributes":462,"./arrow_paths":269}],271:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48860,7 +48859,7 @@ function annAutorange(gd) { }); } -},{"../../lib":393,"../../plots/cartesian/axes":430,"./draw":274}],271:[function(require,module,exports){ +},{"../../lib":401,"../../plots/cartesian/axes":438,"./draw":276}],272:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48946,18 +48945,22 @@ function getToggleSets(gd, hoverData) { explicitOffSet = [], hoverLen = (hoverData || []).length; - var i, j, anni, showMode, pointj, toggleType; + var i, j, anni, showMode, pointj, xa, ya, toggleType; for(i = 0; i < annotations.length; i++) { anni = annotations[i]; showMode = anni.clicktoshow; + if(showMode) { for(j = 0; j < hoverLen; j++) { pointj = hoverData[j]; - if(pointj.xaxis._id === anni.xref && - pointj.yaxis._id === anni.yref && - pointj.xaxis.d2r(pointj.x) === anni._xclick && - pointj.yaxis.d2r(pointj.y) === anni._yclick + xa = pointj.xaxis; + ya = pointj.yaxis; + + if(xa._id === anni.xref && + ya._id === anni.yref && + xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && + ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) ) { // match! toggle this annotation // regardless of its clicktoshow mode @@ -48985,7 +48988,80 @@ function getToggleSets(gd, hoverData) { return {on: onSet, off: offSet, explicitOff: explicitOffSet}; } -},{"../../plotly":425}],272:[function(require,module,exports){ +// to handle log axes until v2 +function clickData2r(d, ax) { + return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); +} + +},{"../../plotly":433}],273:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Color = require('../color'); + +// defaults common to 'annotations' and 'annotations3d' +module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { + coerce('opacity'); + var bgColor = coerce('bgcolor'); + + var borderColor = coerce('bordercolor'); + var borderOpacity = Color.opacity(borderColor); + + coerce('borderpad'); + + var borderWidth = coerce('borderwidth'); + var showArrow = coerce('showarrow'); + + coerce('text', showArrow ? ' ' : 'new text'); + coerce('textangle'); + Lib.coerceFont(coerce, 'font', fullLayout.font); + + coerce('width'); + coerce('align'); + + var h = coerce('height'); + if(h) coerce('valign'); + + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + coerce('standoff'); + + } + + var hoverText = coerce('hovertext'); + var globalHoverLabel = fullLayout.hoverlabel || {}; + + if(hoverText) { + var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || + (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) + ); + + var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || + Color.contrast(hoverBG) + ); + + Lib.coerceFont(coerce, 'hoverlabel.font', { + family: globalHoverLabel.font.family, + size: globalHoverLabel.font.size, + color: globalHoverLabel.font.color || hoverBorder + }); + } + + coerce('captureevents', !!hoverText); +}; + +},{"../../lib":401,"../color":285}],274:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49048,7 +49124,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":413,"fast-isnumeric":87}],273:[function(require,module,exports){ +},{"../../lib/to_log_range":421,"fast-isnumeric":87}],275:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49073,7 +49149,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":427,"./annotation_defaults":267}],274:[function(require,module,exports){ +},{"../../plots/array_container_defaults":435,"./annotation_defaults":268}],276:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49112,7 +49188,8 @@ var drawArrowHead = require('./draw_arrow_head'); module.exports = { draw: draw, - drawOne: drawOne + drawOne: drawOne, + drawRaw: drawRaw }; /* @@ -49133,37 +49210,61 @@ function draw(gd) { } /* - * drawOne: draw a single annotation, potentially with modifications + * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications * * index (int): the annotation to draw */ function drawOne(gd, index) { - var layout = gd.layout, - fullLayout = gd._fullLayout, - gs = gd._fullLayout._size; + var fullLayout = gd._fullLayout; + var options = fullLayout.annotations[index] || {}; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); - // remove the existing annotation if there is one - fullLayout._infolayer.selectAll('.annotation[data-index="' + index + '"]').remove(); + drawRaw(gd, options, index, false, xa, ya); +} + +/** + * drawRaw: draw a single annotation, potentially with modifications + * + * @param {DOM element} gd + * @param {object} options : this annotation's fullLayout options + * @param {integer} index : index in 'annotations' container of the annotation to draw + * @param {string} subplotId : id of the annotation's subplot + * - use false for 2d (i.e. cartesian or paper-ref) annotations + * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px + * @param {object | undefined} ya : ... y-axis + */ +function drawRaw(gd, options, index, subplotId, xa, ya) { + var fullLayout = gd._fullLayout; + var gs = gd._fullLayout._size; + var className; + var annbase; + + if(subplotId) { + className = 'annotation-' + subplotId; + annbase = subplotId + '.annotations[' + index + ']'; + } else { + className = 'annotation'; + annbase = 'annotations[' + index + ']'; + } - // remember a few things about what was already there, - var optionsIn = (layout.annotations || [])[index], - options = fullLayout.annotations[index]; + // remove the existing annotation if there is one + fullLayout._infolayer + .selectAll('.' + className + '[data-index="' + index + '"]') + .remove(); var annClipID = 'clip' + fullLayout._uid + '_ann' + index; // this annotation is gone - quit now after deleting it // TODO: use d3 idioms instead of deleting and redrawing every time - if(!optionsIn || options.visible === false) { + if(!options._input || options.visible === false) { d3.selectAll('#' + annClipID).remove(); return; } - var xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - - // calculated pixel positions - // x & y each will get text, head, and tail as appropriate - annPosPx = {x: {}, y: {}}, + // calculated pixel positions + // x & y each will get text, head, and tail as appropriate + var annPosPx = {x: {}, y: {}}, textangle = +options.textangle || 0; // create the components @@ -49171,26 +49272,32 @@ function drawOne(gd, index) { // with border/arrow together this could handle a whole bunch of // cleanup at this point, but works for now var annGroup = fullLayout._infolayer.append('g') - .classed('annotation', true) + .classed(className, true) .attr('data-index', String(index)) .style('opacity', options.opacity); // another group for text+background so that they can rotate together var annTextGroup = annGroup.append('g') - .classed('annotation-text-g', true) - .attr('data-index', String(index)); + .classed('annotation-text-g', true); var annTextGroupInner = annTextGroup.append('g') .style('pointer-events', options.captureevents ? 'all' : null) .call(setCursor, 'default') .on('click', function() { gd._dragging = false; - gd.emit('plotly_clickannotation', { + + var eventData = { index: index, - annotation: optionsIn, + annotation: options._input, fullAnnotation: options, event: d3.event - }); + }; + + if(subplotId) { + eventData.subplotId = subplotId; + } + + gd.emit('plotly_clickannotation', eventData); }); if(options.hovertext) { @@ -49213,7 +49320,8 @@ function drawOne(gd, index) { fontColor: hoverFont.color }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); }) .on('mouseout', function() { @@ -49246,8 +49354,7 @@ function drawOne(gd, index) { var font = options.font; var annText = annTextGroupInner.append('text') - .classed('annotation', true) - .attr('data-unformatted', options.text) + .classed('annotation-text', true) .text(options.text); function textLayout(s) { @@ -49259,29 +49366,24 @@ function drawOne(gd, index) { }[options.align] || 'middle' }); - svgTextUtils.convertToTspans(s, drawGraphicalElements); + svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); return s; } function drawGraphicalElements() { // if the text has *only* a link, make the whole box into a link - var anchor = annText.selectAll('a'); - if(anchor.size() === 1 && anchor.text() === annText.text()) { + var anchor3 = annText.selectAll('a'); + if(anchor3.size() === 1 && anchor3.text() === annText.text()) { var wholeLink = annTextGroupInner.insert('a', ':first-child').attr({ - 'xlink:xlink:href': anchor.attr('xlink:href'), - 'xlink:xlink:show': anchor.attr('xlink:show') + 'xlink:xlink:href': anchor3.attr('xlink:href'), + 'xlink:xlink:show': anchor3.attr('xlink:show') }) .style({cursor: 'pointer'}); wholeLink.node().appendChild(annTextBG.node()); } - - // make sure lines are aligned the way they will be - // at the end, even if their position changes - annText.selectAll('tspan.line').attr({y: 0, x: 0}); - - var mathjaxGroup = annTextGroupInner.select('.annotation-math-group'); + var mathjaxGroup = annTextGroupInner.select('.annotation-text-math-group'); var hasMathjax = !mathjaxGroup.empty(); var anntextBB = Drawing.bBox( (hasMathjax ? mathjaxGroup : annText).node()); @@ -49314,10 +49416,13 @@ function drawOne(gd, index) { } var annotationIsOffscreen = false; - ['x', 'y'].forEach(function(axLetter) { - var axRef = options[axLetter + 'ref'] || axLetter, + var letters = ['x', 'y']; + + for(var i = 0; i < letters.length; i++) { + var axLetter = letters[i], + axRef = options[axLetter + 'ref'] || axLetter, tailRef = options['a' + axLetter + 'ref'], - ax = Axes.getFromId(gd, axRef), + ax = {x: xa, y: ya}[axLetter], dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, // note that these two can be either positive or negative annSizeFromWidth = outerWidth * Math.cos(dimAngle), @@ -49357,7 +49462,7 @@ function drawOne(gd, index) { annotationIsOffscreen = true; } - if(annotationIsOffscreen) return; + if(annotationIsOffscreen) continue; } basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; @@ -49439,7 +49544,7 @@ function drawOne(gd, index) { // size/shift are used during dragging options['_' + axLetter + 'size'] = annSize; options['_' + axLetter + 'shift'] = textShift; - }); + } if(annotationIsOffscreen) { annTextGroupInner.remove(); @@ -49464,14 +49569,11 @@ function drawOne(gd, index) { .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } else { - var texty = borderfull + yShift - anntextBB.top, - textx = borderfull + xShift - anntextBB.left; - annText.attr({ - x: textx, - y: texty - }) - .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); - annText.selectAll('tspan.line').attr({y: texty, x: textx}); + var texty = borderfull + yShift - anntextBB.top; + var textx = borderfull + xShift - anntextBB.left; + + annText.call(svgTextUtils.positionText, textx, texty) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } annTextClip.select('rect').call(Drawing.setRect, borderfull, borderfull, @@ -49493,8 +49595,6 @@ function drawOne(gd, index) { annTextGroup.attr({transform: 'rotate(' + textangle + ',' + annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - var annbase = 'annotations[' + index + ']'; - /* * add the arrow * uses options[arrowwidth,arrowcolor,arrowhead] for styling @@ -49502,8 +49602,8 @@ function drawOne(gd, index) { * while the head stays put, dx and dy are the pixel offsets */ var drawArrow = function(dx, dy) { - d3.select(gd) - .selectAll('.annotation-arrow-g[data-index="' + index + '"]') + annGroup + .selectAll('.annotation-arrow-g') .remove(); var headX = annPosPx.x.head, @@ -49560,8 +49660,7 @@ function drawOne(gd, index) { var arrowGroup = annGroup.append('g') .style({opacity: Color.opacity(arrowColor)}) - .classed('annotation-arrow-g', true) - .attr('data-index', String(index)); + .classed('annotation-arrow-g', true); var arrow = arrowGroup.append('path') .attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) @@ -49572,7 +49671,7 @@ function drawOne(gd, index) { // the arrow dragger is a small square right at the head, then a line to the tail, // all expanded by a stroke width of 6px plus the arrow line width - if(gd._context.editable && arrow.node().parentNode) { + if(gd._context.editable && arrow.node().parentNode && !subplotId) { var arrowDragHeadX = headX; var arrowDragHeadY = headY; if(options.standoff) { @@ -49581,10 +49680,9 @@ function drawOne(gd, index) { arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; } var arrowDrag = arrowGroup.append('path') - .classed('annotation', true) + .classed('annotation-arrow', true) .classed('anndrag', true) .attr({ - 'data-index': String(index), d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' }) @@ -49600,6 +49698,7 @@ function drawOne(gd, index) { // (head/tail/text) all together dragElement.init({ element: arrowDrag.node(), + gd: gd, prepFn: function() { var pos = Drawing.getTranslate(annTextGroupInner); @@ -49662,6 +49761,7 @@ function drawOne(gd, index) { // textbox and tail, leave the head untouched dragElement.init({ element: annTextGroupInner.node(), + gd: gd, prepFn: function() { baseTextTransform = annTextGroup.attr('transform'); update = {}; @@ -49683,7 +49783,7 @@ function drawOne(gd, index) { drawArrow(dx, dy); } - else { + else if(!subplotId) { if(xa) update[annbase + '.x'] = options.x + dx / xa._m; else { var widthFraction = options._xsize / gs.w, @@ -49711,6 +49811,7 @@ function drawOne(gd, index) { ); } } + else return; annTextGroup.attr({ transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform @@ -49731,20 +49832,22 @@ function drawOne(gd, index) { } if(gd._context.editable) { - annText.call(svgTextUtils.makeEditable, annTextGroupInner) + annText.call(svgTextUtils.makeEditable, {delegate: annTextGroupInner, gd: gd}) .call(textLayout) .on('edit', function(_text) { options.text = _text; - this.attr({'data-unformatted': options.text}); this.call(textLayout); + var update = {}; - update['annotations[' + index + '].text'] = options.text; + update[annbase + '.text'] = options.text; + if(xa && xa.autorange) { update[xa._name + '.autorange'] = true; } if(ya && ya.autorange) { update[ya._name + '.autorange'] = true; } + Plotly.relayout(gd, update); }); } @@ -49772,7 +49875,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":393,"../../lib/setcursor":408,"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/cartesian/axes":430,"../../plots/plots":470,"../color":278,"../dragelement":299,"../drawing":302,"../fx":319,"./draw_arrow_head":275,"d3":79}],275:[function(require,module,exports){ +},{"../../lib":401,"../../lib/setcursor":416,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/cartesian/axes":438,"../../plots/plots":478,"../color":285,"../dragelement":306,"../drawing":309,"../fx":326,"./draw_arrow_head":277,"d3":79}],277:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49886,7 +49989,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { function drawhead(p, rot) { if(!headStyle.path) return; if(style > 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -49906,7 +50009,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":278,"../drawing":302,"./arrow_paths":268,"d3":79,"fast-isnumeric":87}],276:[function(require,module,exports){ +},{"../color":285,"../drawing":309,"./arrow_paths":269,"d3":79,"fast-isnumeric":87}],278:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49931,6 +50034,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -49938,7 +50042,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":269,"./calc_autorange":270,"./click":271,"./convert_coords":272,"./defaults":273,"./draw":274}],277:[function(require,module,exports){ +},{"./attributes":270,"./calc_autorange":271,"./click":272,"./convert_coords":274,"./defaults":275,"./draw":276}],279:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":270}],280:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":401,"../../plots/cartesian/axes":438}],281:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":401,"../../plots/array_container_defaults":435,"../../plots/cartesian/axes":438,"../annotations/common_defaults":273,"./attributes":279}],282:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":474,"../annotations/draw":276}],283:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":279,"./convert":280,"./defaults":281,"./draw":282}],284:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49978,7 +50389,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],278:[function(require,module,exports){ +},{}],285:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50149,7 +50560,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":277,"fast-isnumeric":87,"tinycolor2":249}],279:[function(require,module,exports){ +},{"./attributes":284,"fast-isnumeric":87,"tinycolor2":250}],286:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50305,7 +50716,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/cartesian/layout_attributes":441,"../../plots/font_attributes":454}],280:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/cartesian/layout_attributes":449,"../../plots/font_attributes":462}],287:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50372,7 +50783,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":393,"../../plots/cartesian/tick_label_defaults":448,"../../plots/cartesian/tick_mark_defaults":449,"../../plots/cartesian/tick_value_defaults":450,"./attributes":279}],281:[function(require,module,exports){ +},{"../../lib":401,"../../plots/cartesian/tick_label_defaults":456,"../../plots/cartesian/tick_mark_defaults":457,"../../plots/cartesian/tick_value_defaults":458,"./attributes":286}],288:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50398,6 +50809,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -50671,7 +51084,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -50683,8 +51096,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -50697,8 +51109,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -50931,6 +51342,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -51005,7 +51417,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":393,"../../lib/extend":387,"../../lib/setcursor":408,"../../plotly":425,"../../plots/cartesian/axes":430,"../../plots/cartesian/axis_defaults":432,"../../plots/cartesian/layout_attributes":441,"../../plots/cartesian/position_defaults":444,"../../plots/plots":470,"../../registry":478,"../color":278,"../dragelement":299,"../drawing":302,"../titles":367,"./attributes":279,"d3":79,"tinycolor2":249}],282:[function(require,module,exports){ +},{"../../constants/alignment":381,"../../lib":401,"../../lib/extend":395,"../../lib/setcursor":416,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/cartesian/axes":438,"../../plots/cartesian/axis_defaults":440,"../../plots/cartesian/layout_attributes":449,"../../plots/cartesian/position_defaults":452,"../../plots/plots":478,"../../registry":486,"../color":285,"../dragelement":306,"../drawing":309,"../titles":374,"./attributes":286,"d3":79,"tinycolor2":250}],289:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51024,7 +51436,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":393}],283:[function(require,module,exports){ +},{"../../lib":401}],290:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51079,7 +51491,7 @@ module.exports = { } }; -},{}],284:[function(require,module,exports){ +},{}],291:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51158,7 +51570,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":393,"./flip_scale":289,"./scales":296}],285:[function(require,module,exports){ +},{"../../lib":401,"./flip_scale":296,"./scales":303}],292:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51202,7 +51614,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":387,"./attributes":283,"./scales.js":296}],286:[function(require,module,exports){ +},{"../../lib/extend":395,"./attributes":290,"./scales.js":303}],293:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51218,7 +51630,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":296}],287:[function(require,module,exports){ +},{"./scales":303}],294:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51282,7 +51694,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":393,"../colorbar/defaults":280,"../colorbar/has_colorbar":282,"./flip_scale":289,"./is_valid_scale":293,"fast-isnumeric":87}],288:[function(require,module,exports){ +},{"../../lib":401,"../colorbar/defaults":287,"../colorbar/has_colorbar":289,"./flip_scale":296,"./is_valid_scale":300,"fast-isnumeric":87}],295:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51319,7 +51731,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],289:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51344,7 +51756,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],290:[function(require,module,exports){ +},{}],297:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51384,7 +51796,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":286,"./is_valid_scale_array":294,"./scales":296}],291:[function(require,module,exports){ +},{"./default_scale":293,"./is_valid_scale_array":301,"./scales":303}],298:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51430,7 +51842,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":393,"./is_valid_scale":293,"fast-isnumeric":87}],292:[function(require,module,exports){ +},{"../../lib":401,"./is_valid_scale":300,"fast-isnumeric":87}],299:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51464,7 +51876,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":283,"./calc":284,"./default_scale":286,"./defaults":287,"./extract_scale":288,"./flip_scale":289,"./get_scale":290,"./has_colorscale":291,"./is_valid_scale":293,"./make_color_scale_func":295,"./scales":296}],293:[function(require,module,exports){ +},{"./attributes":290,"./calc":291,"./default_scale":293,"./defaults":294,"./extract_scale":295,"./flip_scale":296,"./get_scale":297,"./has_colorscale":298,"./is_valid_scale":300,"./make_color_scale_func":302,"./scales":303}],300:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51485,7 +51897,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":294,"./scales":296}],294:[function(require,module,exports){ +},{"./is_valid_scale_array":301,"./scales":303}],301:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51522,7 +51934,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":249}],295:[function(require,module,exports){ +},{"tinycolor2":250}],302:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51618,7 +52030,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":278,"d3":79,"fast-isnumeric":87,"tinycolor2":249}],296:[function(require,module,exports){ +},{"../color":285,"d3":79,"fast-isnumeric":87,"tinycolor2":250}],303:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51749,7 +52161,7 @@ module.exports = { ] }; -},{}],297:[function(require,module,exports){ +},{}],304:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51782,7 +52194,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],298:[function(require,module,exports){ +},{}],305:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51820,7 +52232,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":393}],299:[function(require,module,exports){ +},{"../../lib":401}],306:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51849,6 +52261,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -51867,28 +52288,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -51939,10 +52352,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -51989,10 +52398,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -52022,7 +52427,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":376,"../../lib":393,"../../plotly":425,"../../plots/cartesian/constants":435,"./align":297,"./cursor":298,"./unhover":300}],300:[function(require,module,exports){ +},{"../../constants/interactions":384,"../../lib":401,"../../plotly":433,"../../plots/cartesian/constants":443,"./align":304,"./cursor":305,"./unhover":307}],307:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52078,7 +52483,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":386}],301:[function(require,module,exports){ +},{"../../lib/events":394}],308:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52102,7 +52507,7 @@ exports.dash = { }; -},{}],302:[function(require,module,exports){ +},{}],309:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52125,6 +52530,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -52146,13 +52554,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -52161,7 +52575,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -52176,7 +52590,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -52262,6 +52675,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -52488,7 +52911,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -52496,7 +52919,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -52517,9 +52939,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -52550,21 +52971,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -52703,34 +53119,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -52751,18 +53220,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -52917,17 +53397,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":379,"../../lib":393,"../../lib/svg_text_utils":412,"../../registry":478,"../../traces/scatter/make_bubble_size_func":509,"../../traces/scatter/subtypes":514,"../color":278,"../colorscale":292,"./symbol_defs":303,"d3":79,"fast-isnumeric":87,"tinycolor2":249}],303:[function(require,module,exports){ +},{"../../constants/alignment":381,"../../constants/xmlns_namespaces":387,"../../lib":401,"../../lib/svg_text_utils":420,"../../registry":486,"../../traces/scatter/make_bubble_size_func":518,"../../traces/scatter/subtypes":523,"../color":285,"../colorscale":299,"./symbol_defs":310,"d3":79,"fast-isnumeric":87,"tinycolor2":250}],310:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53403,7 +53873,7 @@ module.exports = { } }; -},{"d3":79}],304:[function(require,module,exports){ +},{"d3":79}],311:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53502,7 +53972,7 @@ module.exports = { } }; -},{}],305:[function(require,module,exports){ +},{}],312:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53565,7 +54035,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":430,"../../registry":478,"./compute_error":306,"fast-isnumeric":87}],306:[function(require,module,exports){ +},{"../../plots/cartesian/axes":438,"../../registry":486,"./compute_error":313,"fast-isnumeric":87}],313:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53661,7 +54131,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],307:[function(require,module,exports){ +},{}],314:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53738,7 +54208,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":393,"../../registry":478,"./attributes":304,"fast-isnumeric":87}],308:[function(require,module,exports){ +},{"../../lib":401,"../../registry":486,"./attributes":311,"fast-isnumeric":87}],315:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53797,7 +54267,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":304,"./calc":305,"./defaults":307,"./plot":309,"./style":310}],309:[function(require,module,exports){ +},{"./attributes":311,"./calc":312,"./defaults":314,"./plot":316,"./style":317}],316:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53961,7 +54431,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":514,"d3":79,"fast-isnumeric":87}],310:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":523,"d3":79,"fast-isnumeric":87}],317:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -53998,7 +54468,7 @@ module.exports = function style(traces) { }); }; -},{"../color":278,"d3":79}],311:[function(require,module,exports){ +},{"../color":285,"d3":79}],318:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54034,7 +54504,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/font_attributes":454}],312:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/font_attributes":462}],319:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54050,30 +54520,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; + + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":393,"../../registry":478}],313:[function(require,module,exports){ +},{"../../lib":401,"../../registry":486}],320:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54085,10 +54571,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -54102,7 +54597,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":478}],314:[function(require,module,exports){ +},{"../../registry":486,"./hover":324}],321:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54134,7 +54629,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],315:[function(require,module,exports){ +},{}],322:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54157,7 +54652,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":393,"./attributes":311,"./hoverlabel_defaults":318}],316:[function(require,module,exports){ +},{"../../lib":401,"./attributes":318,"./hoverlabel_defaults":325}],323:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54168,6 +54663,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -54244,7 +54740,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":314}],317:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":401,"./constants":321}],324:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54313,7 +54835,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -54325,13 +54847,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -54408,15 +54930,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -54601,11 +55123,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -54704,6 +55226,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -54737,7 +55260,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -54751,7 +55274,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -54770,7 +55293,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -54805,7 +55328,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -54842,23 +55365,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -54874,14 +55390,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -54971,7 +55482,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -54987,12 +55500,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -55004,11 +55515,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -55276,17 +55785,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -55303,6 +55807,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -55370,7 +55898,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -55380,29 +55908,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -55554,7 +56059,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":393,"../../lib/events":386,"../../lib/override_cursor":402,"../../lib/svg_text_utils":412,"../../plots/cartesian/axes":430,"../../registry":478,"../color":278,"../dragelement":299,"../drawing":302,"./constants":314,"./helpers":316,"d3":79,"fast-isnumeric":87,"tinycolor2":249}],318:[function(require,module,exports){ +},{"../../lib":401,"../../lib/events":394,"../../lib/override_cursor":410,"../../lib/svg_text_utils":420,"../../plots/cartesian/axes":438,"../../registry":486,"../color":285,"../dragelement":306,"../drawing":309,"./constants":321,"./helpers":323,"d3":79,"fast-isnumeric":87,"tinycolor2":250}],325:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55575,7 +56080,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":393}],319:[function(require,module,exports){ +},{"../../lib":401}],326:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55613,7 +56118,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -55635,23 +56143,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":393,"../dragelement":299,"./attributes":311,"./calc":312,"./click":313,"./constants":314,"./defaults":315,"./helpers":316,"./hover":317,"./layout_attributes":320,"./layout_defaults":321,"./layout_global_defaults":322,"d3":79}],320:[function(require,module,exports){ +},{"../../lib":401,"../dragelement":306,"./attributes":318,"./calc":319,"./click":320,"./constants":321,"./defaults":322,"./helpers":323,"./hover":324,"./layout_attributes":327,"./layout_defaults":328,"./layout_global_defaults":329,"d3":79}],327:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55704,7 +56210,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/font_attributes":454,"./constants":314}],321:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/font_attributes":462,"./constants":321}],328:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55752,7 +56258,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":393,"./layout_attributes":320}],322:[function(require,module,exports){ +},{"../../lib":401,"./layout_attributes":327}],329:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55775,7 +56281,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":393,"./hoverlabel_defaults":318,"./layout_attributes":320}],323:[function(require,module,exports){ +},{"../../lib":401,"./hoverlabel_defaults":325,"./layout_attributes":327}],330:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55897,7 +56403,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":435}],324:[function(require,module,exports){ +},{"../../plots/cartesian/constants":443}],331:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55980,7 +56486,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":413,"fast-isnumeric":87}],325:[function(require,module,exports){ +},{"../../lib/to_log_range":421,"fast-isnumeric":87}],332:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56041,7 +56547,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":393,"../../plots/array_container_defaults":427,"../../plots/cartesian/axes":430,"./attributes":323}],326:[function(require,module,exports){ +},{"../../lib":401,"../../plots/array_container_defaults":435,"../../plots/cartesian/axes":438,"./attributes":330}],333:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56262,7 +56768,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":379,"../../plots/cartesian/axes":430,"../drawing":302,"d3":79}],327:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":387,"../../plots/cartesian/axes":438,"../drawing":309,"d3":79}],334:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56285,7 +56791,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":323,"./convert_coords":324,"./defaults":325,"./draw":326}],328:[function(require,module,exports){ +},{"./attributes":330,"./convert_coords":331,"./defaults":332,"./draw":333}],335:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56334,7 +56840,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],329:[function(require,module,exports){ +},{}],336:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56425,7 +56931,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/font_attributes":454,"../color/attributes":277}],330:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/font_attributes":462,"../color/attributes":284}],337:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56443,7 +56949,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],331:[function(require,module,exports){ +},{}],338:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56536,7 +57042,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":393,"../../plots/layout_attributes":468,"../../registry":478,"./attributes":329,"./helpers":334}],332:[function(require,module,exports){ +},{"../../lib":401,"../../plots/layout_attributes":476,"../../registry":486,"./attributes":336,"./helpers":341}],339:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56561,6 +57067,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -56650,7 +57158,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -56856,6 +57364,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -56907,30 +57416,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -57095,20 +57598,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -57116,18 +57620,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -57362,7 +57867,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":376,"../../lib":393,"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/plots":470,"../../registry":478,"../color":278,"../dragelement":299,"../drawing":302,"./anchor_utils":328,"./constants":330,"./get_legend_data":333,"./helpers":334,"./style":336,"d3":79}],333:[function(require,module,exports){ +},{"../../constants/alignment":381,"../../constants/interactions":384,"../../lib":401,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/plots":478,"../../registry":486,"../color":285,"../dragelement":306,"../drawing":309,"./anchor_utils":335,"./constants":337,"./get_legend_data":340,"./helpers":341,"./style":343,"d3":79}],340:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57467,7 +57972,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":478,"./helpers":334}],334:[function(require,module,exports){ +},{"../../registry":486,"./helpers":341}],341:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57498,7 +58003,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":478}],335:[function(require,module,exports){ +},{"../../registry":486}],342:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57522,7 +58027,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":329,"./defaults":331,"./draw":332,"./style":336}],336:[function(require,module,exports){ +},{"./attributes":336,"./defaults":338,"./draw":339,"./style":343}],343:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57545,7 +58050,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -57583,179 +58088,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); - - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } - var dMod, tMod; + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + var dMod, tMod; - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; - } - return valToBound; - } + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - function pickFirst(array) { return array[0]; } + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; + } + + function pickFirst(array) { return array[0]; } + + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; + + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); + + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); + + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; -},{"../../lib":393,"../../registry":478,"../../traces/pie/style_one":492,"../../traces/scatter/subtypes":514,"../color":278,"../drawing":302,"d3":79}],337:[function(require,module,exports){ +},{"../../lib":401,"../../registry":486,"../../traces/pie/style_one":501,"../../traces/scatter/subtypes":523,"../color":285,"../drawing":309,"d3":79}],344:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58333,7 +58838,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":393,"../../plotly":425,"../../plots/cartesian/axes":430,"../../plots/plots":470,"../../snapshot/download":480}],338:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":401,"../../plotly":433,"../../plots/cartesian/axes":438,"../../plots/plots":478,"../../snapshot/download":488}],345:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58347,7 +58852,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":339}],339:[function(require,module,exports){ +},{"./manage":346}],346:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58471,7 +58976,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -58523,7 +59028,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -58575,7 +59080,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":430,"../../traces/scatter/subtypes":514,"./buttons":337,"./modebar":340}],340:[function(require,module,exports){ +},{"../../plots/cartesian/axes":438,"../../traces/scatter/subtypes":523,"./buttons":344,"./modebar":347}],347:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58869,7 +59374,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":393,"d3":79}],341:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":401,"d3":79}],348:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58959,7 +59464,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/font_attributes":454,"../color/attributes":277,"./button_attributes":342}],342:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/font_attributes":462,"../color/attributes":284,"./button_attributes":349}],349:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59000,7 +59505,7 @@ module.exports = { } }; -},{}],343:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59029,7 +59534,7 @@ module.exports = { darkAmount: 10 }; -},{}],344:[function(require,module,exports){ +},{}],351:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59128,7 +59633,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":393,"../color":278,"./attributes":341,"./button_attributes":342,"./constants":343}],345:[function(require,module,exports){ +},{"../../lib":401,"../color":285,"./attributes":348,"./button_attributes":349,"./constants":350}],352:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59150,6 +59655,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -59190,7 +59697,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -59277,11 +59784,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -59313,26 +59818,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -59351,13 +59853,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -59403,7 +59900,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/cartesian/axis_ids":433,"../../plots/plots":470,"../color":278,"../drawing":302,"../legend/anchor_utils":328,"./constants":343,"./get_update_object":346,"d3":79}],346:[function(require,module,exports){ +},{"../../constants/alignment":381,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/cartesian/axis_ids":441,"../../plots/plots":478,"../color":285,"../drawing":309,"../legend/anchor_utils":335,"./constants":350,"./get_update_object":353,"d3":79}],353:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59460,7 +59957,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":79}],347:[function(require,module,exports){ +},{"d3":79}],354:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59487,7 +59984,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":341,"./defaults":344,"./draw":345}],348:[function(require,module,exports){ +},{"./attributes":348,"./defaults":351,"./draw":352}],355:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59551,7 +60048,7 @@ module.exports = { } }; -},{"../color/attributes":277}],349:[function(require,module,exports){ +},{"../color/attributes":284}],356:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59587,7 +60084,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":430,"./constants":350}],350:[function(require,module,exports){ +},{"../../plots/cartesian/axes":438,"./constants":357}],357:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59639,7 +60136,7 @@ module.exports = { extraPad: 15 }; -},{}],351:[function(require,module,exports){ +},{}],358:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59696,7 +60193,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":393,"./attributes":348}],352:[function(require,module,exports){ +},{"../../lib":401,"./attributes":355}],359:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60247,7 +60744,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":393,"../../lib/setcursor":408,"../../plotly":425,"../../plots/cartesian":440,"../../plots/cartesian/axes":430,"../../plots/plots":470,"../color":278,"../dragelement":299,"../drawing":302,"./constants":350,"d3":79}],353:[function(require,module,exports){ +},{"../../lib":401,"../../lib/setcursor":416,"../../plotly":433,"../../plots/cartesian":448,"../../plots/cartesian/axes":438,"../../plots/plots":478,"../color":285,"../dragelement":306,"../drawing":309,"./constants":357,"d3":79}],360:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60274,7 +60771,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":348,"./calc_autorange":349,"./defaults":351,"./draw":352}],354:[function(require,module,exports){ +},{"./attributes":355,"./calc_autorange":356,"./defaults":358,"./draw":359}],361:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60371,7 +60868,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../traces/scatter/attributes":494,"../annotations/attributes":269,"../drawing/attributes":301}],355:[function(require,module,exports){ +},{"../../lib/extend":395,"../../traces/scatter/attributes":503,"../annotations/attributes":270,"../drawing/attributes":308}],362:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60417,7 +60914,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -60448,7 +60945,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":393,"../../plots/cartesian/axes":430,"./constants":356,"./helpers":359}],356:[function(require,module,exports){ +},{"../../lib":401,"../../plots/cartesian/axes":438,"./constants":363,"./helpers":366}],363:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60512,7 +61009,7 @@ module.exports = { } }; -},{}],357:[function(require,module,exports){ +},{}],364:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60537,7 +61034,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":427,"./shape_defaults":361}],358:[function(require,module,exports){ +},{"../../plots/array_container_defaults":435,"./shape_defaults":368}],365:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60670,8 +61167,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -60680,6 +61177,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -60912,7 +61411,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":393,"../../lib/setcursor":408,"../../plotly":425,"../../plots/cartesian/axes":430,"../color":278,"../dragelement":299,"../drawing":302,"./constants":356,"./helpers":359}],359:[function(require,module,exports){ +},{"../../lib":401,"../../lib/setcursor":416,"../../plotly":433,"../../plots/cartesian/axes":438,"../color":285,"../dragelement":306,"../drawing":309,"./constants":363,"./helpers":366}],366:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60993,7 +61492,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],360:[function(require,module,exports){ +},{}],367:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61019,7 +61518,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":354,"./calc_autorange":355,"./defaults":357,"./draw":358}],361:[function(require,module,exports){ +},{"./attributes":361,"./calc_autorange":362,"./defaults":364,"./draw":365}],368:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61118,7 +61617,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":393,"../../plots/cartesian/axes":430,"./attributes":354,"./helpers":359}],362:[function(require,module,exports){ +},{"../../lib":401,"../../plots/cartesian/axes":438,"./attributes":361,"./helpers":366}],369:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61141,7 +61640,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -61166,6 +61665,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -61352,7 +61857,7 @@ module.exports = { }, }; -},{"../../lib/extend":387,"../../plots/animation_attributes":426,"../../plots/font_attributes":454,"../../plots/pad_attributes":469,"./constants":363}],363:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/animation_attributes":434,"../../plots/font_attributes":462,"../../plots/pad_attributes":477,"./constants":370}],370:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61400,9 +61905,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -61449,7 +61951,7 @@ module.exports = { currentValueInset: 0, }; -},{}],364:[function(require,module,exports){ +},{}],371:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61547,14 +62049,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -61562,7 +62066,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":393,"../../plots/array_container_defaults":427,"./attributes":362,"./constants":363}],365:[function(require,module,exports){ +},{"../../lib":401,"../../plots/array_container_defaults":435,"./attributes":369,"./constants":370}],372:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61583,11 +62087,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -61651,24 +62156,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -61696,14 +62195,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -61713,26 +62210,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -61759,6 +62238,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -61850,7 +62354,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -61867,9 +62374,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; + + svgTextUtils.positionText(text, x0, y0); return text; } @@ -61901,11 +62413,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -61932,7 +62447,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -61974,7 +62495,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -62164,7 +62687,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":412,"../../plots/plots":470,"../color":278,"../drawing":302,"../legend/anchor_utils":328,"./constants":363,"d3":79}],366:[function(require,module,exports){ +},{"../../constants/alignment":381,"../../lib/svg_text_utils":420,"../../plots/plots":478,"../color":285,"../drawing":309,"../legend/anchor_utils":335,"./constants":370,"d3":79}],373:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62187,7 +62710,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":362,"./constants":363,"./defaults":364,"./draw":365}],367:[function(require,module,exports){ +},{"./attributes":369,"./constants":370,"./defaults":371,"./draw":372}],374:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62210,6 +62733,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -62242,29 +62766,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -62273,7 +62802,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -62282,6 +62811,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -62301,11 +62833,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -62317,33 +62846,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -62374,8 +62903,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -62383,8 +62911,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -62395,11 +62922,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -62409,18 +62936,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":376,"../../lib":393,"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/plots":470,"../color":278,"../drawing":302,"d3":79,"fast-isnumeric":87}],368:[function(require,module,exports){ +},{"../../constants/interactions":384,"../../lib":401,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/plots":478,"../color":285,"../drawing":309,"d3":79,"fast-isnumeric":87}],375:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62441,7 +62964,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -62462,6 +62985,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -62567,7 +63096,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../../plots/font_attributes":454,"../../plots/pad_attributes":469,"../color/attributes":277}],369:[function(require,module,exports){ +},{"../../lib/extend":395,"../../plots/font_attributes":462,"../../plots/pad_attributes":477,"../color/attributes":284}],376:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62614,9 +63143,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -62640,10 +63166,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],370:[function(require,module,exports){ +},{}],377:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62722,13 +63256,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -62737,7 +63273,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":393,"../../plots/array_container_defaults":427,"./attributes":368,"./constants":369}],371:[function(require,module,exports){ +},{"../../lib":401,"../../plots/array_container_defaults":435,"./attributes":375,"./constants":376}],378:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62757,6 +63293,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -62942,7 +63480,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -62954,7 +63492,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -63062,7 +63600,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -63071,7 +63609,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -63172,9 +63712,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -63194,18 +63734,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -63256,19 +63799,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -63362,34 +63904,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); - - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -63405,8 +63942,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -63417,9 +63954,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":412,"../../plots/plots":470,"../color":278,"../drawing":302,"../legend/anchor_utils":328,"./constants":369,"./scrollbox":373,"d3":79}],372:[function(require,module,exports){ -arguments[4][366][0].apply(exports,arguments) -},{"./attributes":368,"./constants":369,"./defaults":370,"./draw":371,"dup":366}],373:[function(require,module,exports){ +},{"../../constants/alignment":381,"../../lib/svg_text_utils":420,"../../plots/plots":478,"../color":285,"../drawing":309,"../legend/anchor_utils":335,"./constants":376,"./scrollbox":380,"d3":79}],379:[function(require,module,exports){ +arguments[4][373][0].apply(exports,arguments) +},{"./attributes":375,"./constants":376,"./defaults":377,"./draw":378,"dup":373}],380:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63890,7 +64427,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":393,"../color":278,"../drawing":302,"d3":79}],374:[function(require,module,exports){ +},{"../../lib":401,"../color":285,"../drawing":309,"d3":79}],381:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],382:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63911,7 +64484,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],375:[function(require,module,exports){ +},{}],383:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63934,7 +64507,7 @@ module.exports = { x: '❌' }; -},{}],376:[function(require,module,exports){ +},{}],384:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63958,7 +64531,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],377:[function(require,module,exports){ +},{}],385:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64011,7 +64584,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],378:[function(require,module,exports){ +},{}],386:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64049,7 +64622,7 @@ module.exports = { }; -},{}],379:[function(require,module,exports){ +},{}],387:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64073,7 +64646,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],380:[function(require,module,exports){ +},{}],388:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64091,7 +64664,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -64132,6 +64705,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -64153,7 +64727,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":276,"./components/fx":319,"./components/images":327,"./components/legend":335,"./components/rangeselector":347,"./components/rangeslider":353,"./components/shapes":360,"./components/sliders":366,"./components/updatemenus":372,"./fonts/mathjax_config":381,"./lib/queue":405,"./plot_api/plot_schema":419,"./plot_api/register":420,"./plot_api/set_plot_config":421,"./plot_api/to_image":423,"./plot_api/validate":424,"./plotly":425,"./snapshot":483,"./snapshot/download":480,"./traces/scatter":504,"d3":79,"es6-promise":84}],381:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":278,"./components/annotations3d":283,"./components/fx":326,"./components/images":334,"./components/legend":342,"./components/rangeselector":354,"./components/rangeslider":360,"./components/shapes":367,"./components/sliders":373,"./components/updatemenus":379,"./fonts/mathjax_config":389,"./lib/queue":413,"./plot_api/plot_schema":427,"./plot_api/register":428,"./plot_api/set_plot_config":429,"./plot_api/to_image":431,"./plot_api/validate":432,"./plotly":433,"./snapshot":491,"./snapshot/download":488,"./traces/scatter":513,"d3":79,"es6-promise":84}],389:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64186,7 +64760,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],382:[function(require,module,exports){ +},{}],390:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64219,7 +64793,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":377,"fast-isnumeric":87}],383:[function(require,module,exports){ +},{"../constants/numerical":385,"fast-isnumeric":87}],391:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64234,6 +64808,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -64259,6 +64834,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -64511,6 +65100,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -64530,7 +65148,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":290,"../components/colorscale/scales":296,"./nested_property":399,"fast-isnumeric":87,"tinycolor2":249}],384:[function(require,module,exports){ +},{"../components/colorscale/get_scale":297,"../components/colorscale/scales":303,"../plots/attributes":436,"./nested_property":407,"fast-isnumeric":87,"tinycolor2":250}],392:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65158,7 +65776,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":377,"../registry":478,"./loggers":396,"./mod":398,"d3":79,"fast-isnumeric":87}],385:[function(require,module,exports){ +},{"../constants/numerical":385,"../registry":486,"./loggers":404,"./mod":406,"d3":79,"fast-isnumeric":87}],393:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65187,7 +65805,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],386:[function(require,module,exports){ +},{}],394:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65353,7 +65971,7 @@ var Events = { module.exports = Events; -},{"events":85}],387:[function(require,module,exports){ +},{"events":85}],395:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65467,7 +66085,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":395}],388:[function(require,module,exports){ +},{"./is_plain_object.js":403}],396:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65518,7 +66136,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],389:[function(require,module,exports){ +},{}],397:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65549,7 +66167,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],390:[function(require,module,exports){ +},{}],398:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65637,7 +66255,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":277,"../components/colorscale":292,"color-rgba":62,"fast-isnumeric":87}],391:[function(require,module,exports){ +},{"../components/color/attributes":284,"../components/colorscale":299,"color-rgba":62,"fast-isnumeric":87}],399:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65706,7 +66324,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":378,"superscript-text":247}],392:[function(require,module,exports){ +},{"../constants/string_mappings":386,"superscript-text":248}],400:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65722,7 +66340,7 @@ module.exports = convertHTMLToUnicode; module.exports = function identity(d) { return d; }; -},{}],393:[function(require,module,exports){ +},{}],401:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65735,6 +66353,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -65751,6 +66374,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -65812,6 +66436,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -66062,6 +66693,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -66069,6 +66709,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -66109,7 +66794,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -66139,13 +66824,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -66386,7 +67064,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":382,"./coerce":383,"./dates":384,"./ensure_array":385,"./extend":387,"./filter_unique":388,"./filter_visible":389,"./identity":392,"./is_array":394,"./is_plain_object":395,"./loggers":396,"./matrix":397,"./mod":398,"./nested_property":399,"./noop":400,"./notifier":401,"./push_unique":404,"./relink_private":406,"./search":407,"./stats":410,"./to_log_range":413,"d3":79}],394:[function(require,module,exports){ +},{"../constants/numerical":385,"./clean_number":390,"./coerce":391,"./dates":392,"./ensure_array":393,"./extend":395,"./filter_unique":396,"./filter_visible":397,"./identity":400,"./is_array":402,"./is_plain_object":403,"./loggers":404,"./matrix":405,"./mod":406,"./nested_property":407,"./noop":408,"./notifier":409,"./push_unique":412,"./relink_private":414,"./search":415,"./stats":418,"./to_log_range":421,"d3":79,"fast-isnumeric":87}],402:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66410,7 +67088,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],395:[function(require,module,exports){ +},{}],403:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66439,7 +67117,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],396:[function(require,module,exports){ +},{}],404:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66513,7 +67191,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":418}],397:[function(require,module,exports){ +},{"../plot_api/plot_config":426}],405:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66623,7 +67301,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],398:[function(require,module,exports){ +},{}],406:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66643,7 +67321,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],399:[function(require,module,exports){ +},{}],407:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66947,7 +67625,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":414,"./is_array":394,"./is_plain_object":395,"fast-isnumeric":87}],400:[function(require,module,exports){ +},{"../plot_api/container_array_match":422,"./is_array":402,"./is_plain_object":403,"fast-isnumeric":87}],408:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66963,7 +67641,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],401:[function(require,module,exports){ +},{}],409:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67045,7 +67723,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":79,"fast-isnumeric":87}],402:[function(require,module,exports){ +},{"d3":79,"fast-isnumeric":87}],410:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67094,7 +67772,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":408}],403:[function(require,module,exports){ +},{"./setcursor":416}],411:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67335,7 +68013,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":377,"./matrix":397}],404:[function(require,module,exports){ +},{"../constants/numerical":385,"./matrix":405}],412:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67373,7 +68051,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],405:[function(require,module,exports){ +},{}],413:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67584,7 +68262,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":393,"../plot_api/plot_config":418}],406:[function(require,module,exports){ +},{"../lib":401,"../plot_api/plot_config":426}],414:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67641,7 +68319,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":394,"./is_plain_object":395}],407:[function(require,module,exports){ +},{"./is_array":402,"./is_plain_object":403}],415:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67752,7 +68430,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":396,"fast-isnumeric":87}],408:[function(require,module,exports){ +},{"./loggers":404,"fast-isnumeric":87}],416:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67775,7 +68453,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],409:[function(require,module,exports){ +},{}],417:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67824,7 +68502,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":278}],410:[function(require,module,exports){ +},{"../components/color":285}],418:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67920,7 +68598,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":87}],411:[function(require,module,exports){ +},{"fast-isnumeric":87}],419:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67941,7 +68619,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-rgba":62}],412:[function(require,module,exports){ +},{"color-rgba":62}],420:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67960,62 +68638,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -68023,42 +68646,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); + .style('white-space', 'pre'); - result = _context.appendSVG(converted); + var hasLink = buildSVGText(_context.node(), str); - if(!result) _context.text(str); - - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -68066,14 +68691,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -68088,7 +68714,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -68105,36 +68735,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -68147,9 +68777,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -68180,23 +68813,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -68207,24 +68852,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -68235,26 +68899,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -68264,122 +68934,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -68416,28 +69161,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; + + context.style({'pointer-events': _delegate ? 'none' : 'all'}); - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -68452,63 +69210,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -68520,10 +69277,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":378,"../constants/xmlns_namespaces":379,"../lib":393,"d3":79}],413:[function(require,module,exports){ +},{"../constants/alignment":381,"../constants/string_mappings":386,"../constants/xmlns_namespaces":387,"../lib":401,"d3":79}],421:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68551,7 +69308,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":87}],414:[function(require,module,exports){ +},{"fast-isnumeric":87}],422:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68609,7 +69366,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":478}],415:[function(require,module,exports){ +},{"../registry":486}],423:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -68827,7 +69584,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -68960,18 +69716,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -69027,7 +69803,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -69130,7 +69906,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":278,"../lib":393,"../plots/cartesian/axes":430,"../plots/plots":470,"../registry":478,"fast-isnumeric":87,"gl-mat4/fromQuat":114}],416:[function(require,module,exports){ +},{"../components/color":285,"../lib":401,"../plots/cartesian/axes":438,"../plots/plots":478,"../registry":486,"fast-isnumeric":87,"gl-mat4/fromQuat":115}],424:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -69344,7 +70120,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":395,"../lib/loggers":396,"../lib/nested_property":399,"../lib/noop":400,"../lib/search":407,"../registry":478,"./container_array_match":414}],417:[function(require,module,exports){ +},{"../lib/is_plain_object":403,"../lib/loggers":404,"../lib/nested_property":407,"../lib/noop":408,"../lib/search":415,"../registry":486,"./container_array_match":422}],425:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -69379,7 +70155,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -69536,9 +70314,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -69567,19 +70343,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; - - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); + if(JSON.stringify(fullLayout._size) === oldmargins) return; - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -69617,7 +70393,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -69717,6 +70496,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -69814,7 +70594,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -69823,9 +70603,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -69840,11 +70621,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -70730,6 +71510,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -70829,6 +71610,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -71260,10 +72044,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -71285,7 +72071,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -71293,7 +72080,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -71306,11 +72093,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -71390,6 +72191,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -71488,7 +72290,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -71536,7 +72347,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -72370,7 +73181,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":302,"../components/errorbars":308,"../constants/xmlns_namespaces":379,"../lib":393,"../lib/events":386,"../lib/queue":405,"../lib/svg_text_utils":412,"../plotly":425,"../plots/cartesian/axis_ids":433,"../plots/cartesian/constants":435,"../plots/cartesian/constraints":437,"../plots/cartesian/graph_interact":439,"../plots/plots":470,"../plots/polar":473,"../registry":478,"./helpers":415,"./manage_arrays":416,"./subroutines":422,"d3":79,"fast-isnumeric":87}],418:[function(require,module,exports){ +},{"../components/drawing":309,"../components/errorbars":315,"../constants/xmlns_namespaces":387,"../lib":401,"../lib/events":394,"../lib/queue":413,"../lib/svg_text_utils":420,"../plotly":433,"../plots/cartesian/axis_ids":441,"../plots/cartesian/constants":443,"../plots/cartesian/constraints":445,"../plots/cartesian/graph_interact":447,"../plots/plots":478,"../plots/polar":481,"../registry":486,"./helpers":423,"./manage_arrays":424,"./subroutines":430,"d3":79,"fast-isnumeric":87}],426:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72496,7 +73307,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],419:[function(require,module,exports){ +},{}],427:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72655,7 +73466,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -72675,9 +73489,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -72902,7 +73715,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":393,"../plots/animation_attributes":426,"../plots/attributes":428,"../plots/frame_attributes":455,"../plots/layout_attributes":468,"../plots/polar/area_attributes":471,"../plots/polar/axis_attributes":472,"../registry":478}],420:[function(require,module,exports){ +},{"../lib":401,"../plots/animation_attributes":434,"../plots/attributes":436,"../plots/frame_attributes":463,"../plots/layout_attributes":476,"../plots/polar/area_attributes":479,"../plots/polar/axis_attributes":480,"../registry":486}],428:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73001,7 +73814,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":393,"../registry":478}],421:[function(require,module,exports){ +},{"../lib":401,"../registry":486}],429:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73027,7 +73840,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":393,"../plotly":425}],422:[function(require,module,exports){ +},{"../lib":401,"../plotly":433}],430:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73156,15 +73969,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -73284,27 +74098,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -73405,19 +74221,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -73434,7 +74253,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":278,"../components/drawing":302,"../components/modebar":338,"../components/titles":367,"../lib":393,"../plotly":425,"../plots/cartesian/graph_interact":439,"../plots/plots":470,"../registry":478,"d3":79}],423:[function(require,module,exports){ +},{"../components/color":285,"../components/drawing":309,"../components/modebar":345,"../components/titles":374,"../lib":401,"../plotly":433,"../plots/cartesian/graph_interact":447,"../plots/plots":478,"../registry":486,"d3":79}],431:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73544,7 +74363,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":393,"../plotly":425,"../snapshot/cloneplot":479,"../snapshot/helpers":482,"../snapshot/svgtoimg":484,"../snapshot/tosvg":486,"fast-isnumeric":87}],424:[function(require,module,exports){ +},{"../lib":401,"../plotly":433,"../snapshot/cloneplot":487,"../snapshot/helpers":490,"../snapshot/svgtoimg":492,"../snapshot/tosvg":494,"fast-isnumeric":87}],432:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73766,6 +74585,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -73814,6 +74638,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -73831,7 +74665,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -73848,8 +74682,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -73915,7 +74749,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":393,"../plots/plots":470,"./plot_schema":419}],425:[function(require,module,exports){ +},{"../lib":401,"../plots/plots":478,"./plot_schema":427}],433:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -73949,7 +74783,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":338,"./plot_api/plot_api":417,"./plot_api/plot_config":418,"./plots/cartesian/axes":430,"./plots/plots":470}],426:[function(require,module,exports){ +},{"./components/modebar":345,"./plot_api/plot_api":425,"./plot_api/plot_config":426,"./plots/cartesian/axes":438,"./plots/plots":478}],434:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74051,7 +74885,7 @@ module.exports = { } }; -},{}],427:[function(require,module,exports){ +},{}],435:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74132,7 +74966,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":393}],428:[function(require,module,exports){ +},{"../lib":401}],436:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74189,11 +75023,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -74217,7 +75060,7 @@ module.exports = { } }; -},{"../components/fx/attributes":311}],429:[function(require,module,exports){ +},{"../components/fx/attributes":318}],437:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74244,7 +75087,7 @@ module.exports = { } }; -},{}],430:[function(require,module,exports){ +},{}],438:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74274,7 +75117,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -74347,33 +75189,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -74614,6 +75450,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -74709,6 +75548,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -76060,10 +76906,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -76096,17 +76942,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -76572,7 +77411,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":278,"../../components/drawing":302,"../../components/titles":367,"../../constants/numerical":377,"../../lib":393,"../../lib/svg_text_utils":412,"../../registry":478,"./axis_autotype":431,"./axis_ids":433,"./layout_attributes":441,"./layout_defaults":442,"./set_convert":447,"d3":79,"fast-isnumeric":87}],431:[function(require,module,exports){ +},{"../../components/color":285,"../../components/drawing":309,"../../components/titles":374,"../../constants/numerical":385,"../../lib":401,"../../lib/svg_text_utils":420,"../../registry":486,"./axis_autotype":439,"./axis_ids":441,"./layout_attributes":449,"./layout_defaults":450,"./set_convert":455,"d3":79,"fast-isnumeric":87}],439:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76647,7 +77486,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":377,"../../lib":393,"fast-isnumeric":87}],432:[function(require,module,exports){ +},{"../../constants/numerical":385,"../../lib":401,"fast-isnumeric":87}],440:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76770,7 +77609,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":277,"../../lib":393,"../../registry":478,"./category_order_defaults":434,"./layout_attributes":441,"./ordered_categories":443,"./set_convert":447,"./tick_label_defaults":448,"./tick_mark_defaults":449,"./tick_value_defaults":450,"tinycolor2":249}],433:[function(require,module,exports){ +},{"../../components/color/attributes":284,"../../lib":401,"../../registry":486,"./category_order_defaults":442,"./layout_attributes":449,"./ordered_categories":451,"./set_convert":455,"./tick_label_defaults":456,"./tick_mark_defaults":457,"./tick_value_defaults":458,"tinycolor2":250}],441:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76892,7 +77731,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":393,"../../registry":478,"../plots":470,"./constants":435}],434:[function(require,module,exports){ +},{"../../lib":401,"../../registry":486,"../plots":478,"./constants":443}],442:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76926,7 +77765,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],435:[function(require,module,exports){ +},{}],443:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76981,7 +77820,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],436:[function(require,module,exports){ +},{}],444:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76999,10 +77838,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(containerOut.fixedrange) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); + + if(!containerIn.scaleanchor) return; + + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -77021,7 +77875,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -77120,7 +77974,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":393,"./axis_ids":433}],437:[function(require,module,exports){ +},{"../../lib":401,"./axis_ids":441}],445:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77137,12 +77991,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -77158,12 +78014,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -77171,32 +78033,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; + + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } + } + } + } +}; + +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; } } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } } }; -},{"../../constants/numerical":377,"./axis_ids":433,"./scale_zoom":445}],438:[function(require,module,exports){ +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":381,"../../constants/numerical":385,"./axis_ids":441,"./scale_zoom":453}],446:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77219,6 +78202,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -77328,7 +78314,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -77382,6 +78367,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -77480,8 +78468,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -77514,7 +78502,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -77533,11 +78522,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -77722,6 +78711,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -77741,8 +78732,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -77839,24 +78835,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -77891,11 +78880,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -77906,7 +78899,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -77915,7 +78908,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -77998,7 +78991,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -78014,13 +79007,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -78197,7 +79192,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":278,"../../components/dragelement":299,"../../components/drawing":302,"../../lib":393,"../../lib/setcursor":408,"../../lib/svg_text_utils":412,"../../plotly":425,"../../registry":478,"./axes":430,"./axis_ids":433,"./constants":435,"./scale_zoom":445,"./select":446,"d3":79,"tinycolor2":249}],439:[function(require,module,exports){ +},{"../../components/color":285,"../../components/dragelement":306,"../../components/drawing":309,"../../constants/alignment":381,"../../lib":401,"../../lib/setcursor":416,"../../lib/svg_text_utils":420,"../../plotly":433,"../../registry":486,"../plots":478,"./axes":438,"./axis_ids":441,"./constants":443,"./scale_zoom":453,"./select":454,"d3":79,"tinycolor2":250}],447:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78220,7 +79215,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -78238,8 +79233,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -78297,7 +79290,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -78358,7 +79351,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":299,"../../components/fx":319,"./constants":435,"./dragbox":438,"fast-isnumeric":87}],440:[function(require,module,exports){ +},{"../../components/dragelement":306,"../../components/fx":326,"./constants":443,"./dragbox":446,"fast-isnumeric":87}],448:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78545,6 +79538,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -78747,7 +79745,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":393,"../plots":470,"./attributes":429,"./axis_ids":433,"./constants":435,"./layout_attributes":441,"./transition_axes":451,"d3":79}],441:[function(require,module,exports){ +},{"../../lib":401,"../plots":478,"./attributes":437,"./axis_ids":441,"./constants":443,"./layout_attributes":449,"./transition_axes":459,"d3":79}],449:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78842,6 +79840,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -79139,7 +80151,7 @@ module.exports = { } }; -},{"../../components/color/attributes":277,"../../components/drawing/attributes":301,"../../lib/extend":387,"../font_attributes":454,"./constants":435}],442:[function(require,module,exports){ +},{"../../components/color/attributes":284,"../../components/drawing/attributes":308,"../../lib/extend":395,"../font_attributes":462,"./constants":443}],450:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79412,7 +80424,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":278,"../../lib":393,"../../registry":478,"../layout_attributes":468,"./axis_defaults":432,"./axis_ids":433,"./constants":435,"./constraint_defaults":436,"./layout_attributes":441,"./position_defaults":444,"./type_defaults":452}],443:[function(require,module,exports){ +},{"../../components/color":285,"../../lib":401,"../../registry":486,"../layout_attributes":476,"./axis_defaults":440,"./axis_ids":441,"./constants":443,"./constraint_defaults":444,"./layout_attributes":449,"./position_defaults":452,"./type_defaults":460}],451:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79491,7 +80503,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":79}],444:[function(require,module,exports){ +},{"d3":79}],452:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79556,7 +80568,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":393,"fast-isnumeric":87}],445:[function(require,module,exports){ +},{"../../lib":401,"fast-isnumeric":87}],453:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79568,20 +80580,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],446:[function(require,module,exports){ +},{"../../constants/alignment":381}],454:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79595,6 +80610,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -79735,7 +80751,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -79781,7 +80799,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":278,"../../lib/polygon":403,"./axes":430,"./constants":435}],447:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":285,"../../components/fx/helpers":323,"../../lib/polygon":411,"./axes":438,"./constants":443}],455:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79800,6 +80835,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -79812,13 +80848,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -79936,7 +80965,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -79949,8 +80978,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -79966,10 +80995,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -79977,16 +81008,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -80004,26 +81037,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -80224,7 +81269,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":377,"../../lib":393,"./axis_ids":433,"./constants":435,"d3":79,"fast-isnumeric":87}],448:[function(require,module,exports){ +},{"../../constants/numerical":385,"../../lib":401,"./axis_ids":441,"./constants":443,"d3":79,"fast-isnumeric":87}],456:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80308,7 +81353,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":393}],449:[function(require,module,exports){ +},{"../../lib":401}],457:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80341,7 +81386,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":393,"./layout_attributes":441}],450:[function(require,module,exports){ +},{"../../lib":401,"./layout_attributes":449}],458:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80425,7 +81470,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":377,"../../lib":393,"fast-isnumeric":87}],451:[function(require,module,exports){ +},{"../../constants/numerical":385,"../../lib":401,"fast-isnumeric":87}],459:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80741,7 +81786,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":302,"../../plotly":425,"../../registry":478,"./axes":430,"d3":79}],452:[function(require,module,exports){ +},{"../../components/drawing":309,"../../plotly":433,"../../registry":486,"./axes":438,"d3":79}],460:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80869,7 +81914,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":478,"./axis_autotype":431,"./axis_ids":433}],453:[function(require,module,exports){ +},{"../../registry":486,"./axis_autotype":439,"./axis_ids":441}],461:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81134,6 +82179,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -81294,7 +82341,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":393,"../plotly":425}],454:[function(require,module,exports){ +},{"../lib":401,"../plotly":433}],462:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81325,7 +82372,7 @@ module.exports = { } }; -},{}],455:[function(require,module,exports){ +},{}],463:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81371,7 +82418,7 @@ module.exports = { } }; -},{}],456:[function(require,module,exports){ +},{}],464:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81388,6 +82435,7 @@ var now = require('right-now'); var createView = require('3d-view'); var mouseChange = require('mouse-change'); var mouseWheel = require('mouse-wheel'); +var mouseOffset = require('mouse-event-offset'); function createCamera(element, options) { element = element || document.body; @@ -81553,8 +82601,24 @@ function createCamera(element, options) { return false; }); - var lastX = 0, lastY = 0; - mouseChange(element, function(buttons, x, y, mods) { + var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}; + mouseChange(element, handleInteraction); + + // enable simple touch interactions + element.addEventListener('touchstart', function(ev) { + var xy = mouseOffset(ev.changedTouches[0], element); + handleInteraction(0, xy[0], xy[1], lastMods); + handleInteraction(1, xy[0], xy[1], lastMods); + }); + element.addEventListener('touchmove', function(ev) { + var xy = mouseOffset(ev.changedTouches[0], element); + handleInteraction(1, xy[0], xy[1], lastMods); + }); + element.addEventListener('touchend', function() { + handleInteraction(0, lastX, lastY, lastMods); + }); + + function handleInteraction(buttons, x, y, mods) { var keyBindingMode = camera.keyBindingMode; if(keyBindingMode === false) return; @@ -81599,9 +82663,10 @@ function createCamera(element, options) { lastX = x; lastY = y; + lastMods = mods; return true; - }); + } mouseWheel(element, function(dx, dy) { if(camera.keyBindingMode === false) return; @@ -81620,7 +82685,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":9,"mouse-change":185,"mouse-wheel":188,"right-now":222}],457:[function(require,module,exports){ +},{"3d-view":9,"mouse-change":186,"mouse-event-offset":187,"mouse-wheel":189,"right-now":223}],465:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81696,6 +82761,12 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) if(!newFullLayout[oldSceneKey] && !!oldFullLayout[oldSceneKey]._scene) { oldFullLayout[oldSceneKey]._scene.destroy(); + + if(oldFullLayout._infolayer) { + oldFullLayout._infolayer + .selectAll('.annotation-' + oldSceneKey) + .remove(); + } } } }; @@ -81737,7 +82808,7 @@ exports.cleanId = function cleanId(id) { return 'scene' + sceneNum; }; -},{"../../constants/xmlns_namespaces":379,"../../lib":393,"../plots":470,"./layout/attributes":458,"./layout/defaults":462,"./layout/layout_attributes":463,"./scene":467}],458:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":387,"../../lib":401,"../plots":478,"./layout/attributes":466,"./layout/defaults":470,"./layout/layout_attributes":471,"./scene":475}],466:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81758,7 +82829,7 @@ module.exports = { } }; -},{}],459:[function(require,module,exports){ +},{}],467:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81865,7 +82936,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":278,"../../../lib/extend":387,"../../cartesian/layout_attributes":441}],460:[function(require,module,exports){ +},{"../../../components/color":285,"../../../lib/extend":395,"../../cartesian/layout_attributes":449}],468:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81937,7 +83008,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":393,"../../cartesian/axis_defaults":432,"../../cartesian/type_defaults":452,"./axis_attributes":459,"tinycolor2":249}],461:[function(require,module,exports){ +},{"../../../lib":401,"../../cartesian/axis_defaults":440,"../../cartesian/type_defaults":460,"./axis_attributes":467,"tinycolor2":250}],469:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82100,7 +83171,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":391,"../../../lib/str2rgbarray":411}],462:[function(require,module,exports){ +},{"../../../lib/html2unicode":399,"../../../lib/str2rgbarray":419}],470:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82114,10 +83185,11 @@ module.exports = createAxesOptions; var Lib = require('../../../lib'); var Color = require('../../../components/color'); +var Registry = require('../../../registry'); var handleSubplotDefaults = require('../../subplot_defaults'); -var layoutAttributes = require('./layout_attributes'); var supplyGl3dAxisLayoutDefaults = require('./axis_defaults'); +var layoutAttributes = require('./layout_attributes'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { @@ -82136,6 +83208,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { type: 'gl3d', attributes: layoutAttributes, handleDefaults: handleGl3dDefaults, + fullLayout: layoutOut, font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, @@ -82200,11 +83273,15 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { calendar: opts.calendar }); + Registry.getComponentMethod('annotations3d', 'handleDefaults')( + sceneLayoutIn, sceneLayoutOut, opts + ); + coerce('dragmode', opts.getDfltFromLayout('dragmode')); coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":278,"../../../lib":393,"../../subplot_defaults":477,"./axis_defaults":460,"./layout_attributes":463}],463:[function(require,module,exports){ +},{"../../../components/color":285,"../../../lib":401,"../../../registry":486,"../../subplot_defaults":485,"./axis_defaults":468,"./layout_attributes":471}],471:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82240,6 +83317,8 @@ function makeVector(x, y, z) { } module.exports = { + _arrayAttrRegexps: [/^scene([2-9]|[1-9][0-9]+)?\.annotations/], + bgcolor: { valType: 'color', @@ -82332,7 +83411,7 @@ module.exports = { } }; -},{"../../../lib/extend":387,"./axis_attributes":459}],464:[function(require,module,exports){ +},{"../../../lib/extend":395,"./axis_attributes":467}],472:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82384,7 +83463,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":411}],465:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":419}],473:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82480,7 +83559,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":393,"../../../lib/html2unicode":391,"../../cartesian/axes":430}],466:[function(require,module,exports){ +},{"../../../lib":401,"../../../lib/html2unicode":399,"../../cartesian/axes":438}],474:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82514,7 +83593,7 @@ function project(camera, v) { module.exports = project; -},{}],467:[function(require,module,exports){ +},{}],475:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -82529,6 +83608,7 @@ module.exports = project; var createPlot = require('gl-plot3d'); var getContext = require('webgl-context'); +var Registry = require('../../registry'); var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); @@ -82546,7 +83626,6 @@ var computeTickMarks = require('./layout/tick_marks'); var STATIC_CANVAS, STATIC_CONTEXT; function render(scene) { - var trace; // update size of svg container @@ -82584,8 +83663,8 @@ function render(scene) { if(lastPicked !== null) { var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate); trace = lastPicked.data; - var hoverinfo = trace.hoverinfo; var ptNumber = selection.index; + var hoverinfo = Fx.castHoverinfo(trace, scene.fullLayout, ptNumber); var xVal = formatter('xaxis', selection.traceCoordinate[0]), yVal = formatter('yaxis', selection.traceCoordinate[1]), @@ -82615,22 +83694,25 @@ function render(scene) { fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') }, { - container: svgContainer + container: svgContainer, + gd: scene.graphDiv }); } - var eventData = { - points: [{ - x: selection.traceCoordinate[0], - y: selection.traceCoordinate[1], - z: selection.traceCoordinate[2], - data: trace._input, - fullData: trace, - curveNumber: trace.index, - pointNumber: ptNumber - }] + var pointData = { + x: selection.traceCoordinate[0], + y: selection.traceCoordinate[1], + z: selection.traceCoordinate[2], + data: trace._input, + fullData: trace, + curveNumber: trace.index, + pointNumber: ptNumber }; + Fx.appendArrayPointValue(pointData, trace, ptNumber); + + var eventData = {points: [pointData]}; + if(selection.buttons && selection.distance < 5) { scene.graphDiv.emit('plotly_click', eventData); } @@ -82644,6 +83726,8 @@ function render(scene) { Fx.loneUnhover(svgContainer); scene.graphDiv.emit('plotly_unhover', oldEventData); } + + scene.drawAnnotations(scene); } function initializeGLPlot(scene, fullLayout, canvas, gl) { @@ -82696,7 +83780,7 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) { if(scene.fullSceneLayout.dragmode === false) return; var update = {}; - update[scene.id] = getLayoutCamera(scene.camera); + update[scene.id + '.camera'] = getLayoutCamera(scene.camera); scene.saveCamera(scene.graphDiv.layout); scene.graphDiv.emit('plotly_relayout', update); }; @@ -82786,6 +83870,9 @@ function Scene(options, fullLayout) { this.contourLevels = [ [], [], [] ]; + this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert'); + this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw'); + if(!initializeGLPlot(this, fullLayout)) return; // todo check the necessity for this line } @@ -82910,6 +83997,9 @@ proto.plot = function(sceneData, fullLayout, layout) { // Save scale this.dataScale = dataScale; + // after computeTraceBounds where ax._categories are filled in + this.convertAnnotations(this); + // Update traces for(i = 0; i < sceneData.length; ++i) { data = sceneData[i]; @@ -82969,13 +84059,28 @@ proto.plot = function(sceneData, fullLayout, layout) { if(axis.autorange) { sceneBounds[0][i] = Infinity; sceneBounds[1][i] = -Infinity; - for(j = 0; j < this.glplot.objects.length; ++j) { - var objBounds = this.glplot.objects[j].bounds; - sceneBounds[0][i] = Math.min(sceneBounds[0][i], - objBounds[0][i] / dataScale[i]); - sceneBounds[1][i] = Math.max(sceneBounds[1][i], - objBounds[1][i] / dataScale[i]); + + var objects = this.glplot.objects; + var annotations = this.fullSceneLayout.annotations || []; + var axLetter = axis._name.charAt(0); + + for(j = 0; j < objects.length; j++) { + var objBounds = objects[j].bounds; + sceneBounds[0][i] = Math.min(sceneBounds[0][i], objBounds[0][i] / dataScale[i]); + sceneBounds[1][i] = Math.max(sceneBounds[1][i], objBounds[1][i] / dataScale[i]); + } + + for(j = 0; j < annotations.length; j++) { + var ann = annotations[j]; + + // N.B. not taking into consideration the arrowhead + if(ann.visible) { + var pos = axis.r2l(ann[axLetter]); + sceneBounds[0][i] = Math.min(sceneBounds[0][i], pos); + sceneBounds[1][i] = Math.max(sceneBounds[1][i], pos); + } } + if('rangemode' in axis && axis.rangemode === 'tozero') { sceneBounds[0][i] = Math.min(sceneBounds[0][i], 0); sceneBounds[1][i] = Math.max(sceneBounds[1][i], 0); @@ -82989,9 +84094,9 @@ proto.plot = function(sceneData, fullLayout, layout) { sceneBounds[1][i] += d / 32.0; } } else { - var range = fullSceneLayout[axisProperties[i]].range; - sceneBounds[0][i] = range[0]; - sceneBounds[1][i] = range[1]; + var range = axis.range; + sceneBounds[0][i] = axis.r2l(range[0]); + sceneBounds[1][i] = axis.r2l(range[1]); } if(sceneBounds[0][i] === sceneBounds[1][i]) { sceneBounds[0][i] -= 1; @@ -83233,7 +84338,7 @@ proto.toImage = function(format) { }; proto.setConvert = function() { - for(var i = 0; i < 3; ++i) { + for(var i = 0; i < 3; i++) { var ax = this.fullSceneLayout[axisProperties[i]]; Axes.setConvert(ax, this.fullLayout); ax.setScale = Lib.noop; @@ -83242,7 +84347,7 @@ proto.setConvert = function() { module.exports = Scene; -},{"../../components/fx":319,"../../lib":393,"../../lib/show_no_webgl_msg":409,"../../lib/str2rgbarray":411,"../../plots/cartesian/axes":430,"./camera":456,"./layout/convert":461,"./layout/spikes":464,"./layout/tick_marks":465,"./project":466,"gl-plot3d":133,"webgl-context":264}],468:[function(require,module,exports){ +},{"../../components/fx":326,"../../lib":401,"../../lib/show_no_webgl_msg":417,"../../lib/str2rgbarray":419,"../../plots/cartesian/axes":438,"../../registry":486,"./camera":464,"./layout/convert":469,"./layout/spikes":472,"./layout/tick_marks":473,"./project":474,"gl-plot3d":134,"webgl-context":265}],476:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -83385,7 +84490,7 @@ module.exports = { } }; -},{"../components/color/attributes":277,"../lib":393,"./font_attributes":454}],469:[function(require,module,exports){ +},{"../components/color/attributes":284,"../lib":401,"./font_attributes":462}],477:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -83423,7 +84528,7 @@ module.exports = { } }; -},{}],470:[function(require,module,exports){ +},{}],478:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -83439,6 +84544,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -83931,12 +85037,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -84261,12 +85393,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -84279,7 +85411,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -85212,6 +86347,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -85427,7 +86566,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -85448,6 +86593,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -85495,25 +86641,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -85522,11 +86654,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -85599,7 +86727,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":278,"../components/errorbars":308,"../constants/numerical":377,"../lib":393,"../plotly":425,"../registry":478,"./animation_attributes":426,"./attributes":428,"./command":453,"./font_attributes":454,"./frame_attributes":455,"./layout_attributes":468,"d3":79,"fast-isnumeric":87}],471:[function(require,module,exports){ +},{"../components/color":285,"../components/errorbars":315,"../constants/numerical":385,"../lib":401,"../plot_api/plot_schema":427,"../plotly":433,"../registry":486,"./animation_attributes":434,"./attributes":436,"./command":461,"./font_attributes":462,"./frame_attributes":463,"./layout_attributes":476,"d3":79,"fast-isnumeric":87}],479:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85624,7 +86752,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":494}],472:[function(require,module,exports){ +},{"../../traces/scatter/attributes":503}],480:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85739,7 +86867,7 @@ module.exports = { } }; -},{"../../lib/extend":387,"../cartesian/layout_attributes":441}],473:[function(require,module,exports){ +},{"../../lib/extend":395,"../cartesian/layout_attributes":449}],481:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85754,7 +86882,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":474,"./micropolar_manager":475}],474:[function(require,module,exports){ +},{"./micropolar":482,"./micropolar_manager":483}],482:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87173,7 +88301,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":393,"d3":79}],475:[function(require,module,exports){ +},{"../../lib":401,"d3":79}],483:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87259,7 +88387,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":278,"../../lib":393,"./micropolar":474,"./undo_manager":476,"d3":79}],476:[function(require,module,exports){ +},{"../../components/color":285,"../../lib":401,"./micropolar":482,"./undo_manager":484,"d3":79}],484:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87325,7 +88453,7 @@ module.exports = function UndoManager() { }; }; -},{}],477:[function(require,module,exports){ +},{}],485:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87400,7 +88528,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":393,"./plots":470}],478:[function(require,module,exports){ +},{"../lib":401,"./plots":478}],486:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87591,7 +88719,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":396,"./lib/noop":400,"./lib/push_unique":404,"./plots/attributes":428}],479:[function(require,module,exports){ +},{"./lib/loggers":404,"./lib/noop":408,"./lib/push_unique":412,"./plots/attributes":436}],487:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87763,7 +88891,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":393,"../plots/plots":470}],480:[function(require,module,exports){ +},{"../lib":401,"../plots/plots":478}],488:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87829,7 +88957,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":393,"../plot_api/to_image":423,"./filesaver":481}],481:[function(require,module,exports){ +},{"../lib":401,"../plot_api/to_image":431,"./filesaver":489}],489:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87897,7 +89025,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],482:[function(require,module,exports){ +},{}],490:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87930,7 +89058,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],483:[function(require,module,exports){ +},{}],491:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87956,7 +89084,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":479,"./download":480,"./helpers":482,"./svgtoimg":484,"./toimage":485,"./tosvg":486}],484:[function(require,module,exports){ +},{"./cloneplot":487,"./download":488,"./helpers":490,"./svgtoimg":492,"./toimage":493,"./tosvg":494}],492:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87994,7 +89122,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -88087,7 +89215,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":393,"events":85}],485:[function(require,module,exports){ +},{"../lib":401,"events":85}],493:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88167,7 +89295,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":393,"../plotly":425,"./cloneplot":479,"./helpers":482,"./svgtoimg":484,"./tosvg":486,"events":85}],486:[function(require,module,exports){ +},{"../lib":401,"../plotly":433,"./cloneplot":487,"./helpers":490,"./svgtoimg":492,"./tosvg":494,"events":85}],494:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88181,12 +89309,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -88239,20 +89384,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -88260,10 +89407,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -88277,67 +89435,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":278,"../components/drawing":302,"../constants/xmlns_namespaces":379,"../lib/svg_text_utils":412,"d3":79}],487:[function(require,module,exports){ -/** -* Copyright 2012-2017, 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'); -var Plots = require('../../plots/plots'); -var Colorscale = require('../../components/colorscale'); -var drawColorbar = require('../../components/colorbar/draw'); - - -module.exports = function colorbar(gd, cd) { - var trace = cd[0].trace, - cbId = 'cb' + trace.uid, - zmin = trace.zmin, - zmax = trace.zmax; - - if(!isNumeric(zmin)) zmin = Lib.aggNums(Math.min, null, trace.z); - if(!isNumeric(zmax)) zmax = Lib.aggNums(Math.max, null, trace.z); - - gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); - - if(!trace.showscale) { - Plots.autoMargin(gd, cbId); - return; - } - - var cb = cd[0].t.cb = drawColorbar(gd, cbId); - var sclFunc = Colorscale.makeColorScaleFunc( - Colorscale.extractScale( - trace.colorscale, - zmin, - zmax - ), - { noNumericCheck: true } - ); - - cb.fillcolor(sclFunc) - .filllevels({start: zmin, end: zmax, size: (zmax - zmin) / 254}) - .options(trace.colorbar)(); -}; - -},{"../../components/colorbar/draw":281,"../../components/colorscale":292,"../../lib":393,"../../plots/plots":470,"fast-isnumeric":87}],488:[function(require,module,exports){ +},{"../components/color":285,"../components/drawing":309,"../constants/xmlns_namespaces":387,"d3":79}],495:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88440,8 +89547,12 @@ module.exports = { width: extendFlat({}, surfaceAtts.contours.x.width) }, + cauto: colorscaleAttrs.zauto, + cmin: colorscaleAttrs.zmin, + cmax: colorscaleAttrs.zmax, colorscale: colorscaleAttrs.colorscale, reversescale: colorscaleAttrs.reversescale, + autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}), showscale: colorscaleAttrs.showscale, colorbar: colorbarAttrs, @@ -88470,7 +89581,76 @@ module.exports = { }, surfaceAtts.lighting) }; -},{"../../components/colorbar/attributes":279,"../../components/colorscale/attributes":283,"../../lib/extend":387,"../surface/attributes":523}],489:[function(require,module,exports){ +},{"../../components/colorbar/attributes":286,"../../components/colorscale/attributes":290,"../../lib/extend":395,"../surface/attributes":532}],496:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 colorscaleCalc = require('../../components/colorscale/calc'); + +module.exports = function calc(gd, trace) { + if(trace.intensity) { + colorscaleCalc(trace, trace.intensity, '', 'c'); + } +}; + +},{"../../components/colorscale/calc":291}],497:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Plots = require('../../plots/plots'); +var Colorscale = require('../../components/colorscale'); +var drawColorbar = require('../../components/colorbar/draw'); + +module.exports = function colorbar(gd, cd) { + var trace = cd[0].trace, + cbId = 'cb' + trace.uid, + cmin = trace.cmin, + cmax = trace.cmax, + vals = trace.intensity || []; + + if(!isNumeric(cmin)) cmin = Lib.aggNums(Math.min, null, vals); + if(!isNumeric(cmax)) cmax = Lib.aggNums(Math.max, null, vals); + + gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); + + if(!trace.showscale) { + Plots.autoMargin(gd, cbId); + return; + } + + var cb = cd[0].t.cb = drawColorbar(gd, cbId); + var sclFunc = Colorscale.makeColorScaleFunc( + Colorscale.extractScale( + trace.colorscale, + cmin, + cmax + ), + { noNumericCheck: true } + ); + + cb.fillcolor(sclFunc) + .filllevels({start: cmin, end: cmax, size: (cmax - cmin) / 254}) + .options(trace.colorbar)(); +}; + +},{"../../components/colorbar/draw":288,"../../components/colorscale":299,"../../lib":401,"../../plots/plots":478,"fast-isnumeric":87}],498:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88597,6 +89777,7 @@ proto.update = function(data) { if(data.intensity) { this.color = '#fff'; config.vertexIntensity = data.intensity; + config.vertexIntensityBounds = [data.cmin, data.cmax]; config.colormap = parseColorScale(data.colorscale); } else if(data.vertexcolor) { @@ -88633,7 +89814,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":411,"alpha-shape":14,"convex-hull":70,"delaunay-triangulate":80,"gl-mesh3d":131,"tinycolor2":249}],490:[function(require,module,exports){ +},{"../../lib/str2rgbarray":419,"alpha-shape":14,"convex-hull":70,"delaunay-triangulate":80,"gl-mesh3d":132,"tinycolor2":250}],499:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88647,10 +89828,9 @@ module.exports = createMesh3DTrace; var Registry = require('../../registry'); var Lib = require('../../lib'); -var colorbarDefaults = require('../../components/colorbar/defaults'); +var colorscaleDefaults = require('../../components/colorscale/defaults'); var attributes = require('./attributes'); - module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); @@ -88713,28 +89893,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if('intensity' in traceIn) { coerce('intensity'); - coerce('showscale', true); - } - else { + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); + } else { traceOut.showscale = false; if('facecolor' in traceIn) coerce('facecolor'); else if('vertexcolor' in traceIn) coerce('vertexcolor'); else coerce('color', defaultColor); } - - if(traceOut.reversescale) { - traceOut.colorscale = traceOut.colorscale.map(function(si) { - return [1 - si[0], si[1]]; - }).reverse(); - } - - if(traceOut.showscale) { - colorbarDefaults(traceIn, traceOut, layout); - } }; -},{"../../components/colorbar/defaults":280,"../../lib":393,"../../registry":478,"./attributes":488}],491:[function(require,module,exports){ +},{"../../components/colorscale/defaults":294,"../../lib":401,"../../registry":486,"./attributes":495}],500:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88750,7 +89919,8 @@ var Mesh3D = {}; Mesh3D.attributes = require('./attributes'); Mesh3D.supplyDefaults = require('./defaults'); -Mesh3D.colorbar = require('../heatmap/colorbar'); +Mesh3D.calc = require('./calc'); +Mesh3D.colorbar = require('./colorbar'); Mesh3D.plot = require('./convert'); Mesh3D.moduleType = 'trace'; @@ -88763,7 +89933,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":457,"../heatmap/colorbar":487,"./attributes":488,"./convert":489,"./defaults":490}],492:[function(require,module,exports){ +},{"../../plots/gl3d":465,"./attributes":495,"./calc":496,"./colorbar":497,"./convert":498,"./defaults":499}],501:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88788,7 +89958,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":278}],493:[function(require,module,exports){ +},{"../../components/color":285}],502:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88840,7 +90010,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":393}],494:[function(require,module,exports){ +},{"../../lib":401}],503:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88886,20 +90056,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -89120,7 +90282,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":279,"../../components/colorscale/color_attributes":285,"../../components/drawing":302,"../../components/drawing/attributes":301,"../../components/errorbars/attributes":304,"../../lib/extend":387,"./constants":499}],495:[function(require,module,exports){ +},{"../../components/colorbar/attributes":286,"../../components/colorscale/color_attributes":292,"../../components/drawing":309,"../../components/drawing/attributes":308,"../../components/errorbars/attributes":311,"../../lib/extend":395,"./constants":508}],504:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89251,7 +90413,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":377,"../../plots/cartesian/axes":430,"./arrays_to_calcdata":493,"./colorscale_calc":498,"./subtypes":514,"fast-isnumeric":87}],496:[function(require,module,exports){ +},{"../../constants/numerical":385,"../../plots/cartesian/axes":438,"./arrays_to_calcdata":502,"./colorscale_calc":507,"./subtypes":523,"fast-isnumeric":87}],505:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89290,7 +90452,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],497:[function(require,module,exports){ +},{}],506:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89346,7 +90508,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":281,"../../components/colorscale":292,"../../lib":393,"../../plots/plots":470,"fast-isnumeric":87}],498:[function(require,module,exports){ +},{"../../components/colorbar/draw":288,"../../components/colorscale":299,"../../lib":401,"../../plots/plots":478,"fast-isnumeric":87}],507:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89379,7 +90541,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":284,"../../components/colorscale/has_colorscale":291,"./subtypes":514}],499:[function(require,module,exports){ +},{"../../components/colorscale/calc":291,"../../components/colorscale/has_colorscale":298,"./subtypes":523}],508:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89395,7 +90557,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],500:[function(require,module,exports){ +},{}],509:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89434,11 +90596,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -89477,7 +90637,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":307,"../../lib":393,"./attributes":494,"./constants":499,"./fillcolor_defaults":501,"./line_defaults":505,"./line_shape_defaults":507,"./marker_defaults":510,"./subtypes":514,"./text_defaults":515,"./xy_defaults":516}],501:[function(require,module,exports){ +},{"../../components/errorbars/defaults":314,"../../lib":401,"./attributes":503,"./constants":508,"./fillcolor_defaults":510,"./line_defaults":514,"./line_shape_defaults":516,"./marker_defaults":519,"./subtypes":523,"./text_defaults":524,"./xy_defaults":525}],510:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89515,7 +90675,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":278}],502:[function(require,module,exports){ +},{"../../components/color":285}],511:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89568,7 +90728,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":278,"./subtypes":514}],503:[function(require,module,exports){ +},{"../../components/color":285,"./subtypes":523}],512:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89595,11 +90755,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -89655,7 +90816,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -89739,7 +90900,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":278,"../../components/errorbars":308,"../../components/fx":319,"../../lib":393,"./get_trace_color":502}],504:[function(require,module,exports){ +},{"../../components/color":285,"../../components/errorbars":315,"../../components/fx":326,"../../lib":401,"./get_trace_color":511}],513:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89783,7 +90944,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":440,"./arrays_to_calcdata":493,"./attributes":494,"./calc":495,"./clean_data":496,"./colorbar":497,"./defaults":500,"./hover":503,"./plot":511,"./select":512,"./style":513,"./subtypes":514}],505:[function(require,module,exports){ +},{"../../plots/cartesian":448,"./arrays_to_calcdata":502,"./attributes":503,"./calc":504,"./clean_data":505,"./colorbar":506,"./defaults":509,"./hover":512,"./plot":520,"./select":521,"./style":522,"./subtypes":523}],514:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89816,7 +90977,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":287,"../../components/colorscale/has_colorscale":291}],506:[function(require,module,exports){ +},{"../../components/colorscale/defaults":294,"../../components/colorscale/has_colorscale":298}],515:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89989,7 +91150,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":377}],507:[function(require,module,exports){ +},{"../../constants/numerical":385}],516:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90008,7 +91169,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],508:[function(require,module,exports){ +},{}],517:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90049,7 +91210,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],509:[function(require,module,exports){ +},{}],518:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90091,7 +91252,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":87}],510:[function(require,module,exports){ +},{"fast-isnumeric":87}],519:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90166,7 +91327,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":278,"../../components/colorscale/defaults":287,"../../components/colorscale/has_colorscale":291,"./subtypes":514}],511:[function(require,module,exports){ +},{"../../components/color":285,"../../components/colorscale/defaults":294,"../../components/colorscale/has_colorscale":298,"./subtypes":523}],520:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90509,10 +91670,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -90523,7 +91686,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -90531,7 +91695,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -90588,17 +91753,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -90610,6 +91778,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -90629,6 +91799,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -90637,7 +91809,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -90714,7 +91886,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":302,"../../components/errorbars":308,"../../lib":393,"../../lib/polygon":403,"./line_points":506,"./link_traces":508,"./subtypes":514,"d3":79}],512:[function(require,module,exports){ +},{"../../components/drawing":309,"../../components/errorbars":315,"../../lib":401,"../../lib/polygon":411,"./line_points":515,"./link_traces":517,"./subtypes":523,"d3":79}],521:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90736,7 +91908,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -90760,11 +91931,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -90787,7 +91956,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":514}],513:[function(require,module,exports){ +},{"./subtypes":523}],522:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90818,10 +91987,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -90833,7 +92002,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":302,"../../components/errorbars":308,"d3":79}],514:[function(require,module,exports){ +},{"../../components/drawing":309,"../../components/errorbars":315,"d3":79}],523:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90869,7 +92038,7 @@ module.exports = { } }; -},{"../../lib":393}],515:[function(require,module,exports){ +},{"../../lib":401}],524:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90890,7 +92059,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":393}],516:[function(require,module,exports){ +},{"../../lib":401}],525:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90940,7 +92109,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":478}],517:[function(require,module,exports){ +},{"../../registry":486}],526:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -90956,7 +92125,7 @@ var colorAttributes = require('../../components/colorscale/color_attributes'); var errorBarAttrs = require('../../components/errorbars/attributes'); var DASHES = require('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl3d_markers'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line, @@ -91085,7 +92254,7 @@ module.exports = { error_z: errorBarAttrs, }; -},{"../../components/colorscale/color_attributes":285,"../../components/errorbars/attributes":304,"../../constants/gl3d_dashes":374,"../../constants/gl_markers":375,"../../lib/extend":387,"../scatter/attributes":494}],518:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":292,"../../components/errorbars/attributes":311,"../../constants/gl3d_dashes":382,"../../constants/gl3d_markers":383,"../../lib/extend":395,"../scatter/attributes":503}],527:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91114,7 +92283,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":493,"../scatter/colorscale_calc":498}],519:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":502,"../scatter/colorscale_calc":507}],528:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91185,7 +92354,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":306}],520:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":313}],529:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91208,7 +92377,7 @@ var str2RgbaArray = require('../../lib/str2rgbarray'); var formatColor = require('../../lib/gl_format_color'); var makeBubbleSizeFn = require('../scatter/make_bubble_size_func'); var DASH_PATTERNS = require('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl3d_markers'); var calculateError = require('./calc_errors'); @@ -91656,7 +92825,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":374,"../../constants/gl_markers":375,"../../lib":393,"../../lib/gl_format_color":390,"../../lib/str2rgbarray":411,"../scatter/make_bubble_size_func":509,"./calc_errors":519,"delaunay-triangulate":80,"gl-error3d":103,"gl-line3d":108,"gl-mesh3d":131,"gl-scatter3d":137}],521:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":382,"../../constants/gl3d_markers":383,"../../lib":401,"../../lib/gl_format_color":398,"../../lib/str2rgbarray":419,"../scatter/make_bubble_size_func":518,"./calc_errors":528,"delaunay-triangulate":80,"gl-error3d":103,"gl-line3d":109,"gl-mesh3d":132,"gl-scatter3d":138}],530:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91746,7 +92915,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) { return len; } -},{"../../components/errorbars/defaults":307,"../../lib":393,"../../registry":478,"../scatter/line_defaults":505,"../scatter/marker_defaults":510,"../scatter/subtypes":514,"../scatter/text_defaults":515,"./attributes":517}],522:[function(require,module,exports){ +},{"../../components/errorbars/defaults":314,"../../lib":401,"../../registry":486,"../scatter/line_defaults":514,"../scatter/marker_defaults":519,"../scatter/subtypes":523,"../scatter/text_defaults":524,"./attributes":526}],531:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91761,7 +92930,7 @@ var Scatter3D = {}; Scatter3D.plot = require('./convert'); Scatter3D.attributes = require('./attributes'); -Scatter3D.markerSymbols = require('../../constants/gl_markers'); +Scatter3D.markerSymbols = require('../../constants/gl3d_markers'); Scatter3D.supplyDefaults = require('./defaults'); Scatter3D.colorbar = require('../scatter/colorbar'); Scatter3D.calc = require('./calc'); @@ -91777,7 +92946,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":375,"../../plots/gl3d":457,"../scatter/colorbar":497,"./attributes":517,"./calc":518,"./convert":520,"./defaults":521}],523:[function(require,module,exports){ +},{"../../constants/gl3d_markers":383,"../../plots/gl3d":465,"../scatter/colorbar":506,"./attributes":526,"./calc":527,"./convert":529,"./defaults":530}],532:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -91882,7 +93051,6 @@ module.exports = { }, - // Todo this block has a structure of colorscale/attributes.js but with colorscale/color_attributes.js names cauto: colorscaleAttrs.zauto, cmin: colorscaleAttrs.zmin, cmax: colorscaleAttrs.zmax, @@ -91997,7 +93165,7 @@ module.exports = { } }; -},{"../../components/color":278,"../../components/colorbar/attributes":279,"../../components/colorscale/attributes":283,"../../lib/extend":387}],524:[function(require,module,exports){ +},{"../../components/color":285,"../../components/colorbar/attributes":286,"../../components/colorscale/attributes":290,"../../lib/extend":395}],533:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92021,7 +93189,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":284}],525:[function(require,module,exports){ +},{"../../components/colorscale/calc":291}],534:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92073,7 +93241,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":281,"../../components/colorscale":292,"../../lib":393,"../../plots/plots":470,"fast-isnumeric":87}],526:[function(require,module,exports){ +},{"../../components/colorbar/draw":288,"../../components/colorscale":299,"../../lib":401,"../../plots/plots":478,"fast-isnumeric":87}],535:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92452,7 +93620,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":411,"gl-surface3d":149,"ndarray":200,"ndarray-fill":190,"ndarray-homography":192,"ndarray-ops":194,"tinycolor2":249}],527:[function(require,module,exports){ +},{"../../lib/str2rgbarray":419,"gl-surface3d":150,"ndarray":201,"ndarray-fill":191,"ndarray-homography":193,"ndarray-ops":195,"tinycolor2":250}],536:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92573,7 +93741,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":287,"../../lib":393,"../../registry":478,"./attributes":523}],528:[function(require,module,exports){ +},{"../../components/colorscale/defaults":294,"../../lib":401,"../../registry":486,"./attributes":532}],537:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -92603,5 +93771,5 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":457,"./attributes":523,"./calc":524,"./colorbar":525,"./convert":526,"./defaults":527}]},{},[4])(4) +},{"../../plots/gl3d":465,"./attributes":532,"./calc":533,"./colorbar":534,"./convert":535,"./defaults":536}]},{},[4])(4) }); \ No newline at end of file diff --git a/dist/plotly-gl3d.min.js b/dist/plotly-gl3d.min.js index bb4c88e271b..bb4c9e906d4 100644 --- a/dist/plotly-gl3d.min.js +++ b/dist/plotly-gl3d.min.js @@ -1,42 +1,43 @@ /** -* plotly.js (gl3d - minified) v1.27.1 +* plotly.js (gl3d - minified) v1.28.0 * Copyright 2012-2017, 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||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))u.rotate(o,0,0,-t*n*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,f*(Math.exp(s)-1))}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":9,"mouse-change":185,"mouse-event-offset":186,"mouse-wheel":188,"right-now":222}],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;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;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}()},{}],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.ushln(f):f<0&&(c=c.ushln(-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 a=0;a20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":35,"double-bits":81}],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)).ushln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":36,"double-bits":81}],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.abs().divmod(r.abs()),o=n.div,s=i(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,f=i(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=i(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}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){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return t&=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))<<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))<<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(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(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 s(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 l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;i=0|t.words[p],a=0|e.words[d],o=i*a+f,c+=o/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0,i+=o>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}function f(t,e,r){return(new h).mulp(t,e,r)}function h(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()), -this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),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.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,r=0!==a||o!==this.length-1?_[6-l.length]+l+r:l+r,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=M[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(t);f=f.idivn(c),r=f.isZero()?h+r:_[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,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>>13,d=0|o[1],p=8191&d,g=d>>>13,v=0|o[2],m=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,A=w>>>13,k=0|o[5],T=8191&k,E=k>>>13,C=0|o[6],L=8191&C,S=C>>>13,P=0|o[7],R=8191&P,O=P>>>13,I=0|o[8],z=8191&I,N=I>>>13,D=0|o[9],j=8191&D,F=D>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,X=0|s[2],W=8191&X,Y=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,K=0|s[4],J=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(f,U),i=Math.imul(f,V),i=i+Math.imul(h,U)|0,a=Math.imul(h,V);var vt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=Math.imul(p,V),i=i+Math.imul(g,U)|0,a=Math.imul(g,V),n=n+Math.imul(f,q)|0,i=i+Math.imul(f,G)|0,i=i+Math.imul(h,q)|0,a=a+Math.imul(h,G)|0;var mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),i=Math.imul(m,V),i=i+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=i+Math.imul(p,G)|0,i=i+Math.imul(g,q)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(f,W)|0,i=i+Math.imul(f,Y)|0,i=i+Math.imul(h,W)|0,a=a+Math.imul(h,Y)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=Math.imul(x,V),i=i+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(m,q)|0,i=i+Math.imul(m,G)|0,i=i+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=i+Math.imul(p,Y)|0,i=i+Math.imul(g,W)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(f,Q)|0,i=i+Math.imul(f,$)|0,i=i+Math.imul(h,Q)|0,a=a+Math.imul(h,$)|0;var bt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=Math.imul(M,V),i=i+Math.imul(A,U)|0,a=Math.imul(A,V),n=n+Math.imul(x,q)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(m,W)|0,i=i+Math.imul(m,Y)|0,i=i+Math.imul(y,W)|0,a=a+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,$)|0,i=i+Math.imul(g,Q)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(f,J)|0,i=i+Math.imul(f,tt)|0,i=i+Math.imul(h,J)|0,a=a+Math.imul(h,tt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=Math.imul(T,V),i=i+Math.imul(E,U)|0,a=Math.imul(E,V),n=n+Math.imul(M,q)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(A,q)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(x,W)|0,i=i+Math.imul(x,Y)|0,i=i+Math.imul(_,W)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=i+Math.imul(m,$)|0,i=i+Math.imul(y,Q)|0,a=a+Math.imul(y,$)|0,n=n+Math.imul(p,J)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(g,J)|0,a=a+Math.imul(g,tt)|0,n=n+Math.imul(f,rt)|0,i=i+Math.imul(f,nt)|0,i=i+Math.imul(h,rt)|0,a=a+Math.imul(h,nt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=Math.imul(L,V),i=i+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(T,q)|0,i=i+Math.imul(T,G)|0,i=i+Math.imul(E,q)|0,a=a+Math.imul(E,G)|0,n=n+Math.imul(M,W)|0,i=i+Math.imul(M,Y)|0,i=i+Math.imul(A,W)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(x,Q)|0,i=i+Math.imul(x,$)|0,i=i+Math.imul(_,Q)|0,a=a+Math.imul(_,$)|0,n=n+Math.imul(m,J)|0,i=i+Math.imul(m,tt)|0,i=i+Math.imul(y,J)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0,n=n+Math.imul(f,at)|0,i=i+Math.imul(f,ot)|0,i=i+Math.imul(h,at)|0,a=a+Math.imul(h,ot)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,U),i=Math.imul(R,V),i=i+Math.imul(O,U)|0,a=Math.imul(O,V),n=n+Math.imul(L,q)|0,i=i+Math.imul(L,G)|0,i=i+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(T,W)|0,i=i+Math.imul(T,Y)|0,i=i+Math.imul(E,W)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,i=i+Math.imul(M,$)|0,i=i+Math.imul(A,Q)|0,a=a+Math.imul(A,$)|0,n=n+Math.imul(x,J)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,J)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=i+Math.imul(m,nt)|0,i=i+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,n=n+Math.imul(f,lt)|0,i=i+Math.imul(f,ut)|0,i=i+Math.imul(h,lt)|0,a=a+Math.imul(h,ut)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(z,U),i=Math.imul(z,V),i=i+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(R,q)|0,i=i+Math.imul(R,G)|0,i=i+Math.imul(O,q)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(L,W)|0,i=i+Math.imul(L,Y)|0,i=i+Math.imul(S,W)|0,a=a+Math.imul(S,Y)|0,n=n+Math.imul(T,Q)|0,i=i+Math.imul(T,$)|0,i=i+Math.imul(E,Q)|0,a=a+Math.imul(E,$)|0,n=n+Math.imul(M,J)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(A,J)|0,a=a+Math.imul(A,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(m,at)|0,i=i+Math.imul(m,ot)|0,i=i+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(g,lt)|0,a=a+Math.imul(g,ut)|0,n=n+Math.imul(f,ft)|0,i=i+Math.imul(f,ht)|0,i=i+Math.imul(h,ft)|0,a=a+Math.imul(h,ht)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,U),i=Math.imul(j,V),i=i+Math.imul(F,U)|0,a=Math.imul(F,V),n=n+Math.imul(z,q)|0,i=i+Math.imul(z,G)|0,i=i+Math.imul(N,q)|0,a=a+Math.imul(N,G)|0,n=n+Math.imul(R,W)|0,i=i+Math.imul(R,Y)|0,i=i+Math.imul(O,W)|0,a=a+Math.imul(O,Y)|0,n=n+Math.imul(L,Q)|0,i=i+Math.imul(L,$)|0,i=i+Math.imul(S,Q)|0,a=a+Math.imul(S,$)|0,n=n+Math.imul(T,J)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(E,J)|0,a=a+Math.imul(E,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,n=n+Math.imul(x,at)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,i=i+Math.imul(m,ut)|0,i=i+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,i=i+Math.imul(p,ht)|0,i=i+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0,n=n+Math.imul(f,pt)|0,i=i+Math.imul(f,gt)|0,i=i+Math.imul(h,pt)|0,a=a+Math.imul(h,gt)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,q),i=Math.imul(j,G),i=i+Math.imul(F,q)|0,a=Math.imul(F,G),n=n+Math.imul(z,W)|0,i=i+Math.imul(z,Y)|0,i=i+Math.imul(N,W)|0,a=a+Math.imul(N,Y)|0,n=n+Math.imul(R,Q)|0,i=i+Math.imul(R,$)|0,i=i+Math.imul(O,Q)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(L,J)|0,i=i+Math.imul(L,tt)|0,i=i+Math.imul(S,J)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(E,rt)|0,a=a+Math.imul(E,nt)|0,n=n+Math.imul(M,at)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(A,at)|0,a=a+Math.imul(A,ot)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,i=i+Math.imul(m,ht)|0,i=i+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,gt)|0,i=i+Math.imul(g,pt)|0,a=a+Math.imul(g,gt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,W),i=Math.imul(j,Y),i=i+Math.imul(F,W)|0,a=Math.imul(F,Y),n=n+Math.imul(z,Q)|0,i=i+Math.imul(z,$)|0,i=i+Math.imul(N,Q)|0,a=a+Math.imul(N,$)|0,n=n+Math.imul(R,J)|0,i=i+Math.imul(R,tt)|0,i=i+Math.imul(O,J)|0,a=a+Math.imul(O,tt)|0,n=n+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,i=i+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(T,at)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,n=n+Math.imul(x,ft)|0,i=i+Math.imul(x,ht)|0,i=i+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0,n=n+Math.imul(m,pt)|0,i=i+Math.imul(m,gt)|0,i=i+Math.imul(y,pt)|0,a=a+Math.imul(y,gt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,Q),i=Math.imul(j,$),i=i+Math.imul(F,Q)|0,a=Math.imul(F,$),n=n+Math.imul(z,J)|0,i=i+Math.imul(z,tt)|0,i=i+Math.imul(N,J)|0,a=a+Math.imul(N,tt)|0,n=n+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,i=i+Math.imul(O,rt)|0,a=a+Math.imul(O,nt)|0,n=n+Math.imul(L,at)|0,i=i+Math.imul(L,ot)|0,i=i+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(E,lt)|0,a=a+Math.imul(E,ut)|0,n=n+Math.imul(M,ft)|0,i=i+Math.imul(M,ht)|0,i=i+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,gt)|0,i=i+Math.imul(_,pt)|0,a=a+Math.imul(_,gt)|0;var Ct=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,J),i=Math.imul(j,tt),i=i+Math.imul(F,J)|0,a=Math.imul(F,tt),n=n+Math.imul(z,rt)|0,i=i+Math.imul(z,nt)|0,i=i+Math.imul(N,rt)|0,a=a+Math.imul(N,nt)|0,n=n+Math.imul(R,at)|0,i=i+Math.imul(R,ot)|0,i=i+Math.imul(O,at)|0,a=a+Math.imul(O,ot)|0,n=n+Math.imul(L,lt)|0,i=i+Math.imul(L,ut)|0,i=i+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(T,ft)|0,i=i+Math.imul(T,ht)|0,i=i+Math.imul(E,ft)|0,a=a+Math.imul(E,ht)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,gt)|0,i=i+Math.imul(A,pt)|0,a=a+Math.imul(A,gt)|0;var Lt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,rt),i=Math.imul(j,nt),i=i+Math.imul(F,rt)|0,a=Math.imul(F,nt),n=n+Math.imul(z,at)|0,i=i+Math.imul(z,ot)|0,i=i+Math.imul(N,at)|0,a=a+Math.imul(N,ot)|0,n=n+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,i=i+Math.imul(O,lt)|0,a=a+Math.imul(O,ut)|0,n=n+Math.imul(L,ft)|0,i=i+Math.imul(L,ht)|0,i=i+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,gt)|0,i=i+Math.imul(E,pt)|0,a=a+Math.imul(E,gt)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,at),i=Math.imul(j,ot),i=i+Math.imul(F,at)|0,a=Math.imul(F,ot),n=n+Math.imul(z,lt)|0,i=i+Math.imul(z,ut)|0,i=i+Math.imul(N,lt)|0,a=a+Math.imul(N,ut)|0,n=n+Math.imul(R,ft)|0,i=i+Math.imul(R,ht)|0,i=i+Math.imul(O,ft)|0,a=a+Math.imul(O,ht)|0,n=n+Math.imul(L,pt)|0,i=i+Math.imul(L,gt)|0,i=i+Math.imul(S,pt)|0,a=a+Math.imul(S,gt)|0;var Pt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,lt),i=Math.imul(j,ut),i=i+Math.imul(F,lt)|0,a=Math.imul(F,ut),n=n+Math.imul(z,ft)|0,i=i+Math.imul(z,ht)|0,i=i+Math.imul(N,ft)|0,a=a+Math.imul(N,ht)|0,n=n+Math.imul(R,pt)|0,i=i+Math.imul(R,gt)|0,i=i+Math.imul(O,pt)|0,a=a+Math.imul(O,gt)|0;var Rt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,ft),i=Math.imul(j,ht),i=i+Math.imul(F,ft)|0,a=Math.imul(F,ht),n=n+Math.imul(z,pt)|0,i=i+Math.imul(z,gt)|0,i=i+Math.imul(N,pt)|0,a=a+Math.imul(N,gt)|0;var Ot=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,pt),i=Math.imul(j,gt),i=i+Math.imul(F,pt)|0,a=Math.imul(F,gt);var It=(u+n|0)+((8191&i)<<13)|0;return u=(a+(i>>>13)|0)+(It>>>26)|0,It&=67108863,l[0]=vt,l[1]=mt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=At,l[9]=kt,l[10]=Tt,l[11]=Et,l[12]=Ct,l[13]=Lt,l[14]=St,l[15]=Pt,l[16]=Rt,l[17]=Ot,l[18]=It,0!==u&&(l[19]=u,r.length++),r};Math.imul||(A=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?A(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):f(this,t,e)},h.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},h.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=l(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);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)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var f=0|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()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(s===-1),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){s=new a(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var h;return h=0===e.cmpn(1)?i:o,h.cmpn(0)<0&&h.iadd(t),h},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0] -},a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return this.cmpn(t)===-1},a.prototype.lt=function(t){return this.cmp(t)===-1},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new y(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var k={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},i(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(k[t])return k[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return k[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,i),h=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var g=d,v=0;0!==g.cmp(s);v++)g=g.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new b(t)},i(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===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))>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":255}],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];",M="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,_,":",M):i.push(M,_,":",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("");return new Function(s)()}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);E.length0;){P-=1;var O=P*k,I=E[O],z=E[O+1],N=E[O+2],D=E[O+3],j=E[O+4],F=E[O+5],B=P*T,U=C[B],V=C[B+1],H=1&F,q=!!(16&F),G=l,X=u,W=g,Y=L;if(H&&(G=g,X=L,W=l,Y=u),!(2&F&&(N=_(t,I,z,N,G,X,V),z>=N)||4&F&&(z=w(t,I,z,N,G,X,U))>=N)){var Z=N-z,Q=j-D;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),M=h*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"},{}],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,M=t+1,A=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],C=r[2*_],L=r[2*_+1],S=2*y,P=2*x,R=2*w,O=2*d,I=2*g,z=2*p,N=0;N<2;++N){var D=r[S+N],j=r[P+N],F=r[R+N];r[O+N]=D,r[I+N]=j,r[z+N]=F}o(v,t,r),o(m,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,C,L,r))for(;;){if(c(A,C,L,r)){c(A,T,E,r)?(s(B,M,A,r),++M,--A):(a(B,A,r),--A);break}if(--A>>1;h(x,E);for(var C=0,L=0,M=0;M=d)S=S-d|0,i(v,m,L--,S);else if(S>=0)i(p,g,C--,S);else if(S<=-d){S=-S-d|0;for(var P=0;P>>1;h(x,C);for(var L=0,S=0,P=0,A=0;A>1==x[2*A+3]>>1&&(O=2,A+=1),R<0){for(var I=-(R>>1)-1,z=0;z>1)-1;0===O?i(p,g,L--,I):1===O?i(v,m,S--,I):2===O&&i(y,b,P--,I)}}}function l(t,e,r,n,o,s,l,u,c,f,v,m){var y=0,b=2*t,_=e,w=e+t,M=1,A=1;n?A=d:M=d;for(var k=o;k>>1;h(x,L);for(var S=0,k=0;k=d?(R=!n,T-=d):(R=!!n,T-=1),R)a(p,g,S++,T);else{var O=m[T],I=b*T,z=v[I+e+1],N=v[I+e+1+t];t:for(var D=0;D>>1;h(x,M);for(var A=0,y=0;y=d)p[A++]=b-d;else{b-=1;var T=c[b],E=g*b,C=u[E+e+1],L=u[E+e+1+t];t:for(var S=0;S=0;--S)if(p[S]===b){for(var I=S+1;IZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?f(t,e,r):"string"==typeof t?u(t,e):h(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),a=n(r),o=a.write(t,e);return o!==r&&(a=a.slice(0,o)),a}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),i=0;i=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(G(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 B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function v(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 E(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,X(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function b(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&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}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)>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)>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)>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<=Q)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 I(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function z(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 N(t,e,r,n,i){return e=+e,r>>>=0,i||z(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||z(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(t,e,r,n,52,8),r+8}function j(t){if(t=t.trim().replace($,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(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=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function H(t){return W.toByteArray(j(t))}function q(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function X(t){return t!==t}var W=t("base64-js"),Y=t("ieee754");r.Buffer=i,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return l(t)},i.allocUnsafeSlow=function(t){return l(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,a){if(!i.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===a&&(a=this.length), -e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.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},i.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},i.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){I(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){I(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);I(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},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);I(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||I(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return N(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return N(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.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)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)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;al?l:o+16383));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":52,"robust-in-sphere":226}],49:[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,n.prototype.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],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===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":52,"robust-orientation":228}],51:[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){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],53:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],57:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var g=e[o],v=g[0],m=g[1],y=t[v],M=t[m];if((y[0]-M[0]||y[1]-M[1])<0){var k=v;v=m,m=k}g[0]=v;var T,E=g[1]=p[1];for(i&&(T=g[2]);a>0&&n[a-1][0]===o;){var p=n[--a],C=p[1];i?e.push([E,C,T]):e.push([E,C]),E=C}i?e.push([E,m,T]):e.push([E,m])}return s}function u(t,e,r){for(var i=e.length,a=new v(i),o=[],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 g(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":60,"is-plain-obj":177}],62:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":64}],64:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],65:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1, -rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],66:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,f,h,d,p,g,v,m,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",h=t.colormap,h||(h="jet"),"string"==typeof h){if(h=h.toLowerCase(),!l[h])throw Error(h+" not a supported colorscale");f=s(l[h])}else{if(!Array.isArray(h))throw Error("unsupported colormap option",h);f=s(h)}if(f.length>p)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);return c===n(t,e,i)?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);return f>0?s>0&&a(t,e,i)>0?1:-1:f<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":228,"robust-product":229,"robust-sum":233,signum:234,"two-sum":254}],68:[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},{}],72:[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":171}],74:[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},{}],75:[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":77}],76:[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 C=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",E,s(c)].join("");return new Function(["function ",C,"(",b.join(","),"){",x.join("\n"),"} return ",C].join(""))()}var u=t("uniq");e.exports=l},{uniq:257}],77:[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:0/0}function a(t){return null===t?0/0:+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=Mo.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?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 $(t){var r=".dragsuppress-"+ ++zo,i="click"+r,a=uo.select(n(t)).on("touchmove"+r,T).on("dragstart"+r,T).on("selectstart"+r,T);if(null==Io&&(Io=!("onselectstart"in t)&&w(t.style,"userSelect")),Io){var o=e(t).style,s=o[Io];o[Io]="none"}return function(t){if(a.on(r,null),Io&&(o[Io]=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(No<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();No=!(o.f||o.e),r.remove()}}return No?(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):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 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)*Ko,n=vt(n)*Jo,a=vt(a)*ts,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(0/0,0/0,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):Mt(""+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 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=ns.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=mt((.4124564*t+.3575761*e+.1804375*r)/Ko),i=mt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*i-16,500*(n-i),200*(i-mt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 Ct(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),St(e,r,t,n)}}function St(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 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 as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(It)),a}function It(){var t=zt(),e=Nt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(It,e)),os=0):(os=1,ls(It))}function zt(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Nt(){for(var t,e=is,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=cs.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=fs.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 M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var A=g.length+x.length+_.length+(b?0:i.length),k=A"===o?k+i+t:"^"===o?k.substring(0,A>>=1)+i+t+k.substring(A):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(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=L[o in gs?e.charAt(s++):o])||(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){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){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,C.c.toString(),e,n)}function l(t,e,n){return r(t,C.x.toString(),e,n)}function u(t,e,n){return r(t,C.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{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Wt(g),w=Xt(v),M=Wt(v),A=Xt(m),k=Wt(m),T=Xt(y),E=Wt(y);p.forEach(function(t,e){b.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 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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(hs.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"%"}},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: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){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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){ms.lastIndex=0;var n=ms.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;As.point=function(o,s){As.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+Fo/4),a=Math.sin(s)},As.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 Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Ae(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(Ne))}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,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()}},b=De(),x=e(b),_=!1;return y}}function Ne(t){return t.length>1}function De(){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-Do:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Do:Vo-e[1])}function Fe(t){var e,r=0/0,n=0/0,i=0/0;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)Do?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])>Do){var a=t[0]=0?1:-1,M=w*_,A=M>Fo,k=p*b;if(Ms.add(Math.atan2(k*w*Math.sin(M),g*x+k*Math.cos(M))),a+=A?_+w*Bo:_,A^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var C=(A^_>=0?-1:1)*nt(E[2]);(n>C||n===C&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-Do||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),(Ae(r,d)||Ae(p,d))&&(p[0]+=Do,p[1]+=Do,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&&Ae(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);xe(p,_e(s,h));var g=d,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-v-b)/m);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],A=t[1],k=e[1];M0^x[1]<(xo(x[0]-w)Fo^(w<=x[0]&&x[0]<=M)){var L=_e(g,(-v+b)/m);return xe(L,p),[x,Me(L)]}}}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)>Do;return ze(e,r,vr(t,6*Ho),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(){L.point=p,v&&v.push(m=[]),A=!0,M=!1,_=w=0/0}function d(){g&&(p(y,b),x&&M&&E.rejoin(),g.push(E.buffer())),L.point=f,M&&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]),A)y=t,b=e,x=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}};C(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,v,m,y,b,x,_,w,M,A,k,T=s,E=De(),C=qe(t,e,r,n),L={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 L}}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){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tHs&&(Hs=t),eqs&&(qs=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){Es+=t,Cs+=e,++Ls}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Ss+=o*(e+t)/2,Ps+=o*(r+n)/2,Rs+=o,Ke(e=t,r=n)}var e,r;Ws.point=function(n,i){Ws.point=t,Ke(e=n,r=i)}}function tr(){Ws.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Ss+=o*(n+t)/2,Ps+=o*(i+e)/2,Rs+=o,o=i*t-n*e,Os+=o*(n+t),Is+=o*(i+e),zs+=3*o,Ke(n=t,i=e)}var e,r,n,i;Ws.point=function(a,o){Ws.point=t,Ke(e=n=a,r=i=o)},Ws.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(){b=0/0,A.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(b,x)}function o(){A.point=r,e.lineEnd()}function l(){n(),A.point=u,A.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=M,A.point=a}function c(){i(b,x,y,_,w,M,d,p,f,g,v,m,s,e),A.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,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,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,M=u+g,A=Math.sqrt(_*_+w*w+M*M),k=Math.asin(M/=A),T=xo(xo(M)-1)a||xo((y*S+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[0]*qo,t[1]*qo]}function n(){s=Se(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,_=Ds,w=x,M=null,A=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?(M=t,Ds):He((M=+t)*Ho),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]):x,i()):A},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?Se(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+Do&&(e=-Vo+Do):e>Vo-Do&&(e=Vo-Do);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 Ir(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function zr(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 Nr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function Dr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=sl.pop()||new Dr;return e.site=t,e}function Fr(t){Zr(t),il.remove(t),sl.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)Do)s=s.L;else{if(!((i=a-Hr(s,o))>Do)){n>-Do?(e=s.P,r=s):i>-Do?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.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=nl,v=g.length;v--;)if((a=g[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oDo||xo(i-r)>Do)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)Do?{x:f,y:xo(e-f)Do?{x:xo(r-p)Do?{x:h,y:xo(e-h)Do?{x:xo(r-d)=-jo)){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=ll.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=ol._;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,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:bn(r,n)})),a=fl.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 Cn(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 Sn(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 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 In(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}}function zn(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 Nn(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 Dn(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 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 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 Ci(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(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],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 ji(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=cs.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=Yi(n.map(i),r?Math:kl);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 Al;arguments.length<2?r=Al:"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,M=(-x*v-m*_)/y,A=(x*m+v*_)/y,k=(-x*v+m*_)/y,T=w-p,E=M-g,C=A-p,L=k-g;return T*T+E*E>C*C+L*L&&(w=A,M=k),[[w-l,M-u],[w*r/b,M*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=Ct(r),p=Ct(n);++f1?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]+Sa(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(Ql,i);return a==Ql.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Ql[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:0/0},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=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=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(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)},Co=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Co=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,Co=Sizzle.matchesSelector),uo.selection=function(){return uo.select(ho.documentElement)};var Lo=uo.selection.prototype=[];Lo.select=function(t){var e,r,n,i,a=[];t=S(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}},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(R(e,t[e]));return this}return this.each(R(t,e))},Lo.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=z(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=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(L)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-A.x)/A.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){S++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function c(t){--S||(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(O,null),d(s),c(o)}var i=this,o=z.of(i,arguments),s=0,f=uo.select(n(i)).on(R,t).on(O,r),h=e(uo.mouse(i)),d=$(i);Bl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=A.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);Bl.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,fs=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,Dt(t,e))).toFixed(Math.max(0,Math.min(20,Dt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Vt(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Vt(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Vt(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,ms=/^%/;uo.locale=function(t){return{numberFormat:Ft(t),timeFormat:qt(t)}};var ys=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=ys.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&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={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=Me(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;As.point(t,r),e(t,r)}function a(){As.lineStart()}function o(){i(g,v),As.lineEnd(),xo(y)>Do&&(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]:tDo?d=90:y<-Do&&(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,1/0===c||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){ks=Ts=Es=Cs=Ls=Ss=Ps=Rs=Os=Is=zs=0,uo.geo.stream(t,Ns);var e=Os,r=Is,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+Do,f+.12*u+Do],[c-.214*u-Do,f+.234*u-Do]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Do,f+.166*u+Do],[c-.115*u-Do,f+.234*u-Do]]).stream(l).point,t},t.scale(1070)};var Fs,Bs,Us,Vs,Hs,qs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=Ye},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Fs+=xo(Bs/2)}},Xs={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ws={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ws.lineStart=er},polygonEnd:function(){Ws.point=Ke,Ws.lineStart=Je,Ws.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 Fs=0,uo.geo.stream(t,i(Gs)),Fs},t.centroid=function(t){return Es=Cs=Ls=Ss=Ps=Rs=Os=Is=zs=0,uo.geo.stream(t,i(Ws)),zs?[Os/zs,Is/zs]:Rs?[Ss/Rs,Ps/Rs]:Ls?[Es/Ls,Cs/Ls]:[0/0,0/0]},t.bounds=function(t){return Hs=qs=-(Us=Vs=1/0),uo.geo.stream(t,i(Xs)),[[Us,Vs],[Hs,qs]]},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)>Do}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>Do}).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+Do],[180,90-Do]]).minorExtent([[-180,-80-Do],[180,80+Do]])},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 Ys=0,uo.geo.stream(t,Zs),Ys};var Ys,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Qs=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=Ar(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Cr(Er)}).raw=Er;var Js=Ar(function(){return 1},Math.asin) -;(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Cr(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=Ct(r),a=Ct(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]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Do)*Do,y:Math.round(o(t,e)/Do)*Do,i:e}})}var n=Sr,i=Pr,a=n,o=i,s=ul;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=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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=Ct(s),x=Ct(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 M=m-g,A=y-v;M>A?y=v+M:m=g+A;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=dl.get(r)||hl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Nn,uo.interpolateHsl=Dn,uo.interpolateLab=jn,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:gl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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=0/0,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=Mi,i=_i;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=Ct(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Ct(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,Ci),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,Ci),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(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),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&&(Ni(ji(o,t,r),t,n),u+=n,c+=n),f+=o.m,u+=i.m,h+=l.m,c+=a.m;o&&!zi(a)&&(a.t=o,a.m+=f-c),i&&!Ii(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,M,A,k,T=0,E=0,C=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Sl?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 L=Math.abs(f-c-2*E)<=Fo?0:1;if(E&&ba(y,b,x,_)===d^L){var S=(c+f)/2;y=u*Math.cos(S),b=u*Math.sin(S),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),A=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,M,A,k)===1-d^P){var R=(c+f)/2;w=t*Math.cos(R),M=t*Math.sin(R),A=k=null}}else w=M=0;if(h>Do&&(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=Ct(e),t):s},t.source=function(e){return arguments.length?(a=Ct(e),t):a},t.target=function(e){return arguments.length?(o=Ct(e),t):o},t.startAngle=function(e){return arguments.length?(l=Ct(e),t):l},t.endAngle=function(e){return arguments.length?(u=Ct(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=Ct(r),t):e},t.target=function(e){return arguments.length?(r=Ct(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=Ya,r=Wa;return t.type=function(r){return arguments.length?(e=Ct(r),t):e},t.size=function(e){return arguments.length?(r=Ct(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*Dl)),r=e*Dl;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/Nl),r=e*Nl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Nl),r=e*Nl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=zl.keys();var Nl=Math.sqrt(3),Dl=Math.tan(30*Ho);Lo.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Fl||{time:Date.now(),ease:Cn,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&&(L||(b=null,P[0]-=f[1],P[1]-=h[1],L=2),T())}function g(){32==uo.event.keyCode&&2==L&&(P[0]+=f[1],P[1]+=h[1],L=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(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){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:45}],82:[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},{}],83:[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){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],86:[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},{}],87:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],88:[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=(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":74}],89:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}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}})},{}],90:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],91:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(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],M=this.pixelRatio*(a[3]*h+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=v,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 C=0;C<2;++C){var L=(A+1+C)%3,S=(A+1+(1^C))%3;this.gridEnable[L]&&this._lines.drawGrid(L,S,this.bounds,E,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var C=0;C<2;++C){var L=(A+1+C)%3,S=(A+1+(1^C))%3;this.zeroEnable[S]&&s[0][S]<=0&&s[1][S]>=0&&this._lines.drawZero(L,S,this.bounds,E,this.zeroLineColor[S],this.zeroLineWidth[S]*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 P=n(y,k[A].primalMinor),R=n(b,k[A].mirrorMinor),O=this.lineTickLength,C=0;C<3;++C){var I=M/r[5*C];P[C]*=O[C]*I,R[C]*=O[C]*I}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,P,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,R,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 z=k[A].primalMinor,N=n(x,k[A].primalOffset),C=0;C<3;++C)this.lineTickEnable[A]&&(N[C]+=M*z[C]*Math.max(this.lineTickLength[C],0)/r[5*C]);if(this.tickEnable[A]){for(var C=0;C<3;++C)N[C]+=M*z[C]*this.tickPad[C]/r[5*C];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],N,this.tickColor[A])}if(this.labelEnable[A]){for(var C=0;C<3;++C)N[C]+=M*z[C]*this.labelPad[C]/r[5*C];N[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],N,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":93,"./lib/cube.js":94,"./lib/lines.js":95,"./lib/text.js":97,"./lib/ticks.js":98}],93:[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":96,"gl-buffer":100,"gl-vao":154}],94:[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]&&(z=g));for(var N=-1,g=0;g<3;++g){var D=z^1<h[j][0]&&(j=D)}}var F=v;F[0]=F[1]=F[2]=0,F[o.log2(N^z)]=z&N,F[o.log2(z^j)]=z&j;var B=7^j;B===_||B===I?(B=7^N,F[o.log2(j^B)]=B&j):F[o.log2(N^B)]=B&N;for(var U=m,V=_,A=0;A<3;++A)U[A]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":139}],97:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),f=s(t,[{buffer:c,size:3}]),h=u(t);h.attributes.position.location=0;var d=new n(t,h,c,f);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},f=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var h=n.prototype,d=[0,0];h.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},h.update=function(t,e,r,n,a){function o(t,e,r,n){var a=f[r];a||(a=f[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,h=0,d=c.length;h=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],h=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),h[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"), -this.length=e<0?i(this.gl,this.type,this.length,this.usage,h,e):i(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}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:200,"ndarray-ops":194,"typedarray-pool":255}],101:[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"}},{}],102:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":101}],103:[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":104,"gl-buffer":100,"gl-vao":154}],104:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"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}","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}",null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":139}],105:[function(t,e,r){"use strict";function n(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}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))<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 FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",null,a)}},{"gl-shader":139}],108:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=g(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=v(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),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 M=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],M,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],M,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],M,-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 A=t.dashes,k=A.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":213}],130:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],131:[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,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=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=M,this.pointIds=x,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=w({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 _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},I.isTransparent=function(){return this.opacity<1},I.pickSlots=1,I.setPickBase=function(t){this.pickId=t},I.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=A.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()}},I.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()}},I.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),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(!w&&G.autoResize){var t=M.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",F=!0}}}function r(){for(var t=z.length,e=j.length,r=0;r0&&0===D[e-1];)D.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=z.length,e=j.length,r=0;rE.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},{}],135:[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(N[1])){var D=z;z=N,N=D,D=O,O=I,I=D;var j=P;P=R,R=j}z[0]<0&&(O[P]=-1),N[1]>0&&(I[R]=-1);for(var F=0,B=0,S=0;S<4;++S)F+=Math.pow(p[4*P+S],2),B+=Math.pow(p[4*R+S],2);O[P]/=Math.sqrt(F),I[R]/=Math.sqrt(B),d.axes[0]=O,d.axes[1]=I,d.fragClipBounds[0]=u(C,b[0],_,-1e8),d.fragClipBounds[1]=u(C,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],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),C=[0,0,0],L=[[0,0,0],[0,0,0]],S=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[S,P];_.draw=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){h(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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=M.cells,q=M.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 A=0|M.type.charAt(M.type.length-1),k=new Array(A),T=0;T=0;)E+=1;_[w]=E}var C=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,C))},e.exports=a},{"./lib/GLError":140,"./lib/create-attributes":141,"./lib/create-uniforms":142,"./lib/reflect":143,"./lib/runtime-reflect":144,"./lib/shader-cache":145}],140:[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},{}],141:[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":140}],142:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(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;parseInt(n)+""===n?a+="["+n+"]":a+="."+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],M(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=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 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=z[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},D.pickSlots=1,D.setPickBase=function(t){this.pickId=t};var j=[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];D.draw=function(t){return s.call(this,t,!1)},D.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]};D.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=z[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},D.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 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");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}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 m=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),f===a&&d)0===l.offset&&l.data.length===m?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+m)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+m));else{var b;b=a===t.FLOAT?v.mallocFloat32(m):v.mallocUint8(m);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,m)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,m)),a===t.FLOAT?v.freeFloat32(b):v.freeUint8(b)}}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,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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],r=i(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,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;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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:200,"ndarray-ops":194,"typedarray-pool":255}],151:[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},{}],160:[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},{}],161:[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)},{}],162:[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(z)?(e(U.join("")),B=u,j):(U.push(z),N=z,j+1)}function R(){return"."===z?(U.push(z),B=v,N=z,j+1):/[eE]/.test(z)?(U.push(z),B=v,N=z,j+1):"x"===z&&1===U.length&&"0"===U[0]?(B=w,U.push(z),N=z,j+1):/[^\d]/.test(z)?(e(U.join("")),B=u,j):(U.push(z),N=z,j+1)}function O(){return"f"===z&&(U.push(z),N=z,j+=1),/[eE]/.test(z)?(U.push(z),N=z,j+1):"-"===z&&/[eE]/.test(N)?(U.push(z),N=z,j+1):/[^\d]/.test(z)?(e(U.join("")),B=u,j):(U.push(z),N=z,j+1)}function I(){if(/[^\d\w_]/.test(z)){var t=U.join("");return B=Q.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:m,e(U.join("")),B=u,j}return U.push(z),N=z,j+1}var z,N,D,j=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,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":165,"./lib/builtins-300es":164,"./lib/literals":167,"./lib/literals-300es":166,"./lib/operators":168}],164:[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":165}],165:[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"]},{}],166:[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":167}],167:[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"]},{}],168:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],169:[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":163}],170:[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?0/0:1/0*(d?-1:1);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)||1/0===e?(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}},{}],171:[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];i[f]=h<0?e: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,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]=m,M[v]=-1,A[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=M[x];if(!(E<0||E===r)){for(var C=new Array(o-1),L=0,S=0;S<=o;++S){var P=M[S];P<0||S===x||(C[L++]=P)}h.push(new i(C,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":228,"simplicial-complex":238}],172:[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)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,a=this.left;a.right;)n=a,a=a.right;if(n===this)a.right=this.right;else{var o=this.left,r=this.right;n.count-=a.count,n.right=a.left,a.left=o,a.right=r}i(this,a),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 o=m.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],173:[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":180,"gl-mat4/clone":111,"gl-mat4/create":112,"gl-mat4/determinant":113,"gl-mat4/invert":117,"gl-mat4/transpose":127,"gl-vec3/cross":155,"gl-vec3/dot":156,"gl-vec3/length":157,"gl-vec3/normalize":159}],180:[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}},{}],181:[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":113,"gl-vec3/lerp":158,"mat4-decompose":179,"mat4-recompose":182,"quat-slerp":215}],182:[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":112, -"gl-mat4/fromRotationTranslation":115,"gl-mat4/identity":116,"gl-mat4/multiply":119,"gl-mat4/scale":125,"gl-mat4/translate":126}],183:[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){return t=t||{},new n(t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}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[9],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":228}],185:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==v.alt,v.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==v.shift,v.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==v.control,v.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==v.meta,v.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!==d||a!==p||o!==g||r(n))&&(d=0|t,p=a||0,g=o||0,e&&e(d,p,g,v))}function a(t){n(0,t)}function o(){(d||p||g||v.shift||v.alt||v.meta||v.control)&&(p=g=0,d=0,v.shift=v.alt=v.control=v.meta=!1,e&&e(0,0,0,v))}function s(t){r(t)&&e&&e(d,p,g,v)}function l(t){0===i.buttons(t)?n(0,t):n(d,t)}function u(t){n(d|i.buttons(t),t)}function c(t){n(d&~i.buttons(t),t)}function f(){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)))}function h(){m&&(m=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",u),t.removeEventListener("mouseup",c),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))}e||(e=t,t=window);var d=0,p=0,g=0,v={shift:!1,alt:!1,control:!1,meta:!1},m=!1;f();var y={element:t};return Object.defineProperties(y,{enabled:{get:function(){return m},set:function(t){t?f():h()},enumerable:!0},buttons:{get:function(){return d},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return g},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),y}e.exports=n;var i=t("mouse-event")},{"mouse-event":187}],186:[function(t,e,r){function n(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var n=t.clientX||0,a=t.clientY||0,o=i(e);return r[0]=n-o.left,r[1]=a-o.top,r}function i(t){return t===window||t===document||t===document.body?a:t.getBoundingClientRect()}var a={left:0,top:0};e.exports=n},{}],187:[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)x.push(w+"["+T+"+"+v(_)+"]");x.push(m(0));for(var _=0;_0){",h(x[t]),"=1;"),I(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",M+"=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",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":255}],190:[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":78}],191:[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"),o.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.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?a.push("dst.set(",s.join(),",",c,",0);"):a.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?a.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)};"):a.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&&a.push("};")}(p)}}a.push("return dst;};return gradient");for(var g=["diff","zero"],v=[f,h],o=1;o<=i;++o)g.push("grad"+o),v.push(n(o));g.push(a.join(""));var m=Function.apply(void 0,g),r=m.apply(void 0,v);return l[e]=r,r}function a(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?o(e.dimension,r):o(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n>",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":75}],195:[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":196,ndarray:200}],196:[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":75}],197:[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&&A&&_.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(""),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=[],C=1;C1?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&&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",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);return y(b,o(t,e,b))}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":255}],198:[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":197}],199:[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":78,"ndarray-linear-interpolate":193}],200:[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":81}],202:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa)for(var x=i[u],_=1/Math.sqrt(v*y),b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(m[w]*g[M]-m[M]*g[w])}}for(var o=0;oa)for(var _=1/Math.sqrt(A),b=0;b<3;++b)x[b]*=_;else for(var b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(var u=0;u<3;++u)h[u]*=d;i[o]=h}return i}},{}],203:[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},{}],204:[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,M=h*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],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))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],C=A[3],L=k*w+C*b+T*_-E*x,S=T*w+C*x+E*b-k*_,P=E*w+C*_+k*x-T*b,R=C*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),L=L*w+R*b+S*_-P*x,S=S*w+R*x+P*b-L*_,P=P*w+R*_+L*x-S*b,R=R*w-L*b-S*x-P*_}var I=i(L,S,P,R);I>1e-6?(L/=I,S/=I,P/=I,R/=I):(L=S=P=0,R=1),this.rotation.set(t,L,S,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":203,"filtered-vector":88,"gl-mat4/fromQuat":114,"gl-mat4/invert":117,"gl-mat4/lookAt":118}],205:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":221}],206:[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}},{}],207:[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||[];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":173,"typedarray-pool":255}],209:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return a?l:(o&&r(o,u),l)}for(var a=0|e.length,o=t.length,s=[new Array(a),new Array(a)],l=0;l0;){var d=(s[0][l].length,function(t,a){var o=s[a][t][0],l=[t];r(o,a);for(var u=o[1^a];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var i=t("compare-angle")},{"compare-angle":67}],210:[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":210,"edges-to-adjacency-list":83,"planar-dual":209,"point-in-big-polygon":212,"robust-sum":233,"two-product":253,uniq:257}],212:[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 M,A,k,T;x<0?(M=c+h,A=f+d,A>M?(k=A-M,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,A<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(M=c+d,A=u+h,A>M?(k=A-M,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,A<=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":53,"compare-cell":68,"compare-oriented-cell":69}],221:[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||void 0===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},{}],222:[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:{})},{}],223:[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 s=new Function("det",r.join(""));return s(t<6?o[t]:o)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}var o=t("robust-determinant"),s=6,l=[i,a];!function(){for(;l.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=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(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,m=i*u,y=i*l,b=a*s,x=c*(d-p)+f*(g-m)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:v(t,e,r,n)}];!function(){for(;m.length<=p;)m.push(l(m.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&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":228}],232:[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)=i?(a=d,(c+=1)0?1:0}},{}],235:[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":220}],236:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--n){n0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}(i[s]),l.push("break;");l.push("}}")}return l.push("}return R;};return getContour",t,"d"),new Function("pool",l.join(""))(a)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var a=t("typedarray-pool"),o=t("marching-simplex-table"),s={}},{"marching-simplex-table":178,"typedarray-pool":255}],238:[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){if(e0){var t=A[0];return a(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=A[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(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 p=e.length,g=t.length,v=new Array(p),m=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=v[t],r=m[t];v[r]>=0&&(v[r]=e),m[e]>=0&&(m[e]=r),k[e]>=0&&h(k[e],i(e)),k[r]>=0&&h(k[r],i(r))}}(E)}for(var C=[],x=0;x=0&&r>=0&&e!==r){var n=k[e],i=k[r];n!==i&&L.push([n,i])}}),o.unique(o.normalize(L)),{positions:C,edges:L}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":228,"simplicial-complex":240}],243:[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":228}],244:[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":243,"binary-search-bounds":34,"functional-red-black-tree":89,"robust-orientation":228}],245:[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":225,"robust-sum":233}],246:[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)};void 0!==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)},{}],247:[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"}},{}],248:[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=p[x].length/y*.5,E=.5+m[x]/y*.5;A.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",A.join(),"]);","break;")}n.push("}},"),f.length>0&&h.push("}}");for(var C=[],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=E(t,360),e=E(e,100),r=E(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=E(t,255),e=E(e,255),r=E(r,255);var n,i,a=q(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){S(t)&&(t="100%");var n=P(t);return t=H(r,q(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 H(1,q(0,t))}function L(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function P(t){return"string"==typeof t&&t.indexOf("%")!=-1}function R(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 L(t)/255}function N(t){return!!Y.CSS_UNIT.exec(t)}function D(t){t=t.replace(F,"").replace(B,"").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=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),a:z(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),format:e?"name":"hex"}:(r=Y.hex4.exec(t))?{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),a:z(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Y.hex3.exec(t))&&{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),format:e?"name":"hex"}}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 F=/^\s+/,B=/\s+$/,U=0,V=e.round,H=e.min,q=e.max,G=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=T(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*E(this._r,255))+"%",g:V(100*E(this._g,255))+"%",b:V(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*E(this._r,255))+"%, "+V(100*E(this._g,255))+"%, "+V(100*E(this._b,255))+"%)":"rgba("+V(100*E(this._r,255))+"%, "+V(100*E(this._g,255))+"%, "+V(100*E(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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(A,arguments)},complement:function(){return this._applyCombination(x,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)&&(r[i]="a"===i?t[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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100;return n({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})},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=j(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 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"},W=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],250:[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":206}],251:[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,M=b,A=-v*b,k=-m*b,T=y,E=this.computedEye,C=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];C[4*o+1]=A*r[o]+k*c[o]+T*e[o],C[4*o+2]=L,C[4*o+3]=0}var S=C[1],P=C[5],R=C[9],O=C[2],I=C[6],z=C[10],N=P*z-R*I,D=R*O-S*z,j=S*I-P*O,F=n(N,D,j);N/=F,D/=F,j/=F,C[0]=N,C[4]=D,C[8]=j;for(var o=0;o<3;++o)E[o]=x[o]+C[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=C[o+4*B]*E[B];C[12+o]=-l}C[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var 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,M=f*m-l*b,A=l*y-c*m,k=n(w,M,A);w/=k,M/=k,A/=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 C=e[1],L=e[5],S=e[9],P=C*m+L*y+S*b,R=C*w+L*M+S*A;T=N<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var O=e[2],I=e[6],z=e[10],N=O*l+I*c+z*f,D=O*m+I*y+z*b,j=O*w+I*M+z*A;T=Math.asin(i(N)),E=Math.atan2(j,D)}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))<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,M=n(x,_,w);x/=M,_/=M,w/=M;var A=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(A)),C=Math.atan2(T,k),L=this.angle._state,S=L[L.length-1],P=L[L.length-2];S%=2*Math.PI;var R=Math.abs(S+2*Math.PI-C),O=Math.abs(S-C),I=Math.abs(S-2*Math.PI-C);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=M[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,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 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,M[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:82}],256:[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))<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)}}()},{}],261:[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":262}],262:[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},{}],263:[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){return t(e).value=r,this},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":261}],264:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":91}],265:[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":75}],266:[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":265}],267:[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),f=u("clicktoshow");if(!c&&!f)return e;u("opacity");var h=u("bgcolor"),d=u("bordercolor"),p=i.opacity(d);u("borderpad");var g=u("borderwidth"),v=u("showarrow");u("text",v?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font),u("width"),u("align"),u("height")&&u("valign");for(var m=["x","y"],y=[-10,-30],b={_fullLayout:r},x=0;x<2;x++){var _=m[x],w=a.coerceRef(t,e,b,_,"","paper");if(a.coercePosition(e,b,u,w,_,.5),v){var M="a"+_,A=a.coerceRef(t,e,b,M,"pixel");"pixel"!==A&&A!==w&&(A=e[M]="pixel");var k="pixel"===A?y[x]:.4;a.coercePosition(e,b,u,A,M,k)}u(_+"anchor"),u(_+"shift")}if(n.noneOrAll(t,e,["x","y"]),v&&(u("arrowcolor",p?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(p&&g||1)),u("standoff"),n.noneOrAll(t,e,["ax","ay"])),f){var T=u("xclick"),E=u("yclick");e._xclick=void 0===T?e.x:T,e._yclick=void 0===E?e.y:E}var C=u("hovertext"),L=r.hoverlabel||{};if(C){var S=u("hoverlabel.bgcolor",L.bgcolor||(i.opacity(h)?i.rgb(h):i.defaultLine)),P=u("hoverlabel.bordercolor",L.bordercolor||i.contrast(S));n.coerceFont(u,"hoverlabel.font",{family:L.font.family,size:L.font.size,color:L.font.color||P})}return u("captureevents",!!C),e}},{"../../lib":393,"../../plots/cartesian/axes":430,"../color":278,"./attributes":269}],268:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],269:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},i,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":387,"../../plots/cartesian/constants":435,"../../plots/font_attributes":454,"./arrow_paths":268}],270:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;i.filterVisible(e.annotations).forEach(function(e){var r,n,i=a.getFromId(t,e.xref),o=a.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;i&&i.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(a.expand(i,[i.r2c(e.x)],{ppadplus:r,ppadminus:n}),a.expand(i,[i.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):a.expand(i,[i.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(a.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),a.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):a.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(a.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return i.syncOrAsync([o,n],t)}}},{"../../lib":393,"../../plots/cartesian/axes":430,"./draw":274}],271:[function(t,e,r){"use strict";function n(t,e){var r=a(t,e);return r.on.length>0||r.explicitOff.length>0}function i(t,e){var r,n=a(t,e),i=n.on,s=n.off.concat(n.explicitOff),l={};if(i.length||s.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var n=N.selectAll("a");if(1===n.size()&&n.text()===N.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":n.attr("xlink:href"),"xlink:xlink:show":n.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(R.node())}N.selectAll("tspan.line").attr({y:0,x:0});var i=C.select(".annotation-math-group"),d=!i.empty(),p=h.bBox((d?i:N).node()),b=p.width,S=p.height,z=x.width||b,D=x.height||S,j=Math.round(z+2*P),F=Math.round(D+2*P);x._w=z,x._h=D;var B=!1;if(["x","y"].forEach(function(e){var n,i,a,o,s,f=x[e+"ref"]||e,h=x["a"+e+"ref"],d=c.getFromId(t,f),p=(k+("x"===e?0:-90))*Math.PI/180,g=j*Math.cos(p),v=F*Math.sin(p),m=Math.abs(g)+Math.abs(v),b=x[e+"anchor"],_=x[e+"shift"]*("x"===e?1:-1),w=A[e];if(d){var M=d.r2fraction(x[e]);if((t._dragging||!d.autorange)&&(M<0||M>1)&&(h===f?((M=d.r2fraction(x["a"+e]))<0||M>1)&&(B=!0):B=!0,B))return;n=d._offset+d.r2p(x[e]),o=.5}else"x"===e?(a=x[e],n=y.l+y.w*a):(a=1-x[e],n=y.t+y.h*a),o=x.showarrow?.5:a;if(x.showarrow){w.head=n;var T=x["a"+e];s=g*r(.5,x.xanchor)-v*r(.5,x.yanchor),h===f?(w.tail=d._offset+d.r2p(T),i=s):(w.tail=n+T,i=s+T),w.text=w.tail+s;var E=l["x"===e?"width":"height"];if("paper"===f&&(w.head=u.constrain(w.head,1,E-1)),"pixel"===h){var C=-Math.max(w.tail-3,w.text),L=Math.min(w.tail+3,w.text)-E;C>0?(w.tail+=C,w.text+=C):L>0&&(w.tail-=L,w.text-=L)}w.tail+=_,w.head+=_}else s=m*r(o,b),i=s,w.text=n+s;w.text+=_,s+=_,i+=_,x["_"+e+"padplus"]=m/2+i,x["_"+e+"padminus"]=m/2-i,x["_"+e+"size"]=m,x["_"+e+"shift"]=s}),B)return void C.remove();var U=0,V=0;if("left"!==x.align&&(U=(z-b)*("center"===x.align?.5:1)),"top"!==x.valign&&(V=(D-S)*("middle"===x.valign?.5:1)),d)i.select("svg").attr({x:P+U-1,y:P+V}).call(h.setClipUrl,O?_:null);else{var H=P+V-p.top,q=P+U-p.left;N.attr({x:q,y:H}).call(h.setClipUrl,O?_:null),N.selectAll("tspan.line").attr({y:H,x:q})}I.select("rect").call(h.setRect,P,P,z,D),R.call(h.setRect,L/2,L/2,j-L,F-L),C.call(h.setTranslate,Math.round(A.x.text-j/2),Math.round(A.y.text-F/2)),E.attr({transform:"rotate("+k+","+A.x.text+","+A.y.text+")"});var G="annotations["+e+"]",X=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i=A.x.head,l=A.y.head,c=A.x.tail+r,d=A.y.tail+n,p=A.x.text+r,g=A.y.text+n,b=u.rotationXYMatrix(k,p,g),_=u.apply2DTransform(b),L=u.apply2DTransform2(b),S=+R.attr("width"),P=+R.attr("height"),O=p-.5*S,I=O+S,z=g-.5*P,N=z+P,D=[[O,z,O,N],[O,N,I,N],[I,N,I,z],[I,z,O,z]].map(L);if(!D.reduce(function(t,e){return t^!!a(i,l,i+1e6,l+1e6,e[0],e[1],e[2],e[3])},!1)){D.forEach(function(t){var e=a(c,d,i,l,t[0],t[1],t[2],t[3]);e&&(c=e.x,d=e.y)});var j=x.arrowwidth,F=x.arrowcolor,B=T.append("g").style({opacity:f.opacity(F)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),U=B.append("path").attr("d","M"+c+","+d+"L"+i+","+l).style("stroke-width",j+"px").call(f.stroke,f.rgb(F));if(m(U,x.arrowhead,"end",x.arrowsize,x.standoff),t._context.editable&&U.node().parentNode){var V=i,H=l;if(x.standoff){var q=Math.sqrt(Math.pow(i-c,2)+Math.pow(l-d,2));V+=x.standoff*(c-i)/q,H+=x.standoff*(d-l)/q}var X,W,Y,Z=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(c-V)+","+(d-H),transform:"translate("+V+","+H+")"}).style("stroke-width",j+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");v.init({element:Z.node(),prepFn:function(){var t=h.getTranslate(C);W=t.x,Y=t.y,X={},w&&w.autorange&&(X[w._name+".autorange"]=!0),M&&M.autorange&&(X[M._name+".autorange"]=!0)},moveFn:function(t,e){var r=_(W,Y),n=r[0]+t,i=r[1]+e;C.call(h.setTranslate,n,i),X[G+".x"]=w?w.p2r(w.r2p(x.x)+t):x.x+t/y.w,X[G+".y"]=M?M.p2r(M.r2p(x.y)+e):x.y-e/y.h,x.axref===x.xref&&(X[G+".ax"]=w.p2r(w.r2p(x.ax)+t)),x.ayref===x.yref&&(X[G+".ay"]=M.p2r(M.r2p(x.ay)+e)),B.attr("transform","translate("+t+","+e+")"),E.attr({transform:"rotate("+k+","+n+","+i+")"})},doneFn:function(e){if(e){s.relayout(t,X);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(x.showarrow&&X(0,0),t._context.editable){var W,Y;v.init({element:C.node(),prepFn:function(){Y=E.attr("transform"),W={}},moveFn:function(t,e){var r="pointer";if(x.showarrow)x.axref===x.xref?W[G+".ax"]=w.p2r(w.r2p(x.ax)+t):W[G+".ax"]=x.ax+t,x.ayref===x.yref?W[G+".ay"]=M.p2r(M.r2p(x.ay)+e):W[G+".ay"]=x.ay+e,X(t,e);else{if(w)W[G+".x"]=x.x+t/w._m;else{var n=x._xsize/y.w,i=x.x+(x._xshift-x.xshift)/y.w-n/2;W[G+".x"]=v.align(i+t/y.w,n,0,1,x.xanchor)}if(M)W[G+".y"]=x.y+e/M._m;else{var a=x._ysize/y.h,o=x.y-(x._yshift+x.yshift)/y.h-a/2;W[G+".y"]=v.align(o-e/y.h,a,0,1,x.yanchor)}w&&M||(r=v.getCursor(w?.5:W[G+".x"],M?.5:W[G+".y"],x.xanchor,x.yanchor))}E.attr({transform:"translate("+t+","+e+")"+Y}),g(C,r)},doneFn:function(e){if(g(C),e){s.relayout(t,W);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var i=t.layout,l=t._fullLayout,y=t._fullLayout._size;l._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var b=(i.annotations||[])[e],x=l.annotations[e],_="clip"+l._uid+"_ann"+e;if(!b||x.visible===!1)return void o.selectAll("#"+_).remove();var w=c.getFromId(t,x.xref),M=c.getFromId(t,x.yref),A={x:{},y:{}},k=+x.textangle||0,T=l._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",x.opacity),E=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),C=E.append("g").style("pointer-events",x.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:b,fullAnnotation:x,event:o.event})});x.hovertext&&C.on("mouseover",function(){var e=x.hoverlabel,r=e.font,n=this.getBoundingClientRect(),i=t.getBoundingClientRect();d.loneHover({x0:n.left-i.left,x1:n.right-i.left,y:(n.top+n.bottom)/2-i.top,text:x.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:l._hoverlayer.node(),outerContainer:l._paper.node()})}).on("mouseout",function(){d.loneUnhover(l._hoverlayer.node())});var L=x.borderwidth,S=x.borderpad,P=L+S,R=C.append("rect").attr("class","bg").style("stroke-width",L+"px").call(f.stroke,x.bordercolor).call(f.fill,x.bgcolor),O=x.width||x.height,I=l._defs.select(".clips").selectAll("#"+_).data(O?[0]:[]);I.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),I.exit().remove();var z=x.font,N=C.append("text").classed("annotation",!0).attr("data-unformatted",x.text).text(x.text);t._context.editable?N.call(p.makeEditable,C).call(r).on("edit",function(n){x.text=n,this.attr({"data-unformatted":x.text}),this.call(r);var i={};i["annotations["+e+"].text"]=x.text,w&&w.autorange&&(i[w._name+".autorange"]=!0),M&&M.autorange&&(i[M._name+".autorange"]=!0),s.relayout(t,i)}):N.call(r)}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("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),m=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":393,"../../lib/setcursor":408,"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/cartesian/axes":430,"../../plots/plots":470,"../color":278,"../dragelement":299,"../drawing":302,"../fx":319,"./draw_arrow_head":275,d3:79}],275:[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,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,i){d.path&&(e>5&&(i=0),n.select(h.parentElement).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}i(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||a.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,M=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var A=p.x-g.x,k=p.y-g.y;if(v=Math.atan2(k,A),m=v+Math.PI,M){if(M*M>A*A+k*k)return void c();var T=M*Math.cos(v),E=M*Math.sin(v);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var C=h.getTotalLength(),L="";if(C=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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return i(o).toRgbString()},o.contrast=function(t,e,r){var n=i(t);return 1!==n.getAlpha()&&(n=i(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).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(S);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?C[0]:(S[e]+S[e-1])/2,e===S.length-1?C[1]:(S[e]+S[e+1])/2].map(J.c2p).map(Math.round);e!==S.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?L:[]);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));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=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 A(){var r=B+_.outlinewidth/2+d.bBox(J._axislayer.node()).width;if(D=ot.select("text"),D.node()&&!D.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,C=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],S=[],P="function"==typeof _.line.color?_.line.color:function(){ -return _.line.color},R="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},O=_.levels.end+_.levels.size/100,I=_.levels.size,z=1.001*C[0]-.001*C[1],N=1.001*C[1]-.001*C[0];for(E=_.levels.start;(E-O)*I<0;E+=I)E>z&&EC[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,M(J._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ft=c.syncOrAsync([o.previousPromises,w,o.previousPromises,A],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=g,s.reversescale&&(g=a(g)),s.colorscale=g)}},{"../../lib":393,"./flip_scale":289,"./scales":296}],285:[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":387,"./attributes":283,"./scales.js":296}],286:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":296}],287:[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;u(f+h+"auto",!(n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],290:[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":286,"./is_valid_scale_array":294,"./scales":296}],291:[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}},{}],298:[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":393}],299:[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=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return t.element.onmousemove=g,v._dragged=!1,v._dragging=!0,c=e.clientX,f=e.clientY,p=e.target,h=(new Date).getTime(),h-v._mouseDownTimey&&(m=Math.max(m-1,1)),t.doneFn&&t.doneFn(v._dragged,m,e),!v._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return i(v),v._dragged=!1,o.pauseEvent(e)}var c,f,h,d,p,g,v=o.getPlotDiv(t.element)||{},m=1,y=l.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),g=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=n},{"../../constants/interactions":376,"../../lib":393,"../../plotly":425,"../../plots/cartesian/constants":435,"./align":297,"./cursor":298,"./unhover":300}],300:[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,i=t._hoverdata;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":386}],301:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],302:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){if(l.traceIs(r,"symbols")){var c=g(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:p.isBubble(r)?c(t.ms):(a.size||6)/2,t.mrc=e;var n=v.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,v.symbolFuncs[i](e)+(n>=200?b:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var f,h,d,m=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=a.outliercolor):(d=(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)?u.defaultLine:o.color,Array.isArray(a.color)&&(f=u.defaultLine,m=!0),f="mc"in t?t.mcc=n(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var y=a.gradient,x=t.mgt;if(x?m=!0:x=y&&y.type,x&&"none"!==x){var _=t.mgc;_?m=!0:_=y.color;var w="g"+s._fullLayout._uid+"-"+r.uid;m&&(w+="-"+t.i),e.call(v.gradient,s,w,x,f,_)}else e.call(u.fill,f);d&&e.call(u.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,M/2),c=Math.pow(s*s+l*l,M/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("tinycolor2"),l=t("../../registry"),u=t("../color"),c=t("../colorscale"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.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(u.fill,n)},v.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},v.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},v.setRect=function(t,e,r,n,i){t.call(v.setPosition,e,r).call(v.setSize,n,i)},v.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);return o(i)&&o(a)&&e.node()?("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0):(e.remove(),!1)},v.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);v.translatePoint(t,i,e,r,n)})},v.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},v.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.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||"";u.stroke(e,n||a.color),v.dashLine(e,s,o)},v.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(u.stroke,r||i.color).call(v.dashLine,s,o)})},v.dashLine=function(t,e,r){r=+r||0,e=v.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},v.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(u.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),r.remove()}})};var m=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolList=[],Object.keys(m).forEach(function(t){var e=m[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=v.symbolNames.length,b="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";v.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=v.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var x={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};v.gradient=function(t,e,r,n,i,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+i+o],f.identity);l.exit().remove(),l.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=a.select(this);"horizontal"===n?t.attr(x):"vertical"===n&&t.attr(_),t.attr("id",r);var e=s(i),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},v.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},v.singlePointStyle=function(t,e,r,i,a,o){var s=r.marker;n(t,e,r,i,a,s,s.line,o)},v.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=v.tryColorscale(r,""),i=v.tryColorscale(r,"line"),o=f.getPlotDiv(t.node());t.each(function(t){v.singlePointStyle(t,a.select(this),e,n,i,o)})}},v.tryColorscale=function(t,e){var r=e?f.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?c.makeColorScaleFunc(c.extractScale(n,r.cmin,r.cmax)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};v.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(v.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=1.3*((d[0].length||1)-1)+1,g=w[l]*c,m=.75*u+w[s]*c+(w[s]-1)*p*u/2;f.attr("transform","translate("+g+","+m+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var M=.5;v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(a.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(l),f.extendFlat({},l)},v.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},v.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||0,y:+n[1]||0}},v.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||0,r=r||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a+=" translate("+e+", "+r+")",a=a.trim(),t[i]("transform",a),a},v.getScale=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||1,y:+n[1]||1}},v.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||1,r=r||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a+=" scale("+e+", "+r+")",a=a.trim(),t[i]("transform",a),a},v.setPointGroupScale=function(t,e,r){var n,i,a;return e=e||1,r=r||1,i=1===e&&1===r?"":" scale("+e+","+r+")",a=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(a,""),n+=i,n=n.trim(),this.setAttribute("transform",n)}),i};v.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=a.select(this),i=n.select("text"),o=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(n.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})},v.measureText=function(t,e,r){var n=t.append("text").text(e).call(v.font,r),i=v.bBox(n.node());return n.remove(),i}},{"../../constants/xmlns_namespaces":379,"../../lib":393,"../../lib/svg_text_utils":412,"../../registry":478,"../../traces/scatter/make_bubble_size_func":509,"../../traces/scatter/subtypes":514,"../color":278,"../colorscale":292,"./symbol_defs":303,d3:79,"fast-isnumeric":87,tinycolor2:249}],303:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"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:79}],304:[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"}}}},{}],305:[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":514,d3:79,"fast-isnumeric":87}],310:[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":278,d3:79}],311:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},i.family,{arrayOk:!0}),size:n({},i.size,{arrayOk:!0}),color:n({},i.color,{arrayOk:!0})}}}},{"../../lib/extend":387,"../../plots/font_attributes":454}],312:[function(t,e,r){"use strict";function n(t,e,r){Array.isArray(t)&&(e[0][r]=t)}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=0;r=0&&r.index$.width||Z<0||Z>$.height)return b.unhoverRaw(t,e)}if(O="xval"in e?w.flat(n,e.xval):w.p2c(T,Y),I="yval"in e?w.flat(n,e.yval):w.p2c(E,Z),!f(O[0])||!f(I[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var K=1/0;for(N=0;N1||j.hoverinfo.indexOf("name")!==-1?j.name:void 0,index:!1,distance:Math.min(K,M.MAXDIST),color:y.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},h[F]&&(q.subplot=h[F]._subplot),G=X.length,"array"===U){var J=e[N];"pointNumber"in J?(q.index=J.pointNumber,U="closest"):(U="","xval"in J&&(V=J.xval,U="x"),"yval"in J&&(H=J.yval,U=U?"closest":"y"))}else V=O[B],H=I[B];if(j._module&&j._module.hoverPoints){var tt=j._module.hoverPoints(q,V,H,U);if(tt)for(var et,rt=0;rtG&&(X.splice(0,G),K=X[0].distance)}if(0===X.length)return b.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,it=[];for(z=0;z1,lt=y.combine(h.plot_bgcolor||y.background,h.paper_bgcolor),ut={hovermode:R,rotateLabels:st,bgColor:lt,container:h._hoverlayer,outerContainer:h._paperdiv,commonLabelOpts:h.hoverlabel},ct=i(X,ut);if(a(X,st?"xa":"ya"),o(ct,st),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,it);v(c.select(e.target),ft?"pointer":"")}e.target&&u(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:E,xvals:O,yvals:I}))}function i(t,e){var r,n,i=e.hovermode,a=e.rotateLabels,o=e.bgColor,s=e.container,l=e.outerContainer,u=e.commonLabelOpts||{},f=e.fontFamily||M.HOVERFONT,h=e.fontSize||M.HOVERFONTSIZE,d=t[0],p=d.xa,v=d.ya,b="y"===i?"yLabel":"xLabel",x=d[b],_=(String(x)||"").split(" ")[0],w=l.node().getBoundingClientRect(),k=w.top,T=w.width,E=w.height,C=d.distance<=M.MAXDIST&&("x"===i||"y"===i);for(r=0;r15&&(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):C&&t[i+"Label"]===x?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 d=e.select("text.nums").call(m.font,t.fontFamily||f,t.fontSize||h,t.fontColor||u).call(m.setPosition,0,0).text(n).attr("data-notex",1).call(g.convertToTspans);d.selectAll("tspan.line").call(m.setPosition,0,0);var p=e.select("text.name"),v=0;r&&r!==n?(p.call(m.font,t.fontFamily||f,t.fontSize||h,l).text(r).call(m.setPosition,0,0).attr("data-notex",1).call(g.convertToTspans),p.selectAll("tspan.line").call(m.setPosition,0,0),v=p.node().getBoundingClientRect().width+2*S):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var b,_,w=d.node().getBoundingClientRect(),M=t.xa._offset+(t.x0+t.x1)/2,P=t.ya._offset+(t.y0+t.y1)/2,R=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),I=w.width+L+S+v;t.ty0=k-w.top,t.bx=w.width+2*S,t.by=w.height+2*S,t.anchor="start",t.txwidth=w.width,t.tx2width=v,t.offset=0,a?(t.pos=M,b=P+O/2+I<=E,_=P-O/2-I>=0,"top"!==t.idealAlign&&b||!_?b?(P+=O/2,t.anchor="start"):t.anchor="middle":(P-=O/2,t.anchor="end")):(t.pos=P,b=M+R/2+I<=T,_=M-R/2-I>=0,"left"!==t.idealAlign&&b||!_?b?(M+=R/2,t.anchor="start"):t.anchor="middle":(M-=R/2,t.anchor="end")),d.attr("text-anchor",t.anchor),v&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+M+","+P+")"+(a?"rotate("+A+")":""))}),O}function a(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)?T: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 o(t,e){t.each(function(t){var r=c.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*(L+S),s=o+a*(t.txwidth+S),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-C,l=t.offset*E),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*L+l)+","+(L+u)+"v"+(t.by/2-L)+"h"+n*t.bx+"v-"+t.by+"H"+(n*L+l)+"V"+(u-L)+"Z"),i.call(m.setPosition,o+l,u+t.ty0-t.by/2+S).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(m.setPosition,s+a*S+l,u+t.ty0-t.by/2+S),r.select("rect").call(m.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(a[r])s=a[r];else if(i[r]){var l=i[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t}function l(t,e){var r=e.hovermode,n=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,f=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var g=o.spikemode,v=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=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 c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),M=t("./constants"),A=M.YANGLE,k=Math.PI*A/180,T=1/Math.sin(k),E=Math.cos(k),C=Math.sin(k),L=M.HOVERARROWSIZE,S=M.HOVERTEXTPAD;r.hover=function(t,e,r){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME)return n(t,e,r),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:a},l=i([r],s);return o(l,s.rotateLabels),l.node()}},{"../../lib":393,"../../lib/events":386,"../../lib/override_cursor":402,"../../lib/svg_text_utils":412,"../../plots/cartesian/axes":430,"../../registry":478,"../color":278,"../dragelement":299,"../drawing":302,"./constants":314,"./helpers":316,d3:79,"fast-isnumeric":87,tinycolor2:249}],318:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i=i||{},r("hoverlabel.bgcolor",i.bgcolor),r("hoverlabel.bordercolor",i.bordercolor),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":393}],319:[function(t,e,r){"use strict";function n(t){var e=o.isD3Selection(t)?t:a.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,r){var n=t.hoverlabel||{},i=o.nestedProperty(n,r).get();return Array.isArray(i)?Array.isArray(e)&&Array.isArray(i[e[0]])?i[e[0]][e[1]]:i[e]:i}var a=t("d3"),o=t("../../lib"),s=t("../dragelement"),l=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:l.getDistanceFunction,getClosest:l.getClosest,inbox:l.inbox,castHoverOption:i,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":393,"../dragelement":299,"./attributes":311,"./calc":312,"./click":313,"./constants":314,"./defaults":315,"./helpers":316,"./hover":317,"./layout_attributes":320,"./layout_defaults":321,"./layout_global_defaults":322,d3:79}],320:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},i.family,{dflt:a.HOVERFONT}),size:n({},i.size,{dflt:a.HOVERFONTSIZE}),color:n({},i.color)}}}},{"../../lib/extend":387,"../../plots/font_attributes":454,"./constants":314}],321:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],329:[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":387,"../../plots/font_attributes":454,"../color/attributes":277}],330:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],331:[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)!==!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,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":393,"../../plots/layout_attributes":468,"../../registry":478,"./attributes":329,"./helpers":334}],332:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(v.font,i.legend.font).text(u),e._context.editable&&!s?c.call(y.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;i=o[o.length-1].direction+".name"}else i="name";f.restyle(e,i,t,l)}):c.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeT&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){a(t,e,n)},T):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,a(t,e,n))}})}function a(t,e,r){if(!e._dragged&&!e._editing){var n,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&k&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),k=!1):k=!1,p.traceIs(l,"pie")){var d=o.label,g=a.indexOf(d);1===r?g===-1?a.push(d):a.splice(g,1):2===r&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&g===-1&&(a=[])),f.relayout(e,"hiddenlabels",a)}else{var v,m=[],y=[];for(v=0;vtspan"),f=c[0].length||1;r=s*f,n=u.node()&&v.bBox(u.node()).width;var h=s*(.3+(1-f)/2);u.attr("y",h),c.attr("y",h)}r=Math.max(r,16)+3,i.height=r,i.width=n}function s(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=M.isGrouped(i);if(M.isVertical(i))o&&e.each(function(t,e){v.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;v.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];c.select(this).select(".legendtoggle").call(v.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(),u=0,f=l.length;un.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,i.height=i.height+g,g=0),v.setTranslate(this,a+y,5+a+e.height/2+p),i.width+=o+r,i.height=Math.max(i.height,e.height),y+=o+r,g=Math.max(e.height,g)}),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];c.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var i="top";A.isBottomAnchor(r)?i="bottom":A.isMiddleAnchor(r)&&(i="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}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),M=t("./helpers"),A=t("./anchor_utils"),k=!0,T=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(v.setTranslate,0,e),S.call(v.setRect,F,t,b.scrollBarWidth,b.scrollBarHeight),E.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&_(t.calcdata,y),M=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var E=r._topdefs.selectAll("#"+o).data([0]);E.enter().append("clipPath").attr("id",o).append("rect");var C=k.selectAll("rect.bg").data([0]);C.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),C.call(m.stroke,y.bordercolor),C.call(m.fill,y.bgcolor),C.style("stroke-width",y.borderwidth+"px");var L=k.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var S=k.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 P=L.selectAll("g.groups").data(x);P.enter().append("g").attr("class","groups"),P.exit().remove();var R=P.selectAll("g.traces").data(h.identity);R.enter().append("g").attr("class","traces"),R.exit().remove(),R.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(i,t)});var O=0!==k.enter().size();O&&(s(t,P,R),l(t));var I=r.width,z=r.height;s(t,P,R),y.height>z?u(t):l(t);var N=r._size,D=N.l+N.w*y.x,j=N.t+N.h*(1-y.y);A.isRightAnchor(y)?D-=y.width:A.isCenterAnchor(y)&&(D-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var F=y.width,B=N.w;F>B?(D=N.l,F=B):(D+F>I&&(D=I-F),D<0&&(D=0),F=Math.min(I-D,y.width));var U=y.height,V=N.h;U>V?(j=N.t,U=V):(j+U>z&&(j=z-U),j<0&&(j=0),U=Math.min(z-j,y.height)),v.setTranslate(k,D,j);var H,q,G=U-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-U;if(y.height<=U||t._context.staticPlot)C.attr({width:F-y.borderwidth,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(L,0,0),E.select("rect").attr({width:F-2*y.borderwidth,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),L.call(v.setClipUrl,o);else{H=b.scrollBarMargin,q=L.attr("data-scroll")||0,C.attr({width:F-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),E.select("rect").attr({width:F-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-q}),L.call(v.setClipUrl,o),O&&e(H,q),k.on("wheel",null),k.on("wheel",function(){q=h.constrain(L.attr("data-scroll")-c.event.deltaY/G*X,-X,0),H=b.scrollBarMargin-q/X*G,e(H,q),0!==q&&q!==-X&&c.event.preventDefault()}),S.on(".drag",null),L.on(".drag",null);var W=c.behavior.drag().on("drag",function(){H=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),q=-(H-b.scrollBarMargin)/G*X,e(H,q)});S.call(W),L.call(W)}if(t._context.editable){var Y,Z,Q,$;k.classed("cursor-move",!0),g.init({element:k.node(),prepFn:function(){var t=v.getTranslate(k);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;v.setTranslate(k,r,n),Y=g.align(r,0,N.l,N.l+N.w,y.xanchor),Z=g.align(n,0,N.t+N.h,N.t,y.yanchor)},doneFn:function(e,n,i){if(e&&void 0!==Y&&void 0!==Z)f.relayout(t,{"legend.x":Y,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===n?k._clickTimeout=setTimeout(function(){a(o,t,n)},T):2===n&&(k._clickTimeout&&clearTimeout(k._clickTimeout),a(o,t,n)))}}})}}}},{"../../constants/interactions":376,"../../lib":393,"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/plots":470,"../../registry":478,"../color":278,"../dragelement":299,"../drawing":302,"./anchor_utils":328,"./constants":330,"./get_legend_data":333,"./helpers":334,"./style":336,d3:79}],333:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))l.indexOf(t)===-1?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;ar[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=l.select(this),i=t[0],a=(i.mlw+1||n.width+1)-1;e.style("stroke-width",a+"px").call(h.fill,i.mc||r.color),a&&e.call(h.stroke,i.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(){var t=e.line.width,r=l.select(this);r.style("stroke-width",t+"px").call(h.fill,e.fillcolor),t&&r.call(h.stroke,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.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var n=r.selectAll("g.legendsymbols").data([t]);n.enter().append("g").classed("legendsymbols",!0),n.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":393,"../../registry":478,"../../traces/pie/style_one":492,"../../traces/scatter/subtypes":514,"../color":278,"../drawing":302,d3:79}],337:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)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(["toggleSpikelines","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)){var p=i(e,r,l);f("x",p[0]),f("y",p[1]),a.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),a.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":393,"../color":278,"./attributes":341,"./button_attributes":342,"./constants":343}],345:[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;sX&&n>W&&!t.shiftKey?p.getCursor(i/r,1-a/n):"move";g(e,o),G=o.split("-")[0]}function a(e){F=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),U=m.getDataToPixel(t,F),V=m.getDataToPixel(t,B,!0),H=m.getPixelToData(t,F),q=m.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(D=r.path,j=a+".path"):(v=U(r.x0),y=V(r.y0),b=U(r.x1),x=V(r.y1),_=a+".x0",w=a+".y0",M=a+".x1",A=a+".y1"),vW&&(d[L]=r[O]=q(u),d[S]=r[I]=q(c)),h-f>X&&(d[P]=r[z]=H(f),d[R]=r[N]=H(h))}e.attr("d",o(t,r))}var d,v,y,b,x,_,w,M,A,k,T,E,C,L,S,P,R,O,I,z,N,D,j,F,B,U,V,H,q,G,X=10,W=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:s},Z=Y.element.getBoundingClientRect();p.init(Y)}function o(t,e){var r,n,i,a,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=m.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(i=m.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=m.decodeDate(n)),u&&"date"===u.type&&(a=m.decodeDate(a)),s(e.path,n,a);var h=n(e.x0),d=n(e.x1),p=a(e.y0),g=a(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var v=(h+d)/2,y=(p+g)/2,b=Math.abs(v-h),x=Math.abs(y-p),_="A"+b+","+x,w=v+b+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i],l=t.substr(1).replace(v.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.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i];return i+t.substr(1).replace(v.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:i}},{"../../lib":393,"../../lib/setcursor":408,"../../plotly":425,"../../plots/cartesian/axes":430,"../color":278,"../dragelement":299,"../drawing":302,"./constants":356,"./helpers":359}],359:[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}},{}],360:[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":354,"./calc_autorange":355,"./defaults":357,"./draw":358}],361:[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)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},v=i.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,b;"paper"!==v?(m=i.getFromId(g,v),b=o.rangeToShapePosition(m),y=o.shapePositionToRange(m)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],M=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),i.coercePosition(e,g,u,v,x,.25),i.coercePosition(e,g,u,v,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=M}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":393,"../../plots/cartesian/axes":430,"./attributes":354,"./helpers":359}],362:[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":387,"../../plots/animation_attributes":426,"../../plots/font_attributes":454,"../../plots/pad_attributes":469,"./constants":363}],363:[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}},{}],364:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),k.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-C.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=C.currentValueInset,i="left"}a.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",i);var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}return e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(k.font,e.currentvalue.font).text(o).call(T.convertToTspans),k.setTranslate(a,n,e.currentValueHeight),a}}function l(t,e,r){var n=t.selectAll("rect."+C.gripRectClass).data([0]) -;n.enter().append("rect").classed(C.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:C.gripWidth,height:C.gripHeight,rx:C.gripRadius,ry:C.gripRadius}).call(A.stroke,r.bordercolor).call(A.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(C.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),n.call(k.font,r.font).text(e.step.label).call(T.convertToTspans),n}function c(t,e){var r=t.selectAll("g."+C.labelsClass).data([0]);r.enter().append("g").classed(C.labelsClass,!0);var n=r.selectAll("g."+C.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(C.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),k.setTranslate(r,m(e,t.fraction),C.tickOffset+e.ticklen+e.labelHeight+C.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&h(t,e,r,a,!0,i)}function h(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),a),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(M.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+C.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(A.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=y(t,w.mouse(i)[0]);f(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(A.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+C.tickRectClass).data(e.steps);r.enter().append("rect").classed(C.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=w.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(A.fill,e.tickcolor),k.setTranslate(i,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?C.tickOffset:C.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*C.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(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 b(t,e,r){var n=t.selectAll("rect."+C.railTouchRectClass).data([0]);n.enter().append("rect").classed(C.railTouchRectClass,!0).call(d,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),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(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"),k.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(s.enter().append("g").classed(C.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+C.groupClassName).data(r,i);l.enter().append("g").classed(C.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,C.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+g+")")}}}var g=r.propContainer,v=r.propName,m=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,A=g.titlefont.family,k=g.titlefont.size,T=g.titlefont.color,E=1,C=!1,L=g.title.trim();""===L&&(E=0),L.match(/Click to enter .+ title/)&&(E=.2,C=!0),w||(w=M._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(L).attr("class",e),S.attr({"data-unformatted":L}).call(h);var P="Click to enter "+y+" title";t._context.editable?(L?S.on(".opacity",null):function(){E=0,C=!0,L=P,S.attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),S.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(h)}).on("input",function(t){this.text(t||" ").attr(x).selectAll("tspan.line").attr(x)})):L&&!L.match(/Click to enter .+ title/)||S.remove(),S.classed("js-placeholder",C)}},{"../../constants/interactions":376,"../../lib":393,"../../lib/svg_text_utils":412,"../../plotly":425,"../../plots/plots":470,"../color":278,"../drawing":302,d3:79,"fast-isnumeric":87}],368:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":387,"../../plots/font_attributes":454,"../../plots/pad_attributes":469,"../color/attributes":277}],369:[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"}},{}],370:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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(a.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+C.headerGroupClassName).data(r,i);c.enter().append("g").classed(C.headerGroupClassName,!0);var f=a.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,C=p,L=v+m;L+E>u&&(L=u-E);var S=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),k?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:C,y:L,width:T,height:E}),this._hbarXMin=C+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var P=m>A,R=n.barWidth+2*n.barPad,O=n.barLength+2*n.barPad,I=p+g,z=v;I+R>l&&(I=l-R);var N=this.container.selectAll("rect.scrollbar-vertical").data(P?[0]:[]);N.exit().on(".drag",null).remove(),N.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),P?(this.vbar=N.attr({rx:n.barRadius,ry:n.barRadius,x:I,y:z,width:R,height:O}),this._vbarYMin=z+O/2,this._vbarTranslateMax=A-O):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var D=this.id,j=c-.5,F=P?f+R+.5:f+.5,B=h-.5,U=k?d+E+.5:d+.5,V=s._topdefs.selectAll("#"+D).data(k||P?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",D).append("rect"),k||P?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(F)-Math.floor(j),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,D),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),k||P){var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(H);var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),P&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":393,"../color":278,"../drawing":302,d3:79}],374:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],375:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],376:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],377:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],378:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],379:[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}},{}],380:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.27.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/fx"),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=t("./components/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":276,"./components/fx":319,"./components/images":327,"./components/legend":335,"./components/rangeselector":347,"./components/rangeslider":353,"./components/shapes":360,"./components/sliders":366,"./components/updatemenus":372,"./fonts/mathjax_config":381,"./lib/queue":405,"./plot_api/plot_schema":419,"./plot_api/register":420,"./plot_api/set_plot_config":421,"./plot_api/to_image":423,"./plot_api/validate":424,"./plotly":425,"./snapshot":483,"./snapshot/download":480,"./traces/scatter":504,d3:79,"es6-promise":84}],381:[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},{}],382:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),n(t)?Number(t):i}},{"../constants/numerical":377,"fast-isnumeric":87}],383:[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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")} -var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),A=h.time.format.utc,k=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,E;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=T&&t<=E?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!s)return m;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return m;l=Number(l);var p;try{var g=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,v),c)}else p=g.newDate(l,Number(u),c)}catch(t){return m}return p?(p.toJD()-w)*y+f*b+h*x+d*_:m}l=2===l.length?(Number(l)+2e3-k)%100+k:Number(l),u-=1;var A=new Date(Date.UTC(2e3,u,c,f,h));return A.setUTCFullYear(l),A.getUTCMonth()!==u?m:A.getUTCDate()!==c?m:A.getTime()+d*_},T=r.MIN_MS=r.dateTime2ms("-9999"),E=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var C=90*y,L=3*b,S=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=T&&t<=E))return m;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=A("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=T+y&&t<=E-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var P=/%\d?f/g,R=[59,59.9,59.99,59.999,59.9999],O=A("%Y"),I=A("%b %Y"),z=A("%b %-d"),N=A("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,h;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(a=l(p),h=c(p)):(a=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=O(g):"m"===r?h=I(g):"d"===r?(a=O(g),h=z(g)):(a=N(g),h=s(t,r))}return h+(a?"\n"+a:"")};var D=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=g(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+D);return l.setUTCMonth(l.getUTCMonth()+e)+i-D},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c",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.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||1/0!==c&&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)<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.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":382,"./coerce":383,"./dates":384,"./ensure_array":385,"./extend":387,"./filter_unique":388,"./filter_visible":389,"./identity":392,"./is_array":394,"./is_plain_object":395,"./loggers":396,"./matrix":397,"./mod":398,"./nested_property":399,"./noop":400,"./notifier":401,"./push_unique":404,"./relink_private":406,"./search":407,"./stats":410,"./to_log_range":413,d3:79}],394:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],395:[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}},{}],396:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,f,h,d,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(c=1;cMath.max(f,v)||u>Math.max(h,m)))if(uc||Math.abs(n(o,h))>i)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":377,"./matrix":397}],404:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ra.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":87}],411:[function(t,e,r){"use strict";function n(t){var e=i(t);return e.length?e:[0,0,0,1]}var i=t("color-rgba");e.exports=n},{"color-rgba":62}],412:[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-"+d.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())d.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":"")+(m[n]||"");if("br"===n)return"
";var a,o=e[4];if("a"===n){var s=o&&o.match(T),u=s&&(s[3]||s[4]);if(a="':a+">"}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,h=t("d3"),d=t("../lib"),p=t("../constants/xmlns_namespaces"),g=t("../constants/string_mappings");r.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=r.getDOMParser(),i=n.parseFromString(e,"application/xml"),a=i.documentElement.firstChild;a;)this.node().appendChild(this.node().ownerDocument.importNode(a,!0)),a=a.nextSibling;return i.querySelector("parsererror")?(d.log(i.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?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=s.attr("class")+"-math",f.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,f=h.select(s.node().parentNode);if(!f.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=d.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){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=f.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"),d=n(l,"height"),g=+s.attr("x")-h*{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("+[-h/2,m-d/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:m-d/2}):"a"===p[0]?l.attr({x:0,y:m}):l.attr({x:g,y:+s.attr("y")+m-d/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},m={sup:'',sub:''},y=["http:","https:","mailto:"],b=new RegExp("]*)?/?>","g"),x=Object.keys(g.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:g.entityToUnicode[t]}}),_=Object.keys(g.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+g.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,M=/(<[^<>]*>)/,A=/<(\/?)([^ >]*)(\s+(.*))?>/i,k=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,E=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(b," ")},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]")&&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=d.getPlotDiv(o.node()),e=h.select(t),n=e.select(".svg-container"),a=n.append("div");a.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,n,r)).on("blur",function(){t._editing=!1,o.text(this.textContent).style({opacity:1});var e,r=h.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(o.node().parentNode).select(e).style({opacity:0});var n=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(o,n)}).on("focus",function(){var e=this;t._editing=!0,h.select(document).on("mouseup",function(){if(h.event.target===e)return!1;document.activeElement===a.node()&&a.node().blur()})}).on("keyup",function(){27===h.event.which?(t._editing=!1,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,n,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":378,"../constants/xmlns_namespaces":379,"../lib":393,d3:79}],413:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":87}],414:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 i=h.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(v,m),d(t),!0)}var b,x,_,w,M,A,k,T=Object.keys(r).map(Number).sort(s),E=e.get(),C=E||[],L=n(m,f).get(),S=[],P=-1,R=C.length;for(b=0;bC.length-(k?0:1))o.warn("index out of range",f,_);else if(void 0!==A)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(A)?S.push(_):k?("add"===A&&(A={}),C.splice(_,0,A),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,A),P===-1&&(P=_);else for(x=0;x=0;b--)C.splice(S[b],1),L&&L.splice(S[b],1);if(C.length?E||e.set(C):e.set(null),g)return!1;if(h(v,m),p!==a){var O;if(P===-1)O=T;else{for(R=Math.max(C.length,R),O=[],b=0;b=P);b++)O.push(_);for(b=P;b=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lF.range[0]?[1,2]:[2,1]);else{var V=F.range[0],H=F.range[1];B?(V<=0&&H<=0&&r(N+".autorange",!0),V<=0?V=H/1e6:H<=0&&(H=V/1e6),r(N+".range[0]",Math.log(V)/Math.LN10),r(N+".range[1]",Math.log(H)/Math.LN10)):(r(N+".range[0]",Math.pow(10,V)),r(N+".range[1]",Math.pow(10,H)))}else r(N+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,j,T,r),w.getComponentMethod("images","convertCoords")(t,j,T,r)}else r(N+".autorange",!0)}else if(R.match(O.AX_NAME_PATTERN)){var q=b.nestedProperty(u,A).get(),G=(T||{}).type;G&&"-"!==G||(G="linear"),w.getComponentMethod("annotations","convertCoords")(t,q,G,r),w.getComponentMethod("images","convertCoords")(t,q,G,r)}var X=S.containerArrayMatch(A);if(X){a=X.array,o=X.index;var W=X.property,Y=b.nestedProperty(l,a),Z=(Y||[])[o]||{};if(""===o)A.indexOf("updatemenus")===-1&&(v.docalc=!0);else if(""===W){var Q=T;S.isAddVal(T)?x[A]=null:S.isRemoveVal(T)?(x[A]=Z,Q=Z):b.warn("unrecognized full object value",e),(n(Q,"x")||n(Q,"y")&&A.indexOf("updatemenus")===-1)&&(v.docalc=!0)}else!n(Z,"x")&&!n(Z,"y")||b.containsAny(A,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);h[a]||(h[a]={});var $=h[a][o];$||($=h[a][o]={}),$[W]=T,delete e[A]}else if("reverse"===R)D.range?D.range.reverse():(r(N+".autorange",!0),D.range=[1,0]),j.autorange?v.docalc=!0:v.doplot=!0;else{var K=String(k.parts[1]||"");0===L.indexOf("scene")?"camera"===k.parts[1]?v.docamera=!0:v.doplot=!0:0===L.indexOf("geo")?v.doplot=!0:0===L.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===A?v.doplot=!0:"margin"===L||"autorange"===K||"rangemode"===K||"type"===K||"domain"===K||"fixedrange"===K||"scaleanchor"===K||"scaleratio"===K||A.indexOf("calendar")!==-1||A.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||A.indexOf("axis")===-1&&"plot_bgcolor"!==A?"hiddenlabels"===A?v.docalc=!0:L.indexOf("legend")!==-1?v.dolegend=!0:A.indexOf("title")!==-1?v.doticks=!0:L.indexOf("bgcolor")!==-1?v.dolayoutstyle=!0:E>1&&b.containsAny(K,["tick","exponent","grid","zeroline"])?v.doticks=!0:A.indexOf(".linewidth")!==-1&&A.indexOf("axis")!==-1?v.doticks=v.dolayoutstyle=!0:E>1&&K.indexOf("line")!==-1?v.dolayoutstyle=!0:E>1&&"mirror"===K?v.doticks=v.dolayoutstyle=!0:"margin.pad"===A?v.doticks=v.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(A)!==-1||A.indexOf("spike")!==-1?v.domodebar=!0:["height","width","autosize"].indexOf(A)===-1&&(v.doplot=!0):v.doplot=!0,k.set(T)}}}for(a in h){S.applyContainerArrayChanges(t,b.nestedProperty(l,a),h[a],v)||(v.doplot=!0)}var J=u._axisConstraintGroups;for(var tt in _)for(o=0;o=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=P.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=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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,P.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?v>=s.length?t.transitionOpts=s[v]:t.transitionOpts=s[0]:t.transitionOpts=s,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&AA)&&k.push(g);m=k}}m.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(b.isPlainObject(e[i])){var h=(u[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&u[h]&&(n++,b.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:c+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=f[i].frame,"number"==typeof a.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=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=P.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":302,"../components/errorbars":308,"../constants/xmlns_namespaces":379,"../lib":393,"../lib/events":386,"../lib/queue":405,"../lib/svg_text_utils":412,"../plotly":425,"../plots/cartesian/axis_ids":433,"../plots/cartesian/constants":435,"../plots/cartesian/constraints":437,"../plots/cartesian/graph_interact":439,"../plots/plots":470,"../plots/polar":473,"../registry":478,"./helpers":415,"./manage_arrays":416,"./subroutines":422,d3:79,"fast-isnumeric":87}],418:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],419:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var i={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var a={};w(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return w(t,v),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],r=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},m)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(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)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(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 c(t){return _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),i=w({},e.layoutAttributes);i[M]=!0,n.set(i)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,M="_isSubplotObj",A="_isLinkedToArray",k=[M,A,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=M,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=k,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]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:k.concat(["description","role"])},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},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)||p.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){if(a=a.slice(0,s).concat([r]),e&&("data_array"===e.valType||e.arrayOk===!0)){var l=n(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}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;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}var i=t("d3"),a=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),f=t("../components/titles"),h=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=a.Axes.list(t);for(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.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)})})}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":393,"../plotly":425,"../snapshot/cloneplot":479,"../snapshot/helpers":482,"../snapshot/svgtoimg":484,"../snapshot/tosvg":486,"fast-isnumeric":87}],424:[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;m.3*f||a(n)||a(i))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=z.tickIncrement(t,"M6","reverse")+1.5*S:a.exactMonths>.8?t=z.tickIncrement(t,"M1","reverse")+15.5*S:t-=S/2;var s=z.tickIncrement(t,r);if(s<=n)return s}return t}function a(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=S&&i<=10||e>=15*S)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=O&&i<=19||e>=R)t._tickround="S";else{var a=t.l2r(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 l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var i=t._tickround,a=r&&t.hoverformat||t.tickformat;n&&(i=b(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=_.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");l!==-1&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&_.mod(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,_.mod(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 f(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=d(e.x,t,i,n)}function d(t,e,r,n){var i=t<0,a=e._tickround,o=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]};s(f),a=(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,-a)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=q[l/3+5])}return i?"\u2212"+t:t}function p(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},z.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(),_.simpleMap(r,t.l2r||Number)},z.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=z.getAutoRange(t);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},z.saveRangeInitial=function(t,e){for(var r=z.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),M=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)}},z.autoBin=function(t,e,r,a,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,a?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},z.setConvert(d),z.autoTicks(d,u);var p,g=z.tickIncrement(z.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=i(g,t,d.dtick,s,o)),p=g;p<=l;)p=z.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},z.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),z.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return a(t);t._tmin=z.tickFirst(t);var i=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=z.tickIncrement(u,t.dtick,i,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),f=0;fC?(e/=C,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,j)):n>L?(e/=L,t.dtick="M"+o(e,1,F)):n>S?(t.dtick=o(e,S,U),t.tick0=_.dateTick0(t.calendar,!0)):n>P?t.dtick=o(e,P,F):n>R?t.dtick=o(e,R,B):n>O?t.dtick=o(e,O,B):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,j))}else if("log"===t.type){t.tick0=0;var i=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var a=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/a,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(e,r,j)}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=o(e,r,j));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)}},z.tickIncrement=function(t,e,r,n){var i=r?-1:1;if(b(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return _.incrementMonth(t,o,n);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?H:V,l=t+.01*i,u=_.roundUp(_.mod(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},z.tickFirst=function(t){var e=t.r2l||Number,r=_.simpleMap(t.range,e),n=r[1]1&&e2*i}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,e){return i(t,e)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":377,"../../lib":393,"fast-isnumeric":87}],432:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories") -;e.exports=function(t,e,r,p,g){function v(r,n){return a.coerce2(t,e,s,r,n)}var m=p.letter,y=p.font||{},b="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?d(m,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),M=w===t.color?w:y.color;r("title",b),a.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:M}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var A=v("linecolor",w),k=v("linewidth"),T=r("showline",!!A||!!k);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var E=v("gridcolor",n(w,p.bgColor,o).toRgbString()),C=v("gridwidth");r("showgrid",p.showGrid||!!E||!!C)||(delete e.gridcolor,delete e.gridwidth);var L=v("zerolinecolor",w),S=v("zerolinewidth");return r("zeroline",p.showGrid||!!L||!!S)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":277,"../../lib":393,"../../registry":478,"./category_order_defaults":434,"./layout_attributes":441,"./ordered_categories":443,"./set_convert":447,"./tick_label_defaults":448,"./tick_mark_defaults":449,"./tick_value_defaults":450,tinycolor2:249}],433:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],435:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],436:[function(t,e,r){"use strict";function n(t,e,r,n){var i,a,s,l,u=n[o(e)].type,c=[];for(a=0;aa*p))for(r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return["lasso","select"].indexOf(t)!==-1}function v(t,e){return"M"+(t.l-.5)+","+(e-N-.5)+"h-3v"+(2*N+1)+"h3ZM"+(t.r+.5)+","+(e-N-.5)+"h3v"+(2*N+1)+"h-3Z"}function m(t,e){return"M"+(e-N-.5)+","+(t.t-.5)+"v-3h"+(2*N+1)+"v3ZM"+(e-N-.5)+","+(t.b+.5)+"v3h"+(2*N+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,N)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,i,a,o,s,l,u=!1,c={},f={};for(n=0;nN||s>N?(wt="xy",o/nt>s/it?(s=o*it/nt,mt>a?yt.t=mt-s:yt.b=mt+s):(o=s*nt/it,vt>i?yt.l=vt-o:yt.r=vt+o),At.attr("d",y(yt))):n():!ot||szoom back out","long"),D=!1)}function G(e,r){var n=1===(F+B).length;if(e)Q();else if(2!==r||n){if(1===r&&n){var i=F?tt[0]:J[0],o="s"===F||"w"===B?0:1,s=i._name+".range["+o+"]",l=a(i,o),u="left",c="middle";if(i.fixedrange)return;F?(c="n"===F?"top":"bottom","right"===i.side&&(u="right")):"e"===B&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(pt).call(k.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=i.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else Z()}function X(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=A.simpleMap(t.range,t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return A.pauseEvent(e);var n=t.querySelector(".plotly");if(U(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Tt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void A.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=Ct.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(B||lt){for(B||(l=.5),a=0;ac[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":393,"fast-isnumeric":87}],445:[function(t,e,r){"use strict";e.exports=function(t,e,r){void 0===r&&(r=.5);var n=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=n[0]+(n[1]-n[0])*r,a=(i-n[0])*e;t.range=t._input.range=[t.l2r(i-a),t.l2r(i+a)]}},{}],446:[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,M="M"+b+","+x,A=i.xaxes[0]._length,k=i.yaxes[0]._length,T=i.xaxes.map(n),E=i.yaxes.map(n),C=i.xaxes.concat(i.yaxes);"lasso"===f&&(p=l([[b,x]],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("+m+", "+y+")").attr("d",M+"Z");var S,P,R,O,I,z=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"),N=[],D=i.gd,j=[];for(S=0;Sh?d:o(t)?Number(t):d):d}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../lib"),l=s.cleanNumber,u=s.ms2DateTime,c=s.dateTime2ms,f=t("../../constants/numerical"),h=f.FP_SAFE,d=f.BADNUM,p=t("./constants"),g=t("./axis_ids");e.exports=function(t,e){function r(e,r){if(e>0)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*w*Math.abs(n-i))}return d}function f(e,r,n){var i=c(e,n||t.calendar);if(i===d){if(!o(e))return d;i=c(new Date(+e))}return i}function v(e,r,n){return u(e,r,n||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if("number"==typeof e)return e}function x(e){return o(e)?a.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:i,t.l2c="log"===t.type?n:i,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=i,t.d2p=t.r2p=function(t){return x(l(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(l(t),e)},t.r2d=t.r2c=function(t){return n(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=i,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return x(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(t){return x(l(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=s.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(t,e,r){return x(f(t,0,r))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2l_noadd=b,t.r2l=t.l2r=t.r2c=t.c2r=i,t.d2p=function(t){return x(b(t))},t.p2d=function(t){return m(_(t))},t.r2p=x,t.p2r=_),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,i=s.nestedProperty(t,e).get(),a=(t._id||"x").charAt(0);if(n="date"===t.type?s.dfltRange(t.calendar):"y"===a?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void s.nestedProperty(t,e).set(n);for("date"===t.type&&(i[0]=s.cleanDate(i[0],d,t.calendar),i[1]=s.cleanDate(i[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!s.isDateTime(i[r],t.calendar)){t[e]=n;break}if(t.r2l(i[0])===t.r2l(i[1])){var l=s.constrain(t.r2l(i[0]),s.MIN_MS+1e3,s.MAX_MS-1e3);i[0]=t.l2r(l-1e3),i[1]=t.l2r(l+1e3);break}}else{if(!o(i[r])){if(!o(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-h?i[r]=-h:i[r]>h&&(i[r]=h),i[0]===i[1]){var u=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=u,i[1]+=u}}},t.setScale=function(r){var n=e._size,i=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=g.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var o=r&&t._r?"_r":"range",l=t.calendar;t.cleanRange(o);var u=t.r2l(t[o][0],l),c=t.r2l(t[o][1],l);if("y"===i?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw s.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,i,a,o="date"===t.type&&e[r+"calendar"];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?i.dateTick0(e.calendar):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":377,"../../lib":393,"fast-isnumeric":87}],451:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r){for(i=0;ir.duration?(d(),A=window.cancelAnimationFrame(g)):A=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(s),o[s]=a}return o}(e),b=Object.keys(y),x=function(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}(v,b,y);if(!x.length)return!1;var _;u&&(_=u());var w,M,A,k=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(A),A=null,p()}),w=Date.now(),A=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":302,"../../plotly":425,"../../registry":478,"./axes":430,d3:79}],452:[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 u=i(e,r,n);if(u){if("histogram"===u.type&&n==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=n+"calendar",f=u[c];if(o(u,n)){for(var h,d=a(u),p=[],g=0;g0?".":"")+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":185,"mouse-wheel":188,"right-now":222}],457:[function(t,e,r){"use strict";var n=t("./scene"),i=t("../plots"),a=t("../../lib"),o=t("../../constants/xmlns_namespaces");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){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl3d"),s=0;s1;o(t,e,r,{type:"gl3d",attributes:s,handleDefaults:n,font:e.font,fullData:r,getDfltFromLayout:a,paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":278,"../../../lib":393,"../../subplot_defaults":477,"./axis_defaults":460,"./layout_attributes":463}],463:[function(t,e,r){"use strict";function n(t,e,r){return{x:{valType:"number",dflt:t},y:{valType:"number",dflt:e},z:{valType:"number",dflt:r}}}var i=t("./axis_attributes"),a=t("../../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},camera:{up:a(n(0,0,1),{}),center:a(n(0,0,0),{}),eye:a(n(1.25,1.25,1.25),{})},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]}},aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto"},aspectratio:{x:{valType:"number",min:0},y:{valType:"number",min:0},z:{valType:"number",min:0}},xaxis:i,yaxis:i,zaxis:i,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest"},_deprecated:{cameraposition:{valType:"info_array"}}}},{"../../../lib/extend":387,"./axis_attributes":459}],464:[function(t,e,r){"use strict";function n(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}function i(t){var e=new n;return e.merge(t),e}var a=t("../../../lib/str2rgbarray"),o=["xaxis","yaxis","zaxis"];n.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[o[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=a(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=i},{"../../../lib/str2rgbarray":411}],465:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],i=new Array(n.length),a=0;ah[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 _=c[k[a]].range;g[0][a]=_[0],g[1][a]=_[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 w=[1,1,1];for(a=0;a<3;++a){l=c[k[a]],u=l.type;var M=y[u];w[a]=Math.pow(M.acc,1/M.count)/d[a]}var A;if("auto"===c.aspectmode)A=Math.max.apply(null,w)/Math.min.apply(null,w)<=4?w:[1,1,1];else if("cube"===c.aspectmode)A=[1,1,1];else if("data"===c.aspectmode)A=w;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var T=c.aspectratio;A=[T.x,T.y,T.z]}c.aspectratio.x=f.aspectratio.x=A[0],c.aspectratio.y=f.aspectratio.y=A[1],c.aspectratio.z=f.aspectratio.z=A[2],this.glplot.aspect=A;var E=c.domain||null,C=e._size||null;if(E&&C){var L=this.container.style;L.position="absolute",L.left=C.l+E.x[0]*C.w+"px",L.top=C.t+(1-E.y[1])*C.h+"px",L.width=C.w*(E.x[1]-E.x[0])+"px",L.height=C.h*(E.y[1]-E.y[0])+"px"}this.glplot.redraw()}},A.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},A.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},A.setCamera=function(t){this.glplot.camera.lookAt.apply(this,l(t))},A.saveCamera=function(t){var e=this.getCamera(),r=p.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;if(void 0===n)i=!0;else for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!function(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]]}(e,n,a,o)){i=!0;break}return i&&r.set(e),i},A.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},A.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"),l=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),l.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=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).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={},i=t.layout||{},a=t._fullData||[],o=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var l=r.width,c=r.height;p.supplyLayoutGlobalDefaults(i,n),i.width||(n.width=l),i.height||(n.height=c)}else{p.supplyLayoutGlobalDefaults(i,n);var f=!i.width||!i.height,h=n.autosize,d=t._context&&t._context.autosizable;f&&(h||d)?p.plotAutoSize(t,i,n):f&&p.sanitizeMargins(t),!h&&f&&(i.width=n.width,i.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,o,i,n),n._has=p._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var c=a(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,g=1-2*s,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(g*(v.width-h)),i=Math.round(g*(v.height-d))}else{var m=u?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;u.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];n._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),c=e._pushmargin;if(e.margin.autoexpand!==!1){c.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(c),h=0;hv){var A=(m*w+(M-e.width)*v)/(w-v),k=(M*(1-v)+(m-e.width)*(1-w))/(w-v);A>=0&&k>=0&&A+k>i+a&&(i=A,a=k)}}if(l(b)&&c[_].t){var T=c[_].t.val,E=c[_].t.size;if(T>y){var C=(b*T+(E-e.height)*y)/(T-y),L=(E*(1-y)+(b-e.height)*(1-T))/(T-y);C>=0&&L>=0&&C+L>s+o&&(s=C,o=L)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):f.isJSDate(t)?f.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(u.layout=a(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=a(l)),"object"===n?u:JSON.stringify(u)},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 u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,c=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,C=E?f.angularAxis.domain:n.extent(M),L=Math.abs(M[1]-M[0]);k&&!A&&(L=0);var S=C.slice();T&&A&&(S[1]+=L);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(S[1]-S[0])/P);var R=f.angularAxis.ticksStep||(S[1]-S[0])/(P*(f.minorTicks+1));w&&(R=Math.max(Math.round(R),1)),S[2]||(S[2]=R);var O=n.range.apply(this,S);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(S.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?L:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var I=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),z=this.appendChild(this.ownerDocument.importNode(I.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 N,D=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},F={"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){N=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:N,elements:B,reverseOrder:f.legend.reverseOrder})})();var U=N.node().getBBox();b=Math.min(f.width-U.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(),N.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else N=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),D.attr("transform","translate("+_+")").style({cursor:"crosshair"});var V=[(f.width-(f.margin.left+f.margin.right+2*b+(U?U.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),f.title){var H=e.select("g.title-group text").style(F).text(f.title),q=H.node().getBBox();H.attr({x:_[0]-q.width/2,y:_[1]-b-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=G.selectAll("circle.grid-circle").data(i.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(j),X.attr("r",i),X.exit().remove()}G.select("circle.outside-circle").attr({r:b}).style(j);var W=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Y=n.svg.axis().scale(i).ticks(5).tickSize(5);G.call(Y).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(j),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(F).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,F["font-size"]]+")":"translate("+[0,F["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),Q=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),Z.exit().remove(),Q.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),Q.selectAll(".minor").style({stroke:f.minorTickColor}),Z.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(F);var $=Z.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(F);f.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(D.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));N.attr({transform:"translate("+[b+K,f.margin.top]+")"});var J=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||J){var et=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 it,at,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!A){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});D.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(W).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});D.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(W).radius;ht.attr({r:r}).style({opacity:.5}),at=i.invert(o.util.getMousePos(W).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ut.text(o.util.round(at)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.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])};A&&(u.t=w[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-V[0]-h.left,f.top+f.height/2-V[1]-h.top];ct.config({color:s}).text(c),ct.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return 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;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var 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 i[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),i={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){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||void 0===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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=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+10,dy:.3*+i.fontSize}),l};return l.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(c);var f=i.padding,h=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,g=h.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[i.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return a(i,t),l},l},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",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);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":393,d3:79}],475:[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":278,"../../lib":393,"./micropolar":474,"./undo_manager":476,d3:79}],476:[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)),h=t._context||{};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;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.vertexcolor[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":411,"alpha-shape":14,"convex-hull":70,"delaunay-triangulate":80,"gl-mesh3d":131,tinycolor2:249}],490:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function u(t){var e=t.map(function(t){var e=l(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var c=u(["x","y","z"]),f=u(["i","j","k"]);if(!c)return void(e.visible=!1);f&&f.forEach(function(t){for(var e=0;eg&&d.splice(g,d.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};i.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>g&&u.splice(g,u.length-g)}var b,x=1.6*(e.marker.sizeref||1);b="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},v.ppad=m.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(m.padded=!1):m.tozero=!0,i.expand(f,d,v),i.expand(h,p,m);var _=new Array(g);for(c=0;c=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],497:[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":281,"../../components/colorscale":292,"../../lib":393,"../../plots/plots":470,"fast-isnumeric":87}],498:[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":284,"../../components/colorscale/has_colorscale":291,"./subtypes":514}],499:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],500:[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,p,g),m=vU!=O>=U&&(S=C[T-1][0],P=C[T][0],L=S+(P-S)*(U-R)/(O-R),D=Math.min(D,L),j=Math.max(j,L));D=Math.max(D,0),j=Math.min(j,h._length);var V=s.defaultLine;return s.opacity(f.fillcolor)?V=f.fillcolor:s.opacity((f.line||{}).color)&&(V=f.line.color),n.extendFlat(t,{distance:l+10,x0:D,x1:j,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":278,"../../components/errorbars":308,"../../components/fx":319,"../../lib":393,"./get_trace_color":502}],504:[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":440,"./arrays_to_calcdata":493,"./attributes":494,"./calc":495,"./clean_data":496,"./colorbar":497,"./defaults":500,"./hover":503,"./plot":511,"./select":512,"./style":513,"./subtypes":514}],505:[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,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":287,"../../components/colorscale/has_colorscale":291}],506:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),i=w.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*k}var a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_=e.xaxis,w=e.yaxis,M=e.simplify,A=e.connectGaps,k=e.baseTolerance,T=e.linear,E=[],C=.2,L=new Array(t.length),S=0;for(M||(k=C=-1),a=0;ai(c))break;s=c,m=p[0]*d[0]+p[1]*d[1],m>g?(g=m,l=c,h=!1):m=t.length||!c)break;L[S++]=c,o=c}}else L[S++]=l}E.push(L.slice(0,S))}return E}},{"../../constants/numerical":377}],507:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],508:[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":87}],510:[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,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?n.background:n.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":278,"../../components/colorscale/defaults":287,"../../components/colorscale/has_colorscale":291,"./subtypes":514}],511:[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,h,p){function g(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function b(){return!1}function x(e){var r,n,i,a=e[0].trace,u=o.select(this),f=c.hasMarkers(a),h=c.hasText(a),d=y(a),p=b,m=b;f&&(p=a.marker.maxdisplayed||a._needsCull?v:s.identity),h&&(m=a.marker.maxdisplayed||a._needsCull?v:s.identity),n=u.selectAll("path.point"),r=n.data(p,d);var x=r.enter().append("path").classed("point",!0);x.call(l.pointStyle,a).call(l.translatePoints,A,k,a),M&&x.style("opacity",0).transition().style("opacity",1);var _=f&&l.tryColorscale(a.marker,""),w=f&&l.tryColorscale(a.marker,"line");r.each(function(e){var r=o.select(this),n=g(r);(i=l.translatePoint(e,n,A,k))&&(l.singlePointStyle(e,n,a,_,w,t),a.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),M?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=u.selectAll("g"),r=n.data(m,d),r.enter().append("g").classed("textpoint",!0).append("text"),r.each(function(t){var e=o.select(this),r=g(e.select("text"));(i=l.translatePoint(t,r,A,k))||e.remove()}),r.selectAll("text").call(l.textPointStyle,a).each(function(t){var e=t.xp||A.c2p(t.x),r=t.yp||k.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){g(o.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;a(t,e,r,n,i);var M=!!p&&p.duration>0,A=r.xaxis,k=r.yaxis,T=n[0].trace,E=T.line,C=o.select(h);if(C.call(u.plot,r,p),T.visible===!0){g(C).style("opacity",T.opacity);var L,S,P=T.fill.charAt(T.fill.length-1);"x"!==P&&"y"!==P&&(P=""),n[0].node3=C;var R="",O=[],I=T._prevtrace;I&&(R=I._prevRevpath||"",S=I._nextFill,O=I._polygons);var z,N,D,j,F,B,U,V,H,q="",G="",X=[],W=[],Y=s.noop;if(L=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(S&&S.datum(n),["hv","vh","hvh","vhv"].indexOf(E.shape)!==-1?(D=l.steps(E.shape),j=l.steps(E.shape.split("").reverse().join(""))):D=j="spline"===E.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),E.smoothing):l.smoothopen(t,E.smoothing)}:function(t){return"M"+t.join("L")},F=function(t){return j(t.reverse())},X=f(n,{xaxis:A,yaxis:k,connectGaps:T.connectgaps,baseTolerance:Math.max(E.width||1,3)/4,linear:"linear"===E.shape,simplify:E.simplify}),H=T._polygons=new Array(X.length),w=0;w1}),Y=function(t){return function(e){if(z=D(e),N=F(e),q?P?(q+="L"+z.substr(1),G=N+"L"+G.substr(1)):(q+="Z"+z,G=N+"Z"+G):(q=z,G=N),c.hasLines(T)&&e.length>1){var r=o.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",z).call(l.lineGroupStyle)).style("opacity",1);else{var i=g(r);i.attr("d",z),l.singleLineStyle(n,i)}}}}}var Z=C.selectAll(".js-line").data(W);g(Z.exit()).style("opacity",0).remove(),Z.each(Y(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Y(!0)),X.length&&(L?B&&V&&(P?("y"===P?B[1]=V[1]=k.c2p(0,!0):"x"===P&&(B[0]=V[0]=A.c2p(0,!0)),g(L).attr("d","M"+V+"L"+B+"L"+q.substr(1))):g(L).attr("d",q+"Z")):"tonext"===T.fill.substr(0,6)&&q&&R&&("tonext"===T.fill?g(S).attr("d",q+"Z"+R+"Z"):g(S).attr("d",q+"L"+R.substr(1)+"Z"),T._polygons=T._polygons.concat(O)),T._prevRevpath=G,T._prevPolygons=H);var Q=C.selectAll(".points");_=Q.data([n]),Q.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(a.range,a.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=n[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),v=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),h(t,e,r),n(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),v){s&&(d=s());o.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).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":302,"../../components/errorbars":308,"../../lib":393,"../../lib/polygon":403,"./line_points":506,"./link_traces":508,"./subtypes":514,d3:79}],512:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace,h=f.index,d=f.marker,p=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!p){var g=Array.isArray(d.opacity)?1:d.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 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.delaunayMesh._trace=this,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":374,"../../constants/gl_markers":375,"../../lib":393,"../../lib/gl_format_color":390,"../../lib/str2rgbarray":411,"../scatter/make_bubble_size_func":509,"./calc_errors":519,"delaunay-triangulate":80,"gl-error3d":103,"gl-line3d":108,"gl-mesh3d":131,"gl-scatter3d":137}],521:[function(t,e,r){"use strict";function n(t,e,r,n){var a=0,o=r("x"),s=r("y"),l=r("z");return i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),o&&s&&l&&(a=Math.min(o.length,s.length,l.length),a=0&&h("surfacecolor",d||p);for(var g=["x","y","z"],v=0;v<3;++v){var m="projection."+g[v];h(m+".show")&&(h(m+".opacity"),h(m+".scale"))}c(t,e,r,{axis:"z"}),c(t,e,r,{axis:"y",inherit:"z"}),c(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":307,"../../lib":393,"../../registry":478,"../scatter/line_defaults":505,"../scatter/marker_defaults":510,"../scatter/subtypes":514,"../scatter/text_defaults":515,"./attributes":517}],522:[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":375,"../../plots/gl3d":457,"../scatter/colorbar":497,"./attributes":517,"./calc":518,"./convert":520,"./defaults":521}],523:[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":278,"../../components/colorbar/attributes":279,"../../components/colorscale/attributes":283,"../../lib/extend":387}],524:[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":284}],525:[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":281,"../../components/colorscale":292,"../../lib":393,"../../plots/plots":470,"fast-isnumeric":87}],526:[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(eMath.abs(e))u.rotate(o,0,0,-t*n*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,f*(Math.exp(s)-1))}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":9,"mouse-change":186,"mouse-event-offset":187,"mouse-wheel":189,"right-now":223}],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;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;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}()},{}],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.ushln(f):f<0&&(c=c.ushln(-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 a=0;a20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":35,"double-bits":81}],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)).ushln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":36,"double-bits":81}],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.abs().divmod(r.abs()),o=n.div,s=i(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,f=i(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}var h=r.bitLength()-l.bitLength()+53,f=i(l.ushln(h).divRound(r));return h<1023?u*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),u*f*Math.pow(2,1023-h))}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){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return t&=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))<<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))<<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(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(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 s(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 l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&l,h=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=h;d++){var p=u-d|0;i=0|t.words[p],a=0|e.words[d],o=i*a+f,c+=o/67108864|0,f=67108863&o}r.words[u]=0|f,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0,i+=o>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}function f(t,e,r){return(new h).mulp(t,e,r)}function h(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()), +this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),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.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,r=0!==a||o!==this.length-1?_[6-l.length]+l+r:l+r,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=M[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(c).toString(t);f=f.idivn(c),r=f.isZero()?h+r:_[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,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>>13,d=0|o[1],p=8191&d,g=d>>>13,v=0|o[2],m=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,A=w>>>13,k=0|o[5],T=8191&k,E=k>>>13,L=0|o[6],C=8191&L,S=L>>>13,P=0|o[7],R=8191&P,O=P>>>13,N=0|o[8],I=8191&N,z=N>>>13,D=0|o[9],j=8191&D,F=D>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>13,X=0|s[2],W=8191&X,Y=X>>>13,Z=0|s[3],Q=8191&Z,$=Z>>>13,K=0|s[4],J=8191&K,tt=K>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ft=8191&ct,ht=ct>>>13,dt=0|s[9],pt=8191&dt,gt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(f,U),i=Math.imul(f,V),i=i+Math.imul(h,U)|0,a=Math.imul(h,V);var vt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=Math.imul(p,V),i=i+Math.imul(g,U)|0,a=Math.imul(g,V),n=n+Math.imul(f,q)|0,i=i+Math.imul(f,G)|0,i=i+Math.imul(h,q)|0,a=a+Math.imul(h,G)|0;var mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,U),i=Math.imul(m,V),i=i+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,q)|0,i=i+Math.imul(p,G)|0,i=i+Math.imul(g,q)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(f,W)|0,i=i+Math.imul(f,Y)|0,i=i+Math.imul(h,W)|0,a=a+Math.imul(h,Y)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=Math.imul(x,V),i=i+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(m,q)|0,i=i+Math.imul(m,G)|0,i=i+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=i+Math.imul(p,Y)|0,i=i+Math.imul(g,W)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(f,Q)|0,i=i+Math.imul(f,$)|0,i=i+Math.imul(h,Q)|0,a=a+Math.imul(h,$)|0;var bt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=Math.imul(M,V),i=i+Math.imul(A,U)|0,a=Math.imul(A,V),n=n+Math.imul(x,q)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,q)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(m,W)|0,i=i+Math.imul(m,Y)|0,i=i+Math.imul(y,W)|0,a=a+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=i+Math.imul(p,$)|0,i=i+Math.imul(g,Q)|0,a=a+Math.imul(g,$)|0,n=n+Math.imul(f,J)|0,i=i+Math.imul(f,tt)|0,i=i+Math.imul(h,J)|0,a=a+Math.imul(h,tt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=Math.imul(T,V),i=i+Math.imul(E,U)|0,a=Math.imul(E,V),n=n+Math.imul(M,q)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(A,q)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(x,W)|0,i=i+Math.imul(x,Y)|0,i=i+Math.imul(_,W)|0,a=a+Math.imul(_,Y)|0,n=n+Math.imul(m,Q)|0,i=i+Math.imul(m,$)|0,i=i+Math.imul(y,Q)|0,a=a+Math.imul(y,$)|0,n=n+Math.imul(p,J)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(g,J)|0,a=a+Math.imul(g,tt)|0,n=n+Math.imul(f,rt)|0,i=i+Math.imul(f,nt)|0,i=i+Math.imul(h,rt)|0,a=a+Math.imul(h,nt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,U),i=Math.imul(C,V),i=i+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(T,q)|0,i=i+Math.imul(T,G)|0,i=i+Math.imul(E,q)|0,a=a+Math.imul(E,G)|0,n=n+Math.imul(M,W)|0,i=i+Math.imul(M,Y)|0,i=i+Math.imul(A,W)|0,a=a+Math.imul(A,Y)|0,n=n+Math.imul(x,Q)|0,i=i+Math.imul(x,$)|0,i=i+Math.imul(_,Q)|0,a=a+Math.imul(_,$)|0,n=n+Math.imul(m,J)|0,i=i+Math.imul(m,tt)|0,i=i+Math.imul(y,J)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0,n=n+Math.imul(f,at)|0,i=i+Math.imul(f,ot)|0,i=i+Math.imul(h,at)|0,a=a+Math.imul(h,ot)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(R,U),i=Math.imul(R,V),i=i+Math.imul(O,U)|0,a=Math.imul(O,V),n=n+Math.imul(C,q)|0,i=i+Math.imul(C,G)|0,i=i+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(T,W)|0,i=i+Math.imul(T,Y)|0,i=i+Math.imul(E,W)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(M,Q)|0,i=i+Math.imul(M,$)|0,i=i+Math.imul(A,Q)|0,a=a+Math.imul(A,$)|0,n=n+Math.imul(x,J)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,J)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=i+Math.imul(m,nt)|0,i=i+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0,n=n+Math.imul(f,lt)|0,i=i+Math.imul(f,ut)|0,i=i+Math.imul(h,lt)|0,a=a+Math.imul(h,ut)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(I,U),i=Math.imul(I,V),i=i+Math.imul(z,U)|0,a=Math.imul(z,V),n=n+Math.imul(R,q)|0,i=i+Math.imul(R,G)|0,i=i+Math.imul(O,q)|0,a=a+Math.imul(O,G)|0,n=n+Math.imul(C,W)|0,i=i+Math.imul(C,Y)|0,i=i+Math.imul(S,W)|0,a=a+Math.imul(S,Y)|0,n=n+Math.imul(T,Q)|0,i=i+Math.imul(T,$)|0,i=i+Math.imul(E,Q)|0,a=a+Math.imul(E,$)|0,n=n+Math.imul(M,J)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(A,J)|0,a=a+Math.imul(A,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(m,at)|0,i=i+Math.imul(m,ot)|0,i=i+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(g,lt)|0,a=a+Math.imul(g,ut)|0,n=n+Math.imul(f,ft)|0,i=i+Math.imul(f,ht)|0,i=i+Math.imul(h,ft)|0,a=a+Math.imul(h,ht)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,U),i=Math.imul(j,V),i=i+Math.imul(F,U)|0,a=Math.imul(F,V),n=n+Math.imul(I,q)|0,i=i+Math.imul(I,G)|0,i=i+Math.imul(z,q)|0,a=a+Math.imul(z,G)|0,n=n+Math.imul(R,W)|0,i=i+Math.imul(R,Y)|0,i=i+Math.imul(O,W)|0,a=a+Math.imul(O,Y)|0,n=n+Math.imul(C,Q)|0,i=i+Math.imul(C,$)|0,i=i+Math.imul(S,Q)|0,a=a+Math.imul(S,$)|0,n=n+Math.imul(T,J)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(E,J)|0,a=a+Math.imul(E,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(A,rt)|0,a=a+Math.imul(A,nt)|0,n=n+Math.imul(x,at)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,i=i+Math.imul(m,ut)|0,i=i+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ft)|0,i=i+Math.imul(p,ht)|0,i=i+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0,n=n+Math.imul(f,pt)|0,i=i+Math.imul(f,gt)|0,i=i+Math.imul(h,pt)|0,a=a+Math.imul(h,gt)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,q),i=Math.imul(j,G),i=i+Math.imul(F,q)|0,a=Math.imul(F,G),n=n+Math.imul(I,W)|0,i=i+Math.imul(I,Y)|0,i=i+Math.imul(z,W)|0,a=a+Math.imul(z,Y)|0,n=n+Math.imul(R,Q)|0,i=i+Math.imul(R,$)|0,i=i+Math.imul(O,Q)|0,a=a+Math.imul(O,$)|0,n=n+Math.imul(C,J)|0,i=i+Math.imul(C,tt)|0,i=i+Math.imul(S,J)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(E,rt)|0,a=a+Math.imul(E,nt)|0,n=n+Math.imul(M,at)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(A,at)|0,a=a+Math.imul(A,ot)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(m,ft)|0,i=i+Math.imul(m,ht)|0,i=i+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,gt)|0,i=i+Math.imul(g,pt)|0,a=a+Math.imul(g,gt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,W),i=Math.imul(j,Y),i=i+Math.imul(F,W)|0,a=Math.imul(F,Y),n=n+Math.imul(I,Q)|0,i=i+Math.imul(I,$)|0,i=i+Math.imul(z,Q)|0,a=a+Math.imul(z,$)|0,n=n+Math.imul(R,J)|0,i=i+Math.imul(R,tt)|0,i=i+Math.imul(O,J)|0,a=a+Math.imul(O,tt)|0,n=n+Math.imul(C,rt)|0,i=i+Math.imul(C,nt)|0,i=i+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(T,at)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(E,at)|0,a=a+Math.imul(E,ot)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,n=n+Math.imul(x,ft)|0,i=i+Math.imul(x,ht)|0,i=i+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0,n=n+Math.imul(m,pt)|0,i=i+Math.imul(m,gt)|0,i=i+Math.imul(y,pt)|0,a=a+Math.imul(y,gt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,Q),i=Math.imul(j,$),i=i+Math.imul(F,Q)|0,a=Math.imul(F,$),n=n+Math.imul(I,J)|0,i=i+Math.imul(I,tt)|0,i=i+Math.imul(z,J)|0,a=a+Math.imul(z,tt)|0,n=n+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,i=i+Math.imul(O,rt)|0,a=a+Math.imul(O,nt)|0,n=n+Math.imul(C,at)|0,i=i+Math.imul(C,ot)|0,i=i+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(E,lt)|0,a=a+Math.imul(E,ut)|0,n=n+Math.imul(M,ft)|0,i=i+Math.imul(M,ht)|0,i=i+Math.imul(A,ft)|0,a=a+Math.imul(A,ht)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,gt)|0,i=i+Math.imul(_,pt)|0,a=a+Math.imul(_,gt)|0;var Lt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,J),i=Math.imul(j,tt),i=i+Math.imul(F,J)|0,a=Math.imul(F,tt),n=n+Math.imul(I,rt)|0,i=i+Math.imul(I,nt)|0,i=i+Math.imul(z,rt)|0,a=a+Math.imul(z,nt)|0,n=n+Math.imul(R,at)|0,i=i+Math.imul(R,ot)|0,i=i+Math.imul(O,at)|0,a=a+Math.imul(O,ot)|0,n=n+Math.imul(C,lt)|0,i=i+Math.imul(C,ut)|0,i=i+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(T,ft)|0,i=i+Math.imul(T,ht)|0,i=i+Math.imul(E,ft)|0,a=a+Math.imul(E,ht)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,gt)|0,i=i+Math.imul(A,pt)|0,a=a+Math.imul(A,gt)|0;var Ct=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,rt),i=Math.imul(j,nt),i=i+Math.imul(F,rt)|0,a=Math.imul(F,nt),n=n+Math.imul(I,at)|0,i=i+Math.imul(I,ot)|0,i=i+Math.imul(z,at)|0,a=a+Math.imul(z,ot)|0,n=n+Math.imul(R,lt)|0,i=i+Math.imul(R,ut)|0,i=i+Math.imul(O,lt)|0,a=a+Math.imul(O,ut)|0,n=n+Math.imul(C,ft)|0,i=i+Math.imul(C,ht)|0,i=i+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,gt)|0,i=i+Math.imul(E,pt)|0,a=a+Math.imul(E,gt)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,at),i=Math.imul(j,ot),i=i+Math.imul(F,at)|0,a=Math.imul(F,ot),n=n+Math.imul(I,lt)|0,i=i+Math.imul(I,ut)|0,i=i+Math.imul(z,lt)|0,a=a+Math.imul(z,ut)|0,n=n+Math.imul(R,ft)|0,i=i+Math.imul(R,ht)|0,i=i+Math.imul(O,ft)|0,a=a+Math.imul(O,ht)|0,n=n+Math.imul(C,pt)|0,i=i+Math.imul(C,gt)|0,i=i+Math.imul(S,pt)|0,a=a+Math.imul(S,gt)|0;var Pt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,lt),i=Math.imul(j,ut),i=i+Math.imul(F,lt)|0,a=Math.imul(F,ut),n=n+Math.imul(I,ft)|0,i=i+Math.imul(I,ht)|0,i=i+Math.imul(z,ft)|0,a=a+Math.imul(z,ht)|0,n=n+Math.imul(R,pt)|0,i=i+Math.imul(R,gt)|0,i=i+Math.imul(O,pt)|0,a=a+Math.imul(O,gt)|0;var Rt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,ft),i=Math.imul(j,ht),i=i+Math.imul(F,ft)|0,a=Math.imul(F,ht),n=n+Math.imul(I,pt)|0,i=i+Math.imul(I,gt)|0,i=i+Math.imul(z,pt)|0,a=a+Math.imul(z,gt)|0;var Ot=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(j,pt),i=Math.imul(j,gt),i=i+Math.imul(F,pt)|0,a=Math.imul(F,gt);var Nt=(u+n|0)+((8191&i)<<13)|0;return u=(a+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,l[0]=vt,l[1]=mt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=At,l[9]=kt,l[10]=Tt,l[11]=Et,l[12]=Lt,l[13]=Ct,l[14]=St,l[15]=Pt,l[16]=Rt,l[17]=Ot,l[18]=Nt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(A=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?A(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):f(this,t,e)},h.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},h.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=l(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);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)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var f=0|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()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){s=new a(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;0==(r.words[0]&g)&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var c=0,f=1;0==(r.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var h;return h=0===e.cmpn(1)?i:o,h.cmpn(0)<0&&h.iadd(t),h},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0] +},a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new y(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var k={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},i(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(k[t])return k[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new g;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return k[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var f=this.pow(c,i),h=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var g=d,v=0;0!==g.cmp(s);v++)g=g.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var f=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new b(t)},i(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===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))>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":256}],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];",M="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,_,":",M):i.push(M,_,":",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("");return new Function(s)()}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);E.length0;){P-=1;var O=P*k,N=E[O],I=E[O+1],z=E[O+2],D=E[O+3],j=E[O+4],F=E[O+5],B=P*T,U=L[B],V=L[B+1],H=1&F,q=!!(16&F),G=l,X=u,W=g,Y=C;if(H&&(G=g,X=C,W=l,Y=u),!(2&F&&(z=_(t,N,I,z,G,X,V),I>=z)||4&F&&(I=w(t,N,I,z,G,X,U))>=z)){var Z=z-I,Q=j-D;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),M=h*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"},{}],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,M=t+1,A=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*_],C=r[2*_+1],S=2*y,P=2*x,R=2*w,O=2*d,N=2*g,I=2*p,z=0;z<2;++z){var D=r[S+z],j=r[P+z],F=r[R+z];r[O+z]=D,r[N+z]=j,r[I+z]=F}o(v,t,r),o(m,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,L,C,r))for(;;){if(c(A,L,C,r)){c(A,T,E,r)?(s(B,M,A,r),++M,--A):(a(B,A,r),--A);break}if(--A>>1;h(x,E);for(var L=0,C=0,M=0;M=d)S=S-d|0,i(v,m,C--,S);else if(S>=0)i(p,g,L--,S);else if(S<=-d){S=-S-d|0;for(var P=0;P>>1;h(x,L);for(var C=0,S=0,P=0,A=0;A>1==x[2*A+3]>>1&&(O=2,A+=1),R<0){for(var N=-(R>>1)-1,I=0;I>1)-1;0===O?i(p,g,C--,N):1===O?i(v,m,S--,N):2===O&&i(y,b,P--,N)}}}function l(t,e,r,n,o,s,l,u,c,f,v,m){var y=0,b=2*t,_=e,w=e+t,M=1,A=1;n?A=d:M=d;for(var k=o;k>>1;h(x,C);for(var S=0,k=0;k=d?(R=!n,T-=d):(R=!!n,T-=1),R)a(p,g,S++,T);else{var O=m[T],N=b*T,I=v[N+e+1],z=v[N+e+1+t];t:for(var D=0;D>>1;h(x,M);for(var A=0,y=0;y=d)p[A++]=b-d;else{b-=1;var T=c[b],E=g*b,L=u[E+e+1],C=u[E+e+1+t];t:for(var S=0;S=0;--S)if(p[S]===b){for(var N=S+1;NZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?f(t,e,r):"string"==typeof t?u(t,e):h(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),a=n(r),o=a.write(t,e);return o!==r&&(a=a.slice(0,o)),a}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),i=0;i=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),i.alloc(+t)}function g(t,e){if(i.isBuffer(t))return t.length;if(G(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 B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return H(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function v(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 E(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,X(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function b(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&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}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)>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)>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)>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 L(n)}function L(t){var e=t.length;if(e<=Q)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 N(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function I(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 z(t,e,r,n,i){return e=+e,r>>>=0,i||I(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return e=+e,r>>>=0,i||I(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(t,e,r,n,52,8),r+8}function j(t){if(t=t.trim().replace($,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(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=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function H(t){return W.toByteArray(j(t))}function q(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function X(t){return t!==t}var W=t("base64-js"),Y=t("ieee754");r.Buffer=i,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return l(t)},i.allocUnsafeSlow=function(t){return l(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,a){if(!i.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===a&&(a=this.length), +e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.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},i.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},i.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),Y.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),Y.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){N(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(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},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);N(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return z(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return z(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},i.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)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)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;al?l:o+16383));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":52,"robust-in-sphere":227}],49:[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,n.prototype.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],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===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":52,"robust-orientation":229}],51:[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){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],53:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],57:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var g=e[o],v=g[0],m=g[1],y=t[v],M=t[m];if((y[0]-M[0]||y[1]-M[1])<0){var k=v;v=m,m=k}g[0]=v;var T,E=g[1]=p[1];for(i&&(T=g[2]);a>0&&n[a-1][0]===o;){var p=n[--a],L=p[1];i?e.push([E,L,T]):e.push([E,L]),E=L}i?e.push([E,m,T]):e.push([E,m])}return s}function u(t,e,r){for(var i=e.length,a=new v(i),o=[],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 g(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":60,"is-plain-obj":178}],62:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":64}],64:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],65:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1, +rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],66:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,f,h,d,p,g,v,m,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",h=t.colormap,h||(h="jet"),"string"==typeof h){if(h=h.toLowerCase(),!l[h])throw Error(h+" not a supported colorscale");f=s(l[h])}else{if(!Array.isArray(h))throw Error("unsupported colormap option",h);f=s(h)}if(f.length>p)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);return c===n(t,e,i)?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);return f>0?s>0&&a(t,e,i)>0?1:-1:f<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":229,"robust-product":230,"robust-sum":234,signum:235,"two-sum":255}],68:[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},{}],72:[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":172}],74:[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},{}],75:[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":77}],76:[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;n0&&l.push("var "+u.join(",")),n=a-1;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;f0&&x.push("var "+_.join(","));for(var 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("");return new Function(["function ",L,"(",b.join(","),"){",x.join("\n"),"} return ",L].join(""))()}var u=t("uniq");e.exports=l},{uniq:258}],77:[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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;ce?1:t>=e?0:NaN}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=Mo.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?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 $(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):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 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)*Ko,n=vt(n)*Jo,a=vt(a)*ts,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):Mt(""+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 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=ns.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=mt((.4124564*t+.3575761*e+.1804375*r)/Ko),i=mt((.2126729*t+.7151522*e+.072175*r)/Jo);return dt(116*i-16,500*(n-i),200*(i-mt((.0193339*t+.119192*e+.9503041*r)/ts)))}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 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 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 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 as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Nt)),a}function Nt(){var t=It(),e=zt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Nt,e)),os=0):(os=1,ls(Nt))}function It(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function zt(){for(var t,e=is,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=cs.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=fs.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 M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(x=a(x,1/0));var A=g.length+x.length+_.length+(b?0:i.length),k=A"===o?k+i+t:"^"===o?k.substring(0,A>>=1)+i+t+k.substring(A):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(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=C[o in gs?e.charAt(s++):o])||(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){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){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,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{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Xt(g),_=Wt(g),w=Xt(v),M=Wt(v),A=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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(hs.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"%"}},C={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){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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){ms.lastIndex=0;var n=ms.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;As.point=function(o,s){As.point=t,n=(e=o)*Ho,i=Math.cos(s=(r=s)*Ho/2+Fo/4),a=Math.sin(s)},As.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 Me(t){return[Math.atan2(t[1],t[0]),nt(t[2])]}function Ae(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),Re(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()}},b=De(),x=e(b),_=!1;return y}}function ze(t){return t.length>1}function De(){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-Do:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Do: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)Do?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])>Do){var a=t[0]=0?1:-1,M=w*_,A=M>Fo,k=p*b;if(Ms.add(Math.atan2(k*w*Math.sin(M),g*x+k*Math.cos(M))),a+=A?_+w*Bo:_,A^h>=r^m>=r){var T=be(me(f),me(t));we(T);var E=be(i,T);we(E);var L=(A^_>=0?-1:1)*nt(E[2]);(n>L||n===L&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!v++)break;h=m,p=b,g=x,f=t}}return(a<-Do||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),(Ae(r,d)||Ae(p,d))&&(p[0]+=Do,p[1]+=Do,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&&Ae(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);xe(p,_e(s,h));var g=d,v=ye(p,g),m=ye(g,g),y=v*v-m*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(g,(-v-b)/m);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],A=t[1],k=e[1];M0^x[1]<(xo(x[0]-w)Fo^(w<=x[0]&&x[0]<=M)){var C=_e(g,(-v+b)/m);return xe(C,p),[x,Me(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)>Do;return Ie(e,r,vr(t,6*Ho),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(){C.point=p,v&&v.push(m=[]),A=!0,M=!1,_=w=NaN}function d(){g&&(p(y,b),x&&M&&E.rejoin(),g.push(E.buffer())),C.point=f,M&&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]),A)y=t,b=e,x=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}};L(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,v,m,y,b,x,_,w,M,A,k,T=s,E=De(),L=qe(t,e,r,n),C={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 C}}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){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tHs&&(Hs=t),eqs&&(qs=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){Es+=t,Ls+=e,++Cs}function Je(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Ss+=o*(e+t)/2,Ps+=o*(r+n)/2,Rs+=o,Ke(e=t,r=n)}var e,r;Ws.point=function(n,i){Ws.point=t,Ke(e=n,r=i)}}function tr(){Ws.point=Ke}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Ss+=o*(n+t)/2,Ps+=o*(i+e)/2,Rs+=o,o=i*t-n*e,Os+=o*(n+t),Ns+=o*(i+e),Is+=3*o,Ke(n=t,i=e)}var e,r,n,i;Ws.point=function(a,o){Ws.point=t,Ke(e=n=a,r=i=o)},Ws.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(){b=NaN,A.point=a,e.lineStart()}function a(r,n){var a=me([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=a[2],s,e),e.point(b,x)}function o(){A.point=r,e.lineEnd()}function l(){n(),A.point=u,A.lineEnd=c}function u(t,e){a(f=t,h=e),d=b,p=x,g=_,v=w,m=M,A.point=a}function c(){i(b,x,y,_,w,M,d,p,f,g,v,m,s,e),A.lineEnd=o,o()}var f,h,d,p,g,v,m,y,b,x,_,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,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,M=u+g,A=Math.sqrt(_*_+w*w+M*M),k=Math.asin(M/=A),T=xo(xo(M)-1)a||xo((y*S+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[0]*qo,t[1]*qo]}function n(){s=Se(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,_=Ds,w=x,M=null,A=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?(M=t,Ds):He((M=+t)*Ho),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]):x,i()):A},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?Se(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+Do&&(e=-Vo+Do):e>Vo-Do&&(e=Vo-Do);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 Dr(){an(this),this.edge=this.site=this.circle=null}function jr(t){var e=sl.pop()||new Dr;return e.site=t,e}function Fr(t){Zr(t),il.remove(t),sl.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)Do)s=s.L;else{if(!((i=a-Hr(s,o))>Do)){n>-Do?(e=s.P,r=s):i>-Do?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.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=nl,v=g.length;v--;)if((a=g[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oDo||xo(i-r)>Do)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-f)Do?{x:f,y:xo(e-f)Do?{x:xo(r-p)Do?{x:h,y:xo(e-h)Do?{x:xo(r-d)=-jo)){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=ll.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=ol._;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,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:bn(r,n)})),a=fl.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 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 Cn(t){return function(e){return Math.pow(e,t)}}function Sn(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 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 Dn(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 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 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 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(Ci),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 ji(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=cs.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=Yi(n.map(i),r?Math:kl);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 Al;arguments.length<2?r=Al:"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,M=(-x*v-m*_)/y,A=(x*m+v*_)/y,k=(-x*v+m*_)/y,T=w-p,E=M-g,L=A-p,C=k-g;return T*T+E*E>L*L+C*C&&(w=A,M=k),[[w-l,M-u],[w*r/b,M*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 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]+Sa(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(Ql,i);return a==Ql.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Ql[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=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=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(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)},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 Co=uo.selection.prototype=[];Co.select=function(t){var e,r,n,i,a=[];t=S(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}},Co.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))},Co.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},Co.sort=function(t){t=q.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.transition().duration(C)),e.call(t.event)}function s(){_&&_.domain(x.range().map(function(t){return(t-A.x)/A.k}).map(x.invert)),M&&M.domain(w.range().map(function(t){return(t-A.y)/A.k}).map(w.invert))}function l(t){S++||t({type:"zoomstart"})}function u(t){s(),t({type:"zoom",scale:A.k,translate:[A.x,A.y]})}function c(t){--S||(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(O,null),d(s),c(o)}var i=this,o=I.of(i,arguments),s=0,f=uo.select(n(i)).on(R,t).on(O,r),h=e(uo.mouse(i)),d=$(i);Bl.call(i),l(o)}function h(){function t(){var t=uo.touches(p);return d=A.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);Bl.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,fs=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,Dt(t,e))).toFixed(Math.max(0,Math.min(20,Dt(t*(1+1e-15),e))))}}),hs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Vt(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Vt(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Vt(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});hs[t+"s"]=r.range,hs[t+"s"].utc=r.utc.range,hs[t+"OfYear"]=function(t){var r=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(r+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var gs={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,ms=/^%/;uo.locale=function(t){return{numberFormat:Ft(t),timeFormat:qt(t)}};var ys=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=ys.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&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={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=Me(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;As.point(t,r),e(t,r)}function a(){As.lineStart()}function o(){i(g,v),As.lineEnd(),xo(y)>Do&&(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]:tDo?d=90:y<-Do&&(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){ks=Ts=Es=Ls=Cs=Ss=Ps=Rs=Os=Ns=Is=0,uo.geo.stream(t,zs);var e=Os,r=Ns,n=Is,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+Do,f+.12*u+Do],[c-.214*u-Do,f+.234*u-Do]]).stream(l).point,i=s.translate([c-.205*u,f+.212*u]).clipExtent([[c-.214*u+Do,f+.166*u+Do],[c-.115*u-Do,f+.234*u-Do]]).stream(l).point,t},t.scale(1070)};var Fs,Bs,Us,Vs,Hs,qs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=Ye},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Fs+=xo(Bs/2)}},Xs={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Ws={point:Ke,lineStart:Je,lineEnd:tr,polygonStart:function(){Ws.lineStart=er},polygonEnd:function(){Ws.point=Ke,Ws.lineStart=Je,Ws.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 Fs=0,uo.geo.stream(t,i(Gs)),Fs},t.centroid=function(t){return Es=Ls=Cs=Ss=Ps=Rs=Os=Ns=Is=0,uo.geo.stream(t,i(Ws)),Is?[Os/Is,Ns/Is]:Rs?[Ss/Rs,Ps/Rs]:Cs?[Es/Cs,Ls/Cs]:[NaN,NaN]},t.bounds=function(t){return Hs=qs=-(Us=Vs=1/0),uo.geo.stream(t,i(Xs)),[[Us,Vs],[Hs,qs]]},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)>Do}).map(c)).concat(uo.range(Math.ceil(s/g)*g,o,g).filter(function(t){return xo(t%m)>Do}).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+Do],[180,90-Do]]).minorExtent([[-180,-80-Do],[180,80+Do]])},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 Ys=0,uo.geo.stream(t,Zs),Ys};var Ys,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Qs=Ar(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Qs)}).raw=Qs;var $s=Ar(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr($s)}).raw=$s,(uo.geo.conicConformal=function(){return Xe(kr)}).raw=kr,(uo.geo.conicEquidistant=function(){return Xe(Tr)}).raw=Tr;var Ks=Ar(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Ks)}).raw=Ks,Er.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Lr(Er)}).raw=Er +;var Js=Ar(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr(Js)}).raw=Js;var tl=Ar(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Cr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Lr(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,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]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Do)*Do,y:Math.round(o(t,e)/Do)*Do,i:e}})}var n=Sr,i=Pr,a=n,o=i,s=ul;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=r.site,o=r.edges.sort(Xr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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 M=m-g,A=y-v;M>A?y=v+M:m=g+A;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=dl.get(r)||hl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=zn,uo.interpolateHsl=Dn,uo.interpolateLab=jn,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:gl)})(t)},Bn.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var gl={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=Mi,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(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),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(ji(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,M,A,k,T=0,E=0,L=[];if((m=(+l.apply(this,arguments)||0)/2)&&(v=a===Sl?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 C=Math.abs(f-c-2*E)<=Fo?0:1;if(E&&ba(y,b,x,_)===d^C){var S=(c+f)/2;y=u*Math.cos(S),b=u*Math.sin(S),x=_=null}}else y=b=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),A=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,M,A,k)===1-d^P){var R=(c+f)/2;w=t*Math.cos(R),M=t*Math.sin(R),A=k=null}}else w=M=0;if(h>Do&&(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(Il.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 Il=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*Dl)),r=e*Dl;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/zl),r=e*zl/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/zl),r=e*zl/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});uo.svg.symbolTypes=Il.keys();var zl=Math.sqrt(3),Dl=Math.tan(30*Ho);Co.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Fl||{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&&(C||(b=null,P[0]-=f[1],P[1]-=h[1],C=2),T())}function g(){32==uo.event.keyCode&&2==C&&(P[0]+=f[1],P[1]+=h[1],C=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),C||(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){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:45}],82:[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},{}],83:[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){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],86:[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},{}],87:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],88:[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=(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":74}],89:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}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}})},{}],90:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],91:[function(t,e,r){function n(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width),"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(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],M=this.pixelRatio*(a[3]*h+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=v,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 L=0;L<2;++L){var C=(A+1+L)%3,S=(A+1+(1^L))%3;this.gridEnable[C]&&this._lines.drawGrid(C,S,this.bounds,E,this.gridColor[C],this.gridWidth[C]*this.pixelRatio)}for(var L=0;L<2;++L){var C=(A+1+L)%3,S=(A+1+(1^L))%3;this.zeroEnable[S]&&s[0][S]<=0&&s[1][S]>=0&&this._lines.drawZero(C,S,this.bounds,E,this.zeroLineColor[S],this.zeroLineWidth[S]*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 P=n(y,k[A].primalMinor),R=n(b,k[A].mirrorMinor),O=this.lineTickLength,L=0;L<3;++L){var N=M/r[5*L];P[L]*=O[L]*N,R[L]*=O[L]*N}this.lineTickEnable[A]&&this._lines.drawAxisTicks(A,k[A].primalOffset,P,this.lineTickColor[A],this.lineTickWidth[A]*this.pixelRatio),this.lineTickMirror[A]&&this._lines.drawAxisTicks(A,k[A].mirrorOffset,R,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 I=k[A].primalMinor,z=n(x,k[A].primalOffset),L=0;L<3;++L)this.lineTickEnable[A]&&(z[L]+=M*I[L]*Math.max(this.lineTickLength[L],0)/r[5*L]);if(this.tickEnable[A]){for(var L=0;L<3;++L)z[L]+=M*I[L]*this.tickPad[L]/r[5*L];this._text.drawTicks(A,this.tickSize[A],this.tickAngle[A],z,this.tickColor[A])}if(this.labelEnable[A]){for(var L=0;L<3;++L)z[L]+=M*I[L]*this.labelPad[L]/r[5*L];z[A]+=.5*(s[0][A]+s[1][A]),this._text.drawLabel(A,this.labelSize[A],this.labelAngle[A],z,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":93,"./lib/cube.js":94,"./lib/lines.js":95,"./lib/text.js":97,"./lib/ticks.js":98}],93:[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":96,"gl-buffer":100,"gl-vao":155}],94:[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 D=I^1<h[j][0]&&(j=D)}}var F=v;F[0]=F[1]=F[2]=0,F[o.log2(z^I)]=I&z,F[o.log2(I^j)]=I&j;var B=7^j;B===_||B===N?(B=7^z,F[o.log2(j^B)]=B&j):F[o.log2(z^B)]=B&z;for(var U=m,V=_,A=0;A<3;++A)U[A]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":140}],97:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),f=s(t,[{buffer:c,size:3}]),h=u(t);h.attributes.position.location=0;var d=new n(t,h,c,f);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},f=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var h=n.prototype,d=[0,0];h.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},h.update=function(t,e,r,n,a){function o(t,e,r,n){var a=f[r];a||(a=f[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,h=0,d=c.length;h=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],h=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),h[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=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&&void 0!==t.shape){var r=t.dtype;if(f.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"), +this.length=e<0?i(this.gl,this.type,this.length,this.usage,h,e):i(this.gl,this.type,this.length,this.usage,h.subarray(0,t.length),e),l.free(h)}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:201,"ndarray-ops":195,"typedarray-pool":256}],101:[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"}},{}],102:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":101}],103:[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,this.lineCount[f]&&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":105,"gl-buffer":100,"gl-vao":155}],104:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&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))<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 FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",null,a)}},{"gl-shader":140}],109:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=g(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=v(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),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 M=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],M,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],M,w,x[0],x[1],x[2],x[3],m[0],m[1],m[2],y[0],y[1],y[2],M,-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 A=t.dashes,k=A.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":214}],131:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],132:[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,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=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=M,this.pointIds=x,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=w({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 _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},N.isTransparent=function(){return this.opacity<1},N.pickSlots=1,N.setPickBase=function(t){this.pickId=t},N.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=A.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()}},N.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()}},N.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(!w&&G.autoResize){var t=M.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",F=!0}}}function r(){for(var t=I.length,e=j.length,r=0;r0&&0===D[e-1];)D.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;k.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){k.colorMask(!0,!0,!0,!0),k.depthMask(!0),k.disable(k.BLEND),k.enable(k.DEPTH_TEST);for(var t=I.length,e=j.length,r=0;rE.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},{}],136:[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 D=I;I=z,z=D,D=O,O=N,N=D;var j=P;P=R,R=j}I[0]<0&&(O[P]=-1),z[1]>0&&(N[R]=-1);for(var F=0,B=0,S=0;S<4;++S)F+=Math.pow(p[4*P+S],2),B+=Math.pow(p[4*R+S],2);O[P]/=Math.sqrt(F),N[R]/=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=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],M=[0,0,0],A=[0,0,0],k=[0,0,0,1],T=[0,0,0,1],E=x.slice(),L=[0,0,0],C=[[0,0,0],[0,0,0]],S=[-1e8,-1e8,-1e8],P=[1e8,1e8,1e8],R=[S,P];_.draw=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){h(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){h(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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=M.cells,q=M.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 A=0|M.type.charAt(M.type.length-1),k=new Array(A),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":141,"./lib/create-attributes":142,"./lib/create-uniforms":143,"./lib/reflect":144,"./lib/runtime-reflect":145,"./lib/shader-cache":146}],141:[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},{}],142:[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":141}],143:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(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;parseInt(n)+""===n?a+="["+n+"]":a+="."+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],M(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=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 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},D.pickSlots=1,D.setPickBase=function(t){this.pickId=t};var j=[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];D.draw=function(t){return s.call(this,t,!1)},D.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]};D.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},D.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 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");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}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 m=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),f===a&&d)0===l.offset&&l.data.length===m?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+m)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+m));else{var b;b=a===t.FLOAT?v.mallocFloat32(m):v.mallocUint8(m);var _=p(b,c,[c[2],c[2]*c[0],1]);f===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):g.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,m)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,m)),a===t.FLOAT?v.freeFloat32(b):v.freeUint8(b)}}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,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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],r=i(e)?e:e.raw;if(r)return f(t,r,0|e.width,0|e.height,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;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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:201,"ndarray-ops":195,"typedarray-pool":256}],152:[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},{}],161:[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},{}],162:[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)},{}],163:[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,j):(U.push(I),z=I,j+1)}function R(){return"."===I?(U.push(I),B=v,z=I,j+1):/[eE]/.test(I)?(U.push(I),B=v,z=I,j+1):"x"===I&&1===U.length&&"0"===U[0]?(B=w,U.push(I),z=I,j+1):/[^\d]/.test(I)?(e(U.join("")),B=u,j):(U.push(I),z=I,j+1)}function O(){return"f"===I&&(U.push(I),z=I,j+=1),/[eE]/.test(I)?(U.push(I),z=I,j+1):"-"===I&&/[eE]/.test(z)?(U.push(I),z=I,j+1):/[^\d]/.test(I)?(e(U.join("")),B=u,j):(U.push(I),z=I,j+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,j}return U.push(I),z=I,j+1}var I,z,D,j=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,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":166,"./lib/builtins-300es":165,"./lib/literals":168,"./lib/literals-300es":167,"./lib/operators":169}],165:[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":166}],166:[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"]},{}],167:[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":168}],168:[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"]},{}],169:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],170:[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":164}],171:[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:1/0*(d?-1:1);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}},{}],172:[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];i[f]=h<0?e: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,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]=m,M[v]=-1,A[v]=e,p[v]=k,k.flip();for(var x=0;x<=o;++x){var E=M[x];if(!(E<0||E===r)){for(var L=new Array(o-1),C=0,S=0;S<=o;++S){var P=M[S];P<0||S===x||(L[C++]=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":229,"simplicial-complex":239}],173:[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)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,a=this.left;a.right;)n=a,a=a.right;if(n===this)a.right=this.right;else{var o=this.left,r=this.right;n.count-=a.count,n.right=a.left,a.left=o,a.right=r}i(this,a),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 o=m.ge(this.leftPoints,t,h);othis.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)},x.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 _=g.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":34}],174:[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":181,"gl-mat4/clone":112,"gl-mat4/create":113,"gl-mat4/determinant":114,"gl-mat4/invert":118,"gl-mat4/transpose":128,"gl-vec3/cross":156,"gl-vec3/dot":157,"gl-vec3/length":158,"gl-vec3/normalize":160}],181:[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}},{}],182:[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":114,"gl-vec3/lerp":159,"mat4-decompose":180,"mat4-recompose":183,"quat-slerp":216}],183:[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":113, +"gl-mat4/fromRotationTranslation":116,"gl-mat4/identity":117,"gl-mat4/multiply":120,"gl-mat4/scale":126,"gl-mat4/translate":127}],184:[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){return t=t||{},new n(t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}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[9],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":229}],186:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==v.alt,v.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==v.shift,v.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==v.control,v.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==v.meta,v.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!==d||a!==p||o!==g||r(n))&&(d=0|t,p=a||0,g=o||0,e&&e(d,p,g,v))}function a(t){n(0,t)}function o(){(d||p||g||v.shift||v.alt||v.meta||v.control)&&(p=g=0,d=0,v.shift=v.alt=v.control=v.meta=!1,e&&e(0,0,0,v))}function s(t){r(t)&&e&&e(d,p,g,v)}function l(t){0===i.buttons(t)?n(0,t):n(d,t)}function u(t){n(d|i.buttons(t),t)}function c(t){n(d&~i.buttons(t),t)}function f(){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)))}function h(){m&&(m=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",u),t.removeEventListener("mouseup",c),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))}e||(e=t,t=window);var d=0,p=0,g=0,v={shift:!1,alt:!1,control:!1,meta:!1},m=!1;f();var y={element:t};return Object.defineProperties(y,{enabled:{get:function(){return m},set:function(t){t?f():h()},enumerable:!0},buttons:{get:function(){return d},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return g},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),y}e.exports=n;var i=t("mouse-event")},{"mouse-event":188}],187:[function(t,e,r){function n(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var n=t.clientX||0,a=t.clientY||0,o=i(e);return r[0]=n-o.left,r[1]=a-o.top,r}function i(t){return t===window||t===document||t===document.body?a:t.getBoundingClientRect()}var a={left:0,top:0};e.exports=n},{}],188:[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)C(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",M+"=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",M="P",A="N",k="Q",T="X",E="T"},{"typedarray-pool":256}],191:[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":78}],192:[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"),o.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.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?a.push("dst.set(",s.join(),",",c,",0);"):a.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?a.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)};"):a.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&&a.push("};")}(p)}}a.push("return dst;};return gradient");for(var g=["diff","zero"],v=[f,h],o=1;o<=i;++o)g.push("grad"+o),v.push(n(o));g.push(a.join(""));var m=Function.apply(void 0,g),r=m.apply(void 0,v);return l[e]=r,r}function a(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?o(e.dimension,r):o(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n>",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":75}],196:[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":197,ndarray:201}],197:[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":75}],198:[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,"b){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,"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&&A&&_.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(""),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=[],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&&A){var C=new Function("insertionSort","malloc","free",_.join("\n"));return C(r,A[0],A[1])}var C=new Function("insertionSort",_.join("\n"));return C(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);return y(b,o(t,e,b))}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":256}],199:[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":198}],200:[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":78,"ndarray-linear-interpolate":194}],201:[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":81}],203:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa)for(var x=i[u],_=1/Math.sqrt(v*y),b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(m[w]*g[M]-m[M]*g[w])}}for(var o=0;oa)for(var _=1/Math.sqrt(A),b=0;b<3;++b)x[b]*=_;else for(var b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(var u=0;u<3;++u)h[u]*=d;i[o]=h}return i}},{}],204:[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},{}],205:[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,M=h*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],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))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var A=this.computedRotation,k=A[0],T=A[1],E=A[2],L=A[3],C=k*w+L*b+T*_-E*x,S=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 O=Math.sin(a)/n(b,x,_);b*=O,x*=O,_*=O,w=Math.cos(e),C=C*w+R*b+S*_-P*x,S=S*w+R*x+P*b-C*_,P=P*w+R*_+C*x-S*b,R=R*w-C*b-S*x-P*_}var N=i(C,S,P,R);N>1e-6?(C/=N,S/=N,P/=N,R/=N):(C=S=P=0,R=1),this.rotation.set(t,C,S,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":204,"filtered-vector":88,"gl-mat4/fromQuat":115,"gl-mat4/invert":118,"gl-mat4/lookAt":119}],206:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":222}],207:[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}},{}],208:[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||[];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":174,"typedarray-pool":256}],210:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var f=0;f<2;++f)for(var h=s[f][n],d=0;d0&&(o=p,l=g,u=f)}return a?l:(o&&r(o,u),l)}for(var a=0|e.length,o=t.length,s=[new Array(a),new Array(a)],l=0;l0;){var d=(s[0][l].length,function(t,a){var o=s[a][t][0],l=[t];r(o,a);for(var u=o[1^a];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],f=t,h=l[1],d=n(c,f,!0);if(i(e[c],e[f],e[h],e[d])<0)break;l.push(t),u=n(c,f)}return l}(l,f));!function(t,e){return e[1]===e[e.length-1]}(h,d)?(h.length>0&&c.push(h),h=d):h.push.apply(h,d)}h.length>0&&c.push(h)}return c}e.exports=n;var i=t("compare-angle")},{"compare-angle":67}],211:[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":211,"edges-to-adjacency-list":83,"planar-dual":210,"point-in-big-polygon":213,"robust-sum":234,"two-product":254,uniq:258}],213:[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 M,A,k,T;x<0?(M=c+h,A=f+d,A>M?(k=A-M,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,A<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):(_=-d/f,y=d*_+p))):_<0?(M=c+d,A=u+h,A>M?(k=A-M,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,A<=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":53,"compare-cell":68,"compare-oriented-cell":69}],222:[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||void 0===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},{}],223:[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:{})},{}],224:[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!0&t?"-":""}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 s=new Function("det",r.join(""));return s(t<6?o[t]:o)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}var o=t("robust-determinant"),s=6,l=[i,a];!function(){for(;l.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=3.3306690738754716e-16*n;return o>=s||o<=-s?o:g(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,m=i*u,y=i*l,b=a*s,x=c*(d-p)+f*(g-m)+h*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(g)+Math.abs(m))*Math.abs(f)+(Math.abs(y)+Math.abs(b))*Math.abs(h),w=7.771561172376103e-16*_;return x>w||-x>w?x:v(t,e,r,n)}];!function(){for(;m.length<=p;)m.push(l(m.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&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":229}],233:[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)=i?(a=d,(c+=1)0?1:0}},{}],236:[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":221}],237:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--n){n0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}(i[s]),l.push("break;");l.push("}}")}return l.push("}return R;};return getContour",t,"d"),new Function("pool",l.join(""))(a)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var a=t("typedarray-pool"),o=t("marching-simplex-table"),s={}},{"marching-simplex-table":179,"typedarray-pool":256}],239:[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){if(e0){var t=A[0];return a(0,T-1),T-=1,u(0),t}return-1}function h(t,e){var r=A[t];return y[r]===e?t:(y[r]=-1/0,c(t),f(),y[r]=e,T+=1,c(T-1))}function d(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 p=e.length,g=t.length,v=new Array(p),m=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var E=f();if(E<0||y[E]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=v[t],r=m[t];v[r]>=0&&(v[r]=e),m[e]>=0&&(m[e]=r),k[e]>=0&&h(k[e],i(e)),k[r]>=0&&h(k[r],i(r))}}(E)}for(var L=[],x=0;x=0&&r>=0&&e!==r){var n=k[e],i=k[r];n!==i&&C.push([n,i])}}),o.unique(o.normalize(C)),{positions:L,edges:C}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":229,"simplicial-complex":241}],244:[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":229}],245:[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":244,"binary-search-bounds":34,"functional-red-black-tree":89,"robust-orientation":229}],246:[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":226,"robust-sum":234}],247:[function(e,r,n){!function(){"use strict";function e(t){return i(a(t),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}function i(t,r){var n,i,a,s,l,u,c,f,h,d=1,p=t.length,g="";for(i=0;i=0),s[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,s[6]?parseInt(s[6]):0);break;case"e":n=s[7]?parseFloat(n).toExponential(s[7]):parseFloat(n).toExponential();break;case"f":n=s[7]?parseFloat(n).toFixed(s[7]):parseFloat(n);break;case"g":n=s[7]?String(Number(n.toPrecision(s[7]))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=s[7]?n.substring(0,s[7]):n;break;case"t":n=String(!!n),n=s[7]?n.substring(0,s[7]):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=s[7]?n.substring(0,s[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=s[7]?n.substring(0,s[7]):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}o.json.test(s[8])?g+=n:(!o.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",n=n.toString().replace(o.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(h+n).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?h+n+l:"0"===u?h+l+n:l+h+n)}return g}function a(t){if(s[t])return s[t];for(var e,r=t,n=[],i=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){i|=1;var a=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))a.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(u[1])}e[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(e)}r=r.substring(e[0].length)}return s[t]=n}var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},s=Object.create(null);void 0!==n&&(n.sprintf=e,n.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r,"function"==typeof t&&t.amd&&t(function(){return{sprintf:e,vsprintf:r}}))}()},{}],248:[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"}},{}],249:[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=p[x].length/y*.5,E=.5+m[x]/y*.5;A.push("d"+x+"-"+E+"-"+T+"*("+p[x].join("+")+k+")/("+g[x].join("+")+")")}h.push("a.push([",A.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=E(t,360),e=E(e,100),r=E(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=E(t,255),e=E(e,255),r=E(r,255);var n,i,a=q(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function E(t,r){S(t)&&(t="100%");var n=P(t);return t=H(r,q(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,q(0,t))}function C(t){return parseInt(t,16)}function S(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function P(t){return"string"==typeof t&&-1!=t.indexOf("%")}function R(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function N(t){return e.round(255*parseFloat(t)).toString(16)}function I(t){return C(t)/255}function z(t){return!!Y.CSS_UNIT.exec(t)}function D(t){t=t.replace(F,"").replace(B,"").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=Y.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Y.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Y.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Y.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Y.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Y.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Y.hex8.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),a:I(r[4]),format:e?"name":"hex8"}:(r=Y.hex6.exec(t))?{r:C(r[1]),g:C(r[2]),b:C(r[3]),format:e?"name":"hex"}:(r=Y.hex4.exec(t))?{r:C(r[1]+""+r[1]),g:C(r[2]+""+r[2]),b:C(r[3]+""+r[3]),a:I(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=Y.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 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 F=/^\s+/,B=/\s+$/,U=0,V=e.round,H=e.min,q=e.max,G=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=T(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*E(this._r,255))+"%",g:V(100*E(this._g,255))+"%",b:V(100*E(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*E(this._r,255))+"%, "+V(100*E(this._g,255))+"%, "+V(100*E(this._b,255))+"%)":"rgba("+V(100*E(this._r,255))+"%, "+V(100*E(this._g,255))+"%, "+V(100*E(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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(A,arguments)},complement:function(){return this._applyCombination(x,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)&&(r[i]="a"===i?t[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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100;return n({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})},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=j(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 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"},W=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(X),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],251:[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":207}],252:[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,M=b,A=-v*b,k=-m*b,T=y,E=this.computedEye,L=this.computedMatrix,o=0;o<3;++o){var C=_*r[o]+w*c[o]+M*e[o];L[4*o+1]=A*r[o]+k*c[o]+T*e[o],L[4*o+2]=C,L[4*o+3]=0}var S=L[1],P=L[5],R=L[9],O=L[2],N=L[6],I=L[10],z=P*I-R*N,D=R*O-S*I,j=S*N-P*O,F=n(z,D,j);z/=F,D/=F,j/=F,L[0]=z,L[4]=D,L[8]=j;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,M=f*m-l*b,A=l*y-c*m,k=n(w,M,A);w/=k,M/=k,A/=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],C=e[5],S=e[9],P=L*m+C*y+S*b,R=L*w+C*M+S*A;T=z<0?-Math.PI/2:Math.PI/2,E=Math.atan2(R,P)}else{var O=e[2],N=e[6],I=e[10],z=O*l+N*c+I*f,D=O*m+N*y+I*b,j=O*w+N*M+I*A;T=Math.asin(i(z)),E=Math.atan2(j,D)}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))<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,M=n(x,_,w);x/=M,_/=M,w/=M;var A=o*c+s*f+l*h,k=g*c+v*f+m*h,T=x*c+_*f+w*h,E=Math.asin(i(A)),L=Math.atan2(T,k),C=this.angle._state,S=C[C.length-1],P=C[C.length-2];S%=2*Math.PI;var R=Math.abs(S+2*Math.PI-L),O=Math.abs(S-L),N=Math.abs(S-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=M[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,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 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,M[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:82}],257:[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))<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)}}()},{}],262:[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":263}],263:[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},{}],264:[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){return t(e).value=r,this},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":262}],265:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":91}],266:[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":75}],267:[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":266}],268:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),f=u("clicktoshow");if(!c&&!f)return e;a(t,e,r,u);for(var h=e.showarrow,d=["x","y"],p=[-10,-30],g={_fullLayout:r},v=0;v<2;v++){var m=d[v],y=i.coerceRef(t,e,g,m,"","paper");if(i.coercePosition(e,g,u,y,m,.5),h){var b="a"+m,x=i.coerceRef(t,e,g,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[v]:.4;i.coercePosition(e,g,u,x,b,_)}u(m+"anchor"),u(m+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=u("xclick"),M=u("yclick");e._xclick=void 0===w?e.x:i.cleanPosition(w,g,e.xref),e._yclick=void 0===M?e.y:i.cleanPosition(M,g,e.yref)}return e}},{"../../lib":401,"../../plots/cartesian/axes":438,"./attributes":270,"./common_defaults":273}],269:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],270:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},i,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":395,"../../plots/cartesian/constants":443,"../../plots/font_attributes":462,"./arrow_paths":269}],271:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;i.filterVisible(e.annotations).forEach(function(e){var r,n,i=a.getFromId(t,e.xref),o=a.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;i&&i.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(a.expand(i,[i.r2c(e.x)],{ppadplus:r,ppadminus:n}),a.expand(i,[i.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):a.expand(i,[i.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(a.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),a.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):a.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(a.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return i.syncOrAsync([o,n],t)}}},{"../../lib":401,"../../plots/cartesian/axes":438,"./draw":276}],272:[function(t,e,r){"use strict";function n(t,e){var r=a(t,e);return r.on.length>0||r.explicitOff.length>0}function i(t,e){var r,n=a(t,e),i=n.on,o=n.off.concat(n.explicitOff),l={};if(i.length||o.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var s=z.selectAll("a");if(1===s.size()&&s.text()===z.text()){L.insert("a",":first-child").attr({"xlink:xlink:href":s.attr("xlink:href"),"xlink:xlink:show":s.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(R.node())}var u=L.select(".annotation-text-math-group"),f=!u.empty(),p=d.bBox((f?u:z).node()),b=p.width,S=p.height,I=e.width||b,D=e.height||S,j=Math.round(I+2*P),F=Math.round(D+2*P);e._w=I,e._h=D;for(var B=!1,U=["x","y"],V=0;V1)&&(Q===Z?((at=$.r2fraction(e["a"+Y]))<0||at>1)&&(B=!0):B=!0,B))continue;H=$._offset+$.r2p(e[Y]),X=.5}else"x"===Y?(G=e[Y],H=w.l+w.w*G):(G=1-e[Y],H=w.t+w.h*G),X=e.showarrow?.5:G;if(e.showarrow){it.head=H;var ot=e["a"+Y];W=J*r(.5,e.xanchor)-tt*r(.5,e.yanchor),Q===Z?(it.tail=$._offset+$.r2p(ot),q=W):(it.tail=H+ot,q=W+ot),it.text=it.tail+W;var st=_["x"===Y?"width":"height"];if("paper"===Z&&(it.head=c.constrain(it.head,1,st-1)),"pixel"===Q){var lt=-Math.max(it.tail-3,it.text),ut=Math.min(it.tail+3,it.text)-st;lt>0?(it.tail+=lt,it.text+=lt):ut>0&&(it.tail-=ut,it.text-=ut)}it.tail+=nt,it.head+=nt}else W=et*r(X,rt),q=W,it.text=H+W;it.text+=nt,W+=nt,q+=nt,e["_"+Y+"padplus"]=et/2+q,e["_"+Y+"padminus"]=et/2-q,e["_"+Y+"size"]=et,e["_"+Y+"shift"]=W}if(B)return void L.remove();var ct=0,ft=0;if("left"!==e.align&&(ct=(I-b)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(D-S)*("middle"===e.valign?.5:1)),f)u.select("svg").attr({x:P+ct-1,y:P+ft}).call(d.setClipUrl,O?M:null);else{var ht=P+ft-p.top,dt=P+ct-p.left;z.call(g.positionText,dt,ht).call(d.setClipUrl,O?M:null)}N.select("rect").call(d.setRect,P,P,I,D),R.call(d.setRect,C/2,C/2,j-C,F-C),L.call(d.setTranslate,Math.round(A.x.text-j/2),Math.round(A.y.text-F/2)),E.attr({transform:"rotate("+k+","+A.x.text+","+A.y.text+")"});var pt=function(r,s){T.selectAll(".annotation-arrow-g").remove();var u=A.x.head,f=A.y.head,p=A.x.tail+r,g=A.y.tail+s,v=A.x.text+r,b=A.y.text+s,_=c.rotationXYMatrix(k,v,b),M=c.apply2DTransform(_),C=c.apply2DTransform2(_),S=+R.attr("width"),P=+R.attr("height"),O=v-.5*S,N=O+S,I=b-.5*P,z=I+P,D=[[O,I,O,z],[O,z,N,z],[N,z,N,I],[N,I,O,I]].map(C);if(!D.reduce(function(t,e){return t^!!o(u,f,u+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){D.forEach(function(t){var e=o(p,g,u,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,g=e.y)});var j=e.arrowwidth,F=e.arrowcolor,B=T.append("g").style({opacity:h.opacity(F)}).classed("annotation-arrow-g",!0),U=B.append("path").attr("d","M"+p+","+g+"L"+u+","+f).style("stroke-width",j+"px").call(h.stroke,h.rgb(F));if(y(U,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&U.node().parentNode&&!n){var V=u,H=f;if(e.standoff){var q=Math.sqrt(Math.pow(u-p,2)+Math.pow(f-g,2));V+=e.standoff*(p-u)/q,H+=e.standoff*(g-f)/q}var G,X,W,Y=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-V)+","+(g-H),transform:"translate("+V+","+H+")"}).style("stroke-width",j+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");m.init({element:Y.node(),gd:t,prepFn:function(){var t=d.getTranslate(L);X=t.x,W=t.y,G={},i&&i.autorange&&(G[i._name+".autorange"]=!0),a&&a.autorange&&(G[a._name+".autorange"]=!0)},moveFn:function(t,r){var n=M(X,W),o=n[0]+t,s=n[1]+r;L.call(d.setTranslate,o,s),G[x+".x"]=i?i.p2r(i.r2p(e.x)+t):e.x+t/w.w,G[x+".y"]=a?a.p2r(a.r2p(e.y)+r):e.y-r/w.h,e.axref===e.xref&&(G[x+".ax"]=i.p2r(i.r2p(e.ax)+t)),e.ayref===e.yref&&(G[x+".ay"]=a.p2r(a.r2p(e.ay)+r)),B.attr("transform","translate("+t+","+r+")"),E.attr({transform:"rotate("+k+","+o+","+s+")"})},doneFn:function(e){if(e){l.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var gt,vt;m.init({element:L.node(),gd:t,prepFn:function(){vt=E.attr("transform"),gt={}},moveFn:function(t,r){var o="pointer";if(e.showarrow)e.axref===e.xref?gt[x+".ax"]=i.p2r(i.r2p(e.ax)+t):gt[x+".ax"]=e.ax+t,e.ayref===e.yref?gt[x+".ay"]=a.p2r(a.r2p(e.ay)+r):gt[x+".ay"]=e.ay+r,pt(t,r);else{if(n)return;if(i)gt[x+".x"]=e.x+t/i._m;else{var s=e._xsize/w.w,l=e.x+(e._xshift-e.xshift)/w.w-s/2;gt[x+".x"]=m.align(l+t/w.w,s,0,1,e.xanchor)}if(a)gt[x+".y"]=e.y+r/a._m;else{var u=e._ysize/w.h,c=e.y-(e._yshift+e.yshift)/w.h-u/2;gt[x+".y"]=m.align(c-r/w.h,u,0,1,e.yanchor)}i&&a||(o=m.getCursor(i?.5:gt[x+".x"],a?.5:gt[x+".y"],e.xanchor,e.yanchor))}E.attr({transform:"translate("+t+","+r+")"+vt}),v(L,o)},doneFn:function(e){if(v(L),e){l.relayout(t,gt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x,_=t._fullLayout,w=t._fullLayout._size;n?(b="annotation-"+n,x=n+".annotations["+r+"]"):(b="annotation",x="annotations["+r+"]"),_._infolayer.selectAll("."+b+'[data-index="'+r+'"]').remove();var M="clip"+_._uid+"_ann"+r;if(!e._input||!1===e.visible)return void s.selectAll("#"+M).remove();var A={x:{},y:{}},k=+e.textangle||0,T=_._infolayer.append("g").classed(b,!0).attr("data-index",String(r)).style("opacity",e.opacity),E=T.append("g").classed("annotation-text-g",!0),L=E.append("g").style("pointer-events",e.captureevents?"all":null).call(v,"default").on("click",function(){t._dragging=!1;var i={index:r,annotation:e._input,fullAnnotation:e,event:s.event};n&&(i.subplotId=n),t.emit("plotly_clickannotation",i)});e.hovertext&&L.on("mouseover",function(){var r=e.hoverlabel,n=r.font,i=this.getBoundingClientRect(),a=t.getBoundingClientRect();p.loneHover({x0:i.left-a.left,x1:i.right-a.left,y:(i.top+i.bottom)/2-a.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var C=e.borderwidth,S=e.borderpad,P=C+S,R=L.append("rect").attr("class","bg").style("stroke-width",C+"px").call(h.stroke,e.bordercolor).call(h.fill,e.bgcolor),O=e.width||e.height,N=_._defs.select(".clips").selectAll("#"+M).data(O?[0]:[]);N.enter().append("clipPath").classed("annclip",!0).attr("id",M).append("rect"),N.exit().remove();var I=e.font,z=L.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?z.call(g.makeEditable,{delegate:L,gd:t}).call(u).on("edit",function(r){e.text=r,this.call(u);var n={};n[x+".text"]=e.text,i&&i.autorange&&(n[i._name+".autorange"]=!0),a&&a.autorange&&(n[a._name+".autorange"]=!0),l.relayout(t,n)}):z.call(u)}function o(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 s=t("d3"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../fx"),g=t("../../lib/svg_text_utils"),v=t("../../lib/setcursor"),m=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:n,drawOne:i,drawRaw:a}},{"../../lib":401,"../../lib/setcursor":416,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/cartesian/axes":438,"../../plots/plots":478,"../color":285,"../dragelement":306,"../drawing":309,"../fx":326,"./draw_arrow_head":277,d3:79}],277:[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,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(r,i){d.path&&(e>5&&(i=0),n.select(h.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}i(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,g,v,m,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||a.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,M=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},g={x:+t.attr("x2"),y:+t.attr("y2")};var A=p.x-g.x,k=p.y-g.y;if(v=Math.atan2(k,A),m=v+Math.PI,M){if(M*M>A*A+k*k)return void c();var T=M*Math.cos(v),E=M*Math.sin(v);_&&(p.x-=T,p.y-=E,t.attr({x1:p.x,y1:p.y})),w&&(g.x+=T,g.y+=E,t.attr({x2:g.x,y2:g.y}))}}else if("path"===h.nodeName){var L=h.getTotalLength(),C="";if(L1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":474,"../annotations/draw":276}],283:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":279,"./convert":280,"./defaults":281,"./draw":282}],284:[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},{}],285:[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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return i(o).toRgbString()},o.contrast=function(t,e,r){var n=i(t);return 1!==n.getAlpha()&&(n=i(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).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]-=(ut-s)/2):r.node()&&!r.classed("js-placeholder")&&(ut=d.bBox(r.node()).height),ut){if(ut+=5,"top"===M.titleside)et.domain[1]-=ut/L.h,a[1]*=-1;else{et.domain[0]+=ut/L.h;var u=v.lineCount(r);a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),et.setScale()}}st.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(L.h*(1-et.domain[1]))+")");var f=st.select(".cbfills").selectAll("rect.cbfill").data(R);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?S[0]:(R[e]+R[e-1])/2,e===R.length-1?S[1]:(R[e]+R[e+1])/2].map(et.c2p).map(Math.round);e!==R.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=N(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Z,width:Math.max(V,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=st.select(".cblines").selectAll("path.cbline").data(M.line.color&&M.line.width?P:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){n.select(this).attr("d","M"+Z+","+(Math.round(et.c2p(t))+M.line.width/2%1)+"h"+V).call(d.lineGroupStyle,M.line.width,O(t),M.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=Z+V+(M.outlinewidth||0)/2-("outside"===M.ticks?1:0),et.side="right",c.syncOrAsync([function(){return l.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(M.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,i=L.l+(et.position||0)*L.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));k("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:M.titleside,offsetLeft:L.l,offsetTop:L.t,maxShift:E.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function k(e,r){var n,i=w();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:et,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:st.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;st.selectAll("."+o+",."+o+"-math-group").remove(),g.draw(t,e,f(a,r||{}))}function T(){var r=V+M.outlinewidth/2+d.bBox(et._axislayer.node()).width;if(F=lt.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=lt.select(".h"+et._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(M.titleside)?d.bBox(i).width:d.bBox(lt.node()).right-Z-L.l,r=Math.max(r,n)}var a=2*M.xpad+r+M.borderwidth+M.outlinewidth/2,s=K-J;st.select(".cbbg").attr({x:Z-M.xpad-(M.borderwidth+M.outlinewidth)/2,y:J-W,width:Math.max(a,2),height:Math.max(s+2*W,2)}).call(p.fill,M.bgcolor).call(p.stroke,M.bordercolor).style({"stroke-width":M.borderwidth}),st.selectAll(".cboutline").attr({x:Z,y:J+M.ypad+("top"===M.titleside?ut:0),width:Math.max(V,2),height:Math.max(s-2*M.ypad-ut,2)}).call(p.stroke,M.outlinecolor).style({fill:"None","stroke-width":M.outlinewidth});var l=({center:.5,right:1}[M.xanchor]||0)*a;st.attr("transform","translate("+(L.l-l)+","+L.t+")"),o.autoMargin(t,e,{x:M.x,y:M.y,l:a*({right:1,center:.5}[M.xanchor]||0),r:a*({left:1,center:.5}[M.xanchor]||0),t:s*({bottom:1,middle:.5}[M.yanchor]||0),b:s*({top:1,middle:.5}[M.yanchor]||0)})}var E=t._fullLayout,L=E._size;if("function"!=typeof M.fillcolor&&"function"!=typeof M.line.color)return void E._infolayer.selectAll("g."+e).remove();var C,S=n.extent(("function"==typeof M.fillcolor?M.fillcolor:M.line.color).domain()),P=[],R=[],O="function"==typeof M.line.color?M.line.color:function(){return M.line.color},N="function"==typeof M.fillcolor?M.fillcolor:function(){return M.fillcolor},I=M.levels.end+M.levels.size/100,z=M.levels.size,D=1.001*S[0]-.001*S[1],j=1.001*S[1]-.001*S[0];for(C=M.levels.start;(C-I)*z<0;C+=z)C>D&&CS[0]&&C1){var ot=Math.pow(10,Math.floor(Math.log(at)/Math.LN10));nt*=ot*c.roundUp(at/ot,[2,5,10]),(Math.abs(M.levels.start)/M.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[$+Y,$+G-Y],et.setScale();var st=E._infolayer.selectAll("g."+e).data([0]);st.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)}),st.attr("transform","translate("+Math.round(L.l)+","+Math.round(L.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(L.l)+",-"+Math.round(L.t)+")");et._axislayer=st.select(".cbaxis");var ut=0;if(-1!==["top","bottom"].indexOf(M.titleside)){var ct,ft=L.l+(M.x+X)*L.w,ht=et.titlefont.size;ct="top"===M.titleside?(1-($+G-Y))*L.h+L.t+3+.75*ht:(1-($+Y))*L.h+L.t-3-.25*ht,k(et._id+"title",{attributes:{x:ft,y:ct,"text-anchor":"start"}})}var dt=c.syncOrAsync([o.previousPromises,A,o.previousPromises,T],t);if(dt&&dt.then&&(t._promises||[]).push(dt),t._context.editable){var pt,gt,vt;u.init({element:st.node(),gd:t,prepFn:function(){pt=st.attr("transform"),h(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),gt=u.align(Q+t/L.w,H,0,1,M.xanchor),vt=u.align($-e/L.h,G,0,1,M.yanchor);var r=u.getCursor(gt,vt,M.xanchor,M.yanchor);h(st,r)},doneFn:function(e){h(st),e&&void 0!==gt&&void 0!==vt&&a.restyle(t,{"colorbar.x":gt,"colorbar.y":vt},w().index)}})}return dt}function w(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=g,s.reversescale&&(g=a(g)),s.colorscale=g)}},{"../../lib":401,"./flip_scale":296,"./scales":303}],292:[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":395,"./attributes":290,"./scales.js":303}],293:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":303}],294:[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;u(f+h+"auto",!(n(v)&&n(m)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],297:[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":293,"./is_valid_scale_array":301,"./scales":303}],298:[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}},{}],305:[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":401}],306:[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=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return g._dragged=!1,g._dragging=!0,c=e.clientX,f=e.clientY,p=e.target,h=(new Date).getTime(),h-g._mouseDownTimem&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v,e),!g._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return i(g),g._dragged=!1,o.pauseEvent(e)}var c,f,h,d,p,g=t.gd,v=1,m=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=n},{"../../constants/interactions":384,"../../lib":401,"../../plotly":433,"../../plots/cartesian/constants":443,"./align":304,"./cursor":305,"./unhover":307}],307:[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,i=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":394}],308:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],309:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){if(u.traceIs(r,"symbols")){var l=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:m.isBubble(r)?l(t.ms):(a.size||6)/2,t.mrc=e;var n=b.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,b.symbolFuncs[i](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var f,h,d,p=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=a.outliercolor):(d=(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)?c.defaultLine:o.color,Array.isArray(a.color)&&(f=c.defaultLine,p=!0),f="mc"in t?t.mcc=n(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var g=a.gradient,v=t.mgt;if(v?p=!0:v=g&&g.type,v&&"none"!==v){var x=t.mgc;x?p=!0:x=g.color;var _="g"+s._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(b.gradient,s,_,v,f,x)}else e.call(c.fill,f);d&&e.call(c.stroke,h)}}function i(t,e,r,n){var i=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+a*a,T/2),c=Math.pow(s*s+l*l,T/2),f=(c*c*i-u*u*s)*n,h=(c*c*a-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[o.round(e[0]+(d&&f/d),2),o.round(e[1]+(d&&h/d),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&h/p),2)]]}function a(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var o=t("d3"),s=t("fast-isnumeric"),l=t("tinycolor2"),u=t("../../registry"),c=t("../color"),f=t("../colorscale"),h=t("../../lib"),d=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),g=t("../../constants/alignment"),v=g.LINE_SPACING,m=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),b=e.exports={};b.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(c.fill,n)},b.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},b.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},b.setRect=function(t,e,r,n,i){t.call(b.setPosition,e,r).call(b.setSize,n,i)},b.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);return!!(s(i)&&s(a)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0)},b.translatePoints=function(t,e,r,n){t.each(function(t){var i=o.select(this);b.translatePoint(t,i,e,r,n)})},b.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},b.crispRound=function(t,e,r){return e&&s(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},b.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||"";c.stroke(e,n||a.color),b.dashLine(e,s,o)},b.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},a=e||i.width||0,s=n||i.dash||"";o.select(this).call(c.stroke,r||i.color).call(b.dashLine,s,a)})},b.dashLine=function(t,e,r){r=+r||0,e=b.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},b.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},b.singleFillStyle=function(t){var e=o.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(c.fill,n)},b.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){h.error(e,t),r.remove()}})};var x=t("./symbol_defs");b.symbolNames=[],b.symbolFuncs=[],b.symbolNeedLines={},b.symbolNoDot={},b.symbolList=[],Object.keys(x).forEach(function(t){var e=x[t];b.symbolList=b.symbolList.concat([e.n,t,e.n+100,t+"-open"]),b.symbolNames[e.n]=t,b.symbolFuncs[e.n]=e.f,e.needLine&&(b.symbolNeedLines[e.n]=!0),e.noDot?b.symbolNoDot[e.n]=!0:b.symbolList=b.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=b.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";b.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=b.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var M={x1:1,x2:0,y1:0,y2:0},A={x1:0,x2:0,y1:1,y2:0};b.gradient=function(t,e,r,n,i,a){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+i+a],h.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(M):"vertical"===n&&t.attr(A),t.attr("id",r);var e=l(i),s=l(a);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},b.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},b.singlePointStyle=function(t,e,r,i,a,o){var s=r.marker;n(t,e,r,i,a,s,s.line,o)},b.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,i=b.tryColorscale(n,""),a=b.tryColorscale(n,"line");t.each(function(t){b.singlePointStyle(t,o.select(this),e,i,a,r)})}},b.tryColorscale=function(t,e){var r=e?h.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?f.makeColorScaleFunc(f.extractScale(n,r.cmin,r.cmax)):h.identity};var k={start:1,end:-1,middle:0,bottom:1,top:-1};b.textPointStyle=function(t,e,r){t.each(function(t){var n=o.select(this),i=t.tx||e.text;if(!i||Array.isArray(i))return void n.remove();var a=t.tp||e.textposition,l=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",u=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=s(c)&&c>0?c:0,n.call(b.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",u).text(i).call(d.convertToTspans,r);var h=o.select(this.parentNode),p=(d.lineCount(n)-1)*v+1,g=k[u]*f,m=.75*c+k[l]*f+(k[l]-1)*p*c/2;h.attr("transform","translate("+g+","+m+")")})};var T=.5;b.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(b.savedBBoxes={},C=0),e&&(b.savedBBoxes[e]=v),C++,h.extendFlat({},v)},b.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},b.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",i=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+i[0]||0,y:+i[1]||0}},b.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,i=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[i]("transform")||"";return e=e||0,r=r||0,o=o.replace(n,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},b.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",i=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+i[0]||1,y:+i[1]||1}},b.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,i=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[i]("transform")||"";return e=e||1,r=r||1,o=o.replace(n,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},b.setPointGroupScale=function(t,e,r){var n,i,a;return e=e||1,r=r||1,i=1===e&&1===r?"":" scale("+e+","+r+")",a=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(a,""),n+=i,n=n.trim(),this.setAttribute("transform",n)}),i};var S=/translate\([^)]*\)\s*$/;b.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),i=n.select("text"),a=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(n.attr("transform")||"").match(S);t=1===e&&1===r?[]:["translate("+a+","+s+")","scale("+e+","+r+")","translate("+-a+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":381,"../../constants/xmlns_namespaces":387,"../../lib":401,"../../lib/svg_text_utils":420,"../../registry":486,"../../traces/scatter/make_bubble_size_func":518,"../../traces/scatter/subtypes":523,"../color":285,"../colorscale":299,"./symbol_defs":310,d3:79,"fast-isnumeric":87,tinycolor2:250}],310:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){ +var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(-.309*t,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"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:79}],311:[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"}}}},{}],312:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&-1!==["linear","log"].indexOf(r.type),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":523,d3:79,"fast-isnumeric":87}],317:[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":285,d3:79}],318:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},i.family,{arrayOk:!0}),size:n({},i.size,{arrayOk:!0}),color:n({},i.color,{arrayOk:!0})}}}},{"../../lib/extend":395,"../../plots/font_attributes":462}],319:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||i.identity,Array.isArray(t)&&(e[0][r]=n(t))}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,o=0;o=0&&r.indexK.width||Q<0||Q>K.height)return b.unhoverRaw(t,e)}if(N="xval"in e?w.flat(h,e.xval):w.p2c(E,Z),I="yval"in e?w.flat(h,e.yval):w.p2c(L,Q),!f(N[0])||!f(I[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var J=1/0;for(D=0;DX&&(W.splice(0,X),J=W[0].distance)}if(0===W.length)return b.unhoverRaw(t,e);W.sort(function(t,e){return t.distance-e.distance});var it=t._hoverdata,at=[];for(z=0;z1,ut=y.combine(g.plot_bgcolor||y.background,g.paper_bgcolor),ct={hovermode:O,rotateLabels:lt,bgColor:ut,container:g._hoverlayer,outerContainer:g._paperdiv,commonLabelOpts:g.hoverlabel},ft=i(W,ct,t);if(a(W,lt?"xa":"ya"),o(ft,lt),e.target&&e.target.tagName){var ht=_.getComponentMethod("annotations","hasClickToShow")(t,at);v(c.select(e.target),ht?"pointer":"")}e.target&&!n&&u(t,e,it)&&(it&&t.emit("plotly_unhover",{event:e,points:it}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:E,yaxes:L,xvals:N,yvals:I}))}function i(t,e,r){var n,i,a=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||M.HOVERFONT,d=e.fontSize||M.HOVERFONTSIZE,p=t[0],v=p.xa,b=p.ya,x="y"===a?"yLabel":"xLabel",_=p[x],w=(String(_)||"").split(" ")[0],k=u.node().getBoundingClientRect(),T=k.top,E=k.width,L=k.height,P=p.distance<=M.MAXDIST&&("x"===a||"y"===a);for(n=0;n15&&(n=n.substr(0,12)+"...")),void 0!==t.extraText&&(i+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(i+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(i+="y: "+t.yLabel+"
"),i+=(i?"z: ":"")+t.zLabel):P&&t[a+"Label"]===_?i=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(i=t.yLabel):i=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(i+=(i?"
":"")+t.text),""===i&&(""===n&&e.remove(),i=n);var p=e.select("text.nums").call(m.font,t.fontFamily||h,t.fontSize||d,t.fontColor||f).text(i).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),v=e.select("text.name"),b=0;n&&n!==i?(v.call(m.font,t.fontFamily||h,t.fontSize||d,u).text(n).attr("data-notex",1).call(g.positionText,0,0).call(g.convertToTspans,r),b=v.node().getBoundingClientRect().width+2*S):(v.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var x,w,M=p.node().getBoundingClientRect(),k=t.xa._offset+(t.x0+t.x1)/2,R=t.ya._offset+(t.y0+t.y1)/2,O=Math.abs(t.x1-t.x0),N=Math.abs(t.y1-t.y0),I=M.width+C+S+b;t.ty0=T-M.top,t.bx=M.width+2*S,t.by=M.height+2*S,t.anchor="start",t.txwidth=M.width,t.tx2width=b,t.offset=0,o?(t.pos=k,x=R+N/2+I<=L,w=R-N/2-I>=0,"top"!==t.idealAlign&&x||!w?x?(R+=N/2,t.anchor="start"):t.anchor="middle":(R-=N/2,t.anchor="end")):(t.pos=R,x=k+O/2+I<=E,w=k-O/2-I>=0,"left"!==t.idealAlign&&x||!w?x?(k+=O/2,t.anchor="start"):t.anchor="middle":(k-=O/2,t.anchor="end")),p.attr("text-anchor",t.anchor),b&&v.attr("text-anchor",t.anchor),e.attr("transform","translate("+k+","+R+")"+(o?"rotate("+A+")":""))}),N}function a(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)?T: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 o(t,e){t.each(function(t){var r=c.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+S),s=o+a*(t.txwidth+S),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-L,l=t.offset*E),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(g.positionText,o+l,u+t.ty0-t.by/2+S),t.tx2width&&(r.select("text.name").call(g.positionText,s+a*S+l,u+t.ty0-t.by/2+S),r.select("rect").call(m.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(a[r])s=a[r];else if(i[r]){var l=i[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r=e.hovermode,n=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,f=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var g=o.spikemode,v=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=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 c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),g=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),m=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),M=t("./constants"),A=M.YANGLE,k=Math.PI*A/180,T=1/Math.sin(k),E=Math.cos(k),L=Math.sin(k),C=M.HOVERARROWSIZE,S=M.HOVERTEXTPAD;r.hover=function(t,e,r,i){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME)return n(t,e,r,i),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,i),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:a},l=i([r],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":401,"../../lib/events":394,"../../lib/override_cursor":410,"../../lib/svg_text_utils":420,"../../plots/cartesian/axes":438,"../../registry":486,"../color":285,"../dragelement":306,"../drawing":309,"./constants":321,"./helpers":323,d3:79,"fast-isnumeric":87,tinycolor2:250}],325:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i=i||{},r("hoverlabel.bgcolor",i.bgcolor),r("hoverlabel.bordercolor",i.bordercolor),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":401}],326:[function(t,e,r){"use strict";function n(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,r){return s.castOption(t,e,"hoverlabel."+r)}function a(t,e,r){function n(r){return s.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return s.castOption(t,r,"hoverinfo",n)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:i,castHoverinfo:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":401,"../dragelement":306,"./attributes":318,"./calc":319,"./click":320,"./constants":321,"./defaults":322,"./helpers":323,"./hover":324,"./layout_attributes":327,"./layout_defaults":328,"./layout_global_defaults":329,d3:79}],327:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},i.family,{dflt:a.HOVERFONT}),size:n({},i.size,{dflt:a.HOVERFONTSIZE}),color:n({},i.color)}}}},{"../../lib/extend":395,"../../plots/font_attributes":462,"./constants":321}], +328:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],336:[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":395,"../../plots/font_attributes":462,"../color/attributes":284}],337:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],338:[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(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,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":401,"../../plots/layout_attributes":476,"../../registry":486,"./attributes":336,"./helpers":341}],339:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(v.font,i.legend.font).text(u),e._context.editable&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(a.type)){var o=n.trace.transforms;i=o[o.length-1].direction+".name"}else i="name";f.restyle(e,i,t,l)}):c.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(m.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeE&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){a(t,e,n)},E):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,a(t,e,n))}})}function a(t,e,r){if(!e._dragged&&!e._editing){var n,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,g=a.indexOf(d);1===r?-1===g?a.push(d):a.splice(g,1):2===r&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&-1===g&&(a=[])),f.relayout(e,"hiddenlabels",a)}else{var v,m=[],y=[];for(v=0;vn.width-(n.margin.r+n.margin.l)&&(y=0,p+=g,i.height=i.height+g,g=0),v.setTranslate(this,a+y,5+a+e.height/2+p),i.width+=o+r,i.height=Math.max(i.height,e.height),y+=o+r,g=Math.max(e.height,g)}),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];c.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.isCenterAnchor(r)&&(n="center");var i="top";k.isBottomAnchor(r)?i="bottom":k.isMiddleAnchor(r)&&(i="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}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),g=t("../dragelement"),v=t("../drawing"),m=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),M=t("./style"),A=t("./helpers"),k=t("./anchor_utils"),T=!0,E=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){C.attr("data-scroll",e).call(v.setTranslate,0,e),S.call(v.setRect,F,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var L=A.selectAll("rect.bg").data([0]);L.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),L.call(m.stroke,y.bordercolor),L.call(m.fill,y.bgcolor),L.style("stroke-width",y.borderwidth+"px");var C=A.selectAll("g.scrollbox").data([0]);C.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 P=C.selectAll("g.groups").data(x);P.enter().append("g").attr("class","groups"),P.exit().remove();var R=P.selectAll("g.traces").data(h.identity);R.enter().append("g").attr("class","traces"),R.exit().remove(),R.call(M,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(i,t)});var O=0!==A.enter().size();O&&(s(t,P,R),l(t));var N=r.width,I=r.height;s(t,P,R),y.height>I?u(t):l(t);var z=r._size,D=z.l+z.w*y.x,j=z.t+z.h*(1-y.y);k.isRightAnchor(y)?D-=y.width:k.isCenterAnchor(y)&&(D-=y.width/2),k.isBottomAnchor(y)?j-=y.height:k.isMiddleAnchor(y)&&(j-=y.height/2);var F=y.width,B=z.w;F>B?(D=z.l,F=B):(D+F>N&&(D=N-F),D<0&&(D=0),F=Math.min(N-D,y.width));var U=y.height,V=z.h;U>V?(j=z.t,U=V):(j+U>I&&(j=I-U),j<0&&(j=0),U=Math.min(I-j,y.height)),v.setTranslate(A,D,j);var H,q,G=U-b.scrollBarHeight-2*b.scrollBarMargin,X=y.height-U;if(y.height<=U||t._context.staticPlot)L.attr({width:F-y.borderwidth,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(C,0,0),T.select("rect").attr({width:F-2*y.borderwidth,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),C.call(v.setClipUrl,o);else{H=b.scrollBarMargin,q=C.attr("data-scroll")||0,L.attr({width:F-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:F-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-q}),C.call(v.setClipUrl,o),O&&e(H,q),A.on("wheel",null),A.on("wheel",function(){q=h.constrain(C.attr("data-scroll")-c.event.deltaY/G*X,-X,0),H=b.scrollBarMargin-q/X*G,e(H,q),0!==q&&q!==-X&&c.event.preventDefault()}),S.on(".drag",null),C.on(".drag",null);var W=c.behavior.drag().on("drag",function(){H=h.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),q=-(H-b.scrollBarMargin)/G*X,e(H,q)});S.call(W),C.call(W)}if(t._context.editable){var Y,Z,Q,$;A.classed("cursor-move",!0),g.init({element:A.node(),gd:t,prepFn:function(){var t=v.getTranslate(A);Q=t.x,$=t.y},moveFn:function(t,e){var r=Q+t,n=$+e;v.setTranslate(A,r,n),Y=g.align(r,0,z.l,z.l+z.w,y.xanchor),Z=g.align(n,0,z.t+z.h,z.t,y.yanchor)},doneFn:function(e,n,i){if(e&&void 0!==Y&&void 0!==Z)f.relayout(t,{"legend.x":Y,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===n?A._clickTimeout=setTimeout(function(){a(o,t,n)},E):2===n&&(A._clickTimeout&&clearTimeout(A._clickTimeout),a(o,t,n)))}}})}}}},{"../../constants/alignment":381,"../../constants/interactions":384,"../../lib":401,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/plots":478,"../../registry":486,"../color":285,"../dragelement":306,"../drawing":309,"./anchor_utils":335,"./constants":337,"./get_legend_data":340,"./helpers":341,"./style":343,d3:79}],340:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+f;l.push(n),s[n]=[[r]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;ar[1])return r[1]}return i}function i(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var g={},v={};h&&(g.mc=r("marker.color",i),g.mo=r("marker.opacity",a.mean,[.2,1]),g.ms=r("marker.size",a.mean,[2,16]),g.mlc=r("marker.line.color",i),g.mlw=r("marker.line.width",a.mean,[0,5]),v.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(v.line={width:r("line.width",i,[0,10])}),d&&(g.tx="Aa",g.tp=r("textposition",i),g.ts=10,g.tc=r("textfont.color",i),g.tf=r("textfont.family",i)),s=[a.minExtend(c,g)],u=a.minExtend(f,v)}var m=n.select(this).select("g.legendpoints"),y=m.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var b=m.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,r=e.marker||{},a=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||r.color),o&&e.call(s.stroke,i.mlc||a.color)})}function h(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.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(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var i=r.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(r).each(c)}},{"../../lib":401,"../../registry":486,"../../traces/pie/style_one":501,"../../traces/scatter/subtypes":523,"../color":285,"../drawing":309,d3:79}],344:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,g=(1+p)/2,v=(1-p)/2;for(n=0;n1)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||p)&&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(["toggleSpikelines","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)){var p=i(e,r,l);f("x",p[0]),f("y",p[1]),a.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),a.coerceFont(f,"font",r.font);var g=f("bgcolor");f("activecolor",o.contrast(g,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":401,"../color":285,"./attributes":348,"./button_attributes":349,"./constants":350}],352:[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;sX&&n>W&&!t.shiftKey?p.getCursor(i/r,1-a/n):"move";g(e,o),G=o.split("-")[0]}function a(e){F=f.getFromId(t,r.xref),B=f.getFromId(t,r.yref),U=m.getDataToPixel(t,F),V=m.getDataToPixel(t,B,!0),H=m.getPixelToData(t,F),q=m.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(D=r.path,j=a+".path"):(v=U(r.x0),y=V(r.y0),b=U(r.x1),x=V(r.y1),_=a+".x0",w=a+".y0",M=a+".x1",A=a+".y1"),vW&&(d[C]=r[O]=q(u),d[S]=r[N]=q(c)),h-f>X&&(d[P]=r[I]=H(f),d[R]=r[z]=H(h))}e.attr("d",o(t,r))}var d,v,y,b,x,_,w,M,A,k,T,E,L,C,S,P,R,O,N,I,z,D,j,F,B,U,V,H,q,G,X=10,W=10,Y={element:e.node(),gd:t,prepFn:a,doneFn:s},Z=Y.element.getBoundingClientRect();p.init(Y),e.node().onmousemove=i}function o(t,e){var r,n,i,a,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=m.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(i=m.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=m.decodeDate(n)),u&&"date"===u.type&&(a=m.decodeDate(a)),s(e.path,n,a);var h=n(e.x0),d=n(e.x1),p=a(e.y0),g=a(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+g;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+g+"H"+h+"Z";var v=(h+d)/2,y=(p+g)/2,b=Math.abs(v-h),x=Math.abs(y-p),_="A"+b+","+x,w=v+b+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i],l=t.substr(1).replace(v.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.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i];return i+t.substr(1).replace(v.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),g=t("../../lib/setcursor"),v=t("./constants"),m=t("./helpers");e.exports={draw:n,drawOne:i}},{"../../lib":401,"../../lib/setcursor":416,"../../plotly":433,"../../plots/cartesian/axes":438,"../color":285,"../dragelement":306,"../drawing":309,"./constants":363,"./helpers":366}],366:[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}},{}],367:[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":361,"./calc_autorange":362,"./defaults":364,"./draw":365}],368:[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)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],g={_fullLayout:r},v=i.coerceRef(t,e,g,p,"","paper");if("path"!==f){var m,y,b;"paper"!==v?(m=i.getFromId(g,v),b=o.rangeToShapePosition(m),y=o.shapePositionToRange(m)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],M=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),i.coercePosition(e,g,u,v,x,.25),i.coercePosition(e,g,u,v,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=M}}return"path"===f?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":401,"../../plots/cartesian/axes":438,"./attributes":361,"./helpers":366}],369:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":395,"../../plots/animation_attributes":434,"../../plots/font_attributes":462,"../../plots/pad_attributes":477,"./constants":370}],370:[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,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}},{}],371:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),k.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-L.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=L.currentValueInset,i="left"}a.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(k.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*C;return T.positionText(a,n,l),a}}function l(t,e,r){var n=t.selectAll("rect."+L.gripRectClass).data([0]);n.enter().append("rect").classed(L.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:L.gripWidth,height:L.gripHeight,rx:L.gripRadius,ry:L.gripRadius}).call(A.stroke,r.bordercolor).call(A.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(L.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(k.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+L.labelsClass).data([0]);r.enter().append("g").classed(L.labelsClass,!0);var n=r.selectAll("g."+L.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(L.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),k.setTranslate(r,m(e,t.fraction),L.tickOffset+e.ticklen+e.font.size*C+L.labelOffset+e.currentValueTotalHeight)})}function f(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&h(t,e,r,a,!0,i)}function h(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),a),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&M.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+L.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(A.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=y(t,w.mouse(i)[0]);f(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(A.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+L.tickRectClass).data(e.steps);r.enter().append("rect").classed(L.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=w.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(A.fill,e.tickcolor),k.setTranslate(i,m(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?L.tickOffset:L.minorTickOffset)+e.currentValueTotalHeight)})}function g(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*L.gripWidth)+","+e.currentValueTotalHeight+")")}}function m(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 b(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(A.fill,r.bgcolor).attr("opacity",0),k.setTranslate(n,0,r.currentValueTotalHeight)}function x(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(A.stroke,e.bordercolor).call(A.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),k.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||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+g+")")}}}var v=r.propContainer,m=r.propName,y=r.traceIndex,b=r.dfltName,x=r.avoid||{},_=r.attributes,w=r.transform,M=r.containerGroup,A=t._fullLayout,k=v.titlefont.family,T=v.titlefont.size,E=v.titlefont.color,L=1,C=!1,S=v.title.trim(),P=t._context.editable;""===S&&(L=0),S.match(h)&&(L=.2,C=!0,P||(S=""));var R=S||P;M||(M=A._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var O=M.selectAll("text").data(R?[0]:[]);if(O.enter().append("text"),O.text(S).attr("class",e),O.exit().remove(),R){O.call(d);var N="Click to enter "+b+" title";P&&(S?O.on(".opacity",null):function(){L=0,C=!0,S=N,O.text(S).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),O.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?a.restyle(t,m,e,y):a.relayout(t,m,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,_.x,_.y)})),O.classed("js-placeholder",C)}}},{"../../constants/interactions":384,"../../lib":401,"../../lib/svg_text_utils":420,"../../plotly":433,"../../plots/plots":478,"../color":285,"../drawing":309,d3:79,"fast-isnumeric":87}],375:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":395,"../../plots/font_attributes":462,"../../plots/pad_attributes":477,"../color/attributes":284}],376:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],377:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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(a.enter().append("g").classed(C.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+C.headerGroupClassName).data(r,i);c.enter().append("g").classed(C.headerGroupClassName,!0);var f=a.selectAll("g."+C.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(C.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,T=n.barLength+2*n.barPad,E=n.barWidth+2*n.barPad,L=p,C=v+m;C+E>u&&(C=u-E);var S=this.container.selectAll("rect.scrollbar-horizontal").data(k?[0]:[]);S.exit().on(".drag",null).remove(),S.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),k?(this.hbar=S.attr({rx:n.barRadius,ry:n.barRadius,x:L,y:C,width:T,height:E}),this._hbarXMin=L+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var P=m>A,R=n.barWidth+2*n.barPad,O=n.barLength+2*n.barPad,N=p+g,I=v;N+R>l&&(N=l-R);var z=this.container.selectAll("rect.scrollbar-vertical").data(P?[0]:[]);z.exit().on(".drag",null).remove(),z.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),P?(this.vbar=z.attr({rx:n.barRadius,ry:n.barRadius,x:N,y:I,width:R,height:O}),this._vbarYMin=I+O/2,this._vbarTranslateMax=A-O):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var D=this.id,j=c-.5,F=P?f+R+.5:f+.5,B=h-.5,U=k?d+E+.5:d+.5,V=s._topdefs.selectAll("#"+D).data(k||P?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",D).append("rect"),k||P?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(F)-Math.floor(j),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,D),this.bg.attr({x:p,y:v,width:g,height:m})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),k||P){var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(H);var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(q),P&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":401,"../color":285,"../drawing":309,d3:79}],381:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],382:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],383:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],384:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],385:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],386:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],387:[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}},{}],388:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":278,"./components/annotations3d":283,"./components/fx":326,"./components/images":334,"./components/legend":342,"./components/rangeselector":354,"./components/rangeslider":360,"./components/shapes":367,"./components/sliders":373,"./components/updatemenus":379,"./fonts/mathjax_config":389,"./lib/queue":413,"./plot_api/plot_schema":427,"./plot_api/register":428,"./plot_api/set_plot_config":429,"./plot_api/to_image":431,"./plot_api/validate":432,"./plotly":433,"./snapshot":491,"./snapshot/download":488,"./traces/scatter":513,d3:79,"es6-promise":84}],389:[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},{}],390:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":385,"fast-isnumeric":87}],391:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);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(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),a=0;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,g=t("./mod"),v=t("../constants/numerical"),m=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),A=h.time.format.utc,k=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,E=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var L,C;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=L&&t<=C?t:m;if("string"!=typeof t&&"number"!=typeof t)return m;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:k);if(!s)return m;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return m;l=Number(l);var p;try{var g=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=g.newDate(l,g.toMonthIndex(l,u,v),c)}else p=g.newDate(l,Number(u),c)}catch(t){return m}return p?(p.toJD()-w)*y+f*b+h*x+d*_:m}l=2===l.length?(Number(l)+2e3-E)%100+E:Number(l),u-=1;var A=new Date(Date.UTC(2e3,u,c,f,h));return A.setUTCFullYear(l),A.getUTCMonth()!==u?m:A.getUTCDate()!==c?m:A.getTime()+d*_},L=r.MIN_MS=r.dateTime2ms("-9999"),C=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==m};var S=90*y,P=3*b,R=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=L&&t<=C))return m;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*g(t+.05,1)),h=Math.round(t-f/10);if(n(r)){var d=Math.floor(h/y)+w,p=Math.floor(g(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=A("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=L+y&&t<=C-y))return m;var e=Math.floor(10*g(t+.05,1)),r=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var O=/%\d?f/g,N=[59,59.9,59.99,59.999,59.9999],I=A("%Y"),z=A("%b %Y"),D=A("%b %-d"),j=A("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,h;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?h=l(p):"m"===r?h=u(p):"d"===r?(a=l(p),h=c(p)):(a=f(p),h=s(t,r))}catch(t){return"Invalid"}else{var g=new Date(Math.floor(t+.05));"y"===r?h=I(g):"m"===r?h=z(g):"d"===r?(a=I(g),h=D(g)):(a=j(g),h=s(t,r))}return h+(a?"\n"+a:"")};var F=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=g(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+F);return l.setUTCMonth(l.getUTCMonth()+e)+i-F},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c",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(no?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,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},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l}},{"../constants/numerical":385,"./clean_number":390,"./coerce":391,"./dates":392,"./ensure_array":393,"./extend":395,"./filter_unique":396,"./filter_visible":397,"./identity":400,"./is_array":402,"./is_plain_object":403,"./loggers":404,"./matrix":405,"./mod":406,"./nested_property":407,"./noop":408,"./notifier":409,"./push_unique":412,"./relink_private":414,"./search":415,"./stats":418,"./to_log_range":421,d3:79,"fast-isnumeric":87}],402:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],403:[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}},{}],404:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),g=t("../plot_api/container_array_match");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(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,f,h,d,p,g=n.length,v=n[0][0],m=n[0][1],y=0;for(c=1;cMath.max(f,v)||u>Math.max(h,m)))if(uc||Math.abs(n(o,h))>i)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":385,"./matrix":405}],412:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ra.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":87}],419:[function(t,e,r){"use strict";function n(t){var e=i(t);return e.length?e:[0,0,0,1]}var i=t("color-rgba");e.exports=n},{"color-rgba":62}],420:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(m,"\\lt ").replace(y,"\\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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),a=u[u.length-1].node}(A);else{var I=y[4],z={type:A},D=o(I,S);if(D?(D=D.replace(N,"$1 fill:"),k&&(D+=";"+k)):k&&(D=k),D&&(z.style=D),"a"===A){s=!0;var j=o(I,P);if(j){var F=document.createElement("a");F.href=j,-1!==M.indexOf(F.protocol)&&(z.href=j,z.target=o(I,R)||"_blank",z.popup=o(I,O))}}n(z)}}return s}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"),g=t("../constants/alignment").LINE_SPACING,v=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,i){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),i&&i.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(v),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};a(l[2],r,function(r,a,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),a&&a.node()&&u.node().insertBefore(a.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),g=n(u,"height"),v=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=parseInt(t.style("font-size"),10)||n(t,"height"),y=-m/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-g/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-g/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:v,y:+t.attr("y")+y-g/2}),i&&i.call(t,f),e(f)})})):o(),t}};var m=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",M=["http:","https:","mailto:","",void 0,":"],A=new RegExp("]*)?/?>","g"),k=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,E=/(<[^<>]*>)/,L=/<(\/?)([^ >]*)(\s+(.*))?>/i,C=//i,S=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,P=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,R=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,O=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,N=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(A," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=f.select(this),i=t("x",e),a=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:i,y:a})})},r.makeEditable=function(t,e){function r(){i(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function n(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function i(){var r=f.select(a),i=r.select(".svg-container"),o=i.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,i,e)).on("blur",function(){a._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;a._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(a._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,i,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(n)}var a=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),f.rebind(t,s,"on")}},{"../constants/alignment":381,"../constants/string_mappings":386,"../constants/xmlns_namespaces":387,"../lib":401,d3:79}],421:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":87}],422:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 i=h.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(v,m),d(t),!0)}var b,x,_,w,M,A,k,T=Object.keys(r).map(Number).sort(s),E=e.get(),L=E||[],C=n(m,f).get(),S=[],P=-1,R=L.length;for(b=0;bL.length-(k?0:1))o.warn("index out of range",f,_);else if(void 0!==A)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(A)?S.push(_):k?("add"===A&&(A={}),L.splice(_,0,A),C&&C.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,A),-1===P&&(P=_);else for(x=0;x=0;b--)L.splice(S[b],1),C&&C.splice(S[b],1);if(L.length?E||e.set(L):e.set(null),g)return!1;if(h(v,m),p!==a){var O;if(-1===P)O=T;else{for(R=Math.max(L.length,R),O=[],b=0;b=P);b++)O.push(_);for(b=P;b=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lV.range[0]?[1,2]:[2,1]);else{var G=V.range[0],X=V.range[1];H?(G<=0&&X<=0&&r(z+".autorange",!0),G<=0?G=X/1e6:X<=0&&(X=G/1e6),r(z+".range[0]",Math.log(G)/Math.LN10),r(z+".range[1]",Math.log(X)/Math.LN10)):(r(z+".range[0]",Math.pow(10,G)),r(z+".range[1]",Math.pow(10,X)))}else r(z+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,F,E,r),w.getComponentMethod("images","convertCoords")(t,F,E,r)}else r(z+".autorange",!0);b.nestedProperty(u,z+"._inputRange").set(null)}else if(N.match(O.AX_NAME_PATTERN)){var W=b.nestedProperty(u,k).get(),Y=(E||{}).type;Y&&"-"!==Y||(Y="linear"),w.getComponentMethod("annotations","convertCoords")(t,W,Y,r),w.getComponentMethod("images","convertCoords")(t,W,Y,r)}var Z=S.containerArrayMatch(k);if(Z){a=Z.array,o=Z.index;var Q=Z.property,$=b.nestedProperty(l,a),K=($||[])[o]||{};if(""===o)-1===k.indexOf("updatemenus")&&(m.docalc=!0);else if(""===Q){var J=E;S.isAddVal(E)?_[k]=null:S.isRemoveVal(E)?(_[k]=K,J=K):b.warn("unrecognized full object value",e),(n(J,"x")||n(J,"y")&&-1===k.indexOf("updatemenus"))&&(m.docalc=!0)}else!n(K,"x")&&!n(K,"y")||b.containsAny(k,["color","opacity","align","dash","updatemenus"])||(m.docalc=!0);h[a]||(h[a]={});var tt=h[a][o];tt||(tt=h[a][o]={}),tt[Q]=E,delete e[k]}else if("reverse"===N)j.range?j.range.reverse():(r(z+".autorange",!0),j.range=[1,0]),F.autorange?m.docalc=!0:m.doplot=!0;else{var et=String(T.parts[1]||"");0===R.indexOf("scene")?"camera"===T.parts[1]?m.docamera=!0:m.doplot=!0:0===R.indexOf("geo")?m.doplot=!0:0===R.indexOf("ternary")?m.doplot=!0:"paper_bgcolor"===k?m.doplot=!0:"margin"===R||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==k.indexOf("calendar")||k.match(/^(bar|box|font)/)?m.docalc=!0:!u._has("gl2d")||-1===k.indexOf("axis")&&"plot_bgcolor"!==k?!u._has("gl2d")||"dragmode"!==k||"lasso"!==E&&"select"!==E||"lasso"===B||"select"===B?"hiddenlabels"===k?m.docalc=!0:-1!==R.indexOf("legend")?m.dolegend=!0:-1!==k.indexOf("title")?m.doticks=!0:-1!==R.indexOf("bgcolor")?m.dolayoutstyle=!0:L>1&&b.containsAny(et,["tick","exponent","grid","zeroline"])?m.doticks=!0:-1!==k.indexOf(".linewidth")&&-1!==k.indexOf("axis")?m.doticks=m.dolayoutstyle=!0:L>1&&-1!==et.indexOf("line")?m.dolayoutstyle=!0:L>1&&"mirror"===et?m.doticks=m.dolayoutstyle=!0:"margin.pad"===k?m.doticks=m.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(k)||-1!==k.indexOf("spike")?m.domodebar=!0:-1===["height","width","autosize"].indexOf(k)&&(m.doplot=!0):m.docalc=!0:m.doplot=!0,T.set(E)}}}for(a in h){S.applyContainerArrayChanges(t,b.nestedProperty(l,a),h[a],m)||(m.doplot=!0)}var rt=u._axisConstraintGroups;for(v in A)for(o=0;o=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=P.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=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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,P.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?v>=s.length?t.transitionOpts=s[v]:t.transitionOpts=s[0]:t.transitionOpts=s,v++,t}var p,g,v=0,m=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&AA)&&k.push(g);m=k}}m.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(b.isPlainObject(e[i])){var h=(u[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&u[h]&&(n++,b.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:c+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=f[i].frame,"number"==typeof a.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=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=P.getGraphDiv(t);var e=t._fullLayout||{},r=t._fullData||[];return M.cleanPlot([],{},r,e),M.purge(t),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":309,"../components/errorbars":315,"../constants/xmlns_namespaces":387,"../lib":401,"../lib/events":394,"../lib/queue":413,"../lib/svg_text_utils":420,"../plotly":433,"../plots/cartesian/axis_ids":441,"../plots/cartesian/constants":443,"../plots/cartesian/constraints":445,"../plots/cartesian/graph_interact":447,"../plots/plots":478,"../plots/polar":481,"../registry":486,"./helpers":423,"./manage_arrays":424,"./subroutines":430,d3:79,"fast-isnumeric":87}],426:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],427:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,g),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){h(n,r.schema.traces[t][e],e)})}),n.type=t;var i={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var a={};w(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return w(t,v),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)f(t,r,"xaxis"),f(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;f(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){h(t,r.schema.layout[e],e)}):h(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],r=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){h(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},m)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(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)):!0===t.arrayOk&&(i[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(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 c(t){return _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function f(t,e,r){var n=p.nestedProperty(t,r),i=w({},e.layoutAttributes);i[M]=!0,n.set(i)}function h(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),g=t("../plots/attributes"),v=t("../plots/layout_attributes"),m=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,M="_isSubplotObj",A="_isLinkedToArray",k=[M,A,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=M,r.IS_LINKED_TO_ARRAY=A,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=k,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]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:k.concat(["description","role"])},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];-1===k.indexOf(n)&&(e(a,n,t,i),r.isValObject(a)||p.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){if(a=a.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)){var l=n(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(g,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}var i=t("d3"),a=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),f=t("../components/titles"),h=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=a.Axes.list(t);for(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.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)})})}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":401,"../plotly":433,"../snapshot/cloneplot":487,"../snapshot/helpers":490,"../snapshot/svgtoimg":492,"../snapshot/tosvg":494,"fast-isnumeric":87}],432:[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;m.3*f||a(n)||a(i))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=N.tickIncrement(t,"M6","reverse")+1.5*S:a.exactMonths>.8?t=N.tickIncrement(t,"M1","reverse")+15.5*S:t-=S/2;var s=N.tickIncrement(t,r);if(s<=n)return s}return t}function a(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&e10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=S&&i<=10||e>=15*S)t._tickround="d";else if(e>=R&&i<=16||e>=P)t._tickround="M";else if(e>=O&&i<=19||e>=R)t._tickround="S";else{var a=t.l2r(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 l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var i=t._tickround,a=r&&t.hoverformat||t.tickformat;n&&(i=b(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=_.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&_.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,_.mod(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 f(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=d(e.x,t,i,n)}function d(t,e,r,n){var i=t<0,a=e._tickround,o=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]};s(f),a=(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,-a)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+g:"E"===o?t+="E"+g:"power"===o?t+="\xd710"+g+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=H[l/3+5])}return i?"\u2212"+t:t}function p(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},N.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(),_.simpleMap(r,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},N.saveRangeInitial=function(t,e){for(var r=N.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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);m&&"domain"===t.constrain&&t._inputDomain&&(m*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),M=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)}},N.autoBin=function(t,e,r,a,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,a?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},N.setConvert(d),N.autoTicks(d,u);var p,g=N.tickIncrement(N.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){g=n(g,t,d,s,l);p=g+(1+Math.floor((l-g)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(g=i(g,t,d.dtick,s,o)),p=g;p<=l;)p=N.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(g,0,o),end:e.c2r(p,0,o),size:d.dtick}},N.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),N.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return a(t);t._tmin=N.tickFirst(t);var i=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=N.tickIncrement(u,t.dtick,i,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),f=0;fL?(e/=L,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,D)):n>C?(e/=C,t.dtick="M"+o(e,1,j)):n>S?(t.dtick=o(e,S,B),t.tick0=_.dateTick0(t.calendar,!0)):n>P?t.dtick=o(e,P,j):n>R?t.dtick=o(e,R,F):n>O?t.dtick=o(e,O,F):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,D))}else if("log"===t.type){t.tick0=0;var i=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var a=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/a,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(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=o(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)}},N.tickIncrement=function(t,e,r,n){var i=r?-1:1;if(b(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return _.incrementMonth(t,o,n);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?V:U,l=t+.01*i,u=_.roundUp(_.mod(l,1),s,r);return Math.floor(l)+Math.log(y.round(Math.pow(10,u),1))/Math.LN10}throw"unrecognized dtick "+String(e)},N.tickFirst=function(t){var e=t.r2l||Number,r=_.simpleMap(t.range,e),n=r[1]1&&e2*i}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,e){return i(t,e)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":385,"../../lib":401,"fast-isnumeric":87}],440:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,g){function v(r,n){return a.coerce2(t,e,s,r,n)}var m=p.letter,y=p.font||{},b="Click to enter "+(p.title||m.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,g),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),f(t,e,r),e._initialCategories="category"===_?d(m,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),M=w===t.color?w:y.color;r("title",b),a.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:M}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var A=v("linecolor",w),k=v("linewidth"),T=r("showline",!!A||!!k);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var E=v("gridcolor",n(w,p.bgColor,o).toRgbString()),L=v("gridwidth");r("showgrid",p.showGrid||!!E||!!L)||(delete e.gridcolor,delete e.gridwidth);var C=v("zerolinecolor",w),S=v("zerolinewidth");return r("zeroline",p.showGrid||!!C||!!S)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":284,"../../lib":401,"../../registry":486,"./category_order_defaults":442,"./layout_attributes":449,"./ordered_categories":451,"./set_convert":455,"./tick_label_defaults":456,"./tick_mark_defaults":457,"./tick_value_defaults":458,tinycolor2:250}],441:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],443:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],444:[function(t,e,r){"use strict";function n(t,e,r,n){var i,a,s,l,u=n[o(e)].type,c=[];for(a=0;ao*m)||_)for(r=0;rP&&OC&&(C=O);var z=(C-L)/(2*S);f/=z,L=l.l2r(L),C=l.l2r(C),l.range=l._input.range=k=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function f(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function g(t){return-1!==["lasso","select"].indexOf(t)}function v(t,e){return"M"+(t.l-.5)+","+(e-j-.5)+"h-3v"+(2*j+1)+"h3ZM"+(t.r+.5)+","+(e-j-.5)+"h3v"+(2*j+1)+"h-3Z"}function m(t,e){return"M"+(e-j-.5)+","+(t.t-.5)+"v-3h"+(2*j+1)+"v3ZM"+(e-j-.5)+","+(t.b+.5)+"v3h"+(2*j+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,j)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,i,a,o,s,l,u=!1,c={},f={};for(n=0;nj||s>j?(At="xy",o/at>s/ot?(s=o*ot/at,bt>a?xt.t=bt-s:xt.b=bt+s):(o=s*at/ot,yt>i?xt.l=yt-o:xt.r=yt+o),Tt.attr("d",y(xt))):n():!lt||szoom back out","long"),F=!1)}function W(e,r){var n=1===(U+V).length;if(e)K();else if(2!==r||n){if(1===r&&n){var i=U?rt[0]:et[0],o="s"===U||"w"===V?0:1,s=i._name+".range["+o+"]",l=a(i,o),u="left",c="middle";if(i.fixedrange)return;U?(c="n"===U?"top":"bottom","right"===i.side&&(u="right")):"e"===V&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(vt).call(k.makeEditable,{gd:t,immediate:!0,background:dt.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=i.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else $()}function Y(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=A.simpleMap(t.range,t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||dt._enablescrollzoom){if(t._transitioningWithDuration)return A.pauseEvent(e);var n=t.querySelector(".plotly");if(H(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Ct);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void A.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=Pt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(V||ct){for(V||(l=.5),a=0;ac[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":401,"fast-isnumeric":87}],453:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var i=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=i[0]+(i[1]-i[0])*r;t.range=t._input.range=[t.l2r(a+(i[0]-a)*e),t.l2r(a+(i[1]-a)*e)]}},{"../../constants/alignment":381}],454:[function(t,e,r){"use strict";function n(t){return t._id}function i(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*w*Math.abs(n-i))}return d}function f(e,r,n){var i=u(e,n||t.calendar);if(i===d){if(!a(e))return d;i=u(new Date(+e))}return i}function v(e,r,n){return l(e,r,n||t.calendar)}function m(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(a(e))return+e}function x(e){return a(e)?i.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:c,t.l2c="log"===t.type?n:c,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=_,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=_,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(e,0,n))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=m,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return m(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,i=o.nestedProperty(t,e).get(),s=(t._id||"x").charAt(0);if(n="date"===t.type?o.dfltRange(t.calendar):"y"===s?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void o.nestedProperty(t,e).set(n);for("date"===t.type&&(i[0]=o.cleanDate(i[0],d,t.calendar),i[1]=o.cleanDate(i[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r],t.calendar)){t[e]=n;break}if(t.r2l(i[0])===t.r2l(i[1])){var l=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(l-1e3),i[1]=t.l2r(l+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]<-h?i[r]=-h:i[r]>h&&(i[r]=h),i[0]===i[1]){var u=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=u,i[1]+=u}}},t.setScale=function(r){var n=e._size,i=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=g.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var s=r&&t._r?"_r":"range",l=t.calendar;t.cleanRange(s);var u=t.r2l(t[s][0],l),c=t.r2l(t[s][1],l);if("y"===i?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,i,a,o="date"===t.type&&e[r+"calendar"];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?i.dateTick0(e.calendar):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":385,"../../lib":401,"fast-isnumeric":87}],459:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r){for(i=0;ir.duration?(d(),A=window.cancelAnimationFrame(g)):A=window.requestAnimationFrame(g)}var v=t._fullLayout,m=[],y=function(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=v[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,m.push(s),o[s]=a}return o}(e),b=Object.keys(y),x=function(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var 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]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(v,b,y);if(!x.length)return!1;var _;u&&(_=u());var w,M,A,k=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(A),A=null,p()}),w=Date.now(),A=window.requestAnimationFrame(g),Promise.resolve()}},{"../../components/drawing":309,"../../plotly":433,"../../registry":486,"./axes":438,d3:79}],460:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var u=i(e,r,n);if(u){if("histogram"===u.type&&n==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=n+"calendar",f=u[c];if(o(u,n)){for(var h,d=a(u),p=[],g=0;g0?".":"")+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))u.rotate(a,0,0,-t*r*Math.PI*p.rotateSpeed/window.innerWidth);else{var o=-p.zoomSpeed*n*e/window.innerHeight*(a-u.lastT())/100;u.pan(a,0,0,f*(Math.exp(o)-1))}}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":9,"mouse-change":186,"mouse-event-offset":187,"mouse-wheel":189,"right-now":223}],465:[function(t,e,r){"use strict";var n=t("./scene"),i=t("../plots"),a=t("../../lib"),o=t("../../constants/xmlns_namespaces");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){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl3d"),s=0;s1;s(t,e,r,{type:"gl3d",attributes:u,handleDefaults:n,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:a,paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":285,"../../../lib":401,"../../../registry":486,"../../subplot_defaults":485,"./axis_defaults":468,"./layout_attributes":471}],471:[function(t,e,r){"use strict";function n(t,e,r){return{x:{valType:"number",dflt:t},y:{valType:"number",dflt:e},z:{valType:"number",dflt:r}}}var i=t("./axis_attributes"),a=t("../../../lib/extend").extendFlat;e.exports={_arrayAttrRegexps:[/^scene([2-9]|[1-9][0-9]+)?\.annotations/],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},camera:{up:a(n(0,0,1),{}),center:a(n(0,0,0),{}),eye:a(n(1.25,1.25,1.25),{})},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]}},aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto"},aspectratio:{x:{valType:"number",min:0},y:{valType:"number",min:0},z:{valType:"number",min:0}},xaxis:i,yaxis:i,zaxis:i,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest"},_deprecated:{cameraposition:{valType:"info_array"}}}},{"../../../lib/extend":395,"./axis_attributes":467}],472:[function(t,e,r){"use strict";function n(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}function i(t){var e=new n;return e.merge(t),e}var a=t("../../../lib/str2rgbarray"),o=["xaxis","yaxis","zaxis"];n.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[o[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=a(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=i},{"../../../lib/str2rgbarray":419}],473:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],i=new Array(n.length),a=0;ah[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,this.convertAnnotations(this),a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var k=g[1][a]-g[0][a];g[0][a]-=k/32,g[1][a]+=k/32}}else{var E=l.range;g[0][a]=l.r2l(E[0]),g[1][a]=l.r2l(E[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 L=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var C=m[u];L[a]=Math.pow(C.acc,1/C.count)/d[a]}var S;if("auto"===c.aspectmode)S=Math.max.apply(null,L)/Math.min.apply(null,L)<=4?L:[1,1,1];else if("cube"===c.aspectmode)S=[1,1,1];else if("data"===c.aspectmode)S=L;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var P=c.aspectratio;S=[P.x,P.y,P.z]}c.aspectratio.x=f.aspectratio.x=S[0],c.aspectratio.y=f.aspectratio.y=S[1],c.aspectratio.z=f.aspectratio.z=S[2],this.glplot.aspect=S;var R=c.domain||null,O=e._size||null;if(R&&O){var N=this.container.style;N.position="absolute",N.left=O.l+R.x[0]*O.w+"px",N.top=O.t+(1-R.y[1])*O.h+"px",N.width=O.w*(R.x[1]-R.x[0])+"px",N.height=O.h*(R.y[1]-R.y[0])+"px"}this.glplot.redraw()}},k.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},k.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){this.glplot.camera.lookAt.apply(this,l(t))},k.saveCamera=function(t){var e=this.getCamera(),r=g.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;if(void 0===n)i=!0;else for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!function(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]]}(e,n,a,o)){i=!0;break}return i&&r.set(e),i},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()?" - ":"")}},v.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=v.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},v.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||v.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,f=r.height;v.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=f)}else{v.supplyLayoutGlobalDefaults(a,n);var h=!a.width||!a.height,d=n.autosize,p=t._context&&t._context.autosizable;h&&(d||p)?v.plotAutoSize(t,a,n):h&&v.sanitizeMargins(t),!d&&h&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,v.supplyDataDefaults(l,s,a,n),n._has=v._hasPlotType.bind(n);var g=n._modules;for(e=0;e0){var c=o(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,p=1-2*s,g=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(g.width-f)),i=Math.round(p*(g.height-h))}else{var m=l?window.getComputedStyle(t):{};n=parseFloat(m.width)||r.width,i=parseFloat(m.height)||r.height}var y=v.layoutAttributes.width.min,b=v.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}),v.sanitizeMargins(r)},v.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];n._replotting||v.doAutoMargin(t)}},v.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(!1!==e.margin.autoexpand){l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(l),h=0;hv){var A=(m*w+(M-e.width)*v)/(w-v),k=(M*(1-v)+(m-e.width)*(1-w))/(w-v);A>=0&&k>=0&&A+k>i+a&&(i=A,a=k)}}if(u(b)&&l[_].t){var T=l[_].t.val,E=l[_].t.size;if(T>y){var L=(b*T+(E-e.height)*y)/(T-y),C=(E*(1-y)+(b-e.height)*(1-T))/(T-y);L>=0&&C>=0&&L+C>s+o&&(s=L,o=C)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},v.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):d.isJSDate(t)?d.ms2DateTimeLocal(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&v.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(u.layout=a(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=a(l)),"object"===n?u:JSON.stringify(u)},v.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(){x=!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,h=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,L=E?f.angularAxis.domain:n.extent(M),C=Math.abs(M[1]-M[0]);k&&!A&&(C=0);var S=L.slice();T&&A&&(S[1]+=C);var P=f.angularAxis.ticksCount||4;P>8&&(P=P/(P/8)+P%8),f.angularAxis.ticksStep&&(P=(S[1]-S[0])/P);var R=f.angularAxis.ticksStep||(S[1]-S[0])/(P*(f.minorTicks+1));w&&(R=Math.max(Math.round(R),1)),S[2]||(S[2]=R);var O=n.range.apply(this,S);if(O=O.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(S.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=T?C:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var N=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),I=this.appendChild(this.ownerDocument.importNode(N.documentElement,!0));e=n.select(I)}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 z,D=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},F={"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){z=e.select(".legend-group").attr({transform:"translate("+[b,f.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:z,elements:B,reverseOrder:f.legend.reverseOrder})})();var U=z.node().getBBox();b=Math.min(f.width-U.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(),z.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else z=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),D.attr("transform","translate("+_+")").style({cursor:"crosshair"});var V=[(f.width-(f.margin.left+f.margin.right+2*b+(U?U.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*b))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),f.title){var H=e.select("g.title-group text").style(F).text(f.title),q=H.node().getBBox();H.attr({x:_[0]-q.width/2,y:_[1]-b-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var X=G.selectAll("circle.grid-circle").data(i.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(j),X.attr("r",i),X.exit().remove()}G.select("circle.outside-circle").attr({r:b}).style(j);var W=e.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Y=n.svg.axis().scale(i).ticks(5).tickSize(5);G.call(Y).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(j),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(F).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,F["font-size"]]+")":"translate("+[0,F["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=e.select(".angular.axis-group").selectAll("g.angular-tick").data(O),Q=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),Z.exit().remove(),Q.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),Q.selectAll(".minor").style({stroke:f.minorTickColor}),Z.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(F);var $=Z.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(F);f.angularAxis.rewriteTicks&&$.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(D.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));z.attr({transform:"translate("+[b+K,f.margin.top]+")"});var J=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||J){var et=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=f.orientation,r.direction=f.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 it,at,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!A){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});D.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(W).angle;ft.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});D.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(W).radius;ht.attr({r:r}).style({opacity:.5}),at=i.invert(o.util.getMousePos(W).radius);var n=o.util.convertToCartesian(r,f.radialAxis.orientation);ut.text(o.util.round(at)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.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])};A&&(u.t=w[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-V[0]-h.left,f.top+f.height/2-V[1]-h.top];ct.config({color:s}).text(c),ct.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var 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 i[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),i={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0, +visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){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||void 0===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":-1!=n.svg.symbolTypes.indexOf(t)?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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=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+10,dy:.3*+i.fontSize}),l};return l.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(c);var f=i.padding,h=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,g=h.height+2*f;return r.attr({d:"M"+[[10,-g/2],[10,-g/4],[i.hasTick?0:10,0],[10,g/4],[10,g/2],[p,g/2],[p,-g/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-g/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return a(i,t),l},l},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var 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);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":401,d3:79}],483:[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":285,"../../lib":401,"./micropolar":482,"./undo_manager":484,d3:79}],484:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n-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)),h=t._context||{};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")?"":e.html(t).text()});return e.remove(),r}function i(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var a=t("d3"),o=t("../components/drawing"),s=t("../components/color"),l=t("../constants/xmlns_namespaces"),u=/"/g,c=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,f=t._fullLayout,h=f._paper,d=f._toppaper;h.insert("rect",":first-child").call(o.setRect,0,0,f.width,f.height).call(s.fill,f.paper_bgcolor);var p=f._basePlotModules||[];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.vertexIntensityBounds=[t.cmin,t.cmax],p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolor[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":419,"alpha-shape":14,"convex-hull":70,"delaunay-triangulate":80,"gl-mesh3d":132,tinycolor2:250}],499:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function u(t){var e=t.map(function(t){var e=l(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var c=u(["x","y","z"]),f=u(["i","j","k"]);if(!c)return void(e.visible=!1);f&&f.forEach(function(t){for(var e=0;eg&&d.splice(g,d.length-g),p.length>g&&p.splice(g,p.length-g);var v={padded:!0},m={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};i.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>g&&u.splice(g,u.length-g)}var b,x=1.6*(e.marker.sizeref||1);b="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},v.ppad=m.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[g-1]&&p[0]===p[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,i.expand(f,d,v),i.expand(h,p,m);var _=new Array(g);for(c=0;c=0;i--){ +var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],506:[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":288,"../../components/colorscale":299,"../../lib":401,"../../plots/plots":478,"fast-isnumeric":87}],507:[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":291,"../../components/colorscale/has_colorscale":298,"./subtypes":523}],508:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],509:[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,p,g),m=vV!=N>=V&&(P=C[E-1][0],R=C[E][0],S=P+(R-P)*(V-O)/(N-O),j=Math.min(j,S),F=Math.max(F,S));j=Math.max(j,0),F=Math.min(F,h._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:l+10,x0:j,x1:F,y0:V,y1:V,color:H}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":285,"../../components/errorbars":315,"../../components/fx":326,"../../lib":401,"./get_trace_color":511}],513:[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":448,"./arrays_to_calcdata":502,"./attributes":503,"./calc":504,"./clean_data":505,"./colorbar":506,"./defaults":509,"./hover":512,"./plot":520,"./select":521,"./style":522,"./subtypes":523}],514:[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,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":294,"../../components/colorscale/has_colorscale":298}],515:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),i=w.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*k}var a,o,s,l,u,c,f,h,d,p,g,v,m,y,b,x,_=e.xaxis,w=e.yaxis,M=e.simplify,A=e.connectGaps,k=e.baseTolerance,T=e.linear,E=[],L=.2,C=new Array(t.length),S=0;for(M||(k=L=-1),a=0;ai(c))break;s=c,m=p[0]*d[0]+p[1]*d[1],m>g?(g=m,l=c,h=!1):m=t.length||!c)break;C[S++]=c,o=c}}else C[S++]=l}E.push(C.slice(0,S))}return E}},{"../../constants/numerical":385}],516:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],517:[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":87}],519:[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,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(r=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?n.background:n.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":285,"../../components/colorscale/defaults":294,"../../components/colorscale/has_colorscale":298,"./subtypes":523}],520:[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,h,p){function g(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function m(t){return t.id}function y(t){if(t.ids)return m}function b(){return!1}function x(e){var r,n,i,a=e[0].trace,u=o.select(this),f=c.hasMarkers(a),h=c.hasText(a),d=y(a),p=b,m=b;f&&(p=a.marker.maxdisplayed||a._needsCull?v:s.identity),h&&(m=a.marker.maxdisplayed||a._needsCull?v:s.identity),n=u.selectAll("path.point"),r=n.data(p,d);var x=r.enter().append("path").classed("point",!0);M&&x.call(l.pointStyle,a,t).call(l.translatePoints,A,k,a).style("opacity",0).transition().style("opacity",1);var _=f&&l.tryColorscale(a.marker,""),w=f&&l.tryColorscale(a.marker,"line");r.order(),r.each(function(e){var r=o.select(this),n=g(r);i=l.translatePoint(e,n,A,k),i?(l.singlePointStyle(e,n,a,_,w,t),a.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):n.remove()}),M?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=u.selectAll("g"),r=n.data(m,d),r.enter().append("g").classed("textpoint",!0).append("text"),r.order(),r.each(function(t){var e=o.select(this),r=g(e.select("text"));(i=l.translatePoint(t,r,A,k))||e.remove()}),r.selectAll("text").call(l.textPointStyle,a,t).each(function(t){var e=t.xp||A.c2p(t.x),r=t.yp||k.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){g(o.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;a(t,e,r,n,i);var M=!!p&&p.duration>0,A=r.xaxis,k=r.yaxis,T=n[0].trace,E=T.line,L=o.select(h);if(L.call(u.plot,r,p),!0===T.visible){g(L).style("opacity",T.opacity);var C,S,P=T.fill.charAt(T.fill.length-1);"x"!==P&&"y"!==P&&(P=""),n[0].node3=L;var R="",O=[],N=T._prevtrace;N&&(R=N._prevRevpath||"",S=N._nextFill,O=N._polygons);var I,z,D,j,F,B,U,V,H,q="",G="",X=[],W=[],Y=s.noop;if(C=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(S&&S.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(E.shape)?(D=l.steps(E.shape),j=l.steps(E.shape.split("").reverse().join(""))):D=j="spline"===E.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),E.smoothing):l.smoothopen(t,E.smoothing)}:function(t){return"M"+t.join("L")},F=function(t){return j(t.reverse())},X=f(n,{xaxis:A,yaxis:k,connectGaps:T.connectgaps,baseTolerance:Math.max(E.width||1,3)/4,linear:"linear"===E.shape,simplify:E.simplify}),H=T._polygons=new Array(X.length),w=0;w1}),Y=function(t){return function(e){if(I=D(e),z=F(e),q?P?(q+="L"+I.substr(1),G=z+"L"+G.substr(1)):(q+="Z"+I,G=z+"Z"+G):(q=I,G=z),c.hasLines(T)&&e.length>1){var r=o.select(this);if(r.datum(n),t)g(r.style("opacity",0).attr("d",I).call(l.lineGroupStyle)).style("opacity",1);else{var i=g(r);i.attr("d",I),l.singleLineStyle(n,i)}}}}}var Z=L.selectAll(".js-line").data(W);g(Z.exit()).style("opacity",0).remove(),Z.each(Y(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Y(!0)),X.length&&(C?B&&V&&(P?("y"===P?B[1]=V[1]=k.c2p(0,!0):"x"===P&&(B[0]=V[0]=A.c2p(0,!0)),g(C).attr("d","M"+V+"L"+B+"L"+q.substr(1)).call(l.singleFillStyle)):g(C).attr("d",q+"Z").call(l.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&q&&R&&("tonext"===T.fill?g(S).attr("d",q+"Z"+R+"Z").call(l.singleFillStyle):g(S).attr("d",q+"L"+R.substr(1)+"Z").call(l.singleFillStyle),T._polygons=T._polygons.concat(O)),T._prevRevpath=G,T._prevPolygons=H);var Q=L.selectAll(".points");_=Q.data([n]),Q.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(a.range,a.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=n[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(p.length/d),v=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),h(t,e,r),n(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),v){s&&(d=s());o.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).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":309,"../../components/errorbars":315,"../../lib":401,"../../lib/polygon":411,"./line_points":515,"./link_traces":517,"./subtypes":523,d3:79}],521:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace,h=f.marker,d=!n.hasMarkers(f)&&!n.hasText(f);if(!0===f.visible&&!d){var p=Array.isArray(h.opacity)?1:h.opacity;if(!1===e)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 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.delaunayMesh._trace=this,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":382,"../../constants/gl3d_markers":383,"../../lib":401,"../../lib/gl_format_color":398,"../../lib/str2rgbarray":419,"../scatter/make_bubble_size_func":518,"./calc_errors":528,"delaunay-triangulate":80,"gl-error3d":103,"gl-line3d":109,"gl-mesh3d":132,"gl-scatter3d":138}],530:[function(t,e,r){"use strict";function n(t,e,r,n){var a=0,o=r("x"),s=r("y"),l=r("z");return i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),o&&s&&l&&(a=Math.min(o.length,s.length,l.length),a=0&&h("surfacecolor",d||p);for(var g=["x","y","z"],v=0;v<3;++v){var m="projection."+g[v];h(m+".show")&&(h(m+".opacity"),h(m+".scale"))}c(t,e,r,{axis:"z"}),c(t,e,r,{axis:"y",inherit:"z"}),c(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":314,"../../lib":401,"../../registry":486,"../scatter/line_defaults":514,"../scatter/marker_defaults":519,"../scatter/subtypes":523,"../scatter/text_defaults":524,"./attributes":526}],531:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl3d_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl3d_markers":383,"../../plots/gl3d":465,"../scatter/colorbar":506,"./attributes":526,"./calc":527,"./convert":529,"./defaults":530}],532:[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":285,"../../components/colorbar/attributes":286,"../../components/colorscale/attributes":290,"../../lib/extend":395}],533:[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":291}],534:[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":288,"../../components/colorscale":299,"../../lib":401,"../../plots/plots":478,"fast-isnumeric":87}],535:[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 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -48380,7 +48447,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":225,"../drawing":249,"./arrow_paths":215,"d3":8,"fast-isnumeric":12}],223:[function(require,module,exports){ +},{"../color":231,"../drawing":255,"./arrow_paths":215,"d3":8,"fast-isnumeric":12}],224:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48405,6 +48472,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -48412,7 +48480,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":216,"./calc_autorange":217,"./click":218,"./convert_coords":219,"./defaults":220,"./draw":221}],224:[function(require,module,exports){ +},{"./attributes":216,"./calc_autorange":217,"./click":218,"./convert_coords":220,"./defaults":221,"./draw":222}],225:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":216}],226:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":344,"../../plots/cartesian/axes":379}],227:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":344,"../../plots/array_container_defaults":376,"../../plots/cartesian/axes":379,"../annotations/common_defaults":219,"./attributes":225}],228:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":405,"../annotations/draw":222}],229:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":225,"./convert":226,"./defaults":227,"./draw":228}],230:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48452,7 +48827,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],225:[function(require,module,exports){ +},{}],231:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48623,7 +48998,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":224,"fast-isnumeric":12,"tinycolor2":197}],226:[function(require,module,exports){ +},{"./attributes":230,"fast-isnumeric":12,"tinycolor2":197}],232:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48779,7 +49154,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../plots/cartesian/layout_attributes":383,"../../plots/font_attributes":396}],227:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/cartesian/layout_attributes":390,"../../plots/font_attributes":403}],233:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48846,7 +49221,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":337,"../../plots/cartesian/tick_label_defaults":390,"../../plots/cartesian/tick_mark_defaults":391,"../../plots/cartesian/tick_value_defaults":392,"./attributes":226}],228:[function(require,module,exports){ +},{"../../lib":344,"../../plots/cartesian/tick_label_defaults":397,"../../plots/cartesian/tick_mark_defaults":398,"../../plots/cartesian/tick_value_defaults":399,"./attributes":232}],234:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -48872,6 +49247,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -49145,7 +49522,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -49157,8 +49534,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -49171,8 +49547,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -49405,6 +49780,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -49479,7 +49855,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":337,"../../lib/extend":332,"../../lib/setcursor":352,"../../plotly":367,"../../plots/cartesian/axes":372,"../../plots/cartesian/axis_defaults":374,"../../plots/cartesian/layout_attributes":383,"../../plots/cartesian/position_defaults":386,"../../plots/plots":407,"../../registry":415,"../color":225,"../dragelement":246,"../drawing":249,"../titles":314,"./attributes":226,"d3":8,"tinycolor2":197}],229:[function(require,module,exports){ +},{"../../constants/alignment":327,"../../lib":344,"../../lib/extend":339,"../../lib/setcursor":359,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/cartesian/axes":379,"../../plots/cartesian/axis_defaults":381,"../../plots/cartesian/layout_attributes":390,"../../plots/cartesian/position_defaults":393,"../../plots/plots":415,"../../registry":423,"../color":231,"../dragelement":252,"../drawing":255,"../titles":320,"./attributes":232,"d3":8,"tinycolor2":197}],235:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49498,7 +49874,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":337}],230:[function(require,module,exports){ +},{"../../lib":344}],236:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49553,7 +49929,7 @@ module.exports = { } }; -},{}],231:[function(require,module,exports){ +},{}],237:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49632,7 +50008,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":337,"./flip_scale":236,"./scales":243}],232:[function(require,module,exports){ +},{"../../lib":344,"./flip_scale":242,"./scales":249}],238:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49676,7 +50052,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":332,"./attributes":230,"./scales.js":243}],233:[function(require,module,exports){ +},{"../../lib/extend":339,"./attributes":236,"./scales.js":249}],239:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49692,7 +50068,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":243}],234:[function(require,module,exports){ +},{"./scales":249}],240:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49756,7 +50132,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":337,"../colorbar/defaults":227,"../colorbar/has_colorbar":229,"./flip_scale":236,"./is_valid_scale":240,"fast-isnumeric":12}],235:[function(require,module,exports){ +},{"../../lib":344,"../colorbar/defaults":233,"../colorbar/has_colorbar":235,"./flip_scale":242,"./is_valid_scale":246,"fast-isnumeric":12}],241:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49793,7 +50169,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],236:[function(require,module,exports){ +},{}],242:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49818,7 +50194,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],237:[function(require,module,exports){ +},{}],243:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49858,7 +50234,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":233,"./is_valid_scale_array":241,"./scales":243}],238:[function(require,module,exports){ +},{"./default_scale":239,"./is_valid_scale_array":247,"./scales":249}],244:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49904,7 +50280,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":337,"./is_valid_scale":240,"fast-isnumeric":12}],239:[function(require,module,exports){ +},{"../../lib":344,"./is_valid_scale":246,"fast-isnumeric":12}],245:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49938,7 +50314,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":230,"./calc":231,"./default_scale":233,"./defaults":234,"./extract_scale":235,"./flip_scale":236,"./get_scale":237,"./has_colorscale":238,"./is_valid_scale":240,"./make_color_scale_func":242,"./scales":243}],240:[function(require,module,exports){ +},{"./attributes":236,"./calc":237,"./default_scale":239,"./defaults":240,"./extract_scale":241,"./flip_scale":242,"./get_scale":243,"./has_colorscale":244,"./is_valid_scale":246,"./make_color_scale_func":248,"./scales":249}],246:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49959,7 +50335,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":241,"./scales":243}],241:[function(require,module,exports){ +},{"./is_valid_scale_array":247,"./scales":249}],247:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -49996,7 +50372,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":197}],242:[function(require,module,exports){ +},{"tinycolor2":197}],248:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50092,7 +50468,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":225,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],243:[function(require,module,exports){ +},{"../color":231,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],249:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50223,7 +50599,7 @@ module.exports = { ] }; -},{}],244:[function(require,module,exports){ +},{}],250:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50256,7 +50632,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],245:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50294,7 +50670,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":337}],246:[function(require,module,exports){ +},{"../../lib":344}],252:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50323,6 +50699,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -50341,28 +50726,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -50413,10 +50790,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -50463,10 +50836,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -50496,7 +50865,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":321,"../../lib":337,"../../plotly":367,"../../plots/cartesian/constants":377,"./align":244,"./cursor":245,"./unhover":247}],247:[function(require,module,exports){ +},{"../../constants/interactions":328,"../../lib":344,"../../plotly":374,"../../plots/cartesian/constants":384,"./align":250,"./cursor":251,"./unhover":253}],253:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50552,7 +50921,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":331}],248:[function(require,module,exports){ +},{"../../lib/events":338}],254:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50576,7 +50945,7 @@ exports.dash = { }; -},{}],249:[function(require,module,exports){ +},{}],255:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -50599,6 +50968,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -50620,13 +50992,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -50635,7 +51013,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -50650,7 +51028,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -50736,6 +51113,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -50962,7 +51349,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -50970,7 +51357,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -50991,9 +51377,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -51024,21 +51409,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -51177,34 +51557,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; - var tester3 = drawing.tester; - var tester = tester3.node(); + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + } + + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -51225,18 +51658,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -51391,17 +51835,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":324,"../../lib":337,"../../lib/svg_text_utils":354,"../../registry":415,"../../traces/scatter/make_bubble_size_func":441,"../../traces/scatter/subtypes":446,"../color":225,"../colorscale":239,"./symbol_defs":250,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],250:[function(require,module,exports){ +},{"../../constants/alignment":327,"../../constants/xmlns_namespaces":331,"../../lib":344,"../../lib/svg_text_utils":361,"../../registry":423,"../../traces/scatter/make_bubble_size_func":449,"../../traces/scatter/subtypes":454,"../color":231,"../colorscale":245,"./symbol_defs":256,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],256:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51877,7 +52311,7 @@ module.exports = { } }; -},{"d3":8}],251:[function(require,module,exports){ +},{"d3":8}],257:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -51976,7 +52410,7 @@ module.exports = { } }; -},{}],252:[function(require,module,exports){ +},{}],258:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52039,7 +52473,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":372,"../../registry":415,"./compute_error":253,"fast-isnumeric":12}],253:[function(require,module,exports){ +},{"../../plots/cartesian/axes":379,"../../registry":423,"./compute_error":259,"fast-isnumeric":12}],259:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52135,7 +52569,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],254:[function(require,module,exports){ +},{}],260:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52212,7 +52646,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":337,"../../registry":415,"./attributes":251,"fast-isnumeric":12}],255:[function(require,module,exports){ +},{"../../lib":344,"../../registry":423,"./attributes":257,"fast-isnumeric":12}],261:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52271,7 +52705,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":251,"./calc":252,"./defaults":254,"./plot":256,"./style":257}],256:[function(require,module,exports){ +},{"./attributes":257,"./calc":258,"./defaults":260,"./plot":262,"./style":263}],262:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52435,7 +52869,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":446,"d3":8,"fast-isnumeric":12}],257:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":454,"d3":8,"fast-isnumeric":12}],263:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52472,7 +52906,7 @@ module.exports = function style(traces) { }); }; -},{"../color":225,"d3":8}],258:[function(require,module,exports){ +},{"../color":231,"d3":8}],264:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52508,7 +52942,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../plots/font_attributes":396}],259:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/font_attributes":403}],265:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52524,30 +52958,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; + + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; + + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + if(!trace.hoverlabel) continue; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":337,"../../registry":415}],260:[function(require,module,exports){ +},{"../../lib":344,"../../registry":423}],266:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52559,10 +53009,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -52576,7 +53035,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":415}],261:[function(require,module,exports){ +},{"../../registry":423,"./hover":270}],267:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52608,7 +53067,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],262:[function(require,module,exports){ +},{}],268:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52631,7 +53090,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":337,"./attributes":258,"./hoverlabel_defaults":265}],263:[function(require,module,exports){ +},{"../../lib":344,"./attributes":264,"./hoverlabel_defaults":271}],269:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52642,6 +53101,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -52718,7 +53178,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":261}],264:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":344,"./constants":267}],270:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -52787,7 +53273,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -52799,13 +53285,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -52882,15 +53368,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -53075,11 +53561,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -53178,6 +53664,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -53211,7 +53698,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -53225,7 +53712,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -53244,7 +53731,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -53279,7 +53766,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -53316,23 +53803,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -53348,14 +53828,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -53445,7 +53920,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -53461,12 +53938,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -53478,11 +53953,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -53750,17 +54223,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -53777,6 +54245,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -53844,7 +54336,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -53854,29 +54346,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -54028,7 +54497,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":337,"../../lib/events":331,"../../lib/override_cursor":346,"../../lib/svg_text_utils":354,"../../plots/cartesian/axes":372,"../../registry":415,"../color":225,"../dragelement":246,"../drawing":249,"./constants":261,"./helpers":263,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],265:[function(require,module,exports){ +},{"../../lib":344,"../../lib/events":338,"../../lib/override_cursor":353,"../../lib/svg_text_utils":361,"../../plots/cartesian/axes":379,"../../registry":423,"../color":231,"../dragelement":252,"../drawing":255,"./constants":267,"./helpers":269,"d3":8,"fast-isnumeric":12,"tinycolor2":197}],271:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54049,7 +54518,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":337}],266:[function(require,module,exports){ +},{"../../lib":344}],272:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54087,7 +54556,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -54109,23 +54581,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":337,"../dragelement":246,"./attributes":258,"./calc":259,"./click":260,"./constants":261,"./defaults":262,"./helpers":263,"./hover":264,"./layout_attributes":267,"./layout_defaults":268,"./layout_global_defaults":269,"d3":8}],267:[function(require,module,exports){ +},{"../../lib":344,"../dragelement":252,"./attributes":264,"./calc":265,"./click":266,"./constants":267,"./defaults":268,"./helpers":269,"./hover":270,"./layout_attributes":273,"./layout_defaults":274,"./layout_global_defaults":275,"d3":8}],273:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54178,7 +54648,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../plots/font_attributes":396,"./constants":261}],268:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/font_attributes":403,"./constants":267}],274:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54226,7 +54696,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":337,"./layout_attributes":267}],269:[function(require,module,exports){ +},{"../../lib":344,"./layout_attributes":273}],275:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54249,7 +54719,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":337,"./hoverlabel_defaults":265,"./layout_attributes":267}],270:[function(require,module,exports){ +},{"../../lib":344,"./hoverlabel_defaults":271,"./layout_attributes":273}],276:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54371,7 +54841,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":377}],271:[function(require,module,exports){ +},{"../../plots/cartesian/constants":384}],277:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54454,7 +54924,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":355,"fast-isnumeric":12}],272:[function(require,module,exports){ +},{"../../lib/to_log_range":362,"fast-isnumeric":12}],278:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54515,7 +54985,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":337,"../../plots/array_container_defaults":369,"../../plots/cartesian/axes":372,"./attributes":270}],273:[function(require,module,exports){ +},{"../../lib":344,"../../plots/array_container_defaults":376,"../../plots/cartesian/axes":379,"./attributes":276}],279:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54736,7 +55206,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":324,"../../plots/cartesian/axes":372,"../drawing":249,"d3":8}],274:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":331,"../../plots/cartesian/axes":379,"../drawing":255,"d3":8}],280:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54759,7 +55229,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":270,"./convert_coords":271,"./defaults":272,"./draw":273}],275:[function(require,module,exports){ +},{"./attributes":276,"./convert_coords":277,"./defaults":278,"./draw":279}],281:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54808,7 +55278,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],276:[function(require,module,exports){ +},{}],282:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54899,7 +55369,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../plots/font_attributes":396,"../color/attributes":224}],277:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/font_attributes":403,"../color/attributes":230}],283:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -54917,7 +55387,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],278:[function(require,module,exports){ +},{}],284:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55010,7 +55480,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":337,"../../plots/layout_attributes":398,"../../registry":415,"./attributes":276,"./helpers":281}],279:[function(require,module,exports){ +},{"../../lib":344,"../../plots/layout_attributes":406,"../../registry":423,"./attributes":282,"./helpers":287}],285:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55035,6 +55505,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -55124,7 +55596,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -55330,6 +55802,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -55381,30 +55854,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -55569,20 +56036,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -55590,18 +56058,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -55836,7 +56305,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":321,"../../lib":337,"../../lib/svg_text_utils":354,"../../plotly":367,"../../plots/plots":407,"../../registry":415,"../color":225,"../dragelement":246,"../drawing":249,"./anchor_utils":275,"./constants":277,"./get_legend_data":280,"./helpers":281,"./style":283,"d3":8}],280:[function(require,module,exports){ +},{"../../constants/alignment":327,"../../constants/interactions":328,"../../lib":344,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/plots":415,"../../registry":423,"../color":231,"../dragelement":252,"../drawing":255,"./anchor_utils":281,"./constants":283,"./get_legend_data":286,"./helpers":287,"./style":289,"d3":8}],286:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55941,7 +56410,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":415,"./helpers":281}],281:[function(require,module,exports){ +},{"../../registry":423,"./helpers":287}],287:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55972,7 +56441,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":415}],282:[function(require,module,exports){ +},{"../../registry":423}],288:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -55996,7 +56465,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":276,"./defaults":278,"./draw":279,"./style":283}],283:[function(require,module,exports){ +},{"./attributes":282,"./defaults":284,"./draw":285,"./style":289}],289:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56019,7 +56488,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -56057,179 +56526,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); + + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); + + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; -},{"../../lib":337,"../../registry":415,"../../traces/pie/style_one":424,"../../traces/scatter/subtypes":446,"../color":225,"../drawing":249,"d3":8}],284:[function(require,module,exports){ +},{"../../lib":344,"../../registry":423,"../../traces/pie/style_one":432,"../../traces/scatter/subtypes":454,"../color":231,"../drawing":255,"d3":8}],290:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56807,7 +57276,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":337,"../../plotly":367,"../../plots/cartesian/axes":372,"../../plots/plots":407,"../../snapshot/download":417}],285:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":344,"../../plotly":374,"../../plots/cartesian/axes":379,"../../plots/plots":415,"../../snapshot/download":425}],291:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56821,7 +57290,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":286}],286:[function(require,module,exports){ +},{"./manage":292}],292:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -56945,7 +57414,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -56997,7 +57466,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -57049,7 +57518,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":372,"../../traces/scatter/subtypes":446,"./buttons":284,"./modebar":287}],287:[function(require,module,exports){ +},{"../../plots/cartesian/axes":379,"../../traces/scatter/subtypes":454,"./buttons":290,"./modebar":293}],293:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57343,7 +57812,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":337,"d3":8}],288:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":344,"d3":8}],294:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57433,7 +57902,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../plots/font_attributes":396,"../color/attributes":224,"./button_attributes":289}],289:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/font_attributes":403,"../color/attributes":230,"./button_attributes":295}],295:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57474,7 +57943,7 @@ module.exports = { } }; -},{}],290:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57503,7 +57972,7 @@ module.exports = { darkAmount: 10 }; -},{}],291:[function(require,module,exports){ +},{}],297:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57602,7 +58071,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":337,"../color":225,"./attributes":288,"./button_attributes":289,"./constants":290}],292:[function(require,module,exports){ +},{"../../lib":344,"../color":231,"./attributes":294,"./button_attributes":295,"./constants":296}],298:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57624,6 +58093,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -57664,7 +58135,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -57751,11 +58222,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -57787,26 +58256,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -57825,13 +58291,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -57877,7 +58338,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":354,"../../plotly":367,"../../plots/cartesian/axis_ids":375,"../../plots/plots":407,"../color":225,"../drawing":249,"../legend/anchor_utils":275,"./constants":290,"./get_update_object":293,"d3":8}],293:[function(require,module,exports){ +},{"../../constants/alignment":327,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/cartesian/axis_ids":382,"../../plots/plots":415,"../color":231,"../drawing":255,"../legend/anchor_utils":281,"./constants":296,"./get_update_object":299,"d3":8}],299:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57934,7 +58395,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":8}],294:[function(require,module,exports){ +},{"d3":8}],300:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -57961,7 +58422,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":288,"./defaults":291,"./draw":292}],295:[function(require,module,exports){ +},{"./attributes":294,"./defaults":297,"./draw":298}],301:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58025,7 +58486,7 @@ module.exports = { } }; -},{"../color/attributes":224}],296:[function(require,module,exports){ +},{"../color/attributes":230}],302:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58061,7 +58522,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":372,"./constants":297}],297:[function(require,module,exports){ +},{"../../plots/cartesian/axes":379,"./constants":303}],303:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58113,7 +58574,7 @@ module.exports = { extraPad: 15 }; -},{}],298:[function(require,module,exports){ +},{}],304:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58170,7 +58631,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":337,"./attributes":295}],299:[function(require,module,exports){ +},{"../../lib":344,"./attributes":301}],305:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58721,7 +59182,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":337,"../../lib/setcursor":352,"../../plotly":367,"../../plots/cartesian":382,"../../plots/cartesian/axes":372,"../../plots/plots":407,"../color":225,"../dragelement":246,"../drawing":249,"./constants":297,"d3":8}],300:[function(require,module,exports){ +},{"../../lib":344,"../../lib/setcursor":359,"../../plotly":374,"../../plots/cartesian":389,"../../plots/cartesian/axes":379,"../../plots/plots":415,"../color":231,"../dragelement":252,"../drawing":255,"./constants":303,"d3":8}],306:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58748,7 +59209,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":295,"./calc_autorange":296,"./defaults":298,"./draw":299}],301:[function(require,module,exports){ +},{"./attributes":301,"./calc_autorange":302,"./defaults":304,"./draw":305}],307:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58845,7 +59306,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../traces/scatter/attributes":426,"../annotations/attributes":216,"../drawing/attributes":248}],302:[function(require,module,exports){ +},{"../../lib/extend":339,"../../traces/scatter/attributes":434,"../annotations/attributes":216,"../drawing/attributes":254}],308:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58891,7 +59352,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -58922,7 +59383,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":337,"../../plots/cartesian/axes":372,"./constants":303,"./helpers":306}],303:[function(require,module,exports){ +},{"../../lib":344,"../../plots/cartesian/axes":379,"./constants":309,"./helpers":312}],309:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -58986,7 +59447,7 @@ module.exports = { } }; -},{}],304:[function(require,module,exports){ +},{}],310:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59011,7 +59472,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":369,"./shape_defaults":308}],305:[function(require,module,exports){ +},{"../../plots/array_container_defaults":376,"./shape_defaults":314}],311:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59144,8 +59605,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -59154,6 +59615,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -59386,7 +59849,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":337,"../../lib/setcursor":352,"../../plotly":367,"../../plots/cartesian/axes":372,"../color":225,"../dragelement":246,"../drawing":249,"./constants":303,"./helpers":306}],306:[function(require,module,exports){ +},{"../../lib":344,"../../lib/setcursor":359,"../../plotly":374,"../../plots/cartesian/axes":379,"../color":231,"../dragelement":252,"../drawing":255,"./constants":309,"./helpers":312}],312:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59467,7 +59930,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],307:[function(require,module,exports){ +},{}],313:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59493,7 +59956,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":301,"./calc_autorange":302,"./defaults":304,"./draw":305}],308:[function(require,module,exports){ +},{"./attributes":307,"./calc_autorange":308,"./defaults":310,"./draw":311}],314:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59592,7 +60055,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":337,"../../plots/cartesian/axes":372,"./attributes":301,"./helpers":306}],309:[function(require,module,exports){ +},{"../../lib":344,"../../plots/cartesian/axes":379,"./attributes":307,"./helpers":312}],315:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59615,7 +60078,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -59640,6 +60103,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -59826,7 +60295,7 @@ module.exports = { }, }; -},{"../../lib/extend":332,"../../plots/animation_attributes":368,"../../plots/font_attributes":396,"../../plots/pad_attributes":406,"./constants":310}],310:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/animation_attributes":375,"../../plots/font_attributes":403,"../../plots/pad_attributes":414,"./constants":316}],316:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -59874,9 +60343,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -59923,7 +60389,7 @@ module.exports = { currentValueInset: 0, }; -},{}],311:[function(require,module,exports){ +},{}],317:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60021,14 +60487,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -60036,7 +60504,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":337,"../../plots/array_container_defaults":369,"./attributes":309,"./constants":310}],312:[function(require,module,exports){ +},{"../../lib":344,"../../plots/array_container_defaults":376,"./attributes":315,"./constants":316}],318:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60057,11 +60525,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -60125,24 +60594,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -60170,14 +60633,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -60187,26 +60648,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -60233,6 +60676,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -60324,7 +60792,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -60341,9 +60812,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + var lines = svgTextUtils.lineCount(text); + + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; + + svgTextUtils.positionText(text, x0, y0); return text; } @@ -60375,11 +60851,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -60406,7 +60885,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -60448,7 +60933,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -60638,7 +61125,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":354,"../../plots/plots":407,"../color":225,"../drawing":249,"../legend/anchor_utils":275,"./constants":310,"d3":8}],313:[function(require,module,exports){ +},{"../../constants/alignment":327,"../../lib/svg_text_utils":361,"../../plots/plots":415,"../color":231,"../drawing":255,"../legend/anchor_utils":281,"./constants":316,"d3":8}],319:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60661,7 +61148,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":309,"./constants":310,"./defaults":311,"./draw":312}],314:[function(require,module,exports){ +},{"./attributes":315,"./constants":316,"./defaults":317,"./draw":318}],320:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60684,6 +61171,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -60716,29 +61204,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -60747,7 +61240,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -60756,6 +61249,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -60775,11 +61271,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -60791,33 +61284,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -60848,8 +61341,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -60857,8 +61349,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -60869,11 +61360,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -60883,18 +61374,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":321,"../../lib":337,"../../lib/svg_text_utils":354,"../../plotly":367,"../../plots/plots":407,"../color":225,"../drawing":249,"d3":8,"fast-isnumeric":12}],315:[function(require,module,exports){ +},{"../../constants/interactions":328,"../../lib":344,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/plots":415,"../color":231,"../drawing":255,"d3":8,"fast-isnumeric":12}],321:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -60915,7 +61402,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -60936,6 +61423,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -61041,7 +61534,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../../plots/font_attributes":396,"../../plots/pad_attributes":406,"../color/attributes":224}],316:[function(require,module,exports){ +},{"../../lib/extend":339,"../../plots/font_attributes":403,"../../plots/pad_attributes":414,"../color/attributes":230}],322:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61088,9 +61581,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -61114,10 +61604,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],317:[function(require,module,exports){ +},{}],323:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61196,13 +61694,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -61211,7 +61711,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":337,"../../plots/array_container_defaults":369,"./attributes":315,"./constants":316}],318:[function(require,module,exports){ +},{"../../lib":344,"../../plots/array_container_defaults":376,"./attributes":321,"./constants":322}],324:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -61231,6 +61731,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -61416,7 +61918,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -61428,7 +61930,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -61536,7 +62038,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -61545,7 +62047,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -61646,9 +62150,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -61668,18 +62172,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -61730,19 +62237,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -61836,34 +62342,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); - - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -61879,8 +62380,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -61891,9 +62392,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":354,"../../plots/plots":407,"../color":225,"../drawing":249,"../legend/anchor_utils":275,"./constants":316,"./scrollbox":320,"d3":8}],319:[function(require,module,exports){ -arguments[4][313][0].apply(exports,arguments) -},{"./attributes":315,"./constants":316,"./defaults":317,"./draw":318,"dup":313}],320:[function(require,module,exports){ +},{"../../constants/alignment":327,"../../lib/svg_text_utils":361,"../../plots/plots":415,"../color":231,"../drawing":255,"../legend/anchor_utils":281,"./constants":322,"./scrollbox":326,"d3":8}],325:[function(require,module,exports){ +arguments[4][319][0].apply(exports,arguments) +},{"./attributes":321,"./constants":322,"./defaults":323,"./draw":324,"dup":319}],326:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62364,7 +62865,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":337,"../color":225,"../drawing":249,"d3":8}],321:[function(require,module,exports){ +},{"../../lib":344,"../color":231,"../drawing":255,"d3":8}],327:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],328:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62388,7 +62925,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],322:[function(require,module,exports){ +},{}],329:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62441,7 +62978,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],323:[function(require,module,exports){ +},{}],330:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62479,7 +63016,7 @@ module.exports = { }; -},{}],324:[function(require,module,exports){ +},{}],331:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62503,7 +63040,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],325:[function(require,module,exports){ +},{}],332:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62521,7 +63058,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -62562,6 +63099,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -62583,7 +63121,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":223,"./components/fx":266,"./components/images":274,"./components/legend":282,"./components/rangeselector":294,"./components/rangeslider":300,"./components/shapes":307,"./components/sliders":313,"./components/updatemenus":319,"./fonts/mathjax_config":326,"./lib/queue":349,"./plot_api/plot_schema":361,"./plot_api/register":362,"./plot_api/set_plot_config":363,"./plot_api/to_image":365,"./plot_api/validate":366,"./plotly":367,"./snapshot":420,"./snapshot/download":417,"./traces/scatter":436,"d3":8,"es6-promise":10}],326:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":224,"./components/annotations3d":229,"./components/fx":272,"./components/images":280,"./components/legend":288,"./components/rangeselector":300,"./components/rangeslider":306,"./components/shapes":313,"./components/sliders":319,"./components/updatemenus":325,"./fonts/mathjax_config":333,"./lib/queue":356,"./plot_api/plot_schema":368,"./plot_api/register":369,"./plot_api/set_plot_config":370,"./plot_api/to_image":372,"./plot_api/validate":373,"./plotly":374,"./snapshot":428,"./snapshot/download":425,"./traces/scatter":444,"d3":8,"es6-promise":10}],333:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62616,7 +63154,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],327:[function(require,module,exports){ +},{}],334:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62649,7 +63187,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":322,"fast-isnumeric":12}],328:[function(require,module,exports){ +},{"../constants/numerical":329,"fast-isnumeric":12}],335:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -62664,6 +63202,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -62689,6 +63228,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -62941,6 +63494,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -62960,7 +63542,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":237,"../components/colorscale/scales":243,"./nested_property":343,"fast-isnumeric":12,"tinycolor2":197}],329:[function(require,module,exports){ +},{"../components/colorscale/get_scale":243,"../components/colorscale/scales":249,"../plots/attributes":377,"./nested_property":350,"fast-isnumeric":12,"tinycolor2":197}],336:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63588,7 +64170,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":322,"../registry":415,"./loggers":340,"./mod":342,"d3":8,"fast-isnumeric":12}],330:[function(require,module,exports){ +},{"../constants/numerical":329,"../registry":423,"./loggers":347,"./mod":349,"d3":8,"fast-isnumeric":12}],337:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63617,7 +64199,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],331:[function(require,module,exports){ +},{}],338:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63783,7 +64365,7 @@ var Events = { module.exports = Events; -},{"events":11}],332:[function(require,module,exports){ +},{"events":11}],339:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63897,7 +64479,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":339}],333:[function(require,module,exports){ +},{"./is_plain_object.js":346}],340:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63948,7 +64530,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],334:[function(require,module,exports){ +},{}],341:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -63979,7 +64561,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],335:[function(require,module,exports){ +},{}],342:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64116,7 +64698,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":322}],336:[function(require,module,exports){ +},{"../constants/numerical":329}],343:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64132,7 +64714,7 @@ exports.makeBlank = function() { module.exports = function identity(d) { return d; }; -},{}],337:[function(require,module,exports){ +},{}],344:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64145,6 +64727,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -64161,6 +64748,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -64222,6 +64810,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -64472,6 +65067,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -64479,6 +65083,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -64519,7 +65168,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -64549,13 +65198,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -64796,7 +65438,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":327,"./coerce":328,"./dates":329,"./ensure_array":330,"./extend":332,"./filter_unique":333,"./filter_visible":334,"./identity":336,"./is_array":338,"./is_plain_object":339,"./loggers":340,"./matrix":341,"./mod":342,"./nested_property":343,"./noop":344,"./notifier":345,"./push_unique":348,"./relink_private":350,"./search":351,"./stats":353,"./to_log_range":355,"d3":8}],338:[function(require,module,exports){ +},{"../constants/numerical":329,"./clean_number":334,"./coerce":335,"./dates":336,"./ensure_array":337,"./extend":339,"./filter_unique":340,"./filter_visible":341,"./identity":343,"./is_array":345,"./is_plain_object":346,"./loggers":347,"./matrix":348,"./mod":349,"./nested_property":350,"./noop":351,"./notifier":352,"./push_unique":355,"./relink_private":357,"./search":358,"./stats":360,"./to_log_range":362,"d3":8,"fast-isnumeric":12}],345:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64820,7 +65462,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],339:[function(require,module,exports){ +},{}],346:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64849,7 +65491,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],340:[function(require,module,exports){ +},{}],347:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -64923,7 +65565,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":360}],341:[function(require,module,exports){ +},{"../plot_api/plot_config":367}],348:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65033,7 +65675,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],342:[function(require,module,exports){ +},{}],349:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65053,7 +65695,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],343:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65357,7 +65999,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":356,"./is_array":338,"./is_plain_object":339,"fast-isnumeric":12}],344:[function(require,module,exports){ +},{"../plot_api/container_array_match":363,"./is_array":345,"./is_plain_object":346,"fast-isnumeric":12}],351:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65373,7 +66015,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],345:[function(require,module,exports){ +},{}],352:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65455,7 +66097,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":8,"fast-isnumeric":12}],346:[function(require,module,exports){ +},{"d3":8,"fast-isnumeric":12}],353:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65504,7 +66146,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":352}],347:[function(require,module,exports){ +},{"./setcursor":359}],354:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65745,7 +66387,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":322,"./matrix":341}],348:[function(require,module,exports){ +},{"../constants/numerical":329,"./matrix":348}],355:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65783,7 +66425,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],349:[function(require,module,exports){ +},{}],356:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -65994,7 +66636,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":337,"../plot_api/plot_config":360}],350:[function(require,module,exports){ +},{"../lib":344,"../plot_api/plot_config":367}],357:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66051,7 +66693,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":338,"./is_plain_object":339}],351:[function(require,module,exports){ +},{"./is_array":345,"./is_plain_object":346}],358:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66162,7 +66804,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":340,"fast-isnumeric":12}],352:[function(require,module,exports){ +},{"./loggers":347,"fast-isnumeric":12}],359:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66185,7 +66827,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],353:[function(require,module,exports){ +},{}],360:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66281,7 +66923,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":12}],354:[function(require,module,exports){ +},{"fast-isnumeric":12}],361:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66300,62 +66942,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -66363,42 +66950,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); - - result = _context.appendSVG(converted); + .style('white-space', 'pre'); - if(!result) _context.text(str); + var hasLink = buildSVGText(_context.node(), str); - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -66406,14 +66995,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -66428,7 +67018,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -66445,36 +67039,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -66487,9 +67081,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -66520,23 +67117,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -66547,24 +67156,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -66575,26 +67203,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -66604,122 +67238,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -66756,28 +67465,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title - -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ + +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; + + context.style({'pointer-events': _delegate ? 'none' : 'all'}); - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -66792,63 +67514,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -66860,10 +67581,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":323,"../constants/xmlns_namespaces":324,"../lib":337,"d3":8}],355:[function(require,module,exports){ +},{"../constants/alignment":327,"../constants/string_mappings":330,"../constants/xmlns_namespaces":331,"../lib":344,"d3":8}],362:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66891,7 +67612,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":12}],356:[function(require,module,exports){ +},{"fast-isnumeric":12}],363:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -66949,7 +67670,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":415}],357:[function(require,module,exports){ +},{"../registry":423}],364:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67167,7 +67888,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -67300,18 +68020,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -67367,7 +68107,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -67470,7 +68210,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":225,"../lib":337,"../plots/cartesian/axes":372,"../plots/plots":407,"../registry":415,"fast-isnumeric":12,"gl-mat4/fromQuat":24}],358:[function(require,module,exports){ +},{"../components/color":231,"../lib":344,"../plots/cartesian/axes":379,"../plots/plots":415,"../registry":423,"fast-isnumeric":12,"gl-mat4/fromQuat":24}],365:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67684,7 +68424,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":339,"../lib/loggers":340,"../lib/nested_property":343,"../lib/noop":344,"../lib/search":351,"../registry":415,"./container_array_match":356}],359:[function(require,module,exports){ +},{"../lib/is_plain_object":346,"../lib/loggers":347,"../lib/nested_property":350,"../lib/noop":351,"../lib/search":358,"../registry":423,"./container_array_match":363}],366:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -67719,7 +68459,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -67876,9 +68618,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -67907,19 +68647,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; + if(JSON.stringify(fullLayout._size) === oldmargins) return; - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); - - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -67957,7 +68697,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -68057,6 +68800,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -68154,7 +68898,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -68163,9 +68907,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -68180,11 +68925,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -69070,6 +69814,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -69169,6 +69914,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -69600,10 +70348,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -69625,7 +70375,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -69633,7 +70384,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -69646,11 +70397,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -69730,6 +70495,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -69828,7 +70594,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -69876,7 +70651,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -70710,7 +71485,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":249,"../components/errorbars":255,"../constants/xmlns_namespaces":324,"../lib":337,"../lib/events":331,"../lib/queue":349,"../lib/svg_text_utils":354,"../plotly":367,"../plots/cartesian/axis_ids":375,"../plots/cartesian/constants":377,"../plots/cartesian/constraints":379,"../plots/cartesian/graph_interact":381,"../plots/plots":407,"../plots/polar":410,"../registry":415,"./helpers":357,"./manage_arrays":358,"./subroutines":364,"d3":8,"fast-isnumeric":12}],360:[function(require,module,exports){ +},{"../components/drawing":255,"../components/errorbars":261,"../constants/xmlns_namespaces":331,"../lib":344,"../lib/events":338,"../lib/queue":356,"../lib/svg_text_utils":361,"../plotly":374,"../plots/cartesian/axis_ids":382,"../plots/cartesian/constants":384,"../plots/cartesian/constraints":386,"../plots/cartesian/graph_interact":388,"../plots/plots":415,"../plots/polar":418,"../registry":423,"./helpers":364,"./manage_arrays":365,"./subroutines":371,"d3":8,"fast-isnumeric":12}],367:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -70836,7 +71611,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],361:[function(require,module,exports){ +},{}],368:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -70995,7 +71770,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -71015,9 +71793,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -71242,7 +72019,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":337,"../plots/animation_attributes":368,"../plots/attributes":370,"../plots/frame_attributes":397,"../plots/layout_attributes":398,"../plots/polar/area_attributes":408,"../plots/polar/axis_attributes":409,"../registry":415}],362:[function(require,module,exports){ +},{"../lib":344,"../plots/animation_attributes":375,"../plots/attributes":377,"../plots/frame_attributes":404,"../plots/layout_attributes":406,"../plots/polar/area_attributes":416,"../plots/polar/axis_attributes":417,"../registry":423}],369:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -71341,7 +72118,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":337,"../registry":415}],363:[function(require,module,exports){ +},{"../lib":344,"../registry":423}],370:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -71367,7 +72144,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":337,"../plotly":367}],364:[function(require,module,exports){ +},{"../lib":344,"../plotly":374}],371:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -71496,15 +72273,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -71624,27 +72402,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -71745,19 +72525,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -71774,7 +72557,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":225,"../components/drawing":249,"../components/modebar":285,"../components/titles":314,"../lib":337,"../plotly":367,"../plots/cartesian/graph_interact":381,"../plots/plots":407,"../registry":415,"d3":8}],365:[function(require,module,exports){ +},{"../components/color":231,"../components/drawing":255,"../components/modebar":291,"../components/titles":320,"../lib":344,"../plotly":374,"../plots/cartesian/graph_interact":388,"../plots/plots":415,"../registry":423,"d3":8}],372:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -71884,7 +72667,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":337,"../plotly":367,"../snapshot/cloneplot":416,"../snapshot/helpers":419,"../snapshot/svgtoimg":421,"../snapshot/tosvg":423,"fast-isnumeric":12}],366:[function(require,module,exports){ +},{"../lib":344,"../plotly":374,"../snapshot/cloneplot":424,"../snapshot/helpers":427,"../snapshot/svgtoimg":429,"../snapshot/tosvg":431,"fast-isnumeric":12}],373:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72106,6 +72889,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -72154,6 +72942,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -72171,7 +72969,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -72188,8 +72986,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -72255,7 +73053,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":337,"../plots/plots":407,"./plot_schema":361}],367:[function(require,module,exports){ +},{"../lib":344,"../plots/plots":415,"./plot_schema":368}],374:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72289,7 +73087,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":285,"./plot_api/plot_api":359,"./plot_api/plot_config":360,"./plots/cartesian/axes":372,"./plots/plots":407}],368:[function(require,module,exports){ +},{"./components/modebar":291,"./plot_api/plot_api":366,"./plot_api/plot_config":367,"./plots/cartesian/axes":379,"./plots/plots":415}],375:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72391,7 +73189,7 @@ module.exports = { } }; -},{}],369:[function(require,module,exports){ +},{}],376:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72472,7 +73270,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":337}],370:[function(require,module,exports){ +},{"../lib":344}],377:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72529,11 +73327,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -72557,7 +73364,7 @@ module.exports = { } }; -},{"../components/fx/attributes":258}],371:[function(require,module,exports){ +},{"../components/fx/attributes":264}],378:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72584,7 +73391,7 @@ module.exports = { } }; -},{}],372:[function(require,module,exports){ +},{}],379:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -72614,7 +73421,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -72687,33 +73493,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -72954,6 +73754,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -73049,6 +73852,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -74400,10 +75210,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -74436,17 +75246,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -74912,7 +75715,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":225,"../../components/drawing":249,"../../components/titles":314,"../../constants/numerical":322,"../../lib":337,"../../lib/svg_text_utils":354,"../../registry":415,"./axis_autotype":373,"./axis_ids":375,"./layout_attributes":383,"./layout_defaults":384,"./set_convert":389,"d3":8,"fast-isnumeric":12}],373:[function(require,module,exports){ +},{"../../components/color":231,"../../components/drawing":255,"../../components/titles":320,"../../constants/numerical":329,"../../lib":344,"../../lib/svg_text_utils":361,"../../registry":423,"./axis_autotype":380,"./axis_ids":382,"./layout_attributes":390,"./layout_defaults":391,"./set_convert":396,"d3":8,"fast-isnumeric":12}],380:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -74987,7 +75790,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":322,"../../lib":337,"fast-isnumeric":12}],374:[function(require,module,exports){ +},{"../../constants/numerical":329,"../../lib":344,"fast-isnumeric":12}],381:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75110,7 +75913,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":224,"../../lib":337,"../../registry":415,"./category_order_defaults":376,"./layout_attributes":383,"./ordered_categories":385,"./set_convert":389,"./tick_label_defaults":390,"./tick_mark_defaults":391,"./tick_value_defaults":392,"tinycolor2":197}],375:[function(require,module,exports){ +},{"../../components/color/attributes":230,"../../lib":344,"../../registry":423,"./category_order_defaults":383,"./layout_attributes":390,"./ordered_categories":392,"./set_convert":396,"./tick_label_defaults":397,"./tick_mark_defaults":398,"./tick_value_defaults":399,"tinycolor2":197}],382:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75232,7 +76035,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":337,"../../registry":415,"../plots":407,"./constants":377}],376:[function(require,module,exports){ +},{"../../lib":344,"../../registry":423,"../plots":415,"./constants":384}],383:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75266,7 +76069,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],377:[function(require,module,exports){ +},{}],384:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75321,7 +76124,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],378:[function(require,module,exports){ +},{}],385:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75339,10 +76142,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); + + if(containerOut.fixedrange) return; + + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(!containerIn.scaleanchor) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -75361,7 +76179,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -75460,7 +76278,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":337,"./axis_ids":375}],379:[function(require,module,exports){ +},{"../../lib":344,"./axis_ids":382}],386:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75477,12 +76295,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; -module.exports = function enforceAxisConstraints(gd) { + +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -75498,12 +76318,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -75511,32 +76337,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; + + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } + + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } } } } }; -},{"../../constants/numerical":322,"./axis_ids":375,"./scale_zoom":387}],380:[function(require,module,exports){ +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; + } + } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } + } +}; + +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":327,"../../constants/numerical":329,"./axis_ids":382,"./scale_zoom":394}],387:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -75559,6 +76506,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -75668,7 +76618,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -75722,6 +76671,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -75820,8 +76772,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -75854,7 +76806,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -75873,11 +76826,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -76062,6 +77015,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -76081,8 +77036,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -76179,24 +77139,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -76231,11 +77184,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -76246,7 +77203,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -76255,7 +77212,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -76338,7 +77295,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -76354,13 +77311,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -76537,7 +77496,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":225,"../../components/dragelement":246,"../../components/drawing":249,"../../lib":337,"../../lib/setcursor":352,"../../lib/svg_text_utils":354,"../../plotly":367,"../../registry":415,"./axes":372,"./axis_ids":375,"./constants":377,"./scale_zoom":387,"./select":388,"d3":8,"tinycolor2":197}],381:[function(require,module,exports){ +},{"../../components/color":231,"../../components/dragelement":252,"../../components/drawing":255,"../../constants/alignment":327,"../../lib":344,"../../lib/setcursor":359,"../../lib/svg_text_utils":361,"../../plotly":374,"../../registry":423,"../plots":415,"./axes":379,"./axis_ids":382,"./constants":384,"./scale_zoom":394,"./select":395,"d3":8,"tinycolor2":197}],388:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76560,7 +77519,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -76578,8 +77537,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -76637,7 +77594,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -76698,7 +77655,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":246,"../../components/fx":266,"./constants":377,"./dragbox":380,"fast-isnumeric":12}],382:[function(require,module,exports){ +},{"../../components/dragelement":252,"../../components/fx":272,"./constants":384,"./dragbox":387,"fast-isnumeric":12}],389:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -76885,6 +77842,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -77087,7 +78049,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":337,"../plots":407,"./attributes":371,"./axis_ids":375,"./constants":377,"./layout_attributes":383,"./transition_axes":393,"d3":8}],383:[function(require,module,exports){ +},{"../../lib":344,"../plots":415,"./attributes":378,"./axis_ids":382,"./constants":384,"./layout_attributes":390,"./transition_axes":400,"d3":8}],390:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77182,6 +78144,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -77479,7 +78455,7 @@ module.exports = { } }; -},{"../../components/color/attributes":224,"../../components/drawing/attributes":248,"../../lib/extend":332,"../font_attributes":396,"./constants":377}],384:[function(require,module,exports){ +},{"../../components/color/attributes":230,"../../components/drawing/attributes":254,"../../lib/extend":339,"../font_attributes":403,"./constants":384}],391:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77752,7 +78728,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":225,"../../lib":337,"../../registry":415,"../layout_attributes":398,"./axis_defaults":374,"./axis_ids":375,"./constants":377,"./constraint_defaults":378,"./layout_attributes":383,"./position_defaults":386,"./type_defaults":394}],385:[function(require,module,exports){ +},{"../../components/color":231,"../../lib":344,"../../registry":423,"../layout_attributes":406,"./axis_defaults":381,"./axis_ids":382,"./constants":384,"./constraint_defaults":385,"./layout_attributes":390,"./position_defaults":393,"./type_defaults":401}],392:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77831,7 +78807,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":8}],386:[function(require,module,exports){ +},{"d3":8}],393:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77896,7 +78872,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":337,"fast-isnumeric":12}],387:[function(require,module,exports){ +},{"../../lib":344,"fast-isnumeric":12}],394:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77908,20 +78884,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],388:[function(require,module,exports){ +},{"../../constants/alignment":327}],395:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -77935,6 +78914,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -78075,7 +79055,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -78121,7 +79103,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":225,"../../lib/polygon":347,"./axes":372,"./constants":377}],389:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":231,"../../components/fx/helpers":269,"../../lib/polygon":354,"./axes":379,"./constants":384}],396:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78140,6 +79139,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -78152,13 +79152,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -78276,7 +79269,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -78289,8 +79282,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -78306,10 +79299,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -78317,16 +79312,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -78344,26 +79341,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -78564,7 +79573,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":322,"../../lib":337,"./axis_ids":375,"./constants":377,"d3":8,"fast-isnumeric":12}],390:[function(require,module,exports){ +},{"../../constants/numerical":329,"../../lib":344,"./axis_ids":382,"./constants":384,"d3":8,"fast-isnumeric":12}],397:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78648,7 +79657,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":337}],391:[function(require,module,exports){ +},{"../../lib":344}],398:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78681,7 +79690,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":337,"./layout_attributes":383}],392:[function(require,module,exports){ +},{"../../lib":344,"./layout_attributes":390}],399:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -78765,7 +79774,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":322,"../../lib":337,"fast-isnumeric":12}],393:[function(require,module,exports){ +},{"../../constants/numerical":329,"../../lib":344,"fast-isnumeric":12}],400:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79081,7 +80090,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":249,"../../plotly":367,"../../registry":415,"./axes":372,"d3":8}],394:[function(require,module,exports){ +},{"../../components/drawing":255,"../../plotly":374,"../../registry":423,"./axes":379,"d3":8}],401:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79209,7 +80218,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":415,"./axis_autotype":373,"./axis_ids":375}],395:[function(require,module,exports){ +},{"../../registry":423,"./axis_autotype":380,"./axis_ids":382}],402:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79474,6 +80483,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -79634,7 +80645,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":337,"../plotly":367}],396:[function(require,module,exports){ +},{"../lib":344,"../plotly":374}],403:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79665,7 +80676,7 @@ module.exports = { } }; -},{}],397:[function(require,module,exports){ +},{}],404:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79711,7 +80722,41 @@ module.exports = { } }; -},{}],398:[function(require,module,exports){ +},{}],405:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +function xformMatrix(m, v) { + var out = [0, 0, 0, 0]; + var i, j; + + for(i = 0; i < 4; ++i) { + for(j = 0; j < 4; ++j) { + out[j] += m[4 * i + j] * v[i]; + } + } + + return out; +} + +function project(camera, v) { + var p = xformMatrix(camera.projection, + xformMatrix(camera.view, + xformMatrix(camera.model, [v[0], v[1], v[2], 1]))); + return p; +} + +module.exports = project; + +},{}],406:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79854,7 +80899,7 @@ module.exports = { } }; -},{"../components/color/attributes":224,"../lib":337,"./font_attributes":396}],399:[function(require,module,exports){ +},{"../components/color/attributes":230,"../lib":344,"./font_attributes":403}],407:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79884,7 +80929,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],400:[function(require,module,exports){ +},{}],408:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -79958,7 +81003,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":337}],401:[function(require,module,exports){ +},{"../../lib":344}],409:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80101,7 +81146,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":324,"../plots":407,"./constants":399,"./layout_attributes":403,"./layout_defaults":404,"./mapbox":405,"mapbox-gl":82}],402:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":331,"../plots":415,"./constants":407,"./layout_attributes":411,"./layout_defaults":412,"./mapbox":413,"mapbox-gl":82}],410:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80326,7 +81371,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":337,"./convert_text_opts":400}],403:[function(require,module,exports){ +},{"../../lib":344,"./convert_text_opts":408}],411:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80530,7 +81575,7 @@ module.exports = { }; -},{"../../components/color":225,"../../lib":337,"../../traces/scatter/attributes":426,"../font_attributes":396}],404:[function(require,module,exports){ +},{"../../components/color":231,"../../lib":344,"../../traces/scatter/attributes":434,"../font_attributes":403}],412:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -80626,7 +81671,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":337,"../subplot_defaults":414,"./layout_attributes":403}],405:[function(require,module,exports){ +},{"../../lib":344,"../subplot_defaults":422,"./layout_attributes":411}],413:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81090,7 +82135,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../components/fx":266,"../../lib":337,"./constants":399,"./layers":402,"./layout_attributes":403,"mapbox-gl":82}],406:[function(require,module,exports){ +},{"../../components/fx":272,"../../lib":344,"./constants":407,"./layers":410,"./layout_attributes":411,"mapbox-gl":82}],414:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81128,7 +82173,7 @@ module.exports = { } }; -},{}],407:[function(require,module,exports){ +},{}],415:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -81144,6 +82189,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -81636,12 +82682,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -81966,12 +83038,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -81984,7 +83056,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -82917,6 +83992,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -83132,7 +84211,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -83153,6 +84238,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -83200,25 +84286,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -83227,11 +84299,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -83304,7 +84372,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":225,"../components/errorbars":255,"../constants/numerical":322,"../lib":337,"../plotly":367,"../registry":415,"./animation_attributes":368,"./attributes":370,"./command":395,"./font_attributes":396,"./frame_attributes":397,"./layout_attributes":398,"d3":8,"fast-isnumeric":12}],408:[function(require,module,exports){ +},{"../components/color":231,"../components/errorbars":261,"../constants/numerical":329,"../lib":344,"../plot_api/plot_schema":368,"../plotly":374,"../registry":423,"./animation_attributes":375,"./attributes":377,"./command":402,"./font_attributes":403,"./frame_attributes":404,"./layout_attributes":406,"d3":8,"fast-isnumeric":12}],416:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -83329,7 +84397,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":426}],409:[function(require,module,exports){ +},{"../../traces/scatter/attributes":434}],417:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -83444,7 +84512,7 @@ module.exports = { } }; -},{"../../lib/extend":332,"../cartesian/layout_attributes":383}],410:[function(require,module,exports){ +},{"../../lib/extend":339,"../cartesian/layout_attributes":390}],418:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -83459,7 +84527,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":411,"./micropolar_manager":412}],411:[function(require,module,exports){ +},{"./micropolar":419,"./micropolar_manager":420}],419:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -84878,7 +85946,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":337,"d3":8}],412:[function(require,module,exports){ +},{"../../lib":344,"d3":8}],420:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -84964,7 +86032,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":225,"../../lib":337,"./micropolar":411,"./undo_manager":413,"d3":8}],413:[function(require,module,exports){ +},{"../../components/color":231,"../../lib":344,"./micropolar":419,"./undo_manager":421,"d3":8}],421:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85030,7 +86098,7 @@ module.exports = function UndoManager() { }; }; -},{}],414:[function(require,module,exports){ +},{}],422:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85105,7 +86173,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":337,"./plots":407}],415:[function(require,module,exports){ +},{"../lib":344,"./plots":415}],423:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85296,7 +86364,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":340,"./lib/noop":344,"./lib/push_unique":348,"./plots/attributes":370}],416:[function(require,module,exports){ +},{"./lib/loggers":347,"./lib/noop":351,"./lib/push_unique":355,"./plots/attributes":377}],424:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85468,7 +86536,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":337,"../plots/plots":407}],417:[function(require,module,exports){ +},{"../lib":344,"../plots/plots":415}],425:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85534,7 +86602,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":337,"../plot_api/to_image":365,"./filesaver":418}],418:[function(require,module,exports){ +},{"../lib":344,"../plot_api/to_image":372,"./filesaver":426}],426:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85602,7 +86670,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],419:[function(require,module,exports){ +},{}],427:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85635,7 +86703,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],420:[function(require,module,exports){ +},{}],428:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85661,7 +86729,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":416,"./download":417,"./helpers":419,"./svgtoimg":421,"./toimage":422,"./tosvg":423}],421:[function(require,module,exports){ +},{"./cloneplot":424,"./download":425,"./helpers":427,"./svgtoimg":429,"./toimage":430,"./tosvg":431}],429:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85699,7 +86767,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -85792,7 +86860,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":337,"events":11}],422:[function(require,module,exports){ +},{"../lib":344,"events":11}],430:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85872,7 +86940,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":337,"../plotly":367,"./cloneplot":416,"./helpers":419,"./svgtoimg":421,"./tosvg":423,"events":11}],423:[function(require,module,exports){ +},{"../lib":344,"../plotly":374,"./cloneplot":424,"./helpers":427,"./svgtoimg":429,"./tosvg":431,"events":11}],431:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -85886,12 +86954,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} + +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -85944,20 +87029,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -85965,10 +87052,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -85982,16 +87080,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":225,"../components/drawing":249,"../constants/xmlns_namespaces":324,"../lib/svg_text_utils":354,"d3":8}],424:[function(require,module,exports){ +},{"../components/color":231,"../components/drawing":255,"../constants/xmlns_namespaces":331,"d3":8}],432:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86016,7 +87114,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":225}],425:[function(require,module,exports){ +},{"../../components/color":231}],433:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86068,7 +87166,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":337}],426:[function(require,module,exports){ +},{"../../lib":344}],434:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86114,20 +87212,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -86348,7 +87438,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":226,"../../components/colorscale/color_attributes":232,"../../components/drawing":249,"../../components/drawing/attributes":248,"../../components/errorbars/attributes":251,"../../lib/extend":332,"./constants":431}],427:[function(require,module,exports){ +},{"../../components/colorbar/attributes":232,"../../components/colorscale/color_attributes":238,"../../components/drawing":255,"../../components/drawing/attributes":254,"../../components/errorbars/attributes":257,"../../lib/extend":339,"./constants":439}],435:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86479,7 +87569,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":322,"../../plots/cartesian/axes":372,"./arrays_to_calcdata":425,"./colorscale_calc":430,"./subtypes":446,"fast-isnumeric":12}],428:[function(require,module,exports){ +},{"../../constants/numerical":329,"../../plots/cartesian/axes":379,"./arrays_to_calcdata":433,"./colorscale_calc":438,"./subtypes":454,"fast-isnumeric":12}],436:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86518,7 +87608,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],429:[function(require,module,exports){ +},{}],437:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86574,7 +87664,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":228,"../../components/colorscale":239,"../../lib":337,"../../plots/plots":407,"fast-isnumeric":12}],430:[function(require,module,exports){ +},{"../../components/colorbar/draw":234,"../../components/colorscale":245,"../../lib":344,"../../plots/plots":415,"fast-isnumeric":12}],438:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86607,7 +87697,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":231,"../../components/colorscale/has_colorscale":238,"./subtypes":446}],431:[function(require,module,exports){ +},{"../../components/colorscale/calc":237,"../../components/colorscale/has_colorscale":244,"./subtypes":454}],439:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86623,7 +87713,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],432:[function(require,module,exports){ +},{}],440:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86662,11 +87752,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -86705,7 +87793,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":254,"../../lib":337,"./attributes":426,"./constants":431,"./fillcolor_defaults":433,"./line_defaults":437,"./line_shape_defaults":439,"./marker_defaults":442,"./subtypes":446,"./text_defaults":447,"./xy_defaults":448}],433:[function(require,module,exports){ +},{"../../components/errorbars/defaults":260,"../../lib":344,"./attributes":434,"./constants":439,"./fillcolor_defaults":441,"./line_defaults":445,"./line_shape_defaults":447,"./marker_defaults":450,"./subtypes":454,"./text_defaults":455,"./xy_defaults":456}],441:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86743,7 +87831,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":225}],434:[function(require,module,exports){ +},{"../../components/color":231}],442:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86796,7 +87884,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":225,"./subtypes":446}],435:[function(require,module,exports){ +},{"../../components/color":231,"./subtypes":454}],443:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -86823,11 +87911,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -86883,7 +87972,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -86967,7 +88056,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":225,"../../components/errorbars":255,"../../components/fx":266,"../../lib":337,"./get_trace_color":434}],436:[function(require,module,exports){ +},{"../../components/color":231,"../../components/errorbars":261,"../../components/fx":272,"../../lib":344,"./get_trace_color":442}],444:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87011,7 +88100,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":382,"./arrays_to_calcdata":425,"./attributes":426,"./calc":427,"./clean_data":428,"./colorbar":429,"./defaults":432,"./hover":435,"./plot":443,"./select":444,"./style":445,"./subtypes":446}],437:[function(require,module,exports){ +},{"../../plots/cartesian":389,"./arrays_to_calcdata":433,"./attributes":434,"./calc":435,"./clean_data":436,"./colorbar":437,"./defaults":440,"./hover":443,"./plot":451,"./select":452,"./style":453,"./subtypes":454}],445:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87044,7 +88133,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":234,"../../components/colorscale/has_colorscale":238}],438:[function(require,module,exports){ +},{"../../components/colorscale/defaults":240,"../../components/colorscale/has_colorscale":244}],446:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87217,7 +88306,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":322}],439:[function(require,module,exports){ +},{"../../constants/numerical":329}],447:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87236,7 +88325,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],440:[function(require,module,exports){ +},{}],448:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87277,7 +88366,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],441:[function(require,module,exports){ +},{}],449:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87319,7 +88408,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":12}],442:[function(require,module,exports){ +},{"fast-isnumeric":12}],450:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87394,7 +88483,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":225,"../../components/colorscale/defaults":234,"../../components/colorscale/has_colorscale":238,"./subtypes":446}],443:[function(require,module,exports){ +},{"../../components/color":231,"../../components/colorscale/defaults":240,"../../components/colorscale/has_colorscale":244,"./subtypes":454}],451:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87737,10 +88826,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -87751,7 +88842,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -87759,7 +88851,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -87816,17 +88909,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -87838,6 +88934,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -87857,6 +88955,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -87865,7 +88965,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -87942,7 +89042,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":249,"../../components/errorbars":255,"../../lib":337,"../../lib/polygon":347,"./line_points":438,"./link_traces":440,"./subtypes":446,"d3":8}],444:[function(require,module,exports){ +},{"../../components/drawing":255,"../../components/errorbars":261,"../../lib":344,"../../lib/polygon":354,"./line_points":446,"./link_traces":448,"./subtypes":454,"d3":8}],452:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -87964,7 +89064,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -87988,11 +89087,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -88015,7 +89112,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":446}],445:[function(require,module,exports){ +},{"./subtypes":454}],453:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88046,10 +89143,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -88061,7 +89158,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":249,"../../components/errorbars":255,"d3":8}],446:[function(require,module,exports){ +},{"../../components/drawing":255,"../../components/errorbars":261,"d3":8}],454:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88097,7 +89194,7 @@ module.exports = { } }; -},{"../../lib":337}],447:[function(require,module,exports){ +},{"../../lib":344}],455:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88118,7 +89215,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":337}],448:[function(require,module,exports){ +},{"../../lib":344}],456:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88168,7 +89265,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":415}],449:[function(require,module,exports){ +},{"../../registry":423}],457:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88263,7 +89360,7 @@ module.exports = { }) }; -},{"../../components/colorscale/color_attributes":232,"../../components/drawing/attributes":248,"../../lib/extend":332,"../../plots/attributes":370,"../scatter/attributes":426}],450:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":238,"../../components/drawing/attributes":254,"../../lib/extend":339,"../../plots/attributes":377,"../scatter/attributes":434}],458:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88307,7 +89404,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":322,"../scatter/arrays_to_calcdata":425,"../scatter/colorscale_calc":430,"fast-isnumeric":12}],451:[function(require,module,exports){ +},{"../../constants/numerical":329,"../scatter/arrays_to_calcdata":433,"../scatter/colorscale_calc":438,"fast-isnumeric":12}],459:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88398,7 +89495,7 @@ module.exports = { }), }; -},{"../../components/colorbar/attributes":226,"../../lib/extend":332,"../../plots/attributes":370,"../../plots/mapbox/layout_attributes":403,"../scatter/attributes":426,"../scattergeo/attributes":449}],452:[function(require,module,exports){ +},{"../../components/colorbar/attributes":232,"../../lib/extend":339,"../../plots/attributes":377,"../../plots/mapbox/layout_attributes":411,"../scatter/attributes":434,"../scattergeo/attributes":457}],460:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88741,7 +89838,7 @@ function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } -},{"../../components/colorscale":239,"../../constants/numerical":322,"../../lib":337,"../../lib/geojson_utils":335,"../../plots/mapbox/convert_text_opts":400,"../scatter/make_bubble_size_func":441,"../scatter/subtypes":446}],453:[function(require,module,exports){ +},{"../../components/colorscale":245,"../../constants/numerical":329,"../../lib":344,"../../lib/geojson_utils":342,"../../plots/mapbox/convert_text_opts":408,"../scatter/make_bubble_size_func":449,"../scatter/subtypes":454}],461:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88807,8 +89904,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } - - coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+text' : undefined); }; function handleLonLatDefaults(traceIn, traceOut, coerce) { @@ -88822,7 +89917,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":337,"../scatter/fillcolor_defaults":433,"../scatter/line_defaults":437,"../scatter/marker_defaults":442,"../scatter/subtypes":446,"../scatter/text_defaults":447,"./attributes":451}],454:[function(require,module,exports){ +},{"../../lib":344,"../scatter/fillcolor_defaults":441,"../scatter/line_defaults":445,"../scatter/marker_defaults":450,"../scatter/subtypes":454,"../scatter/text_defaults":455,"./attributes":459}],462:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88842,7 +89937,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],455:[function(require,module,exports){ +},{}],463:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88945,7 +90040,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../components/fx":266,"../../constants/numerical":322,"../scatter/get_trace_color":434}],456:[function(require,module,exports){ +},{"../../components/fx":272,"../../constants/numerical":329,"../scatter/get_trace_color":442}],464:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -88978,7 +90073,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":401,"../scatter/colorbar":429,"../scattergeo/calc":450,"./attributes":451,"./defaults":453,"./event_data":454,"./hover":455,"./plot":457}],457:[function(require,module,exports){ +},{"../../plots/mapbox":409,"../scatter/colorbar":437,"../scattergeo/calc":458,"./attributes":459,"./defaults":461,"./event_data":462,"./hover":463,"./plot":465}],465:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -89102,5 +90197,5 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":452}]},{},[4])(4) +},{"./convert":460}]},{},[4])(4) }); \ No newline at end of file diff --git a/dist/plotly-mapbox.min.js b/dist/plotly-mapbox.min.js index dde2d93f7f4..396826a3ddb 100644 --- a/dist/plotly-mapbox.min.js +++ b/dist/plotly-mapbox.min.js @@ -1,41 +1,42 @@ /** -* plotly.js (mapbox - minified) v1.27.1 +* plotly.js (mapbox - minified) v1.28.0 * Copyright 2012-2017, 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||t)},c,c.exports,t,e,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o=0;s--)if(l[s]!==u[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!d(t[o],e[o],n,r))return!1;return!0}function g(t,e,n){d(t,e,!0)&&f(t,e,n,"notDeepStrictEqual",g)}function v(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&e.call({},t)===!0}function y(t){var e;try{t()}catch(t){e=t}return e}function x(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=y(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&f(i,n,"Missing expected exception"+r);var a="string"==typeof r,o=!t&&b.isError(i),s=!t&&i&&!n;if((o&&a&&v(i,n)||s)&&f(i,n,"Got unwanted exception"+r),t&&i&&n&&!v(i,n)||!t&&i)throw i}var b=t("util/"),_=Object.prototype.hasOwnProperty,w=Array.prototype.slice,M=function(){return"foo"===function(){}.name}(),k=e.exports=h,A=/\s*function\s+([^\(\s]*)\s*/;k.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=c(this),this.generatedMessage=!0);var e=t.stackStartFunction||f;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=s(e),a=r.indexOf("\n"+i);if(a>=0){var o=r.indexOf("\n",a+1);r=r.substring(o+1)}this.stack=r}}},b.inherits(k.AssertionError,Error),k.fail=f,k.ok=h,k.equal=function(t,e,n){t!=e&&f(t,e,n,"==",k.equal)},k.notEqual=function(t,e,n){t==e&&f(t,e,n,"!=",k.notEqual)},k.deepEqual=function(t,e,n){d(t,e,!1)||f(t,e,n,"deepEqual",k.deepEqual)},k.deepStrictEqual=function(t,e,n){d(t,e,!0)||f(t,e,n,"deepStrictEqual",k.deepStrictEqual)},k.notDeepEqual=function(t,e,n){d(t,e,!1)&&f(t,e,n,"notDeepEqual",k.notDeepEqual)},k.notDeepStrictEqual=g,k.strictEqual=function(t,e,n){t!==e&&f(t,e,n,"===",k.strictEqual)},k.notStrictEqual=function(t,e,n){t===e&&f(t,e,n,"!==",k.notStrictEqual)},k.throws=function(t,e,n){x(!0,t,e,n)},k.doesNotThrow=function(t,e,n){x(!1,t,e,n)},k.ifError=function(t){if(t)throw t};var S=Object.keys||function(t){var e=[];for(var n in t)_.call(t,n)&&e.push(n);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"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:0/0}function a(t){return null===t?0/0:+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+="")===_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 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 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=Mo.length;n=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Co.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==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(n,null),Po&&(o[Po]=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)*$o,r=gt(r)*Ko,a=gt(a)*ts,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(0/0,0/0,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 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,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=rs.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)/$o),i=vt((.2126729*t+.7151522*e+.072175*n)/Ko);return dt(116*i-16,500*(r-i),200*(i-vt((.0193339*t+.119192*e+.9503041*n)/ts)))}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 Ct(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 as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Pt)),a}function Pt(){var t=Ot(),e=Ft()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Pt,e)),os=0):(os=1,ls(Pt))}function Ot(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ft(){for(var t,e=is,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)}:b;return function(t){var n=cs.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=fs.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?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!u&&f&&(b=a(b,1/0));var k=m.length+b.length+_.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(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=E[o in ms?e.charAt(s++):o])||(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){b.lastIndex=0;var r=b.exec(e.slice(n));return r?(t.w=_.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{ds=qt;var e=new ds;return e._=t,r(e)}finally{ds=Date}}var r=e(t);return n.parse=function(t){try{ds=qt;var e=r.parse(t);return e&&e._}finally{ds=Date}},n.toString=r.toString,n},e.multi=e.utc.multi=ce;var x=uo.map(),b=Zt(m),_=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 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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(hs.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"%"}},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 Gt(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3)}function ee(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ie(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ae(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function oe(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function se(t,e,n){gs.lastIndex=0;var r=gs.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=bo(e)/60|0,i=bo(e)%60;return n+Gt(r,"0",2)+Gt(i,"0",2)}function ue(t,e,n){vs.lastIndex=0;var r=vs.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);Ms.add(Math.atan2(h,f)),r=t,i=l,a=u}var e,n,r,i,a;ks.point=function(o,s){ks.point=t,r=(e=o)*Uo,i=Math.cos(s=(n=s)*Uo/2+No/4),a=Math.sin(s)},ks.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 bo(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 Ce(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r0){for(_||(a.polygonStart(),_=!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?(_||(a.polygonStart(),_=!0),De(d,je,t,n,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}},x=Re(),b=e(x),_=!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=0/0,r=0/0,i=0/0;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=bo(a-n);bo(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&&(bo(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(bo(t[0]-e[0])>Ro){var a=t[0]=0?1:-1,M=w*_,k=M>No,A=p*x;if(Ms.add(Math.atan2(A*w*Math.sin(M),m*b+A*Math.cos(M))),a+=k?_+w*Bo:_,k^h>=n^v>=n){var S=xe(ve(f),ve(t));we(S);var T=xe(i,S);we(T);var z=(k^_>=0?-1:1)*rt(T[2]);(r>z||r===z&&(S[0]||S[1]))&&(o+=k^_>=0?1:-1)}if(!g++)break;h=v,p=x,m=b,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=_e(o,f);be(p,_e(s,h));var m=d,g=ye(p,m),v=ye(m,m),y=g*g-v*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),b=_e(m,(-g-x)/v);if(be(b,p),b=Me(b),!n)return b;var _,w=t[0],M=e[0],k=t[1],A=e[1];M0^b[1]<(bo(b[0]-w)No^(w<=b[0]&&b[0]<=M)){var E=_e(m,(-g+x)/v);return be(E,p),[b,Me(E)]}}}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=bo(a)>Ro;return Oe(e,n,vn(t,6*Uo),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 Ge(t,e,n,r){function i(r,i){return bo(r[0]-t)0?0:3:bo(r[0]-n)0?2:1:bo(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,_=w=0/0}function d(){m&&(p(y,x),b&&M&&T.rejoin(),m.push(T.buffer())),E.point=f,M&&s.lineEnd()}function p(t,e){t=Math.max(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,e));var n=c(t,e);if(g&&v.push([t,e]),k)y=t,x=e,b=n,k=!1,n&&(s.lineStart(),s.point(t,e));else if(n&&M)s.point(t,e);else{var r={a:{x:_,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)}_=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 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){Bs+=i*t-r*e,r=t,i=e}var e,n,r,i;Gs.point=function(a,o){Gs.point=t,e=r=a,n=i=o},Gs.lineEnd=function(){t(e,n)}}function We(t,e){tUs&&(Us=t),eHs&&(Hs=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){Ts+=t,zs+=e,++Es}function Ke(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);Ls+=o*(e+t)/2,Is+=o*(n+r)/2,Ds+=o,$e(e=t,n=r)}var e,n;Xs.point=function(r,i){Xs.point=t,$e(e=r,n=i)}}function tn(){Xs.point=$e}function en(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);Ls+=o*(r+t)/2,Is+=o*(i+e)/2,Ds+=o,o=i*t-r*e,Cs+=o*(r+t),Ps+=o*(i+e),Os+=3*o,$e(r=t,i=e)}var e,n,r,i;Xs.point=function(a,o){Xs.point=t,$e(e=r=a,n=i=o)},Xs.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=0/0,k.point=a,e.lineStart()}function a(n,r){var a=ve([n,r]),o=t(n,r);i(x,b,y,_,w,M,x=o[0],b=o[1],y=n,_=a[0],w=a[1],M=a[2],s,e),e.point(x,b)}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=b,m=_,g=w,v=M,k.point=a}function c(){i(x,b,y,_,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,b=y*y+x*x;if(b>4*a&&g--){var _=s+d,w=l+p,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),S=bo(bo(M)-1)a||bo((y*L+x*I)/b-.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[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,_=Rs,w=b,M=null,k=null;return e.stream=function(t){return c&&(c.valid=!1),c=cn(_(o,f(w(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(_=null==t?(M=t,Rs):Ue((M=+t)*Uo),i()):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,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 bo(i)1&&et(t[n[r-2]],t[n[r-1]],t[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}function Pn(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=sl.pop()||new jn;return e.site=t,e}function Bn(t){Qn(t),il.remove(t),sl.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&&bo(n-l.circle.x)Ro)s=s.L;else{if(!((i=a-Hn(s,o))>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(il.insert(e,l),e||n){if(e===n)return Qn(e),n=Nn(e.site),il.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,b={x:(g*y-d*x)/v+c,y:(h*x-m*y)/v+f};nr(n.edge,u,p,b),l.edge=tr(u,t,null,b),n.edge=tr(t,p,null,b),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 Gn(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=rl,g=m.length;g--;)if((a=m[g])&&a.prepare())for(s=a.edges,l=s.length,o=0;oRo||bo(i-n)>Ro)&&(s.splice(o,0,new rr(er(a.site,c,bo(r-f)Ro?{x:f,y:bo(e-f)Ro?{x:bo(n-p)Ro?{x:h,y:bo(e-h)Ro?{x:bo(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=ll.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=ol._;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=b,M=n>=_,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=fl.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 Cr(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 Pr(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),Gr(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(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 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 Gi(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,_r),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=Gi(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=cs.exec(n);if(i.shift(),"s"===i[8]){var a=uo.formatPrefix(Math.max(bo(r[0]),bo(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 Ml?Math.abs(n-ra(Math.max(bo(e[0]),bo(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:Al);return t.domain(e),r=e.map(a),o},o.ticks=function(){var t=Gi(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 kl;arguments.length<2?n=kl:"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 ba(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,b=c*d-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-g*_)/y,M=(-b*g-v*_)/y,k=(b*v+g*_)/y,A=(-b*g+v*_)/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 _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=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=Ct(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(Ql,i);return a==Ql.length?[e.year,ta(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/Ql[a-1]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=Gi(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:0/0},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=0,n=t.length-1,r=t[0],i=new Array(n<0?0:n);e=0;)for(r=t[i],e=r.length;--e>=0;)n[--o]=r[e];return n};var bo=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(bo(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(){_&&_.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 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(C,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,f=uo.select(r(i)).on(D,t).on(C,n),h=e(uo.mouse(i)),d=J(i);Bl.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(b,r).on(_,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);Bl.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,fs=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))))}}),hs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=Vt(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=Vt(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=Vt(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});hs[t+"s"]=n.range,hs[t+"s"].utc=n.utc.range,hs[t+"OfYear"]=function(t){var n=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(n+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var ms={"-":"",_:" ",0:"0"},gs=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Ht(t)}};var ys=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=ys.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,xs),he(xs.s,this.s,this),this.s?this.t+=xs.t:this.s=xs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xs=new fe;uo.geo.stream=function(t,e){t&&bs.hasOwnProperty(t.type)?bs[t.type](t,e):de(t,e)};var bs={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=bo(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(){_.point=e}function r(){b[0]=c,b[1]=h,_.point=t,v=null}function i(t,n){if(v){var r=t-p;y+=bo(r)>180?r+(r>0?360:-360):r}else m=t,g=n;ks.point(t,n),e(t,n)}function a(){ks.lineStart()}function o(){i(m,g),ks.lineEnd(),bo(y)>Ro&&(c=-(h=180)),b[0]=c,b[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),b[0]=c,b[1]=h}};return function(t){d=h=-(c=f=1/0),x=[],uo.geo.stream(t,_);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=b=null,1/0===c||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[c,f],[h,d]]}}(),uo.geo.centroid=function(t){As=Ss=Ts=zs=Es=Ls=Is=Ds=Cs=Ps=Os=0,uo.geo.stream(t,Fs);var e=Cs,n=Ps,r=Os,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 Ns,Bs,qs,Vs,Us,Hs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=Ye},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Ns+=bo(Bs/2)}},Zs={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Xs={point:$e,lineStart:Ke,lineEnd:tn,polygonStart:function(){Xs.lineStart=en},polygonEnd:function(){Xs.point=$e,Xs.lineStart=Ke,Xs.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 Ns=0,uo.geo.stream(t,i(Gs)),Ns},t.centroid=function(t){return Ts=zs=Es=Ls=Is=Ds=Cs=Ps=Os=0,uo.geo.stream(t,i(Xs)),Os?[Cs/Os,Ps/Os]:Ds?[Ls/Ds,Is/Ds]:Es?[Ts/Es,zs/Es]:[0/0,0/0]},t.bounds=function(t){return Us=Hs=-(qs=Vs=1/0),uo.geo.stream(t,i(Zs)),[[qs,Vs],[Us,Hs]]},t.projection=function(t){return arguments.length?(i=(n=t)?t.stream||an(t):b,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 bo(t%g)>Ro}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return bo(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=bn(r,n,y),h=xn(u,l,90), -d=bn(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=_n,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 Ys=0,uo.geo.stream(t,Ws),Ys};var Ys,Ws={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},Qs=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return ln(Qs)}).raw=Qs;var Js=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},b);(uo.geo.azimuthalEquidistant=function(){return ln(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Ze(Sn)}).raw=Sn,(uo.geo.conicEquidistant=function(){return Ze(Tn)}).raw=Tn;var $s=An(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return ln($s)}).raw=$s,zn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return En(zn)}).raw=zn;var Ks=An(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return ln(Ks)}).raw=Ks;var tl=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return ln(tl)}).raw=tl,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]]:[]).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=ul;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=n.site,o=n.edges.sort(Xn),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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),b=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=_),w>y&&(y=w),f.push(_),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),+b(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=dl.get(n)||hl,r=pl.get(r)||b,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:ml)})(t)},Br.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=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=0/0,n=null,u.end({type:"end",alpha:i=0})):t>0&&(u.start({type:"start",alpha:i=t}),n=Ct(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=_i;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&&!Pi(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=Ci,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=Ci,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===Ll?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),b=u*Math.cos(f-T),_=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=_n,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=_n,n=wn,r=Ga;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=Ga,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(Ol.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 Ol=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*Rl)),n=e*Rl;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/Fl),n=e*Fl/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fl),n=e*Fl/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});uo.svg.symbolTypes=Ol.keys();var Fl=Math.sqrt(3),Rl=Math.tan(30*Uo);Eo.transition=function(t){for(var e,n,r=jl||++Vl,i=to(t),a=[],o=Nl||{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(_),r=!1;b&&(t[0]+=b[0],t[1]+=b[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!==_(r.prev,r,r.next))r=r.next;else{if(E(r),(r=e=r.prev)===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)===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(_(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)&&_(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(_(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)&&_(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)&&_(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&&b(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 b(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 _(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))||_(t,e,n)>0!=_(t,e,r)>0&&_(n,r,t)>0!=_(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 _(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 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&&void 0!==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){G=t}function o(t){Z=t}function s(){return function(){H(u)}}function l(){var t=setTimeout;return function(){return t(u,1)}}function u(){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){return 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(0===(t=+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];return t.length<=1?"any"===e?"false":"true":"("+("=="===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")+")"}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?(b.push(i(u,p,e),i(u,p,n)),a||(b=o(s,b,g,v,y))):d>=e&&b.push(i(u,p,e)):h>n?dn&&(b.push(i(u,p,n)),a||(b=o(s,b,g,v,y))));u=m[x-1],h=u[r],h>=e&&h<=n&&b.push(u),f=b[b.length-1],a&&f&&(b[0][0]!==f[0]||b[0][1]!==f[1])&&b.push(b[0]),o(s,b,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,b,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 _="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,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){o(t)<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,b=r[0],_=r[1],w=r[2];return t[0]=(1-(p+g))*b,t[1]=(h+x)*b,t[2]=(d-y)*b,t[3]=0,t[4]=(h-x)*_,t[5]=(1-(f+g))*_,t[6]=(m+v)*_,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,b=l*f,_=r[0],w=r[1],M=r[2],k=i[0],A=i[1],S=i[2];return t[0]=(1-(m+v))*_,t[1]=(d+b)*_,t[2]=(p-x)*_,t[3]=0,t[4]=(d-b)*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],b=a[1],_=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?0/0:1/0*(d?-1:1);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)||1/0===e?(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);i(t,e,n,Math.max(r,Math.floor(n-u*f/l+h)),Math.min(o,Math.floor(n+(l-u)*f/l+h)),s)}var d=e[2*n+s],p=r,m=o;for(a(t,e,r,n),e[2*o+s]>d&&a(t,e,r,o);pd;)m--}e[2*r+s]===d?a(t,e,r,m):(m++,a(t,e,m,o)),m<=n&&(r=m+1),n<=m&&(o=m-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 a=i(n);if("object"!==a)return[new r(e,n,"object expected, %s found",a)];var o=[];for(var s in n)"@"!==s[0]&&o.push(new r(e+"."+s,n[s],'constants must start with "@"'));return o}},{"../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')];switch(i(e.type)){case"vector":case"raster":var u=[];if(u=u.concat(a({key:n,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var c in e)["type","url","tileSize"].indexOf(c)<0&&u.push(new r(n+"."+c,e[c],'a source with a "url" property may not include a "%s" property',c));return u;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)}void 0!==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+_:p.name;b[w]=m[_]*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");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,500),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,15),n=0;n2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(r=1.05);var o=s/(512*this.overscaling)*15,u=t[0],c=t[a-1],f=u.equals(c);if(this.prepareArrayGroup("line",10*a),2!==a||!f){this.distance=0;var h,d,p,m,g,v,y,x=n,b=f?"butt":n,_=!0;this.e1=this.e2=this.e3=-1,f&&(h=t[a-2],g=u.sub(h)._unit()._perp());for(var w=0;w0){var T=h.dist(d);if(T>2*o){var z=h.sub(h.sub(d)._mult(o/T)._round());this.distance+=z.dist(d),this.addCurrentVertex(z,this.distance,m.mult(1),0,0,!1),d=z}}var E=d&&p,L=E?e:p?x:b;if(E&&"round"===L&&(Ar&&(L="bevel"),"bevel"===L&&(A>2&&(L="flipbevel"),A100)M=g.clone();else{var I=m.x*g.y-m.y*g.x>0?-1:1,D=A*m.add(g).mag()/m.sub(g).mag();M._perp()._mult(D*I)}this.addCurrentVertex(h,this.distance,M,0,0,!1),this.addCurrentVertex(h,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===L||"fakeround"===L){var C=m.x*g.y-m.y*g.x>0,P=-Math.sqrt(A*A-1);if(C?(y=0,v=P):(v=0,y=P),_||this.addCurrentVertex(h,this.distance,m,v,y,!1),"fakeround"===L){for(var O,F=Math.floor(8*(.5-(k-.5))),R=0;R=0;j--)O=m.mult((j+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(h,this.distance,O,C)}p&&this.addCurrentVertex(h,this.distance,g,-v,-y,!1)}else"butt"===L?(_||this.addCurrentVertex(h,this.distance,m,0,0,!1),p&&this.addCurrentVertex(h,this.distance,g,0,0,!1)):"square"===L?(_||(this.addCurrentVertex(h,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(h,this.distance,g,-1,-1,!1)):"round"===L&&(_||(this.addCurrentVertex(h,this.distance,m,0,0,!1),this.addCurrentVertex(h,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(h,this.distance,g,-1,-1,!0),this.addCurrentVertex(h,this.distance,g,0,0,!1)));if(S&&w2*o){var B=h.add(p.sub(h)._mult(o/N)._round());this.distance+=B.dist(h),this.addCurrentVertex(B,this.distance,g.mult(1),0,0,!1),h=B}}_=!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],c=l.layoutVertexArray,f=l.elementArray;o=n.clone(),r&&o._sub(n.perp()._mult(r)),this.e3=this.addLineVertex(c,t,o,s,0,r,e),this.e1>=0&&this.e2>=0&&f.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(c,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&f.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>u/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,b=c.getGlyphQuads,_=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*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,v=24*a["text-letter-spacing"],b=[24*a["text-offset"][0],24*a["text-offset"][1]],_=this.fontstack=a["text-font"].join(","),M=[],k=0;kw||E.y<0||E.y>w);if(!d||L){var I=L||b;this.addSymbolInstance(E,S,e,n,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,r.index,this.sourceLayerIndex,this.index,u,m,y,f,g,x,{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,b=p.tex,_=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,_.x,_.y,g.x,g.y,b.x,b.y,w,M,h,k);i(c,_.x,_.y,v.x,v.y,b.x+b.w,b.y,w,M,h,k),i(c,_.x,_.y,y.x,y.y,b.x,b.y+b.h,w,M,h,k),i(c,_.x,_.y,x.x,x.y,b.x+b.w,b.y+b.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(C,P,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){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*(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=[t.x,t.y,0,1],n=[t.x,t.y,1,1];h.transformMat4(e,e,this.pixelMatrixInverse),h.transformMat4(n,n,this.pixelMatrixInverse);var r=e[3],i=n[3],a=e[0]/r,s=n[0]/i,u=e[1]/r,c=n[1]/i,f=e[2]/r,d=n[2]/i,p=f===d?0:(0-f)/(d-f),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(a,s,p)/m,l(u,c,p)/m,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)))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,_>>16),s.uniform2f(r.u_pixel_coord_lower,65535&b,65535&_)}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),b=(y+x)/y-1,_=n.paint["line-dasharray"],w=n.paint["line-pattern"];if(_)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(_.from,"round"===n.layout["line-cap"]),m=t.lineAtlas.getDash(_.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,_.t),s.uniform1f(d.u_extra,b),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,b),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,b),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;this.opacities[n]=n<=t?this.changeOpacities[n]+i: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;if(this.nextRow+r>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o0?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);e.blendColor(1/8,1/8,1/8,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){if(n)return e(n);this._geoJSONIndexes[t.source]=r,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;this._cache.setMaxSize(Math.floor(5*r))},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)<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=new f;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new h(e.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,P[e]);b()}}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])&&v(w,L[M]);else v(t,E);var C=[],P=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),C.push(k),"symbol"===k.type?P.push(k):O.push(k));var R={},j={},N=0;if(P.length>0){for(_=P.length-1;_>=0;_--)P[_].updateIcons(R),P[_].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(_=O.length-1;_>=0;_--)x(this,O[_]);if(0===P.length)return b()},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){if(t)return void this.fire("error",{error:t});this.data=e,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"),b=t("./style_spec"),_=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&&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);return i.setPaintProperty(e,n,r),!(n&&_.isFunctionDefinition(n)&&"$zoom"!==n.property&&void 0!==n.property)&&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:1,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;r.create=function(e,n){return new({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")}[(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,"-transition"))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,"-transition")?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){return this._paintTransitions[t].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<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<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,b=e[p],_=e[p+1],w=_.sub(b)._unit()._mult(x)._add(b)._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();n.emplaceBack(0,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),n.emplaceBack(a,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,0,-32767,0,32767,0,32767,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,a,-32767,0,32767,0,32767,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 _;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);_=this.tempCollisionBox,_.anchorPointX=u.anchorPoint.x,_.anchorPointY=u.anchorPoint.y,_.x1=Math.min(M.x,k.x,A.x,S.x),_.y1=Math.min(M.y,k.x,A.x,S.x),_.x2=Math.max(M.x,k.x,A.x,S.x),_.y2=Math.max(M.y,k.x,A.x,S.x),_.maxScale=u.maxScale}else _=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=o,this.height=o,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=128;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=o+2,u=s+2;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var f=this.data,h=n.bitmap,d=0;d=2048||e>=2048)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=4,this.height*=4,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 b=v[c+1].x;g=Math.max(b,g);for(var _=c+1;_<=y;_++)v[_].y+=n,v[_].x-=b;if(o){var w=c;f[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=b,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){r.mousePos(x,t).equals(_)&&v("click",t)}function m(t){v("dblclick",t),t.preventDefault()}function g(t){b=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(),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",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),b=c.point,_="center"in t?c.project(m).sub(f.div(x)):b,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/x,S=_.sub(b).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},C=(n(1)-L)/M;if(Math.abs(S)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var P=A=0)return!1;return!0}),e.join(" | ")},r.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e=this._container=a.create("div","mapboxgl-ctrl-attrib",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)),e},_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=this._container=o.create("div","mapboxgl-ctrl-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),e):e},_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=a.bezier(0,0,.3,1);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]),s=(r[0]-i[0])/1e3;if(0===s||r[1].equals(i[1]))return void e();var l=a.mult(.3/s),u=l.mag();u>1400&&(u=1400,l._unit()._mult(u));var c=u/750,f=l.mult(-c/2);this._map.panBy(f,{duration:1e3*c,easing:o,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;return"mousemove"===t.type?t.buttons&!1:0!==t.button},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)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=o.bezier(0,0,.25,1);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);e.mag()<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)180&&(d=180);var p=d/180;u+=f*d*(p/2),Math.abs(e._normalizeBearing(u,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();t.length>0&&e-t[0][0]>160;)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;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()-2},n):(t.preventDefault(),e.panBy([-80,0],n));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+2},n):(t.preventDefault(),e.panBy([80,0],n));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+5},n):(t.preventDefault(),e.panBy([0,-80],n));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-5,0)},n):(t.preventDefault(),e.panBy([0,80],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=a.bezier(0,0,.15,1);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 c=Math.abs(1-o)>.15;Math.abs(s)>4?this._gestureIntent="rotate":c&&(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]),s=n.transform.scaleZoom(this._startScale*i[1]),l=a-s,u=(r[0]-i[0])/1e3,c=r[2];if(0===u||a===s)return void n.snapToNorth({},{originalEvent:t});var f=.15*l/u;Math.abs(f)>2.5&&(f=f>0?2.5:-2.5);var h=1e3*Math.abs(f/(12*.15)),d=a+f*h/2e3;d<0&&(d=0),n.easeTo({zoom:d,duration:h,easing:o,around:n.unproject(c)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>2&&e-t[0][0]>160;)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"),b=t("./control/attribution"),_={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:20,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)},w=e.exports=function(t){if(t=a.extend({},_,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)),void 0!==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 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(w.prototype,l),a.extend(w.prototype,g.prototype),a.extend(w.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?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=20)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 20, inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){var t,e={};return 2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length&&function(t){return t instanceof x||Array.isArray(t)}(arguments[0])?t=arguments[0]:1===arguments.length&&(e=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(t),e,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;if(t instanceof x||"number"==typeof t[0])e=[x.convert(t)];else{var n=[x.convert(t[0]),x.convert(t[1])];e=[n[0],new x(n[1].x,n[0].y),n[1],new x(n[0].x,n[1].y),n[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?(this.style=t instanceof c?t: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});if(!t)return void this.fire("error",{error:new Error("Failed to initialize WebGL")});this.painter=new h(t,this.transform)},_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),void 0!==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(w.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))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(void 0!==r.id&&this.parent[r.type])this.parent[r.type](r.data,e.bind(this));else if(void 0!==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)&&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){return"mapbox:"!==l.parse(t).protocol?t:r(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var n=l.parse(t);return"mapbox:"!==n.protocol?t:r("mapbox://"+n.pathname.split("/")[1]+"/{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;if("mapbox:"!==l.parse(e).protocol)return t;var i=s.supportsWebp?".webp":"$1",o=s.devicePixelRatio>=2||512===n?"@2x":"";return l.format({protocol:r.protocol,hostname:r.hostname,pathname:r.pathname.replace(/(\.(?:png|jpg)\d*)/,o+i),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:["#USER","/"],_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)+4294967296*this.buf.readUInt32LE(this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+4294967296*this.buf.readInt32LE(this.pos+4);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)return void a(t,this);this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);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(C,"."),r+o(t.split("."),e).join(".")}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,b=[];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(b={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 b});else if(v&&y)if(n.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:{})},{}],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;t=t.split(e);var s=1e3;a&&"number"==typeof a.maxKeys&&(s=a.maxKeys);var l=t.length;s>0&&l>s&&(l=s);for(var u=0;u=0?(c=p.substr(0,m),f=p.substr(m+1)):(c=p,f=""),h=decodeURIComponent(c),d=decodeURIComponent(f),r(o,h)?i(o[h])?o[h].push(d):o[h]=[o[h],d]:o[h]=d}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);r(t,e,Math.max(n,Math.floor(e-u*f/l+h)),Math.min(o,Math.floor(e+(l-u)*f/l+h)),s)}var d=t[e],p=n,m=o;for(i(t,n,e),s(t[o],d)>0&&i(t,n,o);p0;)m--}0===s(t[n],d)?i(t,n,m):(m++,i(t,m,o)),m<=e&&(n=m+1),e<=m&&(o=m-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){!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,i){return{x:t,y:e,zoom:1/0,id:r,properties:i,parentId:-1,numPoints:n}}function o(t,e){var n=t.geometry.coordinates;return{x:u(n[0]),y:c(n[1]),zoom:1/0,id:e,parentId:-1}}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 d(d({},t.properties),{cluster:!0,cluster_id:t.id,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,reduce:null,initial:function(){return{}},map:function(t){return t}},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=T(t,360),e=T(e,100),n=T(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=T(t,255),e=T(e,255),n=T(n,255);var r,i,a=H(t,e,n),o=U(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function T(t,n){L(t)&&(t="100%");var r=I(t);return t=U(n,H(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 U(1,H(0,t))}function E(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function I(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function C(t){return t<=1&&(t=100*t+"%"),t}function P(t){return e.round(255*parseFloat(t)).toString(16)}function O(t){return E(t)/255}function F(t){return!!Y.CSS_UNIT.exec(t)}function R(t){t=t.replace(N,"").replace(B,"").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=Y.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=Y.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Y.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=Y.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Y.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=Y.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Y.hex8.exec(t))?{r:E(n[1]),g:E(n[2]),b:E(n[3]),a:O(n[4]),format:e?"name":"hex8"}:(n=Y.hex6.exec(t))?{r:E(n[1]),g:E(n[2]),b:E(n[3]),format:e?"name":"hex"}:(n=Y.hex4.exec(t))?{r:E(n[1]+""+n[1]),g:E(n[2]+""+n[2]),b:E(n[3]+""+n[3]),a:O(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=Y.hex3.exec(t))&&{r:E(n[1]+""+n[1]),g:E(n[2]+""+n[2]),b:E(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 N=/^\s+/,B=/\s+$/,q=0,V=e.round,U=e.min,H=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=S(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),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=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),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 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*T(this._r,255))+"%",g:V(100*T(this._g,255))+"%",b:V(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*T(this._r,255))+"%, "+V(100*T(this._g,255))+"%, "+V(100*T(this._b,255))+"%)":"rgba("+V(100*T(this._r,255))+"%, "+V(100*T(this._g,255))+"%, "+V(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(X[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;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("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()):"name"===t&&0===this._a?this.toName():this.toRgbString()},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(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 i in t)t.hasOwnProperty(i)&&(n[i]="a"===i?t[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;return r({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})},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=j(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 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=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(Z),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==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){void 0===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={javascript:!0,"javascript:":!0},x={javascript:!0,"javascript:":!0},b={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=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?I+="x":I+=L[D];if(!I.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var P=z.slice(0,M),O=z.slice(M+1),F=L.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);F&&(P.push(F[1]),O.unshift(F[2])),O.length&&(o="/"+O.join(".")+o),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),T||(this.hostname=l.toASCII(this.hostname));var R=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+R,this.href+=this.host,T&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!y[d])for(var M=0,E=m.length;M0)&&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(!M.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=M.slice(-1)[0],T=(n.host||t.host||M.length>1)&&("."===S||".."===S)||""===S,z=0,E=M.length;E>=0;E--)S=M[E],"."===S?M.splice(E,1):".."===S?(M.splice(E,1),z++):z&&(M.splice(E,1),z--);if(!_&&!w)for(;z--;z)M.unshift("..");!_||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),T&&"/"!==M.join("/").substr(-1)&&M.push("");var L=""===M[0]||M[0]&&"/"===M[0].charAt(0);if(k){n.hostname=n.host=L?"":M.length?M.shift():"";var A=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");A&&(n.auth=A.shift(),n.host=n.hostname=A.shift())}return _=_||n.host&&M.length,_&&!L&&M.unshift(""),M.length?n.pathname=M.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),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(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,b=["{","}"];if(p(e)&&(y=!0,b=["[","]"]),S(e)){v=" [Function"+(e.name?": "+e.name:"")+"]"}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 b[0]+v+b[1];if(r<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var _;return _=y?f(t,e,r,m,o):o.map(function(n){return h(t,e,r,m,n,y)}),t.seen.pop(),d(_,v,b)}function u(t,e){if(_(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")),_(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;return t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>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 b(t){return"symbol"==typeof t}function _(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||void 0===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(),P[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}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;a0||n.explicitOff.length>0}function i(t,e){var n,r=a(t,e),i=r.on,s=r.off.concat(r.explicitOff),l={};if(i.length||s.length){for(n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var r=F.selectAll("a");if(1===r.size()&&r.text()===F.text()){z.insert("a",":first-child").attr({"xlink:xlink:href":r.attr("xlink:href"),"xlink:xlink:show":r.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}F.selectAll("tspan.line").attr({y:0,x:0});var i=z.select(".annotation-math-group"),d=!i.empty(),p=h.bBox((d?i:F).node()),x=p.width,L=p.height,O=b.width||x,R=b.height||L,j=Math.round(O+2*I),N=Math.round(R+2*I);b._w=O,b._h=R;var B=!1;if(["x","y"].forEach(function(e){var r,i,a,o,s,f=b[e+"ref"]||e,h=b["a"+e+"ref"],d=c.getFromId(t,f),p=(A+("x"===e?0:-90))*Math.PI/180,m=j*Math.cos(p),g=N*Math.sin(p),v=Math.abs(m)+Math.abs(g),x=b[e+"anchor"],_=b[e+"shift"]*("x"===e?1:-1),w=k[e];if(d){var M=d.r2fraction(b[e]);if((t._dragging||!d.autorange)&&(M<0||M>1)&&(h===f?((M=d.r2fraction(b["a"+e]))<0||M>1)&&(B=!0):B=!0,B))return;r=d._offset+d.r2p(b[e]),o=.5}else"x"===e?(a=b[e],r=y.l+y.w*a):(a=1-b[e],r=y.t+y.h*a),o=b.showarrow?.5:a;if(b.showarrow){w.head=r;var S=b["a"+e];s=m*n(.5,b.xanchor)-g*n(.5,b.yanchor),h===f?(w.tail=d._offset+d.r2p(S),i=s):(w.tail=r+S,i=s+S),w.text=w.tail+s;var T=l["x"===e?"width":"height"];if("paper"===f&&(w.head=u.constrain(w.head,1,T-1)),"pixel"===h){var z=-Math.max(w.tail-3,w.text),E=Math.min(w.tail+3,w.text)-T;z>0?(w.tail+=z,w.text+=z):E>0&&(w.tail-=E,w.text-=E)}w.tail+=_,w.head+=_}else s=v*n(o,x),i=s,w.text=r+s;w.text+=_,s+=_,i+=_,b["_"+e+"padplus"]=v/2+i,b["_"+e+"padminus"]=v/2-i,b["_"+e+"size"]=v,b["_"+e+"shift"]=s}),B)return void z.remove();var q=0,V=0;if("left"!==b.align&&(q=(O-x)*("center"===b.align?.5:1)),"top"!==b.valign&&(V=(R-L)*("middle"===b.valign?.5:1)),d)i.select("svg").attr({x:I+q-1,y:I+V}).call(h.setClipUrl,C?_:null);else{var U=I+V-p.top,H=I+q-p.left;F.attr({x:H,y:U}).call(h.setClipUrl,C?_:null),F.selectAll("tspan.line").attr({y:U,x:H})}P.select("rect").call(h.setRect,I,I,O,R),D.call(h.setRect,E/2,E/2,j-E,N-E),z.call(h.setTranslate,Math.round(k.x.text-j/2),Math.round(k.y.text-N/2)),T.attr({transform:"rotate("+A+","+k.x.text+","+k.y.text+")"});var G="annotations["+e+"]",Z=function(n,r){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i=k.x.head,l=k.y.head,c=k.x.tail+n,d=k.y.tail+r,p=k.x.text+n,m=k.y.text+r,x=u.rotationXYMatrix(A,p,m),_=u.apply2DTransform(x),E=u.apply2DTransform2(x),L=+D.attr("width"),I=+D.attr("height"),C=p-.5*L,P=C+L,O=m-.5*I,F=O+I,R=[[C,O,C,F],[C,F,P,F],[P,F,P,O],[P,O,C,O]].map(E);if(!R.reduce(function(t,e){return t^!!a(i,l,i+1e6,l+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=a(c,d,i,l,t[0],t[1],t[2],t[3]);e&&(c=e.x,d=e.y)});var j=b.arrowwidth,N=b.arrowcolor,B=S.append("g").style({opacity:f.opacity(N)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),q=B.append("path").attr("d","M"+c+","+d+"L"+i+","+l).style("stroke-width",j+"px").call(f.stroke,f.rgb(N));if(v(q,b.arrowhead,"end",b.arrowsize,b.standoff),t._context.editable&&q.node().parentNode){var V=i,U=l;if(b.standoff){var H=Math.sqrt(Math.pow(i-c,2)+Math.pow(l-d,2));V+=b.standoff*(c-i)/H,U+=b.standoff*(d-l)/H}var Z,X,Y,W=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(c-V)+","+(d-U),transform:"translate("+V+","+U+")"}).style("stroke-width",j+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");g.init({element:W.node(),prepFn:function(){var t=h.getTranslate(z);X=t.x,Y=t.y,Z={},w&&w.autorange&&(Z[w._name+".autorange"]=!0),M&&M.autorange&&(Z[M._name+".autorange"]=!0)},moveFn:function(t,e){var n=_(X,Y),r=n[0]+t,i=n[1]+e;z.call(h.setTranslate,r,i),Z[G+".x"]=w?w.p2r(w.r2p(b.x)+t):b.x+t/y.w,Z[G+".y"]=M?M.p2r(M.r2p(b.y)+e):b.y-e/y.h,b.axref===b.xref&&(Z[G+".ax"]=w.p2r(w.r2p(b.ax)+t)),b.ayref===b.yref&&(Z[G+".ay"]=M.p2r(M.r2p(b.ay)+e)),B.attr("transform","translate("+t+","+e+")"),T.attr({transform:"rotate("+A+","+r+","+i+")"})},doneFn:function(e){if(e){s.relayout(t,Z);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};if(b.showarrow&&Z(0,0),t._context.editable){var X,Y;g.init({element:z.node(),prepFn:function(){Y=T.attr("transform"),X={}},moveFn:function(t,e){var n="pointer";if(b.showarrow)b.axref===b.xref?X[G+".ax"]=w.p2r(w.r2p(b.ax)+t):X[G+".ax"]=b.ax+t,b.ayref===b.yref?X[G+".ay"]=M.p2r(M.r2p(b.ay)+e):X[G+".ay"]=b.ay+e,Z(t,e);else{if(w)X[G+".x"]=b.x+t/w._m;else{var r=b._xsize/y.w,i=b.x+(b._xshift-b.xshift)/y.w-r/2;X[G+".x"]=g.align(i+t/y.w,r,0,1,b.xanchor)}if(M)X[G+".y"]=b.y+e/M._m;else{var a=b._ysize/y.h,o=b.y-(b._yshift+b.yshift)/y.h-a/2;X[G+".y"]=g.align(o-e/y.h,a,0,1,b.yanchor)}w&&M||(n=g.getCursor(w?.5:X[G+".x"],M?.5:X[G+".y"],b.xanchor,b.yanchor))}T.attr({transform:"translate("+t+","+e+")"+Y}),m(z,n)},doneFn:function(e){if(m(z),e){s.relayout(t,X);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var i=t.layout,l=t._fullLayout,y=t._fullLayout._size;l._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var x=(i.annotations||[])[e],b=l.annotations[e],_="clip"+l._uid+"_ann"+e;if(!x||b.visible===!1)return void o.selectAll("#"+_).remove();var w=c.getFromId(t,b.xref),M=c.getFromId(t,b.yref),k={x:{},y:{}},A=+b.textangle||0,S=l._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",b.opacity),T=S.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),z=T.append("g").style("pointer-events",b.captureevents?"all":null).call(m,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:x,fullAnnotation:b,event:o.event})});b.hovertext&&z.on("mouseover",function(){var e=b.hoverlabel,n=e.font,r=this.getBoundingClientRect(),i=t.getBoundingClientRect();d.loneHover({x0:r.left-i.left,x1:r.right-i.left,y:(r.top+r.bottom)/2-i.top,text:b.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:l._hoverlayer.node(),outerContainer:l._paper.node()})}).on("mouseout",function(){d.loneUnhover(l._hoverlayer.node())});var E=b.borderwidth,L=b.borderpad,I=E+L,D=z.append("rect").attr("class","bg").style("stroke-width",E+"px").call(f.stroke,b.bordercolor).call(f.fill,b.bgcolor),C=b.width||b.height,P=l._defs.select(".clips").selectAll("#"+_).data(C?[0]:[]);P.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),P.exit().remove();var O=b.font,F=z.append("text").classed("annotation",!0).attr("data-unformatted",b.text).text(b.text);t._context.editable?F.call(p.makeEditable,z).call(n).on("edit",function(r){b.text=r,this.attr({"data-unformatted":b.text}),this.call(n);var i={};i["annotations["+e+"].text"]=b.text,w&&w.autorange&&(i[w._name+".autorange"]=!0),M&&M.autorange&&(i[M._name+".autorange"]=!0),s.relayout(t,i)}):F.call(n)}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("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),f=t("../color"),h=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),g=t("../dragelement"),v=t("./draw_arrow_head");e.exports={draw:r,drawOne:i}},{"../../lib":337,"../../lib/setcursor":352,"../../lib/svg_text_utils":354,"../../plotly":367,"../../plots/cartesian/axes":372,"../../plots/plots":407,"../color":225,"../dragelement":246,"../drawing":249,"../fx":266,"./draw_arrow_head":222,d3:8}],222:[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,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(n,i){d.path&&(e>5&&(i=0),r.select(h.parentElement).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+n.x+","+n.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:x,opacity:b,"stroke-width":0}))}i(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof n&&n||(n="end");var p,m,g,v,y=(o.getPx(t,"stroke-width")||1)*l,x=t.style("stroke")||a.defaultLine,b=t.style("stroke-opacity")||1,_=n.indexOf("start")>=0,w=n.indexOf("end")>=0,M=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},m={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-m.x,A=p.y-m.y;if(g=Math.atan2(A,k),v=g+Math.PI,M){if(M*M>k*k+A*A)return void c();var S=M*Math.cos(g),T=M*Math.sin(g);_&&(p.x-=S,p.y-=T,t.attr({x1:p.x,y1:p.y})),w&&(m.x+=S,m.y+=T,t.attr({x2:m.x,y2:m.y}))}}else if("path"===h.nodeName){var z=h.getTotalLength(),E="";if(z=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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={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(o).toRgbString()},o.contrast=function(t,e,n){var r=i(t);return 1!==r.getAlpha()&&(r=i(o.combine(t,u))),(r.isDark()?e?r.lighten(e):u:n?r.darken(n):l).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"===_.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(_.line.color&&_.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))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,I(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",c.syncOrAsync([function(){return l.doTicks(t,K,!0)},function(){if(["top","bottom"].indexOf(_.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:_.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=b();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+_.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(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-X-S.l,n=Math.max(n,r)}var a=2*_.xpad+n+_.borderwidth+_.outlinewidth/2,s=Q-J;at.select(".cbbg").attr({x:X-_.xpad-(_.borderwidth+_.outlinewidth)/2,y:J-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:X,y:J+_.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("+(S.l-l)+","+S.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 A=t._fullLayout,S=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var T,z=r.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),E=[],L=[],I="function"==typeof _.line.color?_.line.color:function(){return _.line.color},D="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},C=_.levels.end+_.levels.size/100,P=_.levels.size,O=1.001*z[0]-.001*z[1],F=1.001*z[1]-.001*z[0];for(T=_.levels.start;(T-C)*P<0;T+=P)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(_.levels.start)/_.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(_.titleside)!==-1){var lt,ut=S.l+(_.x+H)*S.w,ct=K.titlefont.size;lt="top"===_.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,_.xanchor),pt=u.align(W-e/S.h,U,0,1,_.yanchor);var n=u.getCursor(dt,pt,_.xanchor,_.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},b().index)}})}return ft}function b(){var n,r,i=e.substr(2);for(n=0;n=0?i.Reds:i.Blues,l.colorscale=m,s.reversescale&&(m=a(m)),s.colorscale=m)}},{"../../lib":337,"./flip_scale":236,"./scales":243}],232:[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":332,"./attributes":230,"./scales.js":243}],233:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":243}],234:[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;u(f+h+"auto",!(r(g)&&r(v)&&g=0;i--,a++)e=t[i],r[a]=[1-e[0],e[1]];return r}},{}],237:[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":233,"./is_valid_scale_array":241,"./scales":243}],238:[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}},{}],245:[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":337}],246:[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=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return t.element.onmousemove=m,g._dragged=!1,g._dragging=!0,c=e.clientX,f=e.clientY,p=e.target,h=(new Date).getTime(),h-g._mouseDownTimey&&(v=Math.max(v-1,1)),t.doneFn&&t.doneFn(g._dragged,v,e),!g._dragged){var n;try{n=new MouseEvent("click",e)}catch(t){n=document.createEvent("MouseEvents"),n.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(n)}return i(g),g._dragged=!1,o.pauseEvent(e)}var c,f,h,d,p,m,g=o.getPlotDiv(t.element)||{},v=1,y=l.DBLCLICKDELAY;g._mouseDownTime||(g._mouseDownTime=0),m=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=r},{"../../constants/interactions":321,"../../lib":337,"../../plotly":367,"../../plots/cartesian/constants":377,"./align":244,"./cursor":245,"./unhover":247}],247:[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,i=t._hoverdata;e||(e={}),e.target&&r.triggerHandler(t,"plotly_beforehover",e)===!1||(n._hoverlayer.selectAll("g").remove(),n._hoverlayer.selectAll("line").remove(),n._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":331}],248:[function(t,e,n){"use strict";n.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],249:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o,s){if(l.traceIs(n,"symbols")){var c=m(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:p.isBubble(n)?c(t.ms):(a.size||6)/2,t.mrc=e;var r=g.symbolNumber(t.mx||a.symbol)||0,i=r%100;return t.om=r%200>=100,g.symbolFuncs[i](e)+(r>=200?x:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var f,h,d,v=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=a.outliercolor):(d=(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)?u.defaultLine:o.color,Array.isArray(a.color)&&(f=u.defaultLine,v=!0),f="mc"in t?t.mcc=r(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var y=a.gradient,b=t.mgt;if(b?v=!0:b=y&&y.type,b&&"none"!==b){var _=t.mgc;_?v=!0:_=y.color;var w="g"+s._fullLayout._uid+"-"+n.uid;v&&(w+="-"+t.i),e.call(g.gradient,s,w,b,f,_)}else e.call(u.fill,f);d&&e.call(u.stroke,h)}}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,M/2),c=Math.pow(s*s+l*l,M/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("tinycolor2"),l=t("../../registry"),u=t("../color"),c=t("../colorscale"),f=t("../../lib"),h=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),m=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(u.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,i){t.call(g.setPosition,e,n).call(g.setSize,r,i)},g.translatePoint=function(t,e,n,r){var i=t.xp||n.c2p(t.x),a=t.yp||r.c2p(t.y);return o(i)&&o(a)&&e.node()?("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0):(e.remove(),!1)},g.translatePoints=function(t,e,n,r){t.each(function(t){var i=a.select(this);g.translatePoint(t,i,e,n,r)})},g.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},g.crispRound=function(t,e,n){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},g.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||"";u.stroke(e,r||a.color),g.dashLine(e,s,o)},g.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(u.stroke,n||i.color).call(g.dashLine,s,o)})},g.dashLine=function(t,e,n){n=+n||0,e=g.dashStyle(e,n),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},g.dashStyle=function(t,e){e=+e||1;var n=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=n+"px,"+n+"px":"dash"===t?t=3*n+"px,"+3*n+"px":"longdash"===t?t=5*n+"px,"+5*n+"px":"dashdot"===t?t=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===t&&(t=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t},g.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=a.select(this);try{n.call(u.fill,e[0].trace.fillcolor)}catch(e){f.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 y=g.symbolNames.length,x="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>=y||t>=400?0:Math.floor(Math.max(t,0))};var b={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};g.gradient=function(t,e,n,r,i,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+n).data([r+i+o],f.identity);l.exit().remove(),l.enter().append("radial"===r?"radialGradient":"linearGradient").each(function(){var t=a.select(this);"horizontal"===r?t.attr(b):"vertical"===r&&t.attr(_),t.attr("id",n);var e=s(i),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+n+")","fill-opacity":null})},g.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},g.singlePointStyle=function(t,e,n,i,a,o){var s=n.marker;r(t,e,n,i,a,s,s.line,o)},g.pointStyle=function(t,e){if(t.size()){var n=e.marker,r=g.tryColorscale(n,""),i=g.tryColorscale(n,"line"),o=f.getPlotDiv(t.node());t.each(function(t){g.singlePointStyle(t,a.select(this),e,r,i,o)})}},g.tryColorscale=function(t,e){var n=e?f.nestedProperty(t,e).get():t,r=n.colorscale,i=n.color;return r&&Array.isArray(i)?c.makeColorScaleFunc(c.extractScale(r,n.cmin,n.cmax)):f.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};g.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(g.font,t.tf||e.textfont.family,u,t.tc||e.textfont.color).attr("text-anchor",l).text(r).call(h.convertToTspans);var f=a.select(this.parentNode),d=n.selectAll("tspan.line"),p=1.3*((d[0].length||1)-1)+1,m=w[l]*c,v=.75*u+w[s]*c+(w[s]-1)*p*u/2;f.attr("transform","translate("+m+","+v+")"),p>1&&d.attr({x:n.attr("x"),y:n.attr("y")})})};var M=.5;g.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],a=[];for(n=1;n=1e4&&(a.selectAll("[data-bb]").attr("data-bb",null),S=[]),t.setAttribute("data-bb",S.length),S.push(l),f.extendFlat({},l)},g.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.split("#")[0]+n),t.attr("clip-path","url("+n+")")},g.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",n=t[e]("transform")||"",r=n.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+r[0]||0,y:+r[1]||0}},g.setTranslate=function(t,e,n){var r=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[r]("transform")||"";return e=e||0,n=n||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a+=" translate("+e+", "+n+")",a=a.trim(),t[i]("transform",a),a},g.getScale=function(t){var e=t.attr?"attr":"getAttribute",n=t[e]("transform")||"",r=n.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+r[0]||1,y:+r[1]||1}},g.setScale=function(t,e,n){var r=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[r]("transform")||"";return e=e||1,n=n||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a+=" scale("+e+", "+n+")",a=a.trim(),t[i]("transform",a),a},g.setPointGroupScale=function(t,e,n){var r,i,a;return e=e||1,n=n||1,i=1===e&&1===n?"":" scale("+e+","+n+")",a=/\s*sc.*/,t.each(function(){r=(this.getAttribute("transform")||"").replace(a,""),r+=i,r=r.trim(),this.setAttribute("transform",r)}),i};g.setTextPointsScale=function(t,e,n){t.each(function(){var t,r=a.select(this),i=r.select("text"),o=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(r.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===n?[]:["translate("+o+","+s+")","scale("+e+","+n+")","translate("+-o+","+-s+")"],l&&t.push(l),r.attr("transform",t.join(" "))})},g.measureText=function(t,e,n){var r=t.append("text").text(e).call(g.font,n),i=g.bBox(r.node());return r.remove(),i}},{"../../constants/xmlns_namespaces":324,"../../lib":337,"../../lib/svg_text_utils":354,"../../registry":415,"../../traces/scatter/make_bubble_size_func":441,"../../traces/scatter/subtypes":446,"../color":225,"../colorscale":239,"./symbol_defs":250,d3:8,"fast-isnumeric":12,tinycolor2:197}],250:[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);return"M-"+e+","+r.round(t/2,2)+"H"+e+"L0,-"+r.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+r.round(t/2,2)+"H"+e+"L0,"+r.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M"+r.round(t/2,2)+",-"+e+"V"+e+"L-"+r.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+r.round(t/2,2)+",-"+e+"V"+e+"L"+r.round(t,2)+",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);return"M"+e+","+a+"L"+n+","+r.round(.809*t,2)+"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);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+r.round(.382*e,2)+"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}],251:[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"}}}},{}],252:[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":446,d3:8,"fast-isnumeric":12}],257:[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":225,d3:8}],258:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},i.family,{arrayOk:!0}),size:r({},i.size,{arrayOk:!0}),color:r({},i.color,{arrayOk:!0})}}}},{"../../lib/extend":332,"../../plots/font_attributes":396}],259:[function(t,e,n){"use strict";function r(t,e,n){Array.isArray(t)&&(e[0][n]=t)}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=0;n=0&&n.indexJ.width||W<0||W>J.height)return x.unhoverRaw(t,e)}if(C="xval"in e?w.flat(r,e.xval):w.p2c(S,Y),P="yval"in e?w.flat(r,e.yval):w.p2c(T,W),!f(C[0])||!f(P[0]))return d.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var $=1/0;for(F=0;F1||j.hoverinfo.indexOf("name")!==-1?j.name:void 0,index:!1,distance:Math.min($,M.MAXDIST),color:y.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},h[N]&&(H.subplot=h[N]._subplot),G=Z.length,"array"===q){var K=e[F];"pointNumber"in K?(H.index=K.pointNumber,q="closest"):(q="","xval"in K&&(V=K.xval,q="x"),"yval"in K&&(U=K.yval,q=q?"closest":"y"))}else V=C[B],U=P[B];if(j._module&&j._module.hoverPoints){var tt=j._module.hoverPoints(H,V,U,q);if(tt)for(var et,nt=0;ntG&&(Z.splice(0,G),$=Z[0].distance)}if(0===Z.length)return x.unhoverRaw(t,e);Z.sort(function(t,e){return t.distance-e.distance});var rt=t._hoverdata,it=[];for(O=0;O1,lt=y.combine(h.plot_bgcolor||y.background,h.paper_bgcolor),ut={hovermode:D,rotateLabels:st,bgColor:lt,container:h._hoverlayer,outerContainer:h._paperdiv,commonLabelOpts:h.hoverlabel},ct=i(Z,ut);if(a(Z,st?"xa":"ya"),o(ct,st),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,it);g(c.select(e.target),ft?"pointer":"")}e.target&&u(t,e,rt)&&(rt&&t.emit("plotly_unhover",{event:e,points:rt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:S,yaxes:T,xvals:C,yvals:P}))}function i(t,e){var n,r,i=e.hovermode,a=e.rotateLabels,o=e.bgColor,s=e.container,l=e.outerContainer,u=e.commonLabelOpts||{},f=e.fontFamily||M.HOVERFONT,h=e.fontSize||M.HOVERFONTSIZE,d=t[0],p=d.xa,g=d.ya,x="y"===i?"yLabel":"xLabel",b=d[x],_=(String(b)||"").split(" ")[0],w=l.node().getBoundingClientRect(),A=w.top,S=w.width,T=w.height,z=d.distance<=M.MAXDIST&&("x"===i||"y"===i);for(n=0;n15&&(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):z&&t[i+"Label"]===b?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 d=e.select("text.nums").call(v.font,t.fontFamily||f,t.fontSize||h,t.fontColor||u).call(v.setPosition,0,0).text(r).attr("data-notex",1).call(m.convertToTspans);d.selectAll("tspan.line").call(v.setPosition,0,0);var p=e.select("text.name"),g=0;n&&n!==r?(p.call(v.font,t.fontFamily||f,t.fontSize||h,l).text(n).call(v.setPosition,0,0).attr("data-notex",1).call(m.convertToTspans),p.selectAll("tspan.line").call(v.setPosition,0,0),g=p.node().getBoundingClientRect().width+2*L):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var x,_,w=d.node().getBoundingClientRect(),M=t.xa._offset+(t.x0+t.x1)/2,I=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),P=w.width+E+L+g;t.ty0=A-w.top,t.bx=w.width+2*L,t.by=w.height+2*L,t.anchor="start",t.txwidth=w.width,t.tx2width=g,t.offset=0,a?(t.pos=M,x=I+C/2+P<=T,_=I-C/2-P>=0,"top"!==t.idealAlign&&x||!_?x?(I+=C/2,t.anchor="start"):t.anchor="middle":(I-=C/2,t.anchor="end")):(t.pos=I,x=M+D/2+P<=S,_=M-D/2-P>=0,"left"!==t.idealAlign&&x||!_?x?(M+=D/2,t.anchor="start"):t.anchor="middle":(M-=D/2,t.anchor="end")),d.attr("text-anchor",t.anchor),g&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+M+","+I+")"+(a?"rotate("+k+")":""))}),C}function a(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)?S: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 o(t,e){t.each(function(t){var n=c.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*(E+L),s=o+a*(t.txwidth+L),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*T),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*E+l)+","+(E+u)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+l)+"V"+(u-E)+"Z"),i.call(v.setPosition,o+l,u+t.ty0-t.by/2+L).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(n.select("text.name, text.name tspan.line").call(v.setPosition,s+a*L+l,u+t.ty0-t.by/2+L),n.select("rect").call(v.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function n(e,n,o){var s;if(a[n])s=a[n];else if(i[n]){var l=i[n];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(r,o).get();s&&(t[e]=s)}var r=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=b.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=b.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=b.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+b.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=b.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+b.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),f.indexOf("x")===-1&&(t.xLabel=void 0),f.indexOf("y")===-1&&(t.yLabel=void 0),f.indexOf("z")===-1&&(t.zLabel=void 0),f.indexOf("text")===-1&&(t.text=void 0),f.indexOf("name")===-1&&(t.name=void 0)),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),t}function l(t,e){var n=e.hovermode,r=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,f=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var m=o.spikemode,g=o.spikethickness,x=o.spikecolor||p,b=o._boundingBox,_=(b.left+b.right)/2=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 c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),m=t("../../lib/svg_text_utils"),g=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),x=t("../dragelement"),b=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),M=t("./constants"),k=M.YANGLE,A=Math.PI*k/180,S=1/Math.sin(A),T=Math.cos(A),z=Math.sin(A),E=M.HOVERARROWSIZE,L=M.HOVERTEXTPAD;n.hover=function(t,e,n){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME)return r(t,e,n),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):r,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:a},l=i([n],s);return o(l,s.rotateLabels),l.node()}},{"../../lib":337,"../../lib/events":331,"../../lib/override_cursor":346,"../../lib/svg_text_utils":354,"../../plots/cartesian/axes":372,"../../registry":415,"../color":225,"../dragelement":246,"../drawing":249,"./constants":261,"./helpers":263,d3:8,"fast-isnumeric":12,tinycolor2:197}],265:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,i){i=i||{},n("hoverlabel.bgcolor",i.bgcolor),n("hoverlabel.bordercolor",i.bordercolor),r.coerceFont(n,"hoverlabel.font",i.font)}},{"../../lib":337}],266:[function(t,e,n){"use strict";function r(t){var e=o.isD3Selection(t)?t:a.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,n){var r=t.hoverlabel||{},i=o.nestedProperty(r,n).get();return Array.isArray(i)?Array.isArray(e)&&Array.isArray(i[e[0]])?i[e[0]][e[1]]:i[e]:i}var a=t("d3"),o=t("../../lib"),s=t("../dragelement"),l=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:l.getDistanceFunction,getClosest:l.getClosest,inbox:l.inbox,castHoverOption:i,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":337,"../dragelement":246,"./attributes":258,"./calc":259,"./click":260,"./constants":261,"./defaults":262,"./helpers":263,"./hover":264,"./layout_attributes":267,"./layout_defaults":268,"./layout_global_defaults":269,d3:8}],267:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},i.family,{dflt:a.HOVERFONT}),size:r({},i.size,{dflt:a.HOVERFONTSIZE}),color:r({},i.color)}}}},{"../../lib/extend":332,"../../plots/font_attributes":396,"./constants":261}],268:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],276:[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":332,"../../plots/font_attributes":396,"../color/attributes":224}],277:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],278:[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)!==!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",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":337,"../../plots/layout_attributes":398,"../../registry":415,"./attributes":276,"./helpers":281}],279:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,function(){n.selectAll("tspan.line").attr({x:n.attr("x")}),t.call(o,e)})}var r=t.data()[0][0],i=e._fullLayout,a=r.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?r.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.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?c.call(y.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;i=o[o.length-1].direction+".name"}else i="name";f.restyle(e,i,t,l)}):c.call(n)}function i(t,e){var n,r=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeS&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){a(t,e,r) -},S):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,a(t,e,r))}})}function a(t,e,n){if(!e._dragged&&!e._editing){var r,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===n&&A&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),A=!1):A=!1,p.traceIs(l,"pie")){var d=o.label,m=a.indexOf(d);1===n?m===-1?a.push(d):a.splice(m,1):2===n&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&m===-1&&(a=[])),f.relayout(e,"hiddenlabels",a)}else{var g,v=[],y=[];for(g=0;gtspan"),f=c[0].length||1;n=s*f,r=u.node()&&g.bBox(u.node()).width;var h=s*(.3+(1-f)/2);u.attr("y",h),c.attr("y",h)}n=Math.max(n,16)+3,i.height=n,i.width=r}function s(t,e,n){var r=t._fullLayout,i=r.legend,a=i.borderwidth,o=M.isGrouped(i);if(M.isVertical(i))o&&e.each(function(t,e){g.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;g.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];c.select(this).select(".legendtoggle").call(g.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(),u=0,f=l.length;ur.width-(r.margin.r+r.margin.l)&&(y=0,p+=m,i.height=i.height+m,m=0),g.setTranslate(this,a+y,5+a+e.height/2+p),i.width+=o+n,i.height=Math.max(i.height,e.height),y+=o+n,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),n.each(function(e){var n=e[0];c.select(this).select(".legendtoggle").call(g.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";k.isRightAnchor(n)?r="right":k.isCenterAnchor(n)&&(r="center");var i="top";k.isBottomAnchor(n)?i="bottom":k.isMiddleAnchor(n)&&(i="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}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,n=e.legend,r="left";k.isRightAnchor(n)?r="right":k.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),m=t("../dragelement"),g=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),b=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),M=t("./helpers"),k=t("./anchor_utils"),A=!0,S=b.DBLCLICKDELAY;e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(g.setTranslate,0,e),L.call(g.setRect,N,t,x.scrollBarWidth,x.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,b=n.showlegend&&_(t.calcdata,y),M=n.hiddenlabels||[];if(!n.showlegend||!b.length)return n._infolayer.selectAll(".legend").remove(),n._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var A=n._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=n._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var z=A.selectAll("rect.bg").data([0]);z.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),z.call(v.stroke,y.bordercolor),z.call(v.fill,y.bgcolor),z.style("stroke-width",y.borderwidth+"px");var E=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=A.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 I=E.selectAll("g.groups").data(b);I.enter().append("g").attr("class","groups"),I.exit().remove();var D=I.selectAll("g.traces").data(h.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(w).style("opacity",function(t){var e=t[0].trace;return p.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(i,t)});var C=0!==A.enter().size();C&&(s(t,I,D),l(t));var P=n.width,O=n.height;s(t,I,D),y.height>O?u(t):l(t);var F=n._size,R=F.l+F.w*y.x,j=F.t+F.h*(1-y.y);k.isRightAnchor(y)?R-=y.width:k.isCenterAnchor(y)&&(R-=y.width/2),k.isBottomAnchor(y)?j-=y.height:k.isMiddleAnchor(y)&&(j-=y.height/2);var N=y.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),R<0&&(R=0),N=Math.min(P-R,y.width));var q=y.height,V=F.h;q>V?(j=F.t,q=V):(j+q>O&&(j=O-q),j<0&&(j=0),q=Math.min(O-j,y.height)),g.setTranslate(A,R,j);var U,H,G=q-x.scrollBarHeight-2*x.scrollBarMargin,Z=y.height-q;if(y.height<=q||t._context.staticPlot)z.attr({width:N-y.borderwidth,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),g.setTranslate(E,0,0),T.select("rect").attr({width:N-2*y.borderwidth,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),E.call(g.setClipUrl,o);else{U=x.scrollBarMargin,H=E.attr("data-scroll")||0,z.attr({width:N-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:N-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:q-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-H}),E.call(g.setClipUrl,o),C&&e(U,H),A.on("wheel",null),A.on("wheel",function(){H=h.constrain(E.attr("data-scroll")-c.event.deltaY/G*Z,-Z,0),U=x.scrollBarMargin-H/Z*G,e(U,H),0!==H&&H!==-Z&&c.event.preventDefault()}),L.on(".drag",null),E.on(".drag",null);var X=c.behavior.drag().on("drag",function(){U=h.constrain(c.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+G),H=-(U-x.scrollBarMargin)/G*Z,e(U,H)});L.call(X),E.call(X)}if(t._context.editable){var Y,W,Q,J;A.classed("cursor-move",!0),m.init({element:A.node(),prepFn:function(){var t=g.getTranslate(A);Q=t.x,J=t.y},moveFn:function(t,e){var n=Q+t,r=J+e;g.setTranslate(A,n,r),Y=m.align(n,0,F.l,F.l+F.w,y.xanchor),W=m.align(r,0,F.t+F.h,F.t,y.yanchor)},doneFn:function(e,r,i){if(e&&void 0!==Y&&void 0!==W)f.relayout(t,{"legend.x":Y,"legend.y":W});else{var o=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===r?A._clickTimeout=setTimeout(function(){a(o,t,r)},S):2===r&&(A._clickTimeout&&clearTimeout(A._clickTimeout),a(o,t,r)))}}})}}}},{"../../constants/interactions":321,"../../lib":337,"../../lib/svg_text_utils":354,"../../plotly":367,"../../plots/plots":407,"../../registry":415,"../color":225,"../dragelement":246,"../drawing":249,"./anchor_utils":275,"./constants":277,"./get_legend_data":280,"./helpers":281,"./style":283,d3:8}],280:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&i.isGrouped(e))l.indexOf(t)===-1?(l.push(t),u=!0,s[t]=[[n]]):s[t].push([n]);else{var r="~~i"+f;l.push(r),s[r]=[[n]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;an[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=l.select(this),i=t[0],a=(i.mlw+1||r.width+1)-1;e.style("stroke-width",a+"px").call(h.fill,i.mc||n.color),a&&e.call(h.stroke,i.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(){var t=e.line.width,n=l.select(this);n.style("stroke-width",t+"px").call(h.fill,e.fillcolor),t&&n.call(h.stroke,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.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var r=n.selectAll("g.legendsymbols").data([t]);r.enter().append("g").classed("legendsymbols",!0),r.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(r).each(i)}},{"../../lib":337,"../../registry":415,"../../traces/pie/style_one":424,"../../traces/scatter/subtypes":446,"../color":225,"../drawing":249,d3:8}],284:[function(t,e,n){"use strict";function r(t,e){var n,r,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,g=(1-p)/2;for(r=0;r1)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(["toggleSpikelines","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)){var p=i(e,n,l);f("x",p[0]),f("y",p[1]),a.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),a.coerceFont(f,"font",n.font);var m=f("bgcolor");f("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":337,"../color":225,"./attributes":288,"./button_attributes":289,"./constants":290}],292:[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;sZ&&r>X&&!t.shiftKey?p.getCursor(i/n,1-a/r):"move";m(e,o),G=o.split("-")[0]}function a(e){N=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),q=v.getDataToPixel(t,N),V=v.getDataToPixel(t,B,!0),U=v.getPixelToData(t,N),H=v.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(g=q(n.x0),y=V(n.y0),x=q(n.x1),b=V(n.y1),_=a+".x0",w=a+".y0",M=a+".x1",k=a+".y1"),gX&&(d[E]=n[C]=H(u),d[L]=n[P]=H(c)),h-f>Z&&(d[I]=n[O]=U(f),d[D]=n[F]=U(h))}e.attr("d",o(t,n))}var d,g,y,x,b,_,w,M,k,A,S,T,z,E,L,I,D,C,P,O,F,R,j,N,B,q,V,U,H,G,Z=10,X=10,Y={setCursor:i,element:e.node(),prepFn:a,doneFn:s},W=Y.element.getBoundingClientRect();p.init(Y)}function o(t,e){var n,r,i,a,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=v.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},u?(i=v.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(r=v.decodeDate(r)),u&&"date"===u.type&&(a=v.decodeDate(a)),s(e.path,r,a);var h=r(e.x0),d=r(e.x1),p=a(e.y0),m=a(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+m;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+m+"H"+h+"Z";var g=(h+d)/2,y=(p+m)/2,x=Math.abs(g-h),b=Math.abs(y-p),_="A"+x+","+b,w=g+x+","+y;return"M"+w+_+" 0 1,1 "+g+","+(y-b)+_+" 0 0,1 "+w+"Z"}function s(t,e,n){return t.replace(g.segmentRE,function(t){var r=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i],l=t.substr(1).replace(g.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.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,n){return t.replace(g.segmentRE,function(t){var r=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i];return i+t.substr(1).replace(g.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),m=t("../../lib/setcursor"),g=t("./constants"),v=t("./helpers");e.exports={draw:r,drawOne:i}},{"../../lib":337,"../../lib/setcursor":352,"../../plotly":367,"../../plots/cartesian/axes":372,"../color":225,"../dragelement":246,"../drawing":249,"./constants":303,"./helpers":306}],306:[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}},{}],307:[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":301,"./calc_autorange":302,"./defaults":304,"./draw":305}],308:[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)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],m={_fullLayout:n},g=i.coerceRef(t,e,m,p,"","paper");if("path"!==f){var v,y,x;"paper"!==g?(v=i.getFromId(m,g),x=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=x=r.identity;var b=p+"0",_=p+"1",w=t[b],M=t[_];t[b]=y(t[b],!0),t[_]=y(t[_],!0),i.coercePosition(e,m,u,g,b,.25),i.coercePosition(e,m,u,g,_,.75),e[b]=x(e[b]),e[_]=x(e[_]),t[b]=w,t[_]=M}}return"path"===f?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":337,"../../plots/cartesian/axes":372,"./attributes":301,"./helpers":306}],309:[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":332,"../../plots/animation_attributes":368,"../../plots/font_attributes":396,"../../plots/pad_attributes":406,"./constants":310}],310:[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}},{}],311:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(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),r("currentvalue.visible")&&(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;l=n.steps.length&&(n.active=0),e.call(s,n).call(b,n).call(c,n).call(p,n).call(x,t,n).call(l,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(g,n,n.active/(n.steps.length-1),!1),e.call(s,n)}function s(t,e,n){if(e.currentvalue.visible){var r,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-z.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":r=.5*e.inputAreaLength,i="middle";break;default:r=z.currentValueInset,i="left"}a.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",i);var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof n)o+=n;else{o+=e.steps[e.active].label}return e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(S.convertToTspans),A.setTranslate(a,r,e.currentValueHeight),a}}function l(t,e,n){var r=t.selectAll("rect."+z.gripRectClass).data([0]);r.enter().append("rect").classed(z.gripRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:z.gripWidth,height:z.gripHeight,rx:z.gripRadius,ry:z.gripRadius}).call(k.stroke,n.bordercolor).call(k.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function u(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),r.call(A.font,n.font).text(e.step.label).call(S.convertToTspans),r}function c(t,e){var n=t.selectAll("g."+z.labelsClass).data([0]);n.enter().append("g").classed(z.labelsClass,!0);var r=n.selectAll("g."+z.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(z.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(u,t,e),A.setTranslate(n,v(e,t.fraction),z.tickOffset+e.ticklen+e.labelHeight+z.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,i){var a=Math.round(r*(n.steps.length-1));a!==n.active&&h(t,e,n,a,!0,i)}function h(t,e,n,r,i,a){var o=n.active;n._input.active=n.active=r;var l=n.steps[n.active];e.call(g,n,n.active/(n.steps.length-1),a),e.call(s,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(M.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,n){function r(){return n.data()[0]}var i=n.node(),a=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var o=n.select("."+z.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,n,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=r(),a=y(t,w.mouse(i)[0]);f(e,n,t,a,!1)}),a.on("mouseup",function(){var t=r();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+z.tickRectClass).data(e.steps);n.enter().append("rect").classed(z.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,i=w.select(this);i.attr({height:r?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,v(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?z.tickOffset:z.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.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(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(k.fill,n.bgcolor).attr("opacity",0),A.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(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.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(s.enter().append("g").classed(z.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==n.length){var l=s.selectAll("g."+z.groupClassName).data(n,i);l.enter().append("g").classed(z.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var m={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[x.side];e.attr("transform","translate("+m+")")}}}var m=n.propContainer,g=n.propName,v=n.traceIndex,y=n.dfltName,x=n.avoid||{},b=n.attributes,_=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(h);var I="Click to enter "+y+" title";t._context.editable?(E?L.on(".opacity",null):function(){T=0,z=!0,E=I,L.attr({"data-unformatted":E}).text(E).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),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(h)}).on("input",function(t){this.text(t||" ").attr(b).selectAll("tspan.line").attr(b)})):E&&!E.match(/Click to enter .+ title/)||L.remove(),L.classed("js-placeholder",z)}},{"../../constants/interactions":321,"../../lib":337,"../../lib/svg_text_utils":354,"../../plotly":367,"../../plots/plots":407,"../color":225,"../drawing":249,d3:8,"fast-isnumeric":12}],315:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":332,"../../plots/font_attributes":396,"../../plots/pad_attributes":406,"../color/attributes":224}],316:[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"}},{}],317:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(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(a.enter().append("g").classed(z.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==n.length){var c=a.selectAll("g."+z.headerGroupClassName).data(n,i);c.enter().append("g").classed(z.headerGroupClassName,!0);var f=a.selectAll("g."+z.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(z.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,S=r.barLength+2*r.barPad,T=r.barWidth+2*r.barPad,z=p,E=g+v;E+T>u&&(E=u-T);var L=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,r.barColor),A?(this.hbar=L.attr({rx:r.barRadius,ry:r.barRadius,x:z,y:E,width:S,height:T}),this._hbarXMin=z+S/2,this._hbarTranslateMax=M-S):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var I=v>k,D=r.barWidth+2*r.barPad,C=r.barLength+2*r.barPad,P=p+m,O=g;P+D>l&&(P=l-D);var F=this.container.selectAll("rect.scrollbar-vertical").data(I?[0]:[]);F.exit().on(".drag",null).remove(),F.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,r.barColor),I?(this.vbar=F.attr({rx:r.barRadius,ry:r.barRadius,x:P,y:O,width:D,height:C}),this._vbarYMin=O+C/2,this._vbarTranslateMax=k-C):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,j=c-.5,N=I?f+D+.5:f+.5,B=h-.5,q=A?d+T+.5:d+.5,V=s._topdefs.selectAll("#"+R).data(A||I?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",R).append("rect"),A||I?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(q)-Math.floor(B)}),this.container.call(o.setClipUrl,R),this.bg.attr({x:p,y:g,width:m,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||I){var U=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(U);var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(H),I&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(s.constrain(i.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=s.constrain(t||0,0,n),e=s.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/n;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/r;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":337,"../color":225,"../drawing":249,d3:8}],321:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],322:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],323:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],324:[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}},{}],325:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.27.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/fx"),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=t("./components/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":223,"./components/fx":266,"./components/images":274,"./components/legend":282,"./components/rangeselector":294,"./components/rangeslider":300,"./components/shapes":307,"./components/sliders":313,"./components/updatemenus":319,"./fonts/mathjax_config":326,"./lib/queue":349,"./plot_api/plot_schema":361,"./plot_api/register":362,"./plot_api/set_plot_config":363,"./plot_api/to_image":365,"./plot_api/validate":366,"./plotly":367,"./snapshot":420,"./snapshot/download":417,"./traces/scatter":436,d3:8,"es6-promise":10}],326:[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},{}],327:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),r(t)?Number(t):i}},{"../constants/numerical":322,"fast-isnumeric":12}],328:[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;if("string"==typeof t&&t.substr(0,r)===n&&s.test(t.substr(r)))return void e.set(t);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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+o}return r}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),g=t("../constants/numerical"),v=g.BADNUM,y=g.ONEDAY,x=g.ONEHOUR,b=g.ONEMIN,_=g.ONESEC,w=g.EPOCHJD,M=t("../registry"),k=h.time.format.utc,A=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var S,T;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*b,t>=S&&t<=T?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var i=r(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return v;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var g="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,g),c)}else p=m.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*x+h*b+d*_:v}l=2===l.length?(Number(l)+2e3-A)%100+A:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*_},S=n.MIN_MS=n.dateTime2ms("-9999"),T=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==v};var z=90*y,E=3*x,L=5*b;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=S&&t<=T))return v;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*m(t+.05,1)),h=Math.round(t-f/10);if(r(n)){var d=Math.floor(h/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(n).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=S+y&&t<=T-y))return v;var e=Math.floor(10*m(t+.05,1)),n=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,i){if(n.isJSDate(t)||"number"==typeof t){if(r(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,i))return p("unrecognized date",t),e;return t};var I=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],C=k("%Y"),P=k("%b %Y"),O=k("%b %-d"),F=k("%b %-d, %Y");n.formatDate=function(t,e,n,i){var a,h;if(i=r(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===n?h=l(p):"m"===n?h=u(p):"d"===n?(a=l(p),h=c(p)):(a=f(p),h=s(t,n))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===n?h=C(m):"m"===n?h=P(m):"d"===n?(a=C(m),h=O(m)):(a=F(m),h=s(t,n))}return h+(a?"\n"+a:"")};var R=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var i=m(t,y);if(t=Math.round(t-i),n)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(n),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+n)}var l=new Date(t+R);return l.setUTCMonth(l.getUTCMonth()+e)+i-R},n.findExactDates=function(t,e){for(var n,i,a=0,o=0,s=0,l=0,u=r(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},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.simpleMap=function(t,e,n,r){for(var i=t.length,a=new Array(i),o=0;o-1||1/0!==c&&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)<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.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":327,"./coerce":328,"./dates":329,"./ensure_array":330,"./extend":332,"./filter_unique":333,"./filter_visible":334,"./identity":336,"./is_array":338,"./is_plain_object":339,"./loggers":340,"./matrix":341,"./mod":342,"./nested_property":343,"./noop":344,"./notifier":345,"./push_unique":348,"./relink_private":350,"./search":351,"./stats":353,"./to_log_range":355,d3:8}],338:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],339:[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}},{}],340:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){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][0],a=t[e][1],l=!1,d(r))for(n=r.length-1;n>=0;n--)i(r[n],o(a,n))?l?r[n]=void 0:r.pop():l=!0;else if("object"==typeof r&&null!==r)for(s=Object.keys(r),l=!1,n=s.length-1;n>=0;n--)i(r[s[n]],o(a,s[n]))?delete r[s[n]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),m=t("../plot_api/container_array_match");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 n,i,o,s=0,l=e.split(".");s/g),s=0;so||r===i||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],u=t[1];if(n===i||no||u===i||ul)return!1;var c,f,h,d,p,m=r.length,g=r[0][0],v=r[0][1],y=0;for(c=1;cMath.max(f,g)||u>Math.max(h,v)))if(uc||Math.abs(r(o,h))>i)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(a+1);for(var u=l+1;u1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":322,"./matrix":341}],348:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;na.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}],354:[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-"+d.randstr([],64),a=h.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=h.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())d.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":"")+(v[r]||"");if("br"===r)return"
";var a,o=e[4];if("a"===r){var s=o&&o.match(S),u=s&&(s[3]||s[4]);if(a="':a+">"}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,h=t("d3"),d=t("../lib"),p=t("../constants/xmlns_namespaces"),m=t("../constants/string_mappings");n.getDOMParser=function(){if(f)return f;if(window.DOMParser)return f=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},h.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),r=n.getDOMParser(),i=r.parseFromString(e,"application/xml"),a=i.documentElement.firstChild;a;)this.node().appendChild(this.node().ownerDocument.importNode(a,!0)),a=a.nextSibling;return i.querySelector("parsererror")?(d.log(i.querySelector("parsererror div").textContent),null):h.select(this.node().lastChild)},n.html_entity_decode=function(t){var e=h.select("body").append("div").style({display:"none"}).html(""),n=t.replace(/(&[^;]*;)/gi,function(t){return"<"===t?"<":"&rt;"===t?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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(){f.empty()||(p=s.attr("class")+"-math",f.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,f=h.select(s.node().parentNode);if(!f.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",f.selectAll("svg."+p).remove(),f.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=d.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){f.selectAll("svg."+p).remove(),f.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return n(),void t();var u=f.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=r(l,"width"),d=r(l,"height"),m=+s.attr("x")-h*{start:0,middle:.5,end:1}[s.attr("text-anchor")||"start"],g=parseInt(s.style("font-size"),10)||r(s,"height"),v=-g/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-h/2,v-d/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:v-d/2}):"a"===p[0]?l.attr({x:0,y:v}):l.attr({x:m,y:+s.attr("y")+v-d/2}),e&&e.call(s,u),t(u)})}))}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:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},v={sup:'',sub:''},y=["http:","https:","mailto:"],x=new RegExp("]*)?/?>","g"),b=Object.keys(m.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:m.entityToUnicode[t]}}),_=Object.keys(m.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+m.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,M=/(<[^<>]*>)/,k=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,S=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,T=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(x," ")},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]")&&h.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=d.getPlotDiv(o.node()),e=h.select(t),r=e.select(".svg-container"),a=r.append("div");a.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,r,n)).on("blur",function(){t._editing=!1,o.text(this.textContent).style({opacity:1});var e,n=h.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(o.node().parentNode).select(e).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 e=this;t._editing=!0,h.select(document).on("mouseup",function(){if(h.event.target===e)return!1;document.activeElement===a.node()&&a.node().blur()})}).on("keyup",function(){27===h.event.which?(t._editing=!1,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,r,n)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(i)}n||(n={});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"}),n.immediate?r():u.on("click",r),h.rebind(this,s,"on")}},{"../constants/string_mappings":323,"../constants/xmlns_namespaces":324,"../lib":337,d3:8}],355:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":12}],356:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,i=r.layoutArrayContainers,a=r.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)} -var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 i=h.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!m&&(h(g,v),d(t),!0)}var x,b,_,w,M,k,A,S=Object.keys(n).map(Number).sort(s),T=e.get(),z=T||[],E=r(v,f).get(),L=[],I=-1,D=z.length;for(x=0;xz.length-(A?0:1))o.warn("index out of range",f,_);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),c(k)?L.push(_):A?("add"===k&&(k={}),z.splice(_,0,k),E&&E.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,k),I===-1&&(I=_);else for(b=0;b=0;x--)z.splice(L[x],1),E&&E.splice(L[x],1);if(z.length?T||e.set(z):e.set(null),m)return!1;if(h(g,v),p!==a){var C;if(I===-1)C=S;else{for(D=Math.max(z.length,D),C=[],x=0;x=I);x++)C.push(_);for(x=I;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&s(t,n,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lN.range[0]?[1,2]:[2,1]);else{var V=N.range[0],U=N.range[1];B?(V<=0&&U<=0&&n(F+".autorange",!0),V<=0?V=U/1e6:U<=0&&(U=V/1e6),n(F+".range[0]",Math.log(V)/Math.LN10),n(F+".range[1]",Math.log(U)/Math.LN10)):(n(F+".range[0]",Math.pow(10,V)),n(F+".range[1]",Math.pow(10,U)))}else n(F+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,j,S,n),w.getComponentMethod("images","convertCoords")(t,j,S,n)}else n(F+".autorange",!0)}else if(D.match(C.AX_NAME_PATTERN)){var H=x.nestedProperty(u,k).get(),G=(S||{}).type;G&&"-"!==G||(G="linear"),w.getComponentMethod("annotations","convertCoords")(t,H,G,n),w.getComponentMethod("images","convertCoords")(t,H,G,n)}var Z=L.containerArrayMatch(k);if(Z){a=Z.array,o=Z.index;var X=Z.property,Y=x.nestedProperty(l,a),W=(Y||[])[o]||{};if(""===o)k.indexOf("updatemenus")===-1&&(g.docalc=!0);else if(""===X){var Q=S;L.isAddVal(S)?b[k]=null:L.isRemoveVal(S)?(b[k]=W,Q=W):x.warn("unrecognized full object value",e),(r(Q,"x")||r(Q,"y")&&k.indexOf("updatemenus")===-1)&&(g.docalc=!0)}else!r(W,"x")&&!r(W,"y")||x.containsAny(k,["color","opacity","align","dash","updatemenus"])||(g.docalc=!0);h[a]||(h[a]={});var J=h[a][o];J||(J=h[a][o]={}),J[X]=S,delete e[k]}else if("reverse"===D)R.range?R.range.reverse():(n(F+".autorange",!0),R.range=[1,0]),j.autorange?g.docalc=!0:g.doplot=!0;else{var $=String(A.parts[1]||"");0===E.indexOf("scene")?"camera"===A.parts[1]?g.docamera=!0:g.doplot=!0:0===E.indexOf("geo")?g.doplot=!0:0===E.indexOf("ternary")?g.doplot=!0:"paper_bgcolor"===k?g.doplot=!0:"margin"===E||"autorange"===$||"rangemode"===$||"type"===$||"domain"===$||"fixedrange"===$||"scaleanchor"===$||"scaleratio"===$||k.indexOf("calendar")!==-1||k.match(/^(bar|box|font)/)?g.docalc=!0:!u._has("gl2d")||k.indexOf("axis")===-1&&"plot_bgcolor"!==k?"hiddenlabels"===k?g.docalc=!0:E.indexOf("legend")!==-1?g.dolegend=!0:k.indexOf("title")!==-1?g.doticks=!0:E.indexOf("bgcolor")!==-1?g.dolayoutstyle=!0:T>1&&x.containsAny($,["tick","exponent","grid","zeroline"])?g.doticks=!0:k.indexOf(".linewidth")!==-1&&k.indexOf("axis")!==-1?g.doticks=g.dolayoutstyle=!0:T>1&&$.indexOf("line")!==-1?g.dolayoutstyle=!0:T>1&&"mirror"===$?g.doticks=g.dolayoutstyle=!0:"margin.pad"===k?g.doticks=g.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(k)!==-1||k.indexOf("spike")!==-1?g.domodebar=!0:["height","width","autosize"].indexOf(k)===-1&&(g.doplot=!0):g.doplot=!0,A.set(S)}}}for(a in h){L.applyContainerArrayChanges(t,x.nestedProperty(l,a),h[a],g)||(g.doplot=!0)}var K=u._axisConstraintGroups;for(var tt in _)for(o=0;o=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=I.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,I.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?g>=s.length?t.transitionOpts=s[g]:t.transitionOpts=s[0]:t.transitionOpts=s,g++,t}var p,m,g=0,v=[],y=void 0===e||null===e,b=Array.isArray(e);if(y||b||!x.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&kk)&&A.push(m);v=A}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(x.isPlainObject(e[i])){var h=(u[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&u[h]&&(r++,x.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[i]),index:n&&void 0!==n[i]&&null!==n[i]?n[i]:c+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=f[i].frame,"number"==typeof a.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=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 _&&_.add(t,s,u,l,c),M.modifyFrames(t,a)},y.purge=function(t){t=I.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":249,"../components/errorbars":255,"../constants/xmlns_namespaces":324,"../lib":337,"../lib/events":331,"../lib/queue":349,"../lib/svg_text_utils":354,"../plotly":367,"../plots/cartesian/axis_ids":375,"../plots/cartesian/constants":377,"../plots/cartesian/constraints":379,"../plots/cartesian/graph_interact":381,"../plots/plots":407,"../plots/polar":410,"../registry":415,"./helpers":357,"./manage_arrays":358,"./subroutines":364,d3:8,"fast-isnumeric":12}],360:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],361:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,w(r,m),w(r,e.attributes),n.attributes&&w(r,n.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){h(r,n.schema.traces[t][e],e)})}),r.type=t;var i={meta:e.meta||{},attributes:s(r)};if(e.layoutAttributes){var a={};w(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return w(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){h(t,n.schema.layout[e],e)}):h(t,n.layoutAttributes,n.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],n=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){h(n,r.schema.transforms[t][e],e)})}),{attributes:s(n)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(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)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function u(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 _(t,{radialaxis:b.radialaxis,angularaxis:b.angularaxis}),_(t,b.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),i=w({},e.layoutAttributes);i[M]=!0,r.set(i)}function h(t,e,n){var r=p.nestedProperty(t,n);r.set(w(r.get()||{},e))}var d=t("../registry"),p=t("../lib"),m=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),b=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,M="_isSubplotObj",k="_isLinkedToArray",A=[M,k,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=M,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED="_deprecated",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]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},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)||p.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){if(a=a.slice(0,s).concat([n]),e&&("data_array"===e.valType||e.arrayOk===!0)){var l=r(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}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;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}var i=t("d3"),a=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),f=t("../components/titles"),h=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");n.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,n.lsInner],t)},n.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=a.Axes.list(t);for(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.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)})})}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":337,"../plotly":367,"../snapshot/cloneplot":416,"../snapshot/helpers":419,"../snapshot/svgtoimg":421,"../snapshot/tosvg":423,"fast-isnumeric":12}],366:[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;v.3*f||a(r)||a(i))){var h=n.dtick/2;t+=t+h.8){var o=Number(n.substr(1));a.exactYears>.8&&o%12==0?t=O.tickIncrement(t,"M6","reverse")+1.5*L:a.exactMonths>.8?t=O.tickIncrement(t,"M1","reverse")+15.5*L:t-=L/2;var s=O.tickIncrement(t,n);if(s<=r)return s}return t}function a(t){var e,n,r=t.tickvals,i=t.ticktext,a=new Array(r.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),n=0;nc&&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>=C&&i<=19||e>=D)t._tickround="S";else{var a=t.l2r(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 l(t,e,n){var r=t.tickfont||{};return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function u(t,e,n,r){var i=t._tickround,a=n&&t.hoverformat||t.tickformat;r&&(i=x(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=_.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");l!==-1&&(o=s.substr(l+1),s=s.substr(0,l)),r&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(n?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&_.mod(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,_.mod(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 f(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function h(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=d(e.x,t,i,r)}function d(t,e,n,r){var i=t<0,a=e._tickround,o=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]};s(f),a=(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,-a)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+m:"E"===o?t+="E"+m:"power"===o?t+="\xd710"+m+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=H[l/3+5])}return i?"\u2212"+t:t}function p(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},O.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(),_.simpleMap(n,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 n=t._input;n.range=t.range.slice(),n.autorange=t.autorange}},O.saveRangeInitial=function(t,e){for(var n=O.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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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),b=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),w=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),M=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},O.autoBin=function(t,e,n,a,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(n)u=(l-s)/n;else{var c=_.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*_.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*_.stdev(t)/Math.pow(t.length,a?.25:.4)),x(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},O.setConvert(d),O.autoTicks(d,u);var p,m=O.tickIncrement(O.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){m=r(m,t,d,s,l);p=m+(1+Math.floor((l-m)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(m=i(m,t,d.dtick,s,o)),p=m;p<=l;)p=O.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(m,0,o),end:e.c2r(p,0,o),size:d.dtick}},O.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var n,r=t.nticks;r||("category"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/n):(n="y"===t._id.charAt(0)?40:80,r=_.constrain(t._length/n,4,9)+1)),"array"===t.tickmode&&(r*=100),O.autoTicks(t,Math.abs(e[1]-e[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return a(t);t._tmin=O.tickFirst(t);var i=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=O.tickIncrement(u,t.dtick,i,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),f=0;fz?(e/=z,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,n,j)):r>E?(e/=E,t.dtick="M"+o(e,1,N)):r>L?(t.dtick=o(e,L,q),t.tick0=_.dateTick0(t.calendar,!0)):r>I?t.dtick=o(e,I,N):r>D?t.dtick=o(e,D,B):r>C?t.dtick=o(e,C,B):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,n,j))}else if("log"===t.type){t.tick0=0;var i=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var a=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/a,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(e,n,j)}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=o(e,n,j));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)}},O.tickIncrement=function(t,e,n,r){var i=n?-1:1;if(x(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return _.incrementMonth(t,o,r);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?U:V,l=t+.01*i,u=_.roundUp(_.mod(l,1),s,n);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,n=_.simpleMap(t.range,e),r=n[1]1&&e2*i}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,e){return i(t,e)?"date":a(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":322,"../../lib":337,"fast-isnumeric":12}],374:[function(t,e,n){"use strict";var r=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,n,p,m){function g(n,r){return a.coerce2(t,e,s,n,r)}var v=p.letter,y=p.font||{},x="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",b=n("visible",!p.cheateronly),_=e.type;if("date"===_){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,m),n("autorange",!e.isValidRange(t.range))&&n("rangemode"),n("range"),e.cleanRange(),f(t,e,n),e._initialCategories="category"===_?d(v,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var w=n("color"),M=w===t.color?w:y.color;n("title",x),a.coerceFont(n,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:M}),l(t,e,n,_),c(t,e,n,_,p),u(t,e,n,p);var k=g("linecolor",w),A=g("linewidth"),S=n("showline",!!k||!!A);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var T=g("gridcolor",r(w,p.bgColor,o).toRgbString()),z=g("gridwidth");n("showgrid",p.showGrid||!!T||!!z)||(delete e.gridcolor,delete e.gridwidth);var E=g("zerolinecolor",w),L=g("zerolinewidth");return n("zeroline",p.showGrid||!!E||!!L)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":224,"../../lib":337,"../../registry":415,"./category_order_defaults":376,"./layout_attributes":383,"./ordered_categories":385,"./set_convert":389,"./tick_label_defaults":390,"./tick_mark_defaults":391,"./tick_value_defaults":392,tinycolor2:197}],375:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(r="array");var o=n("categoryorder",r);"array"===o&&n("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],377:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],378:[function(t,e,n){"use strict";function r(t,e,n,r){var i,a,s,l,u=r[o(e)].type,c=[];for(a=0;aa*p))for(n=0;n=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,n,r,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+n+", "+r+")").attr("d",i+"Z")}function f(t,e,n){return t.append("path").attr("class","zoombox-corners").style({fill:S.background,stroke:S.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+n+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,n,r,i,a){t.attr("d",r+"M"+n.l+","+n.t+"v"+n.h+"h"+n.w+"v-"+n.h+"h-"+n.w+"Z"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){b.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function m(t){return["lasso","select"].indexOf(t)!==-1}function g(t,e){return"M"+(t.l-.5)+","+(e-F-.5)+"h-3v"+(2*F+1)+"h3ZM"+(t.r+.5)+","+(e-F-.5)+"h3v"+(2*F+1)+"h-3Z"}function v(t,e){return"M"+(e-F-.5)+","+(t.t-.5)+"v-3h"+(2*F+1)+"v3ZM"+(e-F-.5)+","+(t.b+.5)+"v3h"+(2*F+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,F)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,n){var r,i,a,o,s,l,u=!1,c={},f={};for(r=0;rF||s>F?(wt="xy",o/rt>s/it?(s=o*it/rt,vt>a?yt.t=vt-s:yt.b=vt+s):(o=s*rt/it,gt>i?yt.l=gt-o:yt.r=gt+o),kt.attr("d",y(yt))):r():!ot||szoom back out","long"),R=!1)}function G(e,n){var r=1===(N+B).length;if(e)Q();else if(2!==n||r){if(1===n&&r){var i=N?tt[0]:K[0],o="s"===N||"w"===B?0:1,s=i._name+".range["+o+"]",l=a(i,o),u="left",c="middle";if(i.fixedrange)return;N?(c="n"===N?"top":"bottom","right"===i.side&&(u="right")):"e"===B&&(u="right"),t._context.showAxisRangeEntryBoxes&&b.select(pt).call(A.makeEditable,null,{immediate:!0,background:ft.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var n=i.d2r(e);void 0!==n&&w.relayout(t,s,n)})}}else W()}function Z(e){function n(t,e,n){function r(e){return t.l2r(a+(e-a)*n)}if(!t.fixedrange){var i=k.simpleMap(t.range,t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(r)}}if(t._context.scrollZoom||ft._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var r=t.querySelector(".plotly");if(q(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(St);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void k.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=zt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(B||lt){for(B||(l=.5),a=0;ac[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":337,"fast-isnumeric":12}],387:[function(t,e,n){"use strict";e.exports=function(t,e,n){void 0===n&&(n=.5);var r=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=r[0]+(r[1]-r[0])*n,a=(i-r[0])*e;t.range=t._input.range=[t.l2r(i-a),t.l2r(i+a)]}},{}],388:[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,b=n-g.top,_=x,w=b,M="M"+x+","+b,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,b]],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,C,P,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;Lh?d:o(t)?Number(t):d):d}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../lib"),l=s.cleanNumber,u=s.ms2DateTime,c=s.dateTime2ms,f=t("../../constants/numerical"),h=f.FP_SAFE,d=f.BADNUM,p=t("./constants"),m=t("./axis_ids");e.exports=function(t,e){function n(e,n){if(e>0)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*w*Math.abs(r-i))}return d}function f(e,n,r){var i=c(e,r||t.calendar);if(i===d){if(!o(e))return d;i=c(new Date(+e))}return i}function g(e,n,r){return u(e,n,r||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var n=t._categories.length-1;return t._categoriesMap[e]=n,n}return d}function x(e){if(t._categoriesMap){var n=t._categoriesMap[e];if(void 0!==n)return n}if("number"==typeof e)return e}function b(e){return o(e)?a.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?n:i,t.l2c="log"===t.type?r:i,t.l2p=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(n(t,e))}:b,t.p2c="log"===t.type?function(t){return r(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=i,t.d2p=t.r2p=function(t){return b(l(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return n(l(t),e)},t.r2d=t.r2c=function(t){return r(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=i,t.c2r=n,t.l2d=r,t.d2p=function(e,n){return b(t.d2r(e,n))},t.p2d=function(t){return r(_(t))},t.r2p=function(t){return b(l(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=s.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=g,t.d2p=t.r2p=function(t,e,n){return b(f(t,0,n))},t.p2d=t.p2r=function(t,e,n){return g(_(t),e,n)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2l_noadd=x,t.r2l=t.l2r=t.r2c=t.c2r=i,t.d2p=function(t){return b(x(t))},t.p2d=function(t){return v(_(t))},t.r2p=b,t.p2r=_),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.cleanRange=function(e){e||(e="range");var n,r,i=s.nestedProperty(t,e).get(),a=(t._id||"x").charAt(0);if(r="date"===t.type?s.dfltRange(t.calendar):"y"===a?p.DFLTRANGEY:p.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void s.nestedProperty(t,e).set(r);for("date"===t.type&&(i[0]=s.cleanDate(i[0],d,t.calendar),i[1]=s.cleanDate(i[1],d,t.calendar)),n=0;n<2;n++)if("date"===t.type){if(!s.isDateTime(i[n],t.calendar)){t[e]=r;break}if(t.r2l(i[0])===t.r2l(i[1])){var l=s.constrain(t.r2l(i[0]),s.MIN_MS+1e3,s.MAX_MS-1e3);i[0]=t.l2r(l-1e3),i[1]=t.l2r(l+1e3);break}}else{if(!o(i[n])){if(!o(i[1-n])){t[e]=r;break}i[n]=i[1-n]*(n?10:.1)}if(i[n]<-h?i[n]=-h:i[n]>h&&(i[n]=h),i[0]===i[1]){var u=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=u,i[1]+=u}}},t.setScale=function(n){var r=e._size,i=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=m.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var o=n&&t._r?"_r":"range",l=t.calendar;t.cleanRange(o);var u=t.r2l(t[o][0],l),c=t.r2l(t[o][1],l);if("y"===i?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw s.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,n){var r,i,a,o="date"===t.type&&e[n+"calendar"];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?i.dateTick0(e.calendar):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":322,"../../lib":337,"fast-isnumeric":12}],393:[function(t,e,n){"use strict";var r=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,u){function c(e,n){function r(e,n){for(i=0;in.duration?(d(),k=window.cancelAnimationFrame(m)):k=window.requestAnimationFrame(m)}var g=t._fullLayout,v=[],y=function(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=g[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,v.push(s),o[s]=a}return o}(e),x=Object.keys(y),b=function(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}(g,x,y);if(!b.length)return!1;var _;u&&(_=u());var w,M,k,A=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(k),k=null,p()}),w=Date.now(),k=window.requestAnimationFrame(m),Promise.resolve()}},{"../../components/drawing":249,"../../plotly":367,"../../registry":415,"./axes":372,d3:8}],394:[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 u=i(e,n,r);if(u){if("histogram"===u.type&&r==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=r+"calendar",f=u[c];if(o(u,r)){for(var h,d=a(u),p=[],m=0;m0?".":"")+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":337,"./convert_text_opts":400}],403:[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={_arrayAttrRegexps:[/^mapbox([2-9]|[1-9][0-9]+)?\.layers/],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":225,"../../lib":337,"../../traces/scatter/attributes":426,"../font_attributes":396}],404:[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"),l=n.select(".js-link-spacer"),u=n.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&r(t,o),l.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=s.select(t).append("div").attr("id","hiddenform").style("display","none"),r=n.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return r.append("input").attr({type:"text",name:"data"}).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={},i=t.layout||{},a=t._fullData||[],o=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),n._initialAutoSizeIsDone){var l=n.width,c=n.height;p.supplyLayoutGlobalDefaults(i,r),i.width||(r.width=l),i.height||(r.height=c)}else{p.supplyLayoutGlobalDefaults(i,r);var f=!i.width||!i.height,h=r.autosize,d=t._context&&t._context.autosizable;f&&(h||d)?p.plotAutoSize(t,i,r):f&&p.sanitizeMargins(t),!h&&f&&(i.width=r.width,i.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=s.length,r._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,o,i,r),r._has=p._hasPlotType.bind(r);var m=r._modules;for(e=0;e0){var c=a(t._boundingBoxMargins),h=c.left+c.right,d=c.bottom+c.top,m=1-2*s,g=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(m*(g.width-h)),i=Math.round(m*(g.height-d))}else{var v=u?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,_=!e.height&&Math.abs(n.height-i)>1;(_||b)&&(b&&(n.width=r),_&&(n.height=i)),t._initialAutoSize||(t._initialAutoSize={width:r,height:i}),p.sanitizeMargins(n)},p.supplyLayoutModuleDefaults=function(t,e,n,r){var i,a;u.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];r._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),c=e._pushmargin;if(e.margin.autoexpand!==!1){c.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(c),h=0;hg){var k=(v*w+(M-e.width)*g)/(w-g),A=(M*(1-g)+(v-e.width)*(1-w))/(w-g);k>=0&&A>=0&&k+A>i+a&&(i=k,a=A)}}if(l(x)&&c[_].t){var S=c[_].t.val,T=c[_].t.size;if(S>y){var z=(x*S+(T-e.height)*y)/(S-y),E=(T*(1-y)+(x-e.height)*(1-S))/(S-y);z>=0&&E>=0&&z+E>s+o&&(s=z,o=E)}}}}if(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,!e._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return u.plot(t)},p.graphJson=function(t,e,n,r,i){function a(t){if("function"==typeof t)return null;if(f.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("string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0&&!f.isPlainObject(t.stream))continue}else if("keepall"!==n&&"string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):f.isJSDate(t)?f.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var n=a(t);return e&&delete n.fit,n})};return e||(u.layout=a(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=a(l)),"object"===r?u:JSON.stringify(u)},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(){_=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,c=0,d=t._fullLayout._basePlotModules,p=!1;if(n)for(s=0;s=0,z=T?f.angularAxis.domain:r.extent(M),E=Math.abs(M[1]-M[0]);A&&!k&&(E=0);var L=z.slice();S&&k&&(L[1]+=E);var I=f.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),f.angularAxis.ticksStep&&(I=(L[1]-L[0])/I);var D=f.angularAxis.ticksStep||(L[1]-L[0])/(I*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),L[2]||(L[2]=D);var C=r.range.apply(this,L);if(C=C.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=r.scale.linear().domain(L.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=S?E:0,void 0===(e=r.select(this).select("svg.chart-root"))||e.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),O=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));e=r.select(O)}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,R=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},N={"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 B=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=void 0===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:F,elements:B,reverseOrder:f.legend.reverseOrder})})();var q=F.node().getBBox();x=Math.min(f.width-q.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],i.range([0,x]),c.layout.radialAxis.domain=i.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}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var V=[(f.width-(f.margin.left+f.margin.right+2*x+(q?q.width:0)))/2,(f.height-(f.margin.top+f.margin.bottom+2*x))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),f.title){var U=e.select("g.title-group text").style(N).text(f.title),H=U.node().getBBox();U.attr({x:_[0]-H.width/2,y:_[1]-x-20})}var G=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Z=G.selectAll("circle.grid-circle").data(i.ticks(5));Z.enter().append("circle").attr({class:"grid-circle"}).style(j),Z.attr("r",i),Z.exit().remove()}G.select("circle.outside-circle").attr({r:x}).style(j);var X=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Y=r.svg.axis().scale(i).ticks(5).tickSize(5);G.call(Y).attr({transform:"rotate("+f.radialAxis.orientation+")"}),G.selectAll(".domain").style(j),G.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(N).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,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(C),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.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),Q.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(N);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var $=r.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+$,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||K){var et=[];d.forEach(function(t,e){var n={};n.radialScale=i,n.angularScale=s,n.container=tt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,et.push({data:t,geometryConfig:n})});var nt=r.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),rt=[];nt.forEach(function(t,e){"unstacked"===t.key?rt=rt.concat(t.values.map(function(t,e){return[t]})):rt.push(t.values)}),rt.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 it,at,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(X).angle;ft.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=s.invert(r);var i=o.util.convertToCartesian(x+12,n+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(X).radius;ht.attr({r:n}).style({opacity:.5}),at=i.invert(o.util.getMousePos(X).radius);var r=o.util.convertToCartesian(n,f.radialAxis.orientation);ut.text(o.util.round(at)).move([r[0]+_[0],r[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.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])};k&&(u.t=w[t[0]]);var c="t: "+u.t+", r: "+u.r,f=this.getBoundingClientRect(),h=e.node().getBoundingClientRect(),d=[f.left+f.width/2-V[0]-h.left,f.top+f.height/2-V[1]-h.top];ct.config({color:s}).text(c),ct.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){if(0!=r.event.which)return!1;r.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}}},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;return r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180;return[e,t(r)]})},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(void 0===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;return[t*Math.cos(n),t*Math.sin(n)]},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 i[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return void 0===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=[o.PolyChart.defaultConfig()],n=r.dispatch("hover"),i={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,n){e[n]||(e[n]={}),a(e[n],o.PolyChart.defaultConfig()),a(e[n],t)}),this):e},t.getColorScale=function(){},r.rebind(t,n,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){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||void 0===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 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 n=t.symbol;return y(n,u)},fill:function(t,e){return g(e)}}),b.exit().remove()}var _=r.svg.axis().scale(v).orient("right"),w=d.select("g.legend-axis").attr({transform:"translate("+[c?n.colorBandWidth:u,u/2]+")"}).call(_);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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,n,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=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+10,dy:.3*+i.fontSize}),l};return l.text=function(a){var o=r.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(c);var f=i.padding,h=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,m=h.height+2*f;return n.attr({d:"M"+[[10,-m/2],[10,-m/4],[i.hasTick?0:10,0],[10,m/4],[10,m/2],[p,m/2],[p,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-m/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return a(i,t),l},l},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);return[[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"]]].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);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};r.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":337,d3:8}],412:[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":225,"../../lib":337,"./micropolar":411,"./undo_manager":413,d3:8}],413:[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)),h=t._context||{};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;nm&&d.splice(m,d.length-m),p.length>m&&p.splice(m,p.length-m);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(n=e.marker,u=n.size,Array.isArray(u)){var y={type:"linear"};i.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>m&&u.splice(m,u.length-m)}var x,b=1.6*(e.marker.sizeref||1);x="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(u)?u.map(x):x(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-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)||d[0]===d[m-1]&&p[0]===p[m-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(v.padded=!1):v.tozero=!0,i.expand(f,d,g),i.expand(h,p,v);var _=new Array(m);for(c=0;c=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===n.xaxis&&a.yaxis===n.yaxis){a.opacity=void 0;break}}}}}},{}],429:[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":228,"../../components/colorscale":239,"../../lib":337,"../../plots/plots":407,"fast-isnumeric":12}],430:[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":231,"../../components/colorscale/has_colorscale":238,"./subtypes":446}],431:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],432:[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,p,m),v=gq!=C>=q&&(L=z[S-1][0],I=z[S][0],E=L+(I-L)*(q-D)/(C-D),R=Math.min(R,E),j=Math.max(j,E));R=Math.max(R,0),j=Math.min(j,h._length);var V=s.defaultLine;return s.opacity(f.fillcolor)?V=f.fillcolor:s.opacity((f.line||{}).color)&&(V=f.line.color),r.extendFlat(t,{distance:l+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":225,"../../components/errorbars":255,"../../components/fx":266,"../../lib":337,"./get_trace_color":434}],436:[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":382,"./arrays_to_calcdata":425,"./attributes":426,"./calc":427,"./clean_data":428,"./colorbar":429,"./defaults":432,"./hover":435,"./plot":443,"./select":444,"./style":445,"./subtypes":446}],437:[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,s){var l=(t.marker||{}).color;if(o("line.color",n),r(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||n)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":234,"../../components/colorscale/has_colorscale":238}],438:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=_.c2p(t[e].x),i=w.c2p(t[e].y);return n!==r&&i!==r&&[n,i]}function i(t){var e=t[0]/_._length,n=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}var a,o,s,l,u,c,f,h,d,p,m,g,v,y,x,b,_=e.xaxis,w=e.yaxis,M=e.simplify,k=e.connectGaps,A=e.baseTolerance,S=e.linear,T=[],z=.2,E=new Array(t.length),L=0;for(M||(A=z=-1),a=0;ai(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>m?(m=v,l=c,h=!1):v=t.length||!c)break;E[L++]=c,o=c}}else E[L++]=l}T.push(E.slice(0,L))}return T}},{"../../constants/numerical":322}],439:[function(t,e,n){"use strict";e.exports=function(t,e,n){"spline"===n("line.shape")&&n("line.smoothing")}},{}],440:[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}],442:[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,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(n=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",n),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?r.background:r.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":225,"../../components/colorscale/defaults":234,"../../components/colorscale/has_colorscale":238,"./subtypes":446}],443:[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,h,p){function m(t){return M?t.transition():t}function g(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function x(){return!1}function b(e){var n,r,i,a=e[0].trace,u=o.select(this),f=c.hasMarkers(a),h=c.hasText(a),d=y(a),p=x,v=x;f&&(p=a.marker.maxdisplayed||a._needsCull?g:s.identity),h&&(v=a.marker.maxdisplayed||a._needsCull?g:s.identity),r=u.selectAll("path.point"),n=r.data(p,d);var b=n.enter().append("path").classed("point",!0);b.call(l.pointStyle,a).call(l.translatePoints,k,A,a),M&&b.style("opacity",0).transition().style("opacity",1);var _=f&&l.tryColorscale(a.marker,""),w=f&&l.tryColorscale(a.marker,"line");n.each(function(e){var n=o.select(this),r=m(n);(i=l.translatePoint(e,r,k,A))&&(l.singlePointStyle(e,r,a,_,w,t),a.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),M?n.exit().transition().style("opacity",0).remove():n.exit().remove(),r=u.selectAll("g"),n=r.data(v,d),n.enter().append("g").classed("textpoint",!0).append("text"),n.each(function(t){var e=o.select(this),n=m(e.select("text"));(i=l.translatePoint(t,n,k,A))||e.remove()}),n.selectAll("text").call(l.textPointStyle,a).each(function(t){var e=t.xp||k.c2p(t.x),n=t.yp||A.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){m(o.select(this)).attr({x:e,y:n})})}),n.exit().remove()}var _,w;a(t,e,n,r,i);var M=!!p&&p.duration>0,k=n.xaxis,A=n.yaxis,S=r[0].trace,T=S.line,z=o.select(h);if(z.call(u.plot,n,p),S.visible===!0){m(z).style("opacity",S.opacity);var E,L,I=S.fill.charAt(S.fill.length-1);"x"!==I&&"y"!==I&&(I=""),r[0].node3=z;var D="",C=[],P=S._prevtrace;P&&(D=P._prevRevpath||"",L=P._nextFill,C=P._polygons);var O,F,R,j,N,B,q,V,U,H="",G="",Z=[],X=[],Y=s.noop;if(E=S._ownFill,c.hasLines(S)||"none"!==S.fill){for(L&&L.datum(r),["hv","vh","hvh","vhv"].indexOf(T.shape)!==-1?(R=l.steps(T.shape),j=l.steps(T.shape.split("").reverse().join(""))):R=j="spline"===T.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),T.smoothing):l.smoothopen(t,T.smoothing)}:function(t){return"M"+t.join("L")},N=function(t){return j(t.reverse())},Z=f(r,{xaxis:k,yaxis:A,connectGaps:S.connectgaps,baseTolerance:Math.max(T.width||1,3)/4,linear:"linear"===T.shape,simplify:T.simplify}),U=S._polygons=new Array(Z.length),w=0;w1}),Y=function(t){return function(e){if(O=R(e),F=N(e),H?I?(H+="L"+O.substr(1),G=F+"L"+G.substr(1)):(H+="Z"+O,G=F+"Z"+G):(H=O,G=F),c.hasLines(S)&&e.length>1){var n=o.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",O).call(l.lineGroupStyle)).style("opacity",1);else{var i=m(n);i.attr("d",O),l.singleLineStyle(r,i)}}}}}var W=z.selectAll(".js-line").data(X);m(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Y(!0)),Z.length&&(E?B&&V&&(I?("y"===I?B[1]=V[1]=A.c2p(0,!0):"x"===I&&(B[0]=V[0]=k.c2p(0,!0)),m(E).attr("d","M"+V+"L"+B+"L"+H.substr(1))):m(E).attr("d",H+"Z")):"tonext"===S.fill.substr(0,6)&&H&&D&&("tonext"===S.fill?m(L).attr("d",H+"Z"+D+"Z"):m(L).attr("d",H+"L"+D.substr(1)+"Z"),S._polygons=S._polygons.concat(C)),S._prevRevpath=G,S._prevPolygons=U);var Q=z.selectAll(".points");_=Q.data([r]),Q.each(b),_.enter().append("g").classed("points",!0).each(b),_.exit().remove()}}function a(t,e,n,r,i){var a=n.xaxis,l=n.yaxis,u=o.extent(s.simpleMap(a.range,a.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=r[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=r.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),m=Math.ceil(p.length/d),g=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),h(t,e,n),r(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),g){s&&(d=s());o.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).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":249,"../../components/errorbars":255,"../../lib":337,"../../lib/polygon":347,"./line_points":438,"./link_traces":440,"./subtypes":446,d3:8}],444:[function(t,e,n){"use strict";var r=t("./subtypes");e.exports=function(t,e){var n,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace,h=f.index,d=f.marker,p=!r.hasMarkers(f)&&!r.hasText(f);if(f.visible===!0&&!p){var m=Array.isArray(d.opacity)?1:d.opacity;if(e===!1)for(n=0;n")}var i=t("../../components/fx"),a=t("../scatter/get_trace_color"),o=t("../../constants/numerical").BADNUM;e.exports=function(t,e,n){function s(t){var e=t.lonlat;if(e[0]===o)return 1/0;var r=Math.abs(c.c2p(e)-c.c2p([p,e[1]])),i=Math.abs(f.c2p(e)-f.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 l=t.cd,u=l[0].trace,c=t.xa,f=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),d=360*h,p=e-d;if(i.getClosest(l,s,t),t.index!==!1){var m=l[t.index],g=m.lonlat,v=[g[0]+d,g[1]],y=c.c2p(v),x=f.c2p(v),b=m.mrc||1;return t.x0=y-b,t.x1=y+b,t.y0=x-b,t.y1=x+b,t.color=a(u,m),t.extraText=r(u,m),[t]}}},{"../../components/fx":266,"../../constants/numerical":322,"../scatter/get_trace_color":434}],456:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("../scattergeo/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":401,"../scatter/colorbar":429,"../scattergeo/calc":450,"./attributes":451,"./defaults":453,"./event_data":454,"./hover":455,"./plot":457}],457:[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":452}]},{},[4])(4)}); \ No newline at end of file +!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||t)},c,c.exports,t,e,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o=0;s--)if(l[s]!==u[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!d(t[o],e[o],n,r))return!1;return!0}function g(t,e,n){d(t,e,!0)&&f(t,e,n,"notDeepStrictEqual",g)}function v(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function y(t){var e;try{t()}catch(t){e=t}return e}function x(t,e,n,r){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=y(e),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!i&&f(i,n,"Missing expected exception"+r);var a="string"==typeof r,o=!t&&_.isError(i),s=!t&&i&&!n;if((o&&a&&v(i,n)||s)&&f(i,n,"Got unwanted exception"+r),t&&i&&n&&!v(i,n)||!t&&i)throw i}var _=t("util/"),b=Object.prototype.hasOwnProperty,w=Array.prototype.slice,M=function(){return"foo"===function(){}.name}(),k=e.exports=h,A=/\s*function\s+([^\(\s]*)\s*/;k.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=c(this),this.generatedMessage=!0);var e=t.stackStartFunction||f;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,i=s(e),a=r.indexOf("\n"+i);if(a>=0){var o=r.indexOf("\n",a+1);r=r.substring(o+1)}this.stack=r}}},_.inherits(k.AssertionError,Error),k.fail=f,k.ok=h,k.equal=function(t,e,n){t!=e&&f(t,e,n,"==",k.equal)},k.notEqual=function(t,e,n){t==e&&f(t,e,n,"!=",k.notEqual)},k.deepEqual=function(t,e,n){d(t,e,!1)||f(t,e,n,"deepEqual",k.deepEqual)},k.deepStrictEqual=function(t,e,n){d(t,e,!0)||f(t,e,n,"deepStrictEqual",k.deepStrictEqual)},k.notDeepEqual=function(t,e,n){d(t,e,!1)&&f(t,e,n,"notDeepEqual",k.notDeepEqual)},k.notDeepStrictEqual=g,k.strictEqual=function(t,e,n){t!==e&&f(t,e,n,"===",k.strictEqual)},k.notStrictEqual=function(t,e,n){t===e&&f(t,e,n,"!==",k.notStrictEqual)},k.throws=function(t,e,n){x(!0,t,e,n)},k.doesNotThrow=function(t,e,n){x(!1,t,e,n)},k.ifError=function(t){if(t)throw t};var S=Object.keys||function(t){var e=[];for(var n in t)b.call(t,n)&&e.push(n);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"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(-1!==i&&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=Co.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==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(n,null),Po&&(o[Po]=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?qo:t<-1?-qo: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)*$o,r=gt(r)*Ko,a=gt(a)*ts,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=rs.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)/$o),i=vt((.2126729*t+.7151522*e+.072175*n)/Ko);return dt(116*i-16,500*(r-i),200*(i-vt((.0193339*t+.119192*e+.9503041*n)/ts)))}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 Ct(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 as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Pt)),a}function Pt(){var t=Ot(),e=Ft()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Pt,e)),os=0):(os=1,ls(Pt))}function Ot(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ft(){for(var t,e=is,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=cs.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=fs.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 Vt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function qt(t,e,n){function r(e){var n=t(e),r=a(n,1);return e-n1)for(;o=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=E[o in ms?e.charAt(s++):o])||(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{ds=Vt;var e=new ds;return e._=t,r(e)}finally{ds=Date}}var r=e(t);return n.parse=function(t){try{ds=Vt;var e=r.parse(t);return e&&e._}finally{ds=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+hs.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(hs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ht(hs.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){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ne(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function re(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+3));return r?(t.j=+r[0],n+r[0].length):-1}function ie(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ae(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function oe(t,e,n){gs.lastIndex=0;var r=gs.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function se(t,e,n){gs.lastIndex=0;var r=gs.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){vs.lastIndex=0;var r=vs.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);Ms.add(Math.atan2(h,f)),r=t,i=l,a=u}var e,n,r,i,a;ks.point=function(o,s){ks.point=t,r=(e=o)*Uo,i=Math.cos(s=(n=s)*Uo/2+No/4),a=Math.sin(s)},ks.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 Ce(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=qe(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]-qo-Ro:qo-t[1])-((e=e.x)[0]<0?e[1]-qo-Ro:qo-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?qo:-qo),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 Ve(t,e,n,r){var i;if(null==t)i=n*qo,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(Ms.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);_e(p,be(s,h));var m=d,g=ye(p,m),v=ye(m,m),y=g*g-v*(ye(p,p)-1);if(!(y<0)){var x=Math.sqrt(y),_=be(m,(-g-x)/v);if(_e(_,p),_=Me(_),!n)return _;var b,w=t[0],M=e[0],k=t[1],A=e[1];M0^_[1]<(_o(_[0]-w)No^(w<=_[0]&&_[0]<=M)){var E=be(m,(-g+x)/v);return _e(E,p),[_,Me(E)]}}}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;return Oe(e,n,vn(t,6*Uo),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(-js,Math.min(js,t)),e=Math.max(-js,Math.min(js,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){Bs+=i*t-r*e,r=t,i=e}var e,n,r,i;Hs.point=function(a,o){Hs.point=t,e=r=a,n=i=o},Hs.lineEnd=function(){t(e,n)}}function We(t,e){tUs&&(Us=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){Ts+=t,zs+=e,++Es}function Ke(){function t(t,r){var i=t-e,a=r-n,o=Math.sqrt(i*i+a*a);Ls+=o*(e+t)/2,Is+=o*(n+r)/2,Ds+=o,$e(e=t,n=r)}var e,n;Xs.point=function(r,i){Xs.point=t,$e(e=r,n=i)}}function tn(){Xs.point=$e}function en(){function t(t,e){var n=t-r,a=e-i,o=Math.sqrt(n*n+a*a);Ls+=o*(r+t)/2,Is+=o*(i+e)/2,Ds+=o,o=i*t-r*e,Cs+=o*(r+t),Ps+=o*(i+e),Os+=3*o,$e(r=t,i=e)}var e,n,r,i;Xs.point=function(a,o){Xs.point=t,$e(e=r=a,n=i=o)},Xs.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[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=Rs,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,Rs):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<-qo+Ro&&(e=-qo+Ro):e>qo-Ro&&(e=qo-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))-qo]},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 Pn(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=sl.pop()||new jn;return e.site=t,e}function Bn(t){Qn(t),il.remove(t),sl.push(t),ar(t)}function Vn(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))>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(il.insert(e,l),e||n){if(e===n)return Qn(e),n=Nn(e.site),il.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=rl,g=m.length;g--;)if((a=m[g])&&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=ll.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=ol._;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=fl.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*qo)}function Ir(t){return Math.pow(2,10*(t-1))}function Dr(t){return 1-Math.sqrt(1-t*t)}function Cr(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 Pr(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=qr(e),i=Vr(e,n),a=qr(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 Vi(t){var e=t.children;return e&&e.length?Vi(e[0]):t}function qi(t){var e,n=t.children;return n&&(e=n.length)?qi(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=cs.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 Ml?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:Al);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 kl;arguments.length<2?n=kl:"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 Va(t){return t.length<3?wa(t):t[0]+La(t,Ba(t))}function qa(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=Ct(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(Ql,i);return a==Ql.length?[e.year,ta(t.map(function(t){return t/31536e6}),n)[2]]:a?e[i/Ql[a-1]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=0,n=t.length-1,r=t[0],i=new Array(n<0?0:n);e=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(C,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,f=uo.select(r(i)).on(D,t).on(C,n),h=e(uo.mouse(i)),d=J(i);Bl.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);Bl.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,fs=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))))}}),hs=uo.time={},ds=Date;Vt.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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;hs.year=qt(function(t){return t=hs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),hs.years=hs.year.range,hs.years.utc=hs.year.utc.range,hs.day=qt(function(t){var e=new ds(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}),hs.days=hs.day.range,hs.days.utc=hs.day.utc.range,hs.dayOfYear=function(t){var e=hs.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=hs[t]=qt(function(t){return(t=hs.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=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});hs[t+"s"]=n.range,hs[t+"s"].utc=n.utc.range,hs[t+"OfYear"]=function(t){var n=hs.year(t).getDay();return Math.floor((hs.dayOfYear(t)+(n+e)%7)/7)}}),hs.week=hs.sunday,hs.weeks=hs.sunday.range,hs.weeks.utc=hs.sunday.utc.range,hs.weekOfYear=hs.sundayOfYear;var ms={"-":"",_:" ",0:"0"},gs=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Gt(t)}};var ys=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=ys.numberFormat,uo.geo={},fe.prototype={s:0,t:0,add:function(t){he(t,this.t,xs),he(xs.s,this.s,this),this.s?this.t+=xs.t:this.s=xs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var xs=new fe;uo.geo.stream=function(t,e){t&&_s.hasOwnProperty(t.type)?_s[t.type](t,e):de(t,e)};var _s={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;ks.point(t,n),e(t,n)}function a(){ks.lineStart()}function o(){i(m,g),ks.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){As=Ss=Ts=zs=Es=Ls=Is=Ds=Cs=Ps=Os=0,uo.geo.stream(t,Fs);var e=Cs,n=Ps,r=Os,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 Ns,Bs,Vs,qs,Us,Gs,Hs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Hs.lineStart=Ye},polygonEnd:function(){Hs.lineStart=Hs.lineEnd=Hs.point=M,Ns+=_o(Bs/2)}},Zs={point:We,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Xs={point:$e,lineStart:Ke,lineEnd:tn,polygonStart:function(){Xs.lineStart=en},polygonEnd:function(){Xs.point=$e,Xs.lineStart=Ke,Xs.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 Ns=0,uo.geo.stream(t,i(Hs)),Ns},t.centroid=function(t){return Ts=zs=Es=Ls=Is=Ds=Cs=Ps=Os=0,uo.geo.stream(t,i(Xs)),Os?[Cs/Os,Ps/Os]:Ds?[Ls/Ds,Is/Ds]:Es?[Ts/Es,zs/Es]:[NaN,NaN]},t.bounds=function(t){return Us=Gs=-(Vs=qs=1/0),uo.geo.stream(t,i(Zs)),[[Vs,qs],[Us,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]*=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 Ys=0,uo.geo.stream(t,Ws),Ys};var Ys,Ws={sphere:M,point:M,lineStart:kn,lineEnd:M,polygonStart:M,polygonEnd:M},Qs=An(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return ln(Qs)}).raw=Qs;var Js=An(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},_);(uo.geo.azimuthalEquidistant=function(){return ln(Js)}).raw=Js,(uo.geo.conicConformal=function(){return Ze(Sn)}).raw=Sn,(uo.geo.conicEquidistant=function(){return Ze(Tn)}).raw=Tn;var $s=An(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return ln($s)}).raw=$s,zn.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-qo]},(uo.geo.mercator=function(){return En(zn)}).raw=zn;var Ks=An(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return ln(Ks)}).raw=Ks;var tl=An(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return ln(tl)}).raw=tl,Ln.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-qo]},(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]]:[]).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=ul;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=n.site,o=n.edges.sort(Xn),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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=dl.get(n)||hl,r=pl.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:ml)})(t)},Br.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=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=Ct(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&&!Pi(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=Ci,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=Vi(l),f=qi(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=Ci,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=Vo)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===Ll?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(Ol.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 Ol=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*Rl)),n=e*Rl;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/Fl),n=e*Fl/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Fl),n=e*Fl/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});uo.svg.symbolTypes=Ol.keys();var Fl=Math.sqrt(3),Rl=Math.tan(30*Uo);Eo.transition=function(t){for(var e,n,r=jl||++ql,i=to(t),a=[],o=Nl||{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.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)===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&&void 0!==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){H=t}function o(t){Z=t}function s(){return function(){G(u)}}function l(){var t=setTimeout;return function(){return t(u,1)}}function u(){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){return 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(0===(t=+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];return t.length<=1?"any"===e?"false":"true":"("+("=="===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")+")"}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){o(t)<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;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:1/0*(d?-1:1);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);i(t,e,n,Math.max(r,Math.floor(n-u*f/l+h)),Math.min(o,Math.floor(n+(l-u)*f/l+h)),s)}var d=e[2*n+s],p=r,m=o;for(a(t,e,r,n),e[2*o+s]>d&&a(t,e,r,o);pd;)m--}e[2*r+s]===d?a(t,e,r,m):(m++,a(t,e,m,o)),m<=n&&(r=m+1),n<=m&&(o=m-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 a=i(n);if("object"!==a)return[new r(e,n,"object expected, %s found",a)];var o=[];for(var s in n)"@"!==s[0]&&o.push(new r(e+"."+s,n[s],'constants must start with "@"'));return o}},{"../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-1===a.values.indexOf(i(n))&&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:(-1===e.indexOf("{fontstack}")&&a.push(new r(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&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')];switch(i(e.type)){case"vector":case"raster":var u=[];if(u=u.concat(a({key:n,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var c in e)["type","url","tileSize"].indexOf(c)<0&&u.push(new r(n+"."+c,e[c],'a source with a "url" property may not include a "%s" property',c));return u;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)}void 0!==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");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,500),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,15),n=0;n2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(r=1.05);var o=s/(512*this.overscaling)*15,u=t[0],c=t[a-1],f=u.equals(c);if(this.prepareArrayGroup("line",10*a),2!==a||!f){this.distance=0;var h,d,p,m,g,v,y,x=n,_=f?"butt":n,b=!0;this.e1=this.e2=this.e3=-1,f&&(h=t[a-2],g=u.sub(h)._unit()._perp());for(var w=0;w0){var T=h.dist(d);if(T>2*o){var z=h.sub(h.sub(d)._mult(o/T)._round());this.distance+=z.dist(d),this.addCurrentVertex(z,this.distance,m.mult(1),0,0,!1),d=z}}var E=d&&p,L=E?e:p?x:_;if(E&&"round"===L&&(Ar&&(L="bevel"),"bevel"===L&&(A>2&&(L="flipbevel"),A100)M=g.clone();else{var I=m.x*g.y-m.y*g.x>0?-1:1,D=A*m.add(g).mag()/m.sub(g).mag();M._perp()._mult(D*I)}this.addCurrentVertex(h,this.distance,M,0,0,!1),this.addCurrentVertex(h,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===L||"fakeround"===L){var C=m.x*g.y-m.y*g.x>0,P=-Math.sqrt(A*A-1);if(C?(y=0,v=P):(v=0,y=P),b||this.addCurrentVertex(h,this.distance,m,v,y,!1),"fakeround"===L){for(var O,F=Math.floor(8*(.5-(k-.5))),R=0;R=0;j--)O=m.mult((j+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(h,this.distance,O,C)}p&&this.addCurrentVertex(h,this.distance,g,-v,-y,!1)}else"butt"===L?(b||this.addCurrentVertex(h,this.distance,m,0,0,!1),p&&this.addCurrentVertex(h,this.distance,g,0,0,!1)):"square"===L?(b||(this.addCurrentVertex(h,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(h,this.distance,g,-1,-1,!1)):"round"===L&&(b||(this.addCurrentVertex(h,this.distance,m,0,0,!1),this.addCurrentVertex(h,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(h,this.distance,g,-1,-1,!0),this.addCurrentVertex(h,this.distance,g,0,0,!1)));if(S&&w2*o){var B=h.add(p.sub(h)._mult(o/N)._round());this.distance+=B.dist(h),this.addCurrentVertex(B,this.distance,g.mult(1),0,0,!1),h=B}}b=!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],c=l.layoutVertexArray,f=l.elementArray;o=n.clone(),r&&o._sub(n.perp()._mult(r)),this.e3=this.addLineVertex(c,t,o,s,0,r,e),this.e1>=0&&this.e2>=0&&f.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(c,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&f.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>u/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*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,v=24*a["text-letter-spacing"],_=[24*a["text-offset"][0],24*a["text-offset"][1]],b=this.fontstack=a["text-font"].join(","),M=[],k=0;kw||E.y<0||E.y>w);if(!d||L){var I=L||_;this.addSymbolInstance(E,S,e,n,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,r.index,this.sourceLayerIndex,this.index,u,m,y,f,g,x,{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(C,P,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){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*(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=[t.x,t.y,0,1],n=[t.x,t.y,1,1];h.transformMat4(e,e,this.pixelMatrixInverse),h.transformMat4(n,n,this.pixelMatrixInverse);var r=e[3],i=n[3],a=e[0]/r,s=n[0]/i,u=e[1]/r,c=n[1]/i,f=e[2]/r,d=n[2]/i,p=f===d?0:(0-f)/(d-f),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(a,s,p)/m,l(u,c,p)/m,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)))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;this.opacities[n]=n<=t?this.changeOpacities[n]+i: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;if(this.nextRow+r>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o0?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);e.blendColor(1/8,1/8,1/8,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){if(n)return e(n);this._geoJSONIndexes[t.source]=r,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;this._cache.setMaxSize(Math.floor(5*r))},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)<0&&(r=-1*r-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=new f;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new h(e.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,P[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])&&v(w,L[M]);else v(t,E);var C=[],P=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),C.push(k),"symbol"===k.type?P.push(k):O.push(k));var R={},j={},N=0;if(P.length>0){for(b=P.length-1;b>=0;b--)P[b].updateIcons(R),P[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===P.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){if(t)return void this.fire("error",{error:t});this.data=e,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&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&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&&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);return i.setPaintProperty(e,n,r),!(n&&b.isFunctionDefinition(n)&&"$zoom"!==n.property&&void 0!==n.property)&&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:1,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;r.create=function(e,n){return new({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")}[(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,"-transition"))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,"-transition")?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){return this._paintTransitions[t].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<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<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();n.emplaceBack(0,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),n.emplaceBack(a,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,0,-32767,0,32767,0,32767,0,0,0,0,0,0,0,0,0),n.emplaceBack(0,a,-32767,0,32767,0,32767,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=o,this.height=o,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=128;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=o+2,u=s+2;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var f=this.data,h=n.bitmap,d=0;d=2048||e>=2048)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=4,this.height*=4,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){r.mousePos(x,t).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},C=(n(1)-L)/M;if(Math.abs(S)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var P=A=0)return!1;return!0}),e.join(" | ")},r.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e=this._container=a.create("div","mapboxgl-ctrl-attrib",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)),e},_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",-1!==n.indexOf("bottom")?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=this._container=o.create("div","mapboxgl-ctrl-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),e):e},_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=a.bezier(0,0,.3,1);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]),s=(r[0]-i[0])/1e3;if(0===s||r[1].equals(i[1]))return void e();var l=a.mult(.3/s),u=l.mag();u>1400&&(u=1400,l._unit()._mult(u));var c=u/750,f=l.mult(-c/2);this._map.panBy(f,{duration:1e3*c,easing:o,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;return"mousemove"===t.type?!1&t.buttons:0!==t.button},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)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=o.bezier(0,0,.25,1);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);e.mag()<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)180&&(d=180);var p=d/180;u+=f*d*(p/2),Math.abs(e._normalizeBearing(u,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();t.length>0&&e-t[0][0]>160;)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;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()-2},n):(t.preventDefault(),e.panBy([-80,0],n));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+2},n):(t.preventDefault(),e.panBy([80,0],n));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+5},n):(t.preventDefault(),e.panBy([0,-80],n));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-5,0)},n):(t.preventDefault(),e.panBy([0,80],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=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");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=a.bezier(0,0,.15,1);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 c=Math.abs(1-o)>.15;Math.abs(s)>4?this._gestureIntent="rotate":c&&(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]),s=n.transform.scaleZoom(this._startScale*i[1]),l=a-s,u=(r[0]-i[0])/1e3,c=r[2];if(0===u||a===s)return void n.snapToNorth({},{originalEvent:t});var f=.15*l/u;Math.abs(f)>2.5&&(f=f>0?2.5:-2.5);var h=1e3*Math.abs(f/(12*.15)),d=a+f*h/2e3;d<0&&(d=0),n.easeTo({zoom:d,duration:h,easing:o,around:n.unproject(c)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>2&&e-t[0][0]>160;)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={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:20,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)},w=e.exports=function(t){if(t=a.extend({},b,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)),void 0!==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(w.prototype,l),a.extend(w.prototype,g.prototype),a.extend(w.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?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=20)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 20, inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(x.convert(t))},queryRenderedFeatures:function(){var t,e={};return 2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length&&function(t){return t instanceof x||Array.isArray(t)}(arguments[0])?t=arguments[0]:1===arguments.length&&(e=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(t),e,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;if(t instanceof x||"number"==typeof t[0])e=[x.convert(t)];else{var n=[x.convert(t[0]),x.convert(t[1])];e=[n[0],new x(n[1].x,n[0].y),n[1],new x(n[0].x,n[1].y),n[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?(this.style=t instanceof c?t: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});if(!t)return void this.fire("error",{error:new Error("Failed to initialize WebGL")});this.painter=new h(t,this.transform)},_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),void 0!==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(w.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))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(void 0!==r.id&&this.parent[r.type])this.parent[r.type](r.data,e.bind(this));else if(void 0!==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)&&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+=-1!==t.indexOf("?")?"&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){return"mapbox:"!==l.parse(t).protocol?t:r(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var n=l.parse(t);return"mapbox:"!==n.protocol?t:r("mapbox://"+n.pathname.split("/")[1]+"/{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;if("mapbox:"!==l.parse(e).protocol)return t;var i=s.supportsWebp?".webp":"$1",o=s.devicePixelRatio>=2||512===n?"@2x":"";return l.format({protocol:r.protocol,hostname:r.hostname,pathname:r.pathname.replace(/(\.(?:png|jpg)\d*)/,o+i),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)+4294967296*this.buf.readUInt32LE(this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+4294967296*this.buf.readInt32LE(this.pos+4);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)return void a(t,this);this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);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(C,"."),r+o(t.split("."),e).join(".")}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);r(t,e,Math.max(n,Math.floor(e-u*f/l+h)),Math.min(o,Math.floor(e+(l-u)*f/l+h)),s)}var d=t[e],p=n,m=o;for(i(t,n,e),s(t[o],d)>0&&i(t,n,o);p0;)m--}0===s(t[n],d)?i(t,n,m):(m++,i(t,m,o)),m<=e&&(n=m+1),e<=m&&(o=m-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){!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,i){return{x:t,y:e,zoom:1/0,id:r,properties:i,parentId:-1,numPoints:n}}function o(t,e){var n=t.geometry.coordinates;return{x:u(n[0]),y:c(n[1]),zoom:1/0,id:e,parentId:-1}}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 d(d({},t.properties),{cluster:!0,cluster_id:t.id,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,reduce:null,initial:function(){return{}},map:function(t){return t}},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=T(t,360),e=T(e,100),n=T(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=T(t,255),e=T(e,255),n=T(n,255);var r,i,a=G(t,e,n),o=U(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function T(t,n){L(t)&&(t="100%");var r=I(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 z(t){return U(1,G(0,t))}function E(t){return parseInt(t,16)}function L(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function I(t){return"string"==typeof t&&-1!=t.indexOf("%")}function D(t){return 1==t.length?"0"+t:""+t}function C(t){return t<=1&&(t=100*t+"%"),t}function P(t){return e.round(255*parseFloat(t)).toString(16)}function O(t){return E(t)/255}function F(t){return!!Y.CSS_UNIT.exec(t)}function R(t){t=t.replace(N,"").replace(B,"").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=Y.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=Y.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Y.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=Y.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Y.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=Y.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Y.hex8.exec(t))?{r:E(n[1]),g:E(n[2]),b:E(n[3]),a:O(n[4]),format:e?"name":"hex8"}:(n=Y.hex6.exec(t))?{r:E(n[1]),g:E(n[2]),b:E(n[3]),format:e?"name":"hex"}:(n=Y.hex4.exec(t))?{r:E(n[1]+""+n[1]),g:E(n[2]+""+n[2]),b:E(n[3]+""+n[3]),a:O(n[4]+""+n[4]),format:e?"name":"hex8"}:!!(n=Y.hex3.exec(t))&&{r:E(n[1]+""+n[1]),g:E(n[2]+""+n[2]),b:E(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 N=/^\s+/,B=/\s+$/,V=0,q=e.round,U=e.min,G=e.max,H=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=S(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),n=q(100*t.s),r=q(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=q(360*t.h),n=q(100*t.s),r=q(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: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*T(this._r,255))+"%",g:q(100*T(this._g,255))+"%",b:q(100*T(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+q(100*T(this._r,255))+"%, "+q(100*T(this._g,255))+"%, "+q(100*T(this._b,255))+"%)":"rgba("+q(100*T(this._r,255))+"%, "+q(100*T(this._g,255))+"%, "+q(100*T(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(X[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;return e||!r||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("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()):"name"===t&&0===this._a?this.toName():this.toRgbString()},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)&&(n[i]="a"===i?t[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:H(),g:H(),b:H()})},r.mix=function(t,e,n){n=0===n?0:n||50;var i=r(t).toRgb(),a=r(e).toRgb(),o=n/100;return r({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})},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=j(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 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=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(Z),Y=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();void 0!==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){void 0===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=/^[+a-z0-9A-Z_-]{0,63}$/,x=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=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=-1!==r&&r127?P+="x":P+=C[O];if(!P.match(y)){var R=I.slice(0,S),j=I.slice(S+1),N=C.match(x);N&&(R.push(N[1]),j.unshift(N[2])),j.length&&(s="/"+j.join(".")+s),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),L||(this.hostname=l.toASCII(this.hostname));var B=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+B,this.href+=this.host,L&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[p])for(var S=0,D=m.length;S0)&&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(!M.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=M.slice(-1)[0],T=(n.host||t.host||M.length>1)&&("."===S||".."===S)||""===S,z=0,E=M.length;E>=0;E--)S=M[E],"."===S?M.splice(E,1):".."===S?(M.splice(E,1),z++):z&&(M.splice(E,1),z--);if(!x&&!_)for(;z--;z)M.unshift("..");!x||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),T&&"/"!==M.join("/").substr(-1)&&M.push("");var L=""===M[0]||M[0]&&"/"===M[0].charAt(0);if(k){n.hostname=n.host=L?"":M.length?M.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&&M.length,x&&!L&&M.unshift(""),M.length?n.pathname=M.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)){v=" [Function"+(e.name?": "+e.name:"")+"]"}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 b;return b=y?f(t,e,r,m,o):o.map(function(n){return h(t,e,r,m,n,y)}),t.seen.pop(),d(b,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;return t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>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||void 0===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;a0||n.explicitOff.length>0}function i(t,e){var n,r=a(t,e),i=r.on,o=r.off.concat(r.explicitOff),l={};if(i.length||o.length){for(n=0;n2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var s=F.selectAll("a");if(1===s.size()&&s.text()===F.text()){z.insert("a",":first-child").attr({"xlink:xlink:href":s.attr("xlink:href"),"xlink:xlink:show":s.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}var u=z.select(".annotation-text-math-group"),f=!u.empty(),p=d.bBox((f?u:F).node()),x=p.width,L=p.height,O=e.width||x,R=e.height||L,j=Math.round(O+2*I),N=Math.round(R+2*I);e._w=O,e._h=R;for(var B=!1,V=["x","y"],q=0;q1)&&(Q===W?((at=J.r2fraction(e["a"+Y]))<0||at>1)&&(B=!0):B=!0,B))continue;U=J._offset+J.r2p(e[Y]),Z=.5}else"x"===Y?(H=e[Y],U=w.l+w.w*H):(H=1-e[Y],U=w.t+w.h*H),Z=e.showarrow?.5:H;if(e.showarrow){it.head=U;var ot=e["a"+Y];X=K*n(.5,e.xanchor)-tt*n(.5,e.yanchor),Q===W?(it.tail=J._offset+J.r2p(ot),G=X):(it.tail=U+ot,G=X+ot),it.text=it.tail+X;var st=b["x"===Y?"width":"height"];if("paper"===W&&(it.head=c.constrain(it.head,1,st-1)),"pixel"===Q){var lt=-Math.max(it.tail-3,it.text),ut=Math.min(it.tail+3,it.text)-st;lt>0?(it.tail+=lt,it.text+=lt):ut>0&&(it.tail-=ut,it.text-=ut)}it.tail+=rt,it.head+=rt}else X=et*n(Z,nt),G=X,it.text=U+X;it.text+=rt,X+=rt,G+=rt,e["_"+Y+"padplus"]=et/2+G,e["_"+Y+"padminus"]=et/2-G,e["_"+Y+"size"]=et,e["_"+Y+"shift"]=X}if(B)return void z.remove();var ct=0,ft=0;if("left"!==e.align&&(ct=(O-x)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(R-L)*("middle"===e.valign?.5:1)),f)u.select("svg").attr({x:I+ct-1,y:I+ft}).call(d.setClipUrl,C?M:null);else{var ht=I+ft-p.top,dt=I+ct-p.left;F.call(m.positionText,dt,ht).call(d.setClipUrl,C?M:null)}P.select("rect").call(d.setRect,I,I,O,R),D.call(d.setRect,E/2,E/2,j-E,N-E),z.call(d.setTranslate,Math.round(k.x.text-j/2),Math.round(k.y.text-N/2)),T.attr({transform:"rotate("+A+","+k.x.text+","+k.y.text+")"});var pt=function(n,s){S.selectAll(".annotation-arrow-g").remove();var u=k.x.head,f=k.y.head,p=k.x.tail+n,m=k.y.tail+s,g=k.x.text+n,x=k.y.text+s,b=c.rotationXYMatrix(A,g,x),M=c.apply2DTransform(b),E=c.apply2DTransform2(b),L=+D.attr("width"),I=+D.attr("height"),C=g-.5*L,P=C+L,O=x-.5*I,F=O+I,R=[[C,O,C,F],[C,F,P,F],[P,F,P,O],[P,O,C,O]].map(E);if(!R.reduce(function(t,e){return t^!!o(u,f,u+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=o(p,m,u,f,t[0],t[1],t[2],t[3]);e&&(p=e.x,m=e.y)});var j=e.arrowwidth,N=e.arrowcolor,B=S.append("g").style({opacity:h.opacity(N)}).classed("annotation-arrow-g",!0),V=B.append("path").attr("d","M"+p+","+m+"L"+u+","+f).style("stroke-width",j+"px").call(h.stroke,h.rgb(N));if(y(V,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&V.node().parentNode&&!r){var q=u,U=f;if(e.standoff){var G=Math.sqrt(Math.pow(u-p,2)+Math.pow(f-m,2));q+=e.standoff*(p-u)/G,U+=e.standoff*(m-f)/G}var H,Z,X,Y=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-q)+","+(m-U),transform:"translate("+q+","+U+")"}).style("stroke-width",j+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");v.init({element:Y.node(),gd:t,prepFn:function(){var t=d.getTranslate(z);Z=t.x,X=t.y,H={},i&&i.autorange&&(H[i._name+".autorange"]=!0),a&&a.autorange&&(H[a._name+".autorange"]=!0)},moveFn:function(t,n){var r=M(Z,X),o=r[0]+t,s=r[1]+n;z.call(d.setTranslate,o,s),H[_+".x"]=i?i.p2r(i.r2p(e.x)+t):e.x+t/w.w,H[_+".y"]=a?a.p2r(a.r2p(e.y)+n):e.y-n/w.h,e.axref===e.xref&&(H[_+".ax"]=i.p2r(i.r2p(e.ax)+t)),e.ayref===e.yref&&(H[_+".ay"]=a.p2r(a.r2p(e.ay)+n)),B.attr("transform","translate("+t+","+n+")"),T.attr({transform:"rotate("+A+","+o+","+s+")"})},doneFn:function(e){if(e){l.relayout(t,H);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var mt,gt;v.init({element:z.node(),gd:t,prepFn:function(){gt=T.attr("transform"),mt={}},moveFn:function(t,n){var o="pointer";if(e.showarrow)e.axref===e.xref?mt[_+".ax"]=i.p2r(i.r2p(e.ax)+t):mt[_+".ax"]=e.ax+t,e.ayref===e.yref?mt[_+".ay"]=a.p2r(a.r2p(e.ay)+n):mt[_+".ay"]=e.ay+n,pt(t,n);else{if(r)return;if(i)mt[_+".x"]=e.x+t/i._m;else{var s=e._xsize/w.w,l=e.x+(e._xshift-e.xshift)/w.w-s/2;mt[_+".x"]=v.align(l+t/w.w,s,0,1,e.xanchor)}if(a)mt[_+".y"]=e.y+n/a._m;else{var u=e._ysize/w.h,c=e.y-(e._yshift+e.yshift)/w.h-u/2;mt[_+".y"]=v.align(c-n/w.h,u,0,1,e.yanchor)}i&&a||(o=v.getCursor(i?.5:mt[_+".x"],a?.5:mt[_+".y"],e.xanchor,e.yanchor))}T.attr({transform:"translate("+t+","+n+")"+gt}),g(z,o)},doneFn:function(e){if(g(z),e){l.relayout(t,mt);var n=document.querySelector(".js-notes-box-panel");n&&n.redraw(n.selectedObj)}}})}}var x,_,b=t._fullLayout,w=t._fullLayout._size;r?(x="annotation-"+r,_=r+".annotations["+n+"]"):(x="annotation",_="annotations["+n+"]"),b._infolayer.selectAll("."+x+'[data-index="'+n+'"]').remove();var M="clip"+b._uid+"_ann"+n;if(!e._input||!1===e.visible)return void s.selectAll("#"+M).remove();var k={x:{},y:{}},A=+e.textangle||0,S=b._infolayer.append("g").classed(x,!0).attr("data-index",String(n)).style("opacity",e.opacity),T=S.append("g").classed("annotation-text-g",!0),z=T.append("g").style("pointer-events",e.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1;var i={index:n,annotation:e._input,fullAnnotation:e,event:s.event};r&&(i.subplotId=r),t.emit("plotly_clickannotation",i)});e.hovertext&&z.on("mouseover",function(){var n=e.hoverlabel,r=n.font,i=this.getBoundingClientRect(),a=t.getBoundingClientRect();p.loneHover({x0:i.left-a.left,x1:i.right-a.left,y:(i.top+i.bottom)/2-a.top,text:e.hovertext,color:n.bgcolor,borderColor:n.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:b._hoverlayer.node(),outerContainer:b._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(b._hoverlayer.node())});var E=e.borderwidth,L=e.borderpad,I=E+L,D=z.append("rect").attr("class","bg").style("stroke-width",E+"px").call(h.stroke,e.bordercolor).call(h.fill,e.bgcolor),C=e.width||e.height,P=b._defs.select(".clips").selectAll("#"+M).data(C?[0]:[]);P.enter().append("clipPath").classed("annclip",!0).attr("id",M).append("rect"),P.exit().remove();var O=e.font,F=z.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?F.call(m.makeEditable,{delegate:z,gd:t}).call(u).on("edit",function(n){e.text=n,this.call(u);var r={};r[_+".text"]=e.text,i&&i.autorange&&(r[i._name+".autorange"]=!0),a&&a.autorange&&(r[a._name+".autorange"]=!0),l.relayout(t,r)}):F.call(u)}function o(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 s=t("d3"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../fx"),m=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:r,drawOne:i,drawRaw:a}},{"../../lib":344,"../../lib/setcursor":359,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/cartesian/axes":379,"../../plots/plots":415,"../color":231,"../dragelement":252,"../drawing":255,"../fx":272,"./draw_arrow_head":223,d3:8}],223:[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,u){function c(){t.style("stroke-dasharray","0px,100px")}function f(n,i){d.path&&(e>5&&(i=0),r.select(h.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+n.x+","+n.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:x,opacity:_,"stroke-width":0}))}i(l)||(l=1);var h=t.node(),d=s[e||0];"string"==typeof n&&n||(n="end");var p,m,g,v,y=(o.getPx(t,"stroke-width")||1)*l,x=t.style("stroke")||a.defaultLine,_=t.style("stroke-opacity")||1,b=n.indexOf("start")>=0,w=n.indexOf("end")>=0,M=d.backoff*y+u;if("line"===h.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},m={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-m.x,A=p.y-m.y;if(g=Math.atan2(A,k),v=g+Math.PI,M){if(M*M>k*k+A*A)return void c();var S=M*Math.cos(g),T=M*Math.sin(g);b&&(p.x-=S,p.y-=T,t.attr({x1:p.x,y1:p.y})),w&&(m.x+=S,m.y+=T,t.attr({x2:m.x,y2:m.y}))}}else if("path"===h.nodeName){var z=h.getTotalLength(),E="";if(z1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*n[0],e.yaxis.r2l(l.y)*n[1],e.zaxis.r2l(l.z)*n[2]]),r(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":405,"../annotations/draw":222}],229:[function(t,e,n){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":225,"./convert":226,"./defaults":227,"./draw":228}],230:[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},{}],231:[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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={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(o).toRgbString()},o.contrast=function(t,e,n){var r=i(t);return 1!==r.getAlpha()&&(r=i(o.combine(t,u))),(r.isDark()?e?r.lighten(e):u:n?r.darken(n):l).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]-=(ut-s)/2):n.node()&&!n.classed("js-placeholder")&&(ut=d.bBox(n.node()).height),ut){if(ut+=5,"top"===M.titleside)et.domain[1]-=ut/z.h,a[1]*=-1;else{et.domain[0]+=ut/z.h;var u=g.lineCount(n);a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),et.setScale()}}st.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(z.h*(1-et.domain[1]))+")");var f=st.select(".cbfills").selectAll("rect.cbfill").data(D);f.enter().append("rect").classed("cbfill",!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var n=[0===e?L[0]:(D[e]+D[e-1])/2,e===D.length-1?L[1]:(D[e]+D[e+1])/2].map(et.c2p).map(Math.round);e!==D.length-1&&(n[1]+=n[1]>n[0]?1:-1);var a=P(t).replace("e-",""),o=i(a).toHexString();r.select(this).attr({x:W,width:Math.max(q,2),y:r.min(n),height:Math.max(r.max(n)-r.min(n),2),fill:o})});var h=st.select(".cblines").selectAll("path.cbline").data(M.line.color&&M.line.width?I:[]);return h.enter().append("path").classed("cbline",!0),h.exit().remove(),h.each(function(t){r.select(this).attr("d","M"+W+","+(Math.round(et.c2p(t))+M.line.width/2%1)+"h"+q).call(d.lineGroupStyle,M.line.width,C(t),M.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=W+q+(M.outlinewidth||0)/2-("outside"===M.ticks?1:0),et.side="right",c.syncOrAsync([function(){return l.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(M.titleside)){var e=et.titlefont.size,n=et._offset+et._length/2,i=z.l+(et.position||0)*z.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));A("h"+et._id+"title",{avoid:{selection:r.select(t).selectAll("g."+et._id+"tick"),side:M.titleside,offsetLeft:z.l,offsetTop:z.t,maxShift:T.width},attributes:{x:i,y:n,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,n){var r,i=w();r=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:et,propName:r,traceIndex:i.index,dfltName:"colorscale",containerGroup:st.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;st.selectAll("."+o+",."+o+"-math-group").remove(),m.draw(t,e,f(a,n||{}))}function S(){var n=q+M.outlinewidth/2+d.bBox(et._axislayer.node()).width;if(N=lt.select("text"),N.node()&&!N.classed("js-placeholder")){var r,i=lt.select(".h"+et._id+"title-math-group").node();r=i&&-1!==["top","bottom"].indexOf(M.titleside)?d.bBox(i).width:d.bBox(lt.node()).right-W-z.l,n=Math.max(n,r)}var a=2*M.xpad+n+M.borderwidth+M.outlinewidth/2,s=$-K;st.select(".cbbg").attr({x:W-M.xpad-(M.borderwidth+M.outlinewidth)/2,y:K-X,width:Math.max(a,2),height:Math.max(s+2*X,2)}).call(p.fill,M.bgcolor).call(p.stroke,M.bordercolor).style({"stroke-width":M.borderwidth}),st.selectAll(".cboutline").attr({x:W,y:K+M.ypad+("top"===M.titleside?ut:0),width:Math.max(q,2),height:Math.max(s-2*M.ypad-ut,2)}).call(p.stroke,M.outlinecolor).style({fill:"None","stroke-width":M.outlinewidth});var l=({center:.5,right:1}[M.xanchor]||0)*a;st.attr("transform","translate("+(z.l-l)+","+z.t+")"),o.autoMargin(t,e,{x:M.x,y:M.y,l:a*({right:1,center:.5}[M.xanchor]||0),r:a*({left:1,center:.5}[M.xanchor]||0),t:s*({bottom:1,middle:.5}[M.yanchor]||0),b:s*({top:1,middle:.5}[M.yanchor]||0)})}var T=t._fullLayout,z=T._size;if("function"!=typeof M.fillcolor&&"function"!=typeof M.line.color)return void T._infolayer.selectAll("g."+e).remove();var E,L=r.extent(("function"==typeof M.fillcolor?M.fillcolor:M.line.color).domain()),I=[],D=[],C="function"==typeof M.line.color?M.line.color:function(){return M.line.color},P="function"==typeof M.fillcolor?M.fillcolor:function(){return M.fillcolor},O=M.levels.end+M.levels.size/100,F=M.levels.size,R=1.001*L[0]-.001*L[1],j=1.001*L[1]-.001*L[0];for(E=M.levels.start;(E-O)*F<0;E+=F)E>R&&EL[0]&&E1){var ot=Math.pow(10,Math.floor(Math.log(at)/Math.LN10));rt*=ot*c.roundUp(at/ot,[2,5,10]),(Math.abs(M.levels.start)/M.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=rt}et.domain=[J+Y,J+H-Y],et.setScale();var st=T._infolayer.selectAll("g."+e).data([0]);st.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)}),st.attr("transform","translate("+Math.round(z.l)+","+Math.round(z.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(z.l)+",-"+Math.round(z.t)+")");et._axislayer=st.select(".cbaxis");var ut=0;if(-1!==["top","bottom"].indexOf(M.titleside)){var ct,ft=z.l+(M.x+Z)*z.w,ht=et.titlefont.size;ct="top"===M.titleside?(1-(J+H-Y))*z.h+z.t+3+.75*ht:(1-(J+Y))*z.h+z.t-3-.25*ht,A(et._id+"title",{attributes:{x:ft,y:ct,"text-anchor":"start"}})}var dt=c.syncOrAsync([o.previousPromises,k,o.previousPromises,S],t);if(dt&&dt.then&&(t._promises||[]).push(dt),t._context.editable){var pt,mt,gt;u.init({element:st.node(),gd:t,prepFn:function(){pt=st.attr("transform"),h(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),mt=u.align(Q+t/z.w,U,0,1,M.xanchor),gt=u.align(J-e/z.h,H,0,1,M.yanchor);var n=u.getCursor(mt,gt,M.xanchor,M.yanchor);h(st,n)},doneFn:function(e){h(st),e&&void 0!==mt&&void 0!==gt&&a.restyle(t,{"colorbar.x":mt,"colorbar.y":gt},w().index)}})}return dt}function w(){var n,r,i=e.substr(2);for(n=0;n=0?i.Reds:i.Blues,l.colorscale=m,s.reversescale&&(m=a(m)),s.colorscale=m)}},{"../../lib":344,"./flip_scale":242,"./scales":249}],238:[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":339,"./attributes":236,"./scales.js":249}],239:[function(t,e,n){"use strict";var r=t("./scales");e.exports=r.RdBu},{"./scales":249}],240:[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;u(f+h+"auto",!(r(g)&&r(v)&&g=0;i--,a++)e=t[i],r[a]=[1-e[0],e[1]];return r}},{}],243:[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":239,"./is_valid_scale_array":247,"./scales":249}],244:[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}},{}],251:[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":344}],252:[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=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return m._dragged=!1,m._dragging=!0,c=e.clientX,f=e.clientY,p=e.target,h=(new Date).getTime(),h-m._mouseDownTimev&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(m._dragged,g,e),!m._dragged){var n;try{n=new MouseEvent("click",e)}catch(t){n=document.createEvent("MouseEvents"),n.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(n)}return i(m),m._dragged=!1,o.pauseEvent(e)}var c,f,h,d,p,m=t.gd,g=1,v=l.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=r},{"../../constants/interactions":328,"../../lib":344,"../../plotly":374,"../../plots/cartesian/constants":384,"./align":250,"./cursor":251,"./unhover":253}],253:[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,i=t._hoverdata;e||(e={}),e.target&&!1===r.triggerHandler(t,"plotly_beforehover",e)||(n._hoverlayer.selectAll("g").remove(),n._hoverlayer.selectAll("line").remove(),n._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":338}],254:[function(t,e,n){"use strict";n.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],255:[function(t,e,n){"use strict";function r(t,e,n,r,i,a,o,s){if(u.traceIs(n,"symbols")){var l=y(n);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:v.isBubble(n)?l(t.ms):(a.size||6)/2,t.mrc=e;var r=x.symbolNumber(t.mx||a.symbol)||0,i=r%100;return t.om=r%200>=100,x.symbolFuncs[i](e)+(r>=200?w:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var f,h,d,p=!1;if(t.so?(d=o.outlierwidth,h=o.outliercolor,f=a.outliercolor):(d=(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)?c.defaultLine:o.color,Array.isArray(a.color)&&(f=c.defaultLine,p=!0),f="mc"in t?t.mcc=r(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,f).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var m=a.gradient,g=t.mgt;if(g?p=!0:g=m&&m.type,g&&"none"!==g){var _=t.mgc;_?p=!0:_=m.color;var b="g"+s._fullLayout._uid+"-"+n.uid;p&&(b+="-"+t.i),e.call(x.gradient,s,b,g,f,_)}else e.call(c.fill,f);d&&e.call(c.stroke,h)}}function i(t,e,n,r){var i=t[0]-e[0],a=t[1]-e[1],s=n[0]-e[0],l=n[1]-e[1],u=Math.pow(i*i+a*a,S/2),c=Math.pow(s*s+l*l,S/2),f=(c*c*i-u*u*s)*r,h=(c*c*a-u*u*l)*r,d=3*c*(u+c),p=3*u*(u+c);return[[o.round(e[0]+(d&&f/d),2),o.round(e[1]+(d&&h/d),2)],[o.round(e[0]-(p&&f/p),2),o.round(e[1]-(p&&h/p),2)]]}function a(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var o=t("d3"),s=t("fast-isnumeric"),l=t("tinycolor2"),u=t("../../registry"),c=t("../color"),f=t("../colorscale"),h=t("../../lib"),d=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),m=t("../../constants/alignment"),g=m.LINE_SPACING,v=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),x=e.exports={};x.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(c.fill,r)},x.setPosition=function(t,e,n){t.attr("x",e).attr("y",n)},x.setSize=function(t,e,n){t.attr("width",e).attr("height",n)},x.setRect=function(t,e,n,r,i){t.call(x.setPosition,e,n).call(x.setSize,r,i)},x.translatePoint=function(t,e,n,r){var i=t.xp||n.c2p(t.x),a=t.yp||r.c2p(t.y);return!!(s(i)&&s(a)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0)},x.translatePoints=function(t,e,n,r){t.each(function(t){var i=o.select(this);x.translatePoint(t,i,e,n,r)})},x.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},x.crispRound=function(t,e,n){return e&&s(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},x.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||"";c.stroke(e,r||a.color),x.dashLine(e,s,o)},x.lineGroupStyle=function(t,e,n,r){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},a=e||i.width||0,s=r||i.dash||"";o.select(this).call(c.stroke,n||i.color).call(x.dashLine,s,a)})},x.dashLine=function(t,e,n){n=+n||0,e=x.dashStyle(e,n),t.style({"stroke-dasharray":e,"stroke-width":n+"px"})},x.dashStyle=function(t,e){e=+e||1;var n=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=n+"px,"+n+"px":"dash"===t?t=3*n+"px,"+3*n+"px":"longdash"===t?t=5*n+"px,"+5*n+"px":"dashdot"===t?t=3*n+"px,"+n+"px,"+n+"px,"+n+"px":"longdashdot"===t&&(t=5*n+"px,"+2*n+"px,"+n+"px,"+2*n+"px"),t},x.singleFillStyle=function(t){var e=o.select(t.node()),n=e.data(),r=(((n[0]||[])[0]||{}).trace||{}).fillcolor;r&&t.call(c.fill,r)},x.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var n=o.select(this);try{n.call(c.fill,e[0].trace.fillcolor)}catch(e){h.error(e,t),n.remove()}})};var _=t("./symbol_defs");x.symbolNames=[],x.symbolFuncs=[],x.symbolNeedLines={},x.symbolNoDot={},x.symbolList=[],Object.keys(_).forEach(function(t){var e=_[t];x.symbolList=x.symbolList.concat([e.n,t,e.n+100,t+"-open"]),x.symbolNames[e.n]=t,x.symbolFuncs[e.n]=e.f,e.needLine&&(x.symbolNeedLines[e.n]=!0),e.noDot?x.symbolNoDot[e.n]=!0:x.symbolList=x.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var b=x.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";x.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=x.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=b||t>=400?0:Math.floor(Math.max(t,0))};var M={x1:1,x2:0,y1:0,y2:0},k={x1:0,x2:0,y1:1,y2:0};x.gradient=function(t,e,n,r,i,a){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+n).data([r+i+a],h.identity);s.exit().remove(),s.enter().append("radial"===r?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===r?t.attr(M):"vertical"===r&&t.attr(k),t.attr("id",n);var e=l(i),s=l(a);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+n+")","fill-opacity":null})},x.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},x.singlePointStyle=function(t,e,n,i,a,o){var s=n.marker;r(t,e,n,i,a,s,s.line,o)},x.pointStyle=function(t,e,n){if(t.size()){var r=e.marker,i=x.tryColorscale(r,""),a=x.tryColorscale(r,"line");t.each(function(t){x.singlePointStyle(t,o.select(this),e,i,a,n)})}},x.tryColorscale=function(t,e){var n=e?h.nestedProperty(t,e).get():t,r=n.colorscale,i=n.color;return r&&Array.isArray(i)?f.makeColorScaleFunc(f.extractScale(r,n.cmin,n.cmax)):h.identity};var A={start:1,end:-1,middle:0,bottom:1,top:-1};x.textPointStyle=function(t,e,n){t.each(function(t){var r=o.select(this),i=t.tx||e.text;if(!i||Array.isArray(i))return void r.remove();var a=t.tp||e.textposition,l=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",u=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,f=t.mrc?t.mrc/.8+1:0;c=s(c)&&c>0?c:0,r.call(x.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",u).text(i).call(d.convertToTspans,n);var h=o.select(this.parentNode),p=(d.lineCount(r)-1)*g+1,m=A[u]*f,v=.75*c+A[l]*f+(A[l]-1)*p*c/2;h.attr("transform","translate("+m+","+v+")")})};var S=.5;x.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var n,r="M"+t[0],a=[];for(n=1;n=1e4&&(x.savedBBoxes={},E=0),e&&(x.savedBBoxes[e]=g),E++,h.extendFlat({},g)},x.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.split("#")[0]+n),t.attr("clip-path","url("+n+")")},x.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,n=t.attr?"attr":"getAttribute",r=t[n]("transform")||"",i=r.replace(e,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+i[0]||0,y:+i[1]||0}},x.setTranslate=function(t,e,n){var r=/(\btranslate\(.*?\);?)/,i=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[i]("transform")||"";return e=e||0,n=n||0,o=o.replace(r,"").trim(),o+=" translate("+e+", "+n+")",o=o.trim(),t[a]("transform",o),o},x.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,n=t.attr?"attr":"getAttribute",r=t[n]("transform")||"",i=r.replace(e,function(t,e,n){return[e,n].join(" ")}).split(" ");return{x:+i[0]||1,y:+i[1]||1}},x.setScale=function(t,e,n){var r=/(\bscale\(.*?\);?)/,i=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[i]("transform")||"";return e=e||1,n=n||1,o=o.replace(r,"").trim(),o+=" scale("+e+", "+n+")",o=o.trim(),t[a]("transform",o),o},x.setPointGroupScale=function(t,e,n){var r,i,a;return e=e||1,n=n||1,i=1===e&&1===n?"":" scale("+e+","+n+")",a=/\s*sc.*/,t.each(function(){r=(this.getAttribute("transform")||"").replace(a,""),r+=i,r=r.trim(),this.setAttribute("transform",r)}),i};var L=/translate\([^)]*\)\s*$/;x.setTextPointsScale=function(t,e,n){t.each(function(){var t,r=o.select(this),i=r.select("text"),a=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(r.attr("transform")||"").match(L);t=1===e&&1===n?[]:["translate("+a+","+s+")","scale("+e+","+n+")","translate("+-a+","+-s+")"],l&&t.push(l),r.attr("transform",t.join(" "))})}},{"../../constants/alignment":327,"../../constants/xmlns_namespaces":331,"../../lib":344,"../../lib/svg_text_utils":361,"../../registry":423,"../../traces/scatter/make_bubble_size_func":449,"../../traces/scatter/subtypes":454,"../color":231,"../colorscale":245,"./symbol_defs":256,d3:8,"fast-isnumeric":12,tinycolor2:197}],256:[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);return"M-"+e+","+r.round(t/2,2)+"H"+e+"L0,-"+r.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+r.round(t/2,2)+"H"+e+"L0,"+r.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M"+r.round(t/2,2)+",-"+e+"V"+e+"L-"+r.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=r.round(2*t/Math.sqrt(3),2);return"M-"+r.round(t/2,2)+",-"+e+"V"+e+"L"+r.round(t,2)+",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(-.309*t,2);return"M"+e+","+a+"L"+n+","+r.round(.809*t,2)+"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(-.309*e,2),u=r.round(.118*e,2),c=r.round(.809*e,2);return"M"+n+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+r.round(.382*e,2)+"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}],257:[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"}}}},{}],258:[function(t,e,n){"use strict";function r(t,e,n,r){var a=e["error_"+r]||{},l=a.visible&&-1!==["linear","log"].indexOf(n.type),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":454,d3:8,"fast-isnumeric":12}],263:[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":231,d3:8}],264:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:r({},i.family,{arrayOk:!0}),size:r({},i.size,{arrayOk:!0}),color:r({},i.color,{arrayOk:!0})}}}},{"../../lib/extend":339,"../../plots/font_attributes":403}],265:[function(t,e,n){"use strict";function r(t,e,n,r){r=r||i.identity,Array.isArray(t)&&(e[0][n]=r(t))}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,n=t._fullLayout,o=0;o=0&&n.index$.width||Q<0||Q>$.height)return x.unhoverRaw(t,e)}if(P="xval"in e?w.flat(h,e.xval):w.p2c(T,W),O="yval"in e?w.flat(h,e.yval):w.p2c(z,Q),!f(P[0])||!f(O[0]))return d.warn("Fx.hover failed",e,t),x.unhoverRaw(t,e)}var K=1/0;for(R=0;RZ&&(X.splice(0,Z),K=X[0].distance)}if(0===X.length)return x.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var it=t._hoverdata,at=[];for(F=0;F1,ut=y.combine(m.plot_bgcolor||y.background,m.paper_bgcolor),ct={hovermode:C,rotateLabels:lt,bgColor:ut,container:m._hoverlayer,outerContainer:m._paperdiv,commonLabelOpts:m.hoverlabel},ft=i(X,ct,t);if(a(X,lt?"xa":"ya"),o(ft,lt),e.target&&e.target.tagName){var ht=b.getComponentMethod("annotations","hasClickToShow")(t,at);g(c.select(e.target),ht?"pointer":"")}e.target&&!r&&u(t,e,it)&&(it&&t.emit("plotly_unhover",{event:e,points:it}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:z,xvals:P,yvals:O}))}function i(t,e,n){var r,i,a=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||M.HOVERFONT,d=e.fontSize||M.HOVERFONTSIZE,p=t[0],g=p.xa,x=p.ya,_="y"===a?"yLabel":"xLabel",b=p[_],w=(String(b)||"").split(" ")[0],A=u.node().getBoundingClientRect(),S=A.top,T=A.width,z=A.height,I=p.distance<=M.MAXDIST&&("x"===a||"y"===a);for(r=0;r15&&(r=r.substr(0,12)+"...")),void 0!==t.extraText&&(i+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(i+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(i+="y: "+t.yLabel+"
"),i+=(i?"z: ":"")+t.zLabel):I&&t[a+"Label"]===b?i=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(i=t.yLabel):i=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(i+=(i?"
":"")+t.text),""===i&&(""===r&&e.remove(),i=r);var p=e.select("text.nums").call(v.font,t.fontFamily||h,t.fontSize||d,t.fontColor||f).text(i).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,n),g=e.select("text.name"),x=0;r&&r!==i?(g.call(v.font,t.fontFamily||h,t.fontSize||d,u).text(r).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,n),x=g.node().getBoundingClientRect().width+2*L):(g.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var _,w,M=p.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,C=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=M.width+E+L+x;t.ty0=S-M.top,t.bx=M.width+2*L,t.by=M.height+2*L,t.anchor="start",t.txwidth=M.width,t.tx2width=x,t.offset=0,o?(t.pos=A,_=D+P/2+O<=z,w=D-P/2-O>=0,"top"!==t.idealAlign&&_||!w?_?(D+=P/2,t.anchor="start"):t.anchor="middle":(D-=P/2,t.anchor="end")):(t.pos=D,_=A+C/2+O<=T,w=A-C/2-O>=0,"left"!==t.idealAlign&&_||!w?_?(A+=C/2,t.anchor="start"):t.anchor="middle":(A-=C/2,t.anchor="end")),p.attr("text-anchor",t.anchor),x&&g.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+D+")"+(o?"rotate("+k+")":""))}),P}function a(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)?S: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 o(t,e){t.each(function(t){var n=c.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*(E+L),s=o+a*(t.txwidth+L),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-z,l=t.offset*T),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*E+l)+","+(E+u)+"v"+(t.by/2-E)+"h"+r*t.bx+"v-"+t.by+"H"+(r*E+l)+"V"+(u-E)+"Z"),i.call(m.positionText,o+l,u+t.ty0-t.by/2+L),t.tx2width&&(n.select("text.name").call(m.positionText,s+a*L+l,u+t.ty0-t.by/2+L),n.select("rect").call(v.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function n(e,n,o){var s;if(a[n])s=a[n];else if(i[n]){var l=i[n];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(r,o).get();s&&(t[e]=s)}var r=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};n("hoverinfo","hi","hoverinfo"),n("color","hbg","hoverlabel.bgcolor"),n("borderColor","hbc","hoverlabel.bordercolor"),n("fontFamily","htf","hoverlabel.font.family"),n("fontSize","hts","hoverlabel.font.size"),n("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=_.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=_.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=_.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+_.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=_.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+_.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(f=f.split("+"),-1===f.indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var n=e.hovermode,r=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(r.selectAll(".spikeline").remove(),"closest"===n&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,f=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=h.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var m=o.spikemode,g=o.spikethickness,x=o.spikecolor||p,_=o._boundingBox,b=(_.left+_.right)/2=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 c=t("d3"),f=t("fast-isnumeric"),h=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),m=t("../../lib/svg_text_utils"),g=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),x=t("../dragelement"),_=t("../../plots/cartesian/axes"),b=t("../../registry"),w=t("./helpers"),M=t("./constants"),k=M.YANGLE,A=Math.PI*k/180,S=1/Math.sin(A),T=Math.cos(A),z=Math.sin(A),E=M.HOVERARROWSIZE,L=M.HOVERTEXTPAD;n.hover=function(t,e,n,i){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME)return r(t,e,n,i),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){r(t,e,n,i),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},n.loneHover=function(t,e){var n={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},r=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):r,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:r,outerContainer:a},l=i([n],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":344,"../../lib/events":338,"../../lib/override_cursor":353,"../../lib/svg_text_utils":361,"../../plots/cartesian/axes":379,"../../registry":423,"../color":231,"../dragelement":252,"../drawing":255,"./constants":267,"./helpers":269,d3:8,"fast-isnumeric":12,tinycolor2:197}],271:[function(t,e,n){"use strict";var r=t("../../lib");e.exports=function(t,e,n,i){i=i||{},n("hoverlabel.bgcolor",i.bgcolor),n("hoverlabel.bordercolor",i.bordercolor),r.coerceFont(n,"hoverlabel.font",i.font)}},{"../../lib":344}],272:[function(t,e,n){"use strict";function r(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,n){return s.castOption(t,e,"hoverlabel."+n)}function a(t,e,n){function r(n){return s.coerceHoverinfo({hoverinfo:n},{_module:t._module},e)}return s.castOption(t,n,"hoverinfo",r)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:i,castHoverinfo:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:r,click:t("./click")}},{"../../lib":344,"../dragelement":252,"./attributes":264,"./calc":265,"./click":266,"./constants":267,"./defaults":268,"./helpers":269,"./hover":270,"./layout_attributes":273,"./layout_defaults":274,"./layout_global_defaults":275,d3:8}],273:[function(t,e,n){"use strict";var r=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:r({},i.family,{dflt:a.HOVERFONT}),size:r({},i.size,{dflt:a.HOVERFONTSIZE}),color:r({},i.color)}}}},{"../../lib/extend":339,"../../plots/font_attributes":403,"./constants":267}],274:[function(t,e,n){"use strict";function r(t){for(var e=!0,n=0;n=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}},{}],282:[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":339,"../../plots/font_attributes":403,"../color/attributes":230}],283:[function(t,e,n){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],284:[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(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",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":344,"../../plots/layout_attributes":406,"../../registry":423,"./attributes":282,"./helpers":287}],285:[function(t,e,n){"use strict";function r(t,e){function n(n){y.convertToTspans(n,e,function(){o(t,e)})}var r=t.data()[0][0],i=e._fullLayout,a=r.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?r.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?c.call(y.makeEditable,{gd:e}).call(n).on("edit",function(t){this.text(t).call(n),this.text()||(t=" ");var i,a=r.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(a.type)){var o=r.trace.transforms;i=o[o.length-1].direction+".name"}else i="name";f.restyle(e,i,t,l)}):c.call(n)}function i(t,e){var n,r=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){n=(new Date).getTime(),n-e._legendMouseDownTimeT&&(r=Math.max(r-1,1)),1===r?n._clickTimeout=setTimeout(function(){a(t,e,r)},T):2===r&&(n._clickTimeout&&clearTimeout(n._clickTimeout),e._legendMouseDownTime=0,a(t,e,r))}})}function a(t,e,n){if(!e._dragged&&!e._editing){var r,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===n&&S&&e.data&&e._context.showTips?(h.notifier("Double click on legend to isolate individual trace","long"),S=!1):S=!1,p.traceIs(l,"pie")){var d=o.label,m=a.indexOf(d);1===n?-1===m?a.push(d):a.splice(m,1):2===n&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&-1===m&&(a=[])),f.relayout(e,"hiddenlabels",a)}else{var g,v=[],y=[];for(g=0;gr.width-(r.margin.r+r.margin.l)&&(y=0,p+=m,i.height=i.height+m,m=0),g.setTranslate(this,a+y,5+a+e.height/2+p),i.width+=o+n,i.height=Math.max(i.height,e.height),y+=o+n,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),n.each(function(e){var n=e[0];c.select(this).select(".legendtoggle").call(g.setRect,0,-n.height/2,t._context.editable?0:i.width,n.height)})}}function l(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.isCenterAnchor(n)&&(r="center");var i="top";A.isBottomAnchor(n)?i="bottom":A.isMiddleAnchor(n)&&(i="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}[i]||0),t:n.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,n=e.legend,r="left";A.isRightAnchor(n)?r="right":A.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"),f=t("../../plotly"),h=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),m=t("../dragelement"),g=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),x=t("./constants"),_=t("../../constants/interactions"),b=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),M=t("./style"),k=t("./helpers"),A=t("./anchor_utils"),S=!0,T=_.DBLCLICKDELAY;e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(g.setTranslate,0,e),L.call(g.setRect,N,t,x.scrollBarWidth,x.scrollBarHeight),S.select("rect").attr({y:y.borderwidth-e})}var n=t._fullLayout,o="legend"+n._uid;if(n._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=n.legend,_=n.showlegend&&w(t.calcdata,y),b=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 S=n._topdefs.selectAll("#"+o).data([0]);S.enter().append("clipPath").attr("id",o).append("rect");var z=k.selectAll("rect.bg").data([0]);z.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),z.call(v.stroke,y.bordercolor),z.call(v.fill,y.bgcolor),z.style("stroke-width",y.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 I=E.selectAll("g.groups").data(_);I.enter().append("g").attr("class","groups"),I.exit().remove();var D=I.selectAll("g.traces").data(h.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(M,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==b.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(r,t).call(i,t)});var C=0!==k.enter().size();C&&(s(t,I,D),l(t));var P=n.width,O=n.height;s(t,I,D),y.height>O?u(t):l(t);var F=n._size,R=F.l+F.w*y.x,j=F.t+F.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var N=y.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),R<0&&(R=0),N=Math.min(P-R,y.width));var V=y.height,q=F.h;V>q?(j=F.t,V=q):(j+V>O&&(j=O-V),j<0&&(j=0),V=Math.min(O-j,y.height)),g.setTranslate(k,R,j);var U,G,H=V-x.scrollBarHeight-2*x.scrollBarMargin,Z=y.height-V;if(y.height<=V||t._context.staticPlot)z.attr({width:N-y.borderwidth,height:V-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),g.setTranslate(E,0,0),S.select("rect").attr({width:N-2*y.borderwidth,height:V-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),E.call(g.setClipUrl,o);else{U=x.scrollBarMargin,G=E.attr("data-scroll")||0,z.attr({width:N-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:V-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),S.select("rect").attr({width:N-2*y.borderwidth+x.scrollBarWidth+x.scrollBarMargin,height:V-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-G}),E.call(g.setClipUrl,o),C&&e(U,G),k.on("wheel",null),k.on("wheel",function(){G=h.constrain(E.attr("data-scroll")-c.event.deltaY/H*Z,-Z,0),U=x.scrollBarMargin-G/Z*H,e(U,G),0!==G&&G!==-Z&&c.event.preventDefault()}),L.on(".drag",null),E.on(".drag",null);var X=c.behavior.drag().on("drag",function(){U=h.constrain(c.event.y-x.scrollBarHeight/2,x.scrollBarMargin,x.scrollBarMargin+H),G=-(U-x.scrollBarMargin)/H*Z,e(U,G)});L.call(X),E.call(X)}if(t._context.editable){var Y,W,Q,J;k.classed("cursor-move",!0),m.init({element:k.node(),gd:t,prepFn:function(){var t=g.getTranslate(k);Q=t.x,J=t.y},moveFn:function(t,e){var n=Q+t,r=J+e;g.setTranslate(k,n,r),Y=m.align(n,0,F.l,F.l+F.w,y.xanchor),W=m.align(r,0,F.t+F.h,F.t,y.yanchor)},doneFn:function(e,r,i){if(e&&void 0!==Y&&void 0!==W)f.relayout(t,{"legend.x":Y,"legend.y":W});else{var o=n._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===r?k._clickTimeout=setTimeout(function(){a(o,t,r)},T):2===r&&(k._clickTimeout&&clearTimeout(k._clickTimeout),a(o,t,r)))}}})}}}},{"../../constants/alignment":327,"../../constants/interactions":328,"../../lib":344,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/plots":415,"../../registry":423,"../color":231,"../dragelement":252,"../drawing":255,"./anchor_utils":281,"./constants":283,"./get_legend_data":286,"./helpers":287,"./style":289,d3:8}],286:[function(t,e,n){"use strict";var r=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function n(t,n){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[n]]):s[t].push([n]);else{var r="~~i"+f;l.push(r),s[r]=[[n]],f++}}var a,o,s={},l=[],u=!1,c={},f=0;for(a=0;an[1])return n[1]}return i}function i(t){return t[0]}var s,u,c=t[0],f=c.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var m={},g={};h&&(m.mc=n("marker.color",i),m.mo=n("marker.opacity",a.mean,[.2,1]),m.ms=n("marker.size",a.mean,[2,16]),m.mlc=n("marker.line.color",i),m.mlw=n("marker.line.width",a.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(g.line={width:n("line.width",i,[0,10])}),d&&(m.tx="Aa",m.tp=n("textposition",i),m.ts=10,m.tc=n("textfont.color",i),m.tf=n("textfont.family",i)),s=[a.minExtend(c,m)],u=a.minExtend(f,g)}var v=r.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),h&&(s[0].mrc=3);var x=v.selectAll("g.pointtext").data(d?s:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(o.textPointStyle,u,e)}function f(t){var e=t[0].trace,n=e.marker||{},a=n.line||{},o=r.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=r.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||n.color),o&&e.call(s.stroke,i.mlc||a.color)})}function h(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.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(){var t=e.line.width,n=r.select(this);n.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&n.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,n=r.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.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(u,t[0],e)}t.each(function(t){var e=r.select(this),n=e.selectAll("g.layers").data([0]);n.enter().append("g").classed("layers",!0),n.style("opacity",t[0].trace.opacity),n.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),n.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var i=n.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(f).each(h).each(d).each(n).each(c)}},{"../../lib":344,"../../registry":423,"../../traces/pie/style_one":432,"../../traces/scatter/subtypes":454,"../color":231,"../drawing":255,d3:8}],290:[function(t,e,n){"use strict";function r(t,e){var n,r,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,g=(1-p)/2;for(r=0;r1)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||p)&&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(["toggleSpikelines","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)){var p=i(e,n,l);f("x",p[0]),f("y",p[1]),a.noneOrAll(t,e,["x","y"]),f("xanchor"),f("yanchor"),a.coerceFont(f,"font",n.font);var m=f("bgcolor");f("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),f("bordercolor"),f("borderwidth")}}},{"../../lib":344,"../color":231,"./attributes":294,"./button_attributes":295,"./constants":296}],298:[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;sZ&&r>X&&!t.shiftKey?p.getCursor(i/n,1-a/r):"move";m(e,o),H=o.split("-")[0]}function a(e){N=f.getFromId(t,n.xref),B=f.getFromId(t,n.yref),V=v.getDataToPixel(t,N),q=v.getDataToPixel(t,B,!0),U=v.getPixelToData(t,N),G=v.getPixelToData(t,B,!0);var a="shapes["+r+"]";"path"===n.type?(R=n.path,j=a+".path"):(g=V(n.x0),y=q(n.y0),x=V(n.x1),_=q(n.y1),b=a+".x0",w=a+".y0",M=a+".x1",k=a+".y1"),gX&&(d[E]=n[C]=G(u),d[L]=n[P]=G(c)),h-f>Z&&(d[I]=n[O]=U(f),d[D]=n[F]=U(h))}e.attr("d",o(t,n))}var d,g,y,x,_,b,w,M,k,A,S,T,z,E,L,I,D,C,P,O,F,R,j,N,B,V,q,U,G,H,Z=10,X=10,Y={element:e.node(),gd:t,prepFn:a,doneFn:s},W=Y.element.getBoundingClientRect();p.init(Y),e.node().onmousemove=i}function o(t,e){var n,r,i,a,o=e.type,l=f.getFromId(t,e.xref),u=f.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(n=v.shapePositionToRange(l),r=function(t){return l._offset+l.r2p(n(t,!0))}):r=function(t){return c.l+c.w*t},u?(i=v.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(r=v.decodeDate(r)),u&&"date"===u.type&&(a=v.decodeDate(a)),s(e.path,r,a);var h=r(e.x0),d=r(e.x1),p=a(e.y0),m=a(e.y1);if("line"===o)return"M"+h+","+p+"L"+d+","+m;if("rect"===o)return"M"+h+","+p+"H"+d+"V"+m+"H"+h+"Z";var g=(h+d)/2,y=(p+m)/2,x=Math.abs(g-h),_=Math.abs(y-p),b="A"+x+","+_,w=g+x+","+y;return"M"+w+b+" 0 1,1 "+g+","+(y-_)+b+" 0 0,1 "+w+"Z"}function s(t,e,n){return t.replace(g.segmentRE,function(t){var r=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i],l=t.substr(1).replace(g.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.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,n){return t.replace(g.segmentRE,function(t){var r=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i];return i+t.substr(1).replace(g.paramRE,function(t){return r>=s?t:(a[r]?t=e(t):o[r]&&(t=n(t)),r++,t)})})}var u=t("../../plotly"),c=t("../../lib"),f=t("../../plots/cartesian/axes"),h=t("../color"),d=t("../drawing"),p=t("../dragelement"),m=t("../../lib/setcursor"),g=t("./constants"),v=t("./helpers");e.exports={draw:r,drawOne:i}},{"../../lib":344,"../../lib/setcursor":359,"../../plotly":374,"../../plots/cartesian/axes":379,"../color":231,"../dragelement":252,"../drawing":255,"./constants":309,"./helpers":312}],312:[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}},{}],313:[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":307,"./calc_autorange":308,"./defaults":310,"./draw":311}],314:[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)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",f=u("type",c),h=["x","y"],d=0;d<2;d++){var p=h[d],m={_fullLayout:n},g=i.coerceRef(t,e,m,p,"","paper");if("path"!==f){var v,y,x;"paper"!==g?(v=i.getFromId(m,g),x=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=x=r.identity;var _=p+"0",b=p+"1",w=t[_],M=t[b];t[_]=y(t[_],!0),t[b]=y(t[b],!0),i.coercePosition(e,m,u,g,_,.25),i.coercePosition(e,m,u,g,b,.75),e[_]=x(e[_]),e[b]=x(e[b]),t[_]=w,t[b]=M}}return"path"===f?u("path"):r.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":344,"../../plots/cartesian/axes":379,"./attributes":307,"./helpers":312}],315:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":339,"../../plots/animation_attributes":375,"../../plots/font_attributes":403,"../../plots/pad_attributes":414,"./constants":316}],316:[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,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}},{}],317:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(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),r("currentvalue.visible")&&(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;l=n.steps.length&&(n.active=0),e.call(s,n).call(_,n).call(c,n).call(p,n).call(x,t,n).call(l,t,n),A.setTranslate(e,n.lx+n.pad.l,n.ly+n.pad.t),e.call(g,n,n.active/(n.steps.length-1),!1),e.call(s,n)}function s(t,e,n){if(e.currentvalue.visible){var r,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":r=e.inputAreaLength-z.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":r=.5*e.inputAreaLength,i="middle";break;default:r=z.currentValueInset,i="left"}a.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"" +;if("string"==typeof n)o+=n;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(S.convertToTspans,e.gd);var s=S.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*E;return S.positionText(a,r,l),a}}function l(t,e,n){var r=t.selectAll("rect."+z.gripRectClass).data([0]);r.enter().append("rect").classed(z.gripRectClass,!0).call(d,e,t,n).style("pointer-events","all"),r.attr({width:z.gripWidth,height:z.gripHeight,rx:z.gripRadius,ry:z.gripRadius}).call(k.stroke,n.bordercolor).call(k.fill,n.bgcolor).style("stroke-width",n.borderwidth+"px")}function u(t,e,n){var r=t.selectAll("text").data([0]);return r.enter().append("text").classed(z.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),r.call(A.font,n.font).text(e.step.label).call(S.convertToTspans,n.gd),r}function c(t,e){var n=t.selectAll("g."+z.labelsClass).data([0]);n.enter().append("g").classed(z.labelsClass,!0);var r=n.selectAll("g."+z.labelGroupClass).data(e.labelSteps);r.enter().append("g").classed(z.labelGroupClass,!0),r.exit().remove(),r.each(function(t){var n=w.select(this);n.call(u,t,e),A.setTranslate(n,v(e,t.fraction),z.tickOffset+e.ticklen+e.font.size*E+z.labelOffset+e.currentValueTotalHeight)})}function f(t,e,n,r,i){var a=Math.round(r*(n.steps.length-1));a!==n.active&&h(t,e,n,a,!0,i)}function h(t,e,n,r,i,a){var o=n.active;n._input.active=n.active=r;var l=n.steps[n.active];e.call(g,n,n.active/(n.steps.length-1),a),e.call(s,n),t.emit("plotly_sliderchange",{slider:n,step:n.steps[n.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var n=e._nextMethod.step;n.method&&(n.execute&&M.executeAPICommand(t,n.method,n.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,n){function r(){return n.data()[0]}var i=n.node(),a=w.select(e);t.on("mousedown",function(){var t=r();e.emit("plotly_sliderstart",{slider:t});var o=n.select("."+z.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);f(e,n,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=r(),a=y(t,w.mouse(i)[0]);f(e,n,t,a,!1)}),a.on("mouseup",function(){var t=r();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var n=t.selectAll("rect."+z.tickRectClass).data(e.steps);n.enter().append("rect").classed(z.tickRectClass,!0),n.exit().remove(),n.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var r=n%e.labelStride==0,i=w.select(this);i.attr({height:r?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,v(e,n/(e.steps.length-1))-.5*e.tickwidth,(r?z.tickOffset:z.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,n=0;n0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.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(d,e,t,n).style("pointer-events","all"),r.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,z.tickOffset+n.ticklen+n.labelHeight)}).call(k.fill,n.bgcolor).attr("opacity",0),A.setTranslate(r,0,n.currentValueTotalHeight)}function _(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(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(n,z.railInset,.5*(e.inputAreaWidth-z.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(z.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&b(t),0!==n.length){var l=s.selectAll("g."+z.groupClassName).data(n,i);l.enter().append("g").classed(z.groupClassName,!0),l.exit().each(function(e){w.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,M.autoMargin(t,z.autoMarginIdRoot+e._index)});for(var u=0;u0||h<0){var m={left:[-n,0],right:[n,0],top:[0,-n],bottom:[0,n]}[_.side];e.attr("transform","translate("+m+")")}}}var g=n.propContainer,v=n.propName,y=n.traceIndex,x=n.dfltName,_=n.avoid||{},b=n.attributes,w=n.transform,M=n.containerGroup,k=t._fullLayout,A=g.titlefont.family,S=g.titlefont.size,T=g.titlefont.color,z=1,E=!1,L=g.title.trim(),I=t._context.editable;""===L&&(z=0),L.match(h)&&(z=.2,E=!0,I||(L=""));var D=L||I;M||(M=k._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var C=M.selectAll("text").data(D?[0]:[]);if(C.enter().append("text"),C.text(L).attr("class",e),C.exit().remove(),D){C.call(d);var P="Click to enter "+x+" title";I&&(L?C.on(".opacity",null):function(){z=0,E=!0,L=P,C.text(L).on("mouseover.opacity",function(){r.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){r.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}(),C.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?a.restyle(t,v,e,y):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,b.x,b.y)})),C.classed("js-placeholder",E)}}},{"../../constants/interactions":328,"../../lib":344,"../../lib/svg_text_utils":361,"../../plotly":374,"../../plots/plots":415,"../color":231,"../drawing":255,d3:8,"fast-isnumeric":12}],321:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":339,"../../plots/font_attributes":403,"../../plots/pad_attributes":414,"../color/attributes":230}],322:[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,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],323:[function(t,e,n){"use strict";function r(t,e,n){function r(n,r){return a.coerce(t,e,s,n,r)}r("visible",i(t,e).length>0)&&(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(a.enter().append("g").classed(E.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&b(t),0!==n.length){var c=a.selectAll("g."+E.headerGroupClassName).data(n,i);c.enter().append("g").classed(E.headerGroupClassName,!0);var f=a.selectAll("g."+E.dropdownButtonGroupClassName).data([0]);f.enter().append("g").classed(E.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var h=0;hM,S=r.barLength+2*r.barPad,T=r.barWidth+2*r.barPad,z=p,E=g+v;E+T>u&&(E=u-T);var L=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);L.exit().on(".drag",null).remove(),L.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,r.barColor),A?(this.hbar=L.attr({rx:r.barRadius,ry:r.barRadius,x:z,y:E,width:S,height:T}),this._hbarXMin=z+S/2,this._hbarTranslateMax=M-S):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var I=v>k,D=r.barWidth+2*r.barPad,C=r.barLength+2*r.barPad,P=p+m,O=g;P+D>l&&(P=l-D);var F=this.container.selectAll("rect.scrollbar-vertical").data(I?[0]:[]);F.exit().on(".drag",null).remove(),F.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,r.barColor),I?(this.vbar=F.attr({rx:r.barRadius,ry:r.barRadius,x:P,y:O,width:D,height:C}),this._vbarYMin=O+C/2,this._vbarTranslateMax=k-C):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,j=c-.5,N=I?f+D+.5:f+.5,B=h-.5,V=A?d+T+.5:d+.5,q=s._topdefs.selectAll("#"+R).data(A||I?[0]:[]);if(q.exit().remove(),q.enter().append("clipPath").attr("id",R).append("rect"),A||I?(this._clipRect=q.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(V)-Math.floor(B)}),this.container.call(o.setClipUrl,R),this.bg.attr({x:p,y:g,width:m,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||I){var U=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(U);var G=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(G),I&&this.vbar.on(".drag",null).call(G)}this.setTranslate(e,n)},r.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},r.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},r.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},r.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var n=t+this._hbarXMin,r=n+this._hbarTranslateMax;t=(s.constrain(i.event.x,n,r)-n)/(r-n)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},r.prototype.setTranslate=function(t,e){var n=this.position.w-this._box.w,r=this.position.h-this._box.h;if(t=s.constrain(t||0,0,n),e=s.constrain(e||0,0,r),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/n;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/r;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":344,"../color":231,"../drawing":255,d3:8}],327:[function(t,e,n){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],328:[function(t,e,n){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],329:[function(t,e,n){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],330:[function(t,e,n){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],331:[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}},{}],332:[function(t,e,n){"use strict";var r=t("./plotly");n.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":224,"./components/annotations3d":229,"./components/fx":272,"./components/images":280,"./components/legend":288,"./components/rangeselector":300,"./components/rangeslider":306,"./components/shapes":313,"./components/sliders":319,"./components/updatemenus":325,"./fonts/mathjax_config":333,"./lib/queue":356,"./plot_api/plot_schema":368,"./plot_api/register":369,"./plot_api/set_plot_config":370,"./plot_api/to_image":372,"./plot_api/validate":373,"./plotly":374,"./snapshot":428,"./snapshot/download":425,"./traces/scatter":444,d3:8,"es6-promise":10}],333:[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},{}],334:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),r(t)?Number(t):i}},{"../constants/numerical":329,"fast-isnumeric":12}],335:[function(t,e,n){"use strict";var r=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;n.valObjects={data_array:{coerceFunction:function(t,e,n){Array.isArray(t)?e.set(t):void 0!==n&&e.set(n)}},enumerated:{coerceFunction:function(t,e,n,r){r.coerceNumber&&(t=+t),-1===r.values.indexOf(t)?e.set(n):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var n=e.values,r=0;ri.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;!0!==r.strict&&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(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;if("string"==typeof t&&t.substr(0,r)===n&&l.test(t.substr(r)))return void e.set(t);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(-1!==(r.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),a=0;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),r+=":"+o}return r}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function f(t){return t.formatDate("M d, yyyy")}var h=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),g=t("../constants/numerical"),v=g.BADNUM,y=g.ONEDAY,x=g.ONEHOUR,_=g.ONEMIN,b=g.ONESEC,w=g.EPOCHJD,M=t("../registry"),k=h.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,S=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=(new Date).getFullYear()-70;n.dateTick0=function(t,e){return r(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},n.dfltRange=function(t){return r(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},n.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var z,E;n.dateTime2ms=function(t,e){if(n.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*_,t>=z&&t<=E?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var i=r(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?S:A);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),f=Number(s[7]||0),h=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return v;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var g="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,g),c)}else p=m.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+f*x+h*_+d*b:v}l=2===l.length?(Number(l)+2e3-T)%100+T:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,f,h));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*b},z=n.MIN_MS=n.dateTime2ms("-9999"),E=n.MAX_MS=n.dateTime2ms("9999-12-31 23:59:59.9999"),n.isDateTime=function(t,e){return n.dateTime2ms(t,e)!==v};var L=90*y,I=3*x,D=5*_;n.ms2DateTime=function(t,e,n){if("number"!=typeof t||!(t>=z&&t<=E))return v;e||(e=0);var i,o,s,l,u,c,f=Math.floor(10*m(t+.05,1)),h=Math.round(t-f/10);if(r(n)){var d=Math.floor(h/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(n).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(h))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=z+y&&t<=E-y))return v;var e=Math.floor(10*m(t+.05,1)),n=new Date(Math.round(t-e/10));return a(h.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+e)},n.cleanDate=function(t,e,i){if(n.isJSDate(t)||"number"==typeof t){if(r(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=n.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!n.isDateTime(t,i))return p("unrecognized date",t),e;return t};var C=/%\d?f/g,P=[59,59.9,59.99,59.999,59.9999],O=k("%Y"),F=k("%b %Y"),R=k("%b %-d"),j=k("%b %-d, %Y");n.formatDate=function(t,e,n,i){var a,h;if(i=r(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===n?h=l(p):"m"===n?h=u(p):"d"===n?(a=l(p),h=c(p)):(a=f(p),h=s(t,n))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===n?h=O(m):"m"===n?h=F(m):"d"===n?(a=O(m),h=R(m)):(a=j(m),h=s(t,n))}return h+(a?"\n"+a:"")};var N=3*y;n.incrementMonth=function(t,e,n){n=r(n)&&n;var i=m(t,y);if(t=Math.round(t-i),n)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(n),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+n)}var l=new Date(t+N);return l.setUTCMonth(l.getUTCMonth()+e)+i-N},n.findExactDates=function(t,e){for(var n,i,a=0,o=0,s=0,l=0,u=r(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},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;io?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,n,r){n||(n="x"),r||(r="y");for(var i=0;in?Math.max(n,Math.min(e,t)):Math.max(e,Math.min(n,t))},l.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},l.simpleMap=function(t,e,n,r){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,n)?t(e,n,r):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<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},l.syncOrAsync=function(t,e,n){function r(){return l.syncOrAsync(t,e,n)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(r).then(void 0,l.promiseError);return n&&n(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.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}},{"../constants/numerical":329,"./clean_number":334,"./coerce":335,"./dates":336,"./ensure_array":337,"./extend":339,"./filter_unique":340,"./filter_visible":341,"./identity":343,"./is_array":345,"./is_plain_object":346,"./loggers":347,"./matrix":348,"./mod":349,"./nested_property":350,"./noop":351,"./notifier":352,"./push_unique":355,"./relink_private":357,"./search":358,"./stats":360,"./to_log_range":362,d3:8,"fast-isnumeric":12}],345:[function(t,e,n){"use strict";var r="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||r.isView(t)}},{}],346:[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}},{}],347:[function(t,e,n){"use strict";function r(t,e){if(t.apply)t.apply(t,e);else for(var n=0;n1){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][0],a=t[e][1],l=!1,d(r))for(n=r.length-1;n>=0;n--)i(r[n],o(a,n))?l?r[n]=void 0:r.pop():l=!0;else if("object"==typeof r&&null!==r)for(s=Object.keys(r),l=!1,n=s.length-1;n>=0;n--)i(r[s[n]],o(a,s[n]))?delete r[s[n]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function f(t,e,n){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:n,obj:t}}var h=t("fast-isnumeric"),d=t("./is_array"),p=t("./is_plain_object"),m=t("../plot_api/container_array_match");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 n,i,o,s=0,l=e.split(".");s/g),s=0;so||r===i||rl)&&(!e||!c(t))}function n(t,e){var n=t[0],u=t[1];if(n===i||no||u===i||ul)return!1;var c,f,h,d,p,m=r.length,g=r[0][0],v=r[0][1],y=0;for(c=1;cMath.max(f,g)||u>Math.max(h,v)))if(uc||Math.abs(r(o,h))>i)return!0;return!1};a.filter=function(t,e){function n(n){t.push(n);var s=r.length,l=i;r.splice(a+1);for(var u=l+1;u1){n(t.pop())}return{addPt:n,raw:t,filtered:r}}},{"../constants/numerical":329,"./matrix":348}],355:[function(t,e,n){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var n,r=e.toString();for(n=0;na.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}],361:[function(t,e,n){"use strict";function r(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(v,"\\lt ").replace(y,"\\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){if(!t)return null;var n=t.match(e);return n&&(n[3]||n[4])}function s(t,e){if(!t)return"";for(var n=0;n1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),a=u[u.length-1].node}(k);else{var O=y[4],F={type:k},R=o(O,L);if(R?(R=R.replace(P,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(F.style=R),"a"===k){s=!0;var j=o(O,I);if(j){var N=document.createElement("a");N.href=j,-1!==M.indexOf(N.protocol)&&(F.href=j,F.target=o(O,D)||"_blank",F.popup=o(O,C))}}r(F)}}return s}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"),m=t("../constants/alignment").LINE_SPACING,g=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;n.convertToTspans=function(t,e,i){function o(){c.empty()||(h=t.attr("class")+"-math",c.select("svg."+h).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),n.positionText(t),i&&i.call(t)} +var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(g),c=f.select(t.node().parentNode);if(!c.empty()){var h=t.attr("class")?t.attr("class").split(" ")[0]:"text";return h+="-math",c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var n={fontSize:parseInt(t.style("font-size"),10)};a(l[2],n,function(n,a,l){c.selectAll("svg."+h).remove(),c.selectAll("g."+h+"-group").remove();var u=n&&n.select("svg");if(!u||!u.node())return o(),void e();var f=c.append("g").classed(h+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});f.node().appendChild(u.node()),a&&a.node()&&u.node().insertBefore(a.node().cloneNode(!0),u.node().firstChild),u.attr({class:h,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=r(u,"width"),m=r(u,"height"),g=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||r(t,"height"),y=-v/4;"y"===h[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-m/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===h[0]?u.attr({x:t.attr("x"),y:y-m/2}):"a"===h[0]?u.attr({x:0,y:y}):u.attr({x:g,y:+t.attr("y")+y-m/2}),i&&i.call(t,f),e(f)})})):o(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,x={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},_={sub:"0.3em",sup:"-0.6em"},b={sub:"-0.21em",sup:"0.42em"},w="\u200b",M=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),S=/(\r\n?|\n)/g,T=/(<[^<>]*>)/,z=/<(\/?)([^ >]*)(\s+(.*))?>/i,E=//i,L=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,I=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,D=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,C=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|;)\s*color:/;n.plainText=function(t){return(t||"").replace(k," ")},n.lineCount=function(t){return t.selectAll("tspan.line").size()||1},n.positionText=function(t,e,n){return t.each(function(){function t(t,e){return void 0===e?null===(e=r.attr(t))&&(r.attr(t,0),e=0):r.attr(t,e),e}var r=f.select(this),i=t("x",e),a=t("y",n);"text"===this.nodeName&&r.selectAll("tspan.line").attr({x:i,y:a})})},n.makeEditable=function(t,e){function n(){i(),t.style({opacity:0});var e,n=l.attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0})}function r(t){var e=t.node(),n=document.createRange();n.selectNodeContents(e);var r=window.getSelection();r.removeAllRanges(),r.addRange(n),e.focus()}function i(){var n=f.select(a),i=n.select(".svg-container"),o=i.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,i,e)).on("blur",function(){a._editing=!1,t.text(this.textContent).style({opacity:1});var e,n=f.select(this).attr("class");(e=n?"."+n.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(t.node().parentNode).select(e).style({opacity:0});var r=this.textContent;f.select(this).transition().duration(0).remove(),f.select(document).on("mouseup",null),s.edit.call(t,r)}).on("focus",function(){var t=this;a._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===f.event.which?(a._editing=!1,t.style({opacity:1}),f.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),f.select(this).call(c(t,i,e)))}).on("keydown",function(){13===f.event.which&&this.blur()}).call(r)}var a=e.gd,o=e.delegate,s=f.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?n():l.on("click",n),f.rebind(t,s,"on")}},{"../constants/alignment":327,"../constants/string_mappings":330,"../constants/xmlns_namespaces":331,"../lib":344,d3:8}],362:[function(t,e,n){"use strict";var r=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n}},{"fast-isnumeric":12}],363:[function(t,e,n){"use strict";var r=t("../registry");e.exports=function(t){for(var e,n,i=r.layoutArrayContainers,a=r.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axes"),d=t("../components/color");n.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 i=h.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=f.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",f);var y=n[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!m&&(h(g,v),d(t),!0)}var x,_,b,w,M,k,A,S=Object.keys(n).map(Number).sort(s),T=e.get(),z=T||[],E=r(v,f).get(),L=[],I=-1,D=z.length;for(x=0;xz.length-(A?0:1))o.warn("index out of range",f,b);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,b),c(k)?L.push(b):A?("add"===k&&(k={}),z.splice(b,0,k),E&&E.splice(b,0,{})):o.warn("Unrecognized full object edit value",f,b,k),-1===I&&(I=b);else for(_=0;_=0;x--)z.splice(L[x],1),E&&E.splice(L[x],1);if(z.length?T||e.set(z):e.set(null),m)return!1;if(h(g,v),p!==a){var C;if(-1===I)C=S;else{for(D=Math.max(z.length,D),C=[],x=0;x=I);x++)C.push(b);for(x=I;x=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===n||Array.isArray(n)||(n=[n]),void 0!==n&&s(t,n,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),r=0;r=0&&lq.range[0]?[1,2]:[2,1]);else{var H=q.range[0],Z=q.range[1];U?(H<=0&&Z<=0&&n(F+".autorange",!0),H<=0?H=Z/1e6:Z<=0&&(Z=H/1e6),n(F+".range[0]",Math.log(H)/Math.LN10),n(F+".range[1]",Math.log(Z)/Math.LN10)):(n(F+".range[0]",Math.pow(10,H)),n(F+".range[1]",Math.pow(10,Z)))}else n(F+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,N,T,n),w.getComponentMethod("images","convertCoords")(t,N,T,n)}else n(F+".autorange",!0);x.nestedProperty(u,F+"._inputRange").set(null)}else if(P.match(C.AX_NAME_PATTERN)){var X=x.nestedProperty(u,A).get(),Y=(T||{}).type;Y&&"-"!==Y||(Y="linear"),w.getComponentMethod("annotations","convertCoords")(t,X,Y,n),w.getComponentMethod("images","convertCoords")(t,X,Y,n)}var W=L.containerArrayMatch(A);if(W){a=W.array,o=W.index;var Q=W.property,J=x.nestedProperty(l,a),$=(J||[])[o]||{};if(""===o)-1===A.indexOf("updatemenus")&&(v.docalc=!0);else if(""===Q){var K=T;L.isAddVal(T)?b[A]=null:L.isRemoveVal(T)?(b[A]=$,K=$):x.warn("unrecognized full object value",e),(r(K,"x")||r(K,"y")&&-1===A.indexOf("updatemenus"))&&(v.docalc=!0)}else!r($,"x")&&!r($,"y")||x.containsAny(A,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);h[a]||(h[a]={});var tt=h[a][o];tt||(tt=h[a][o]={}),tt[Q]=T,delete e[A]}else if("reverse"===P)j.range?j.range.reverse():(n(F+".autorange",!0),j.range=[1,0]),N.autorange?v.docalc=!0:v.doplot=!0;else{var et=String(S.parts[1]||"") +;0===D.indexOf("scene")?"camera"===S.parts[1]?v.docamera=!0:v.doplot=!0:0===D.indexOf("geo")?v.doplot=!0:0===D.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===A?v.doplot=!0:"margin"===D||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!u._has("gl2d")||"dragmode"!==A||"lasso"!==T&&"select"!==T||"lasso"===B||"select"===B?"hiddenlabels"===A?v.docalc=!0:-1!==D.indexOf("legend")?v.dolegend=!0:-1!==A.indexOf("title")?v.doticks=!0:-1!==D.indexOf("bgcolor")?v.dolayoutstyle=!0:z>1&&x.containsAny(et,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:z>1&&-1!==et.indexOf("line")?v.dolayoutstyle=!0:z>1&&"mirror"===et?v.doticks=v.dolayoutstyle=!0:"margin.pad"===A?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,S.set(T)}}}for(a in h){L.applyContainerArrayChanges(t,x.nestedProperty(l,a),h[a],v)||(v.doplot=!0)}var nt=u._axisConstraintGroups;for(g in k)for(o=0;o=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=I.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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function f(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var n=e.name?e.name.toString():null;t._fullLayout._currentFrame=n,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,I.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:n,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function h(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&f()};e()}function d(t){return Array.isArray(s)?g>=s.length?t.transitionOpts=s[g]:t.transitionOpts=s[0]:t.transitionOpts=s,g++,t}var p,m,g=0,v=[],y=void 0===e||null===e,_=Array.isArray(e);if(y||_||!x.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&A.push(m);v=A}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(x.isPlainObject(e[i])){var h=(u[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&u[h]&&(r++,x.warn('addFrames: overwriting frame "'+u[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),r>5&&x.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),f.push({frame:M.supplyFrameDefaults(e[i]),index:n&&void 0!==n[i]&&null!==n[i]?n[i]:c+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=f[i].frame,"number"==typeof a.name&&x.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=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=I.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._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":255,"../components/errorbars":261,"../constants/xmlns_namespaces":331,"../lib":344,"../lib/events":338,"../lib/queue":356,"../lib/svg_text_utils":361,"../plotly":374,"../plots/cartesian/axis_ids":382,"../plots/cartesian/constants":384,"../plots/cartesian/constraints":386,"../plots/cartesian/graph_interact":388,"../plots/plots":415,"../plots/polar":418,"../registry":423,"./helpers":364,"./manage_arrays":365,"./subroutines":371,d3:8,"fast-isnumeric":12}],367:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],368:[function(t,e,n){"use strict";function r(t){var e,n;"area"===t?(e={attributes:x},n={}):(e=d.modules[t]._module,n=e.basePlotModule);var r={};r.type=null,w(r,m),w(r,e.attributes),n.attributes&&w(r,n.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.traces&&n.schema.traces[t]&&Object.keys(n.schema.traces[t]).forEach(function(e){h(r,n.schema.traces[t][e],e)})}),r.type=t;var i={meta:e.meta||{},attributes:s(r)};if(e.layoutAttributes){var a={};w(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return w(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var n=d.subplotsRegistry[e];if(n.layoutAttributes)if("cartesian"===n.name)f(t,n,"xaxis"),f(t,n,"yaxis");else{var r="subplot"===n.attr?n.name:n.attr;f(t,n,r)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.layoutAttributes&&(n.schema&&n.schema.layout?Object.keys(n.schema.layout).forEach(function(e){h(t,n.schema.layout[e],e)}):h(t,n.layoutAttributes,n.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],n=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.transforms&&r.schema.transforms[t]&&Object.keys(r.schema.transforms[t]).forEach(function(e){h(n,r.schema.transforms[t][e],e)})}),{attributes:s(n)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(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)):!0===t.arrayOk&&(i[r+"src"]=e(r)):p.isPlainObject(t)&&(t.role="object")}n.crawl(t,r)}function u(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:_.radialaxis,angularaxis:_.angularaxis}),b(t,_.layout),t}function f(t,e,n){var r=p.nestedProperty(t,n),i=w({},e.layoutAttributes);i[M]=!0,r.set(i)}function h(t,e,n){var r=p.nestedProperty(t,n);r.set(w(r.get()||{},e))}var d=t("../registry"),p=t("../lib"),m=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),x=t("../plots/polar/area_attributes"),_=t("../plots/polar/axis_attributes"),b=p.extendFlat,w=p.extendDeep,M="_isSubplotObj",k="_isLinkedToArray",A=[M,k,"_arrayAttrRegexps","_deprecated"];n.IS_SUBPLOT_OBJ=M,n.IS_LINKED_TO_ARRAY=k,n.DEPRECATED="_deprecated",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]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},n.crawl=function(t,e,r){var i=r||0;Object.keys(t).forEach(function(r){var a=t[r];-1===A.indexOf(r)&&(e(a,r,t,i),n.isValObject(a)||p.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){if(a=a.slice(0,s).concat([n]),e&&("data_array"===e.valType||!0===e.arrayOk)){var l=r(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}function r(t){return t.join(".")}var i=[],a=[];if(n.crawl(m,e),t._module&&t._module.attributes&&n.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}var i=t("d3"),a=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),f=t("../components/titles"),h=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");n.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,n.lsInner],t)},n.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=a.Axes.list(t);for(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.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)})})} +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":344,"../plotly":374,"../snapshot/cloneplot":424,"../snapshot/helpers":427,"../snapshot/svgtoimg":429,"../snapshot/tosvg":431,"fast-isnumeric":12}],373:[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;v.3*f||a(r)||a(i))){var h=n.dtick/2;t+=t+h.8){var o=Number(n.substr(1));a.exactYears>.8&&o%12==0?t=P.tickIncrement(t,"M6","reverse")+1.5*L:a.exactMonths>.8?t=P.tickIncrement(t,"M1","reverse")+15.5*L:t-=L/2;var s=P.tickIncrement(t,n);if(s<=r)return s}return t}function a(t){var e,n,r=t.tickvals,i=t.ticktext,a=new Array(r.length),o=b.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),f=Math.max(s,u),h=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),n=0;nc&&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>=C&&i<=19||e>=D)t._tickround="S";else{var a=t.l2r(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 l(t,e,n){var r=t.tickfont||{};return{x:e,dx:0,dy:0,text:n||"",fontSize:r.size,font:r.family,fontColor:r.color}}function u(t,e,n,r){var i=t._tickround,a=n&&t.hoverformat||t.tickformat;r&&(i=x(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=b.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),r&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(n?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,r);else if(x(a)||"D"===a.charAt(0)&&b.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,b.mod(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 f(t,e){var n=t._categories[Math.round(e.x)];void 0===n&&(n=""),e.text=String(n)}function h(t,e,n,r,i){"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=d(e.x,t,i,r)}function d(t,e,n,r){var i=t<0,a=e._tickround,o=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]};s(f),a=(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,-a)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+m:"E"===o?t+="E"+m:"power"===o?t+="\xd710"+m+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=U[l/3+5])}return i?"\u2212"+t:t}function p(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},P.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(),b.simpleMap(n,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),t._r=t.range.slice(),t._rl=b.simpleMap(t._r,t.r2l);var n=t._input;n.range=t.range.slice(),n.autorange=t.autorange}},P.saveRangeInitial=function(t,e){for(var n=P.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||!!b.nestedProperty(t,"rangeslider.autorange").get())&&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);v&&"domain"===t.constrain&&t._inputDomain&&(v*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var _=r((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),w=r((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),M=r(n.vpadplus||n.vpad),k=r(n.vpadminus||n.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},P.autoBin=function(t,e,n,a,o){var s=b.aggNums(Math.min,null,t),l=b.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(n)u=(l-s)/n;else{var c=b.distinctVals(t),f=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),h=f*b.roundUp(c.minDiff/f,[.9,1.9,4.9,9.9],!0);u=Math.max(h,2*b.stdev(t)/Math.pow(t.length,a?.25:.4)),x(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:b.simpleMap([s,l],e.c2r,0,o),calendar:o},P.setConvert(d),P.autoTicks(d,u);var p,m=P.tickIncrement(P.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){m=r(m,t,d,s,l);p=m+(1+Math.floor((l-m)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(m=i(m,t,d.dtick,s,o)),p=m;p<=l;)p=P.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(m,0,o),end:e.c2r(p,0,o),size:d.dtick}},P.calcTicks=function(t){var e=b.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var n,r=t.nticks;r||("category"===t.type?(n=t.tickfont?1.2*(t.tickfont.size||12):15,r=t._length/n):(n="y"===t._id.charAt(0)?40:80,r=b.constrain(t._length/n,4,9)+1)),"array"===t.tickmode&&(r*=100),P.autoTicks(t,Math.abs(e[1]-e[0])/r),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return a(t);t._tmin=P.tickFirst(t);var i=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=P.tickIncrement(u,t.dtick,i,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),f=0;fz?(e/=z,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,n,R)):r>E?(e/=E,t.dtick="M"+o(e,1,j)):r>L?(t.dtick=o(e,L,B),t.tick0=b.dateTick0(t.calendar,!0)):r>I?t.dtick=o(e,I,j):r>D?t.dtick=o(e,D,N):r>C?t.dtick=o(e,C,N):(n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,n,R))}else if("log"===t.type){t.tick0=0;var i=b.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var a=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/a,n=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(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=o(e,n,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)}},P.tickIncrement=function(t,e,n,r){var i=n?-1:1;if(x(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return b.incrementMonth(t,o,r);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?q:V,l=t+.01*i,u=b.roundUp(b.mod(l,1),s,n);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,n=b.simpleMap(t.range,e),r=n[1]1&&e2*i}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,e){return i(t,e)?"date":a(t)?"category":r(t)?"linear":"-"}},{"../../constants/numerical":329,"../../lib":344,"fast-isnumeric":12}],381:[function(t,e,n){"use strict";var r=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),f=t("./category_order_defaults"),h=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,n,p,m){function g(n,r){return a.coerce2(t,e,s,n,r)}var v=p.letter,y=p.font||{},x="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",_=n("visible",!p.cheateronly),b=e.type;if("date"===b){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(h(e,m),n("autorange",!e.isValidRange(t.range))&&n("rangemode"),n("range"),e.cleanRange(),f(t,e,n),e._initialCategories="category"===b?d(v,e.categoryorder,e.categoryarray,p.data):[],!_)return e;var w=n("color"),M=w===t.color?w:y.color;n("title",x),a.coerceFont(n,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:M}),l(t,e,n,b),c(t,e,n,b,p),u(t,e,n,p);var k=g("linecolor",w),A=g("linewidth"),S=n("showline",!!k||!!A);S||(delete e.linecolor,delete e.linewidth),(S||e.ticks)&&n("mirror");var T=g("gridcolor",r(w,p.bgColor,o).toRgbString()),z=g("gridwidth");n("showgrid",p.showGrid||!!T||!!z)||(delete e.gridcolor,delete e.gridwidth);var E=g("zerolinecolor",w),L=g("zerolinewidth");return n("zeroline",p.showGrid||!!E||!!L)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":230,"../../lib":344,"../../registry":423,"./category_order_defaults":383,"./layout_attributes":390,"./ordered_categories":392,"./set_convert":396,"./tick_label_defaults":397,"./tick_mark_defaults":398,"./tick_value_defaults":399,tinycolor2:197}],382:[function(t,e,n){"use strict";function r(t,e,n){function r(t,n){for(var r=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(r="array");var o=n("categoryorder",r);"array"===o&&n("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],384:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],385:[function(t,e,n){"use strict";function r(t,e,n,r){var i,a,s,l,u=r[o(e)].type,c=[];for(a=0;ao*v)||b)for(n=0;nI&&CE&&(E=C);var F=(E-z)/(2*L);f/=F,z=l.l2r(z),E=l.l2r(E),l.range=l._input.range=A=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,n,r,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+n+", "+r+")").attr("d",i+"Z")}function f(t,e,n){return t.append("path").attr("class","zoombox-corners").style({fill:S.background,stroke:S.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+n+")").attr("d","M0,0Z")}function h(t){t.selectAll(".select-outline").remove()}function d(t,e,n,r,i,a){t.attr("d",r+"M"+n.l+","+n.t+"v"+n.h+"h"+n.w+"v-"+n.h+"h-"+n.w+"Z"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){_.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function m(t){return-1!==["lasso","select"].indexOf(t)}function g(t,e){return"M"+(t.l-.5)+","+(e-j-.5)+"h-3v"+(2*j+1)+"h3ZM"+(t.r+.5)+","+(e-j-.5)+"h3v"+(2*j+1)+"h-3Z"}function v(t,e){return"M"+(e-j-.5)+","+(t.t-.5)+"v-3h"+(2*j+1)+"v3ZM"+(e-j-.5)+","+(t.b+.5)+"v3h"+(2*j+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,j)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function x(t,e,n){var r,i,a,o,s,l,u=!1,c={},f={};for(r=0;rj||s>j?(kt="xy",o/at>s/ot?(s=o*ot/at,xt>a?_t.t=xt-s:_t.b=xt+s):(o=s*at/ot,yt>i?_t.l=yt-o:_t.r=yt+o),St.attr("d",y(_t))):r():!lt||szoom back out","long"),N=!1)}function X(e,n){var r=1===(V+q).length;if(e)$();else if(2!==n||r){if(1===n&&r){var i=V?nt[0]:et[0],o="s"===V||"w"===q?0:1,s=i._name+".range["+o+"]",l=a(i,o),u="left",c="middle";if(i.fixedrange)return;V?(c="n"===V?"top":"bottom","right"===i.side&&(u="right")):"e"===q&&(u="right"),t._context.showAxisRangeEntryBoxes&&_.select(gt).call(A.makeEditable,{gd:t,immediate:!0,background:dt.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var n=i.d2r(e);void 0!==n&&w.relayout(t,s,n)})}}else J()}function Y(e){function n(t,e,n){function r(e){return t.l2r(a+(e-a)*n)}if(!t.fixedrange){var i=k.simpleMap(t.range,t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(r)}}if(t._context.scrollZoom||dt._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var r=t.querySelector(".plotly");if(U(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(Et);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void k.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=It.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(q||ct){for(q||(l=.5),a=0;ac[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":344,"fast-isnumeric":12}],394:[function(t,e,n){"use strict";var r=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,n){void 0===n&&(n=r[t.constraintoward||"center"]);var i=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=i[0]+(i[1]-i[0])*n;t.range=t._input.range=[t.l2r(a+(i[0]-a)*e),t.l2r(a+(i[1]-a)*e)]}},{"../../constants/alignment":327}],395:[function(t,e,n){"use strict";function r(t){return t._id}function i(t,e){if(Array.isArray(t))for(var n=e.cd[0].trace,r=0;r0)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*w*Math.abs(r-i))}return d}function f(e,n,r){var i=u(e,r||t.calendar);if(i===d){if(!a(e))return d;i=u(new Date(+e))}return i}function g(e,n,r){return l(e,n,r||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var n=t._categories.length-1;return t._categoriesMap[e]=n,n}return d}function x(e){if(t._categoriesMap){var n=t._categoriesMap[e];if(void 0!==n)return n}if(a(e))return+e}function _(e){return a(e)?i.round(t._b+t._m*e,2):d}function b(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?n:c,t.l2c="log"===t.type?r:c,t.l2p=_,t.p2l=b,t.c2p="log"===t.type?function(t,e){return _(n(t,e))}:_,t.p2c="log"===t.type?function(t){return r(b(t))}:b,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=b,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return n(s(t),e)},t.r2d=t.r2c=function(t){return r(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=n,t.l2d=r,t.d2p=function(e,n){return t.l2p(t.d2r(e,n))},t.p2d=function(t){return r(b(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=b,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=f,t.c2d=t.c2r=t.l2d=t.l2r=g,t.d2p=t.r2p=function(e,n,r){return t.l2p(f(e,0,r))},t.p2d=t.p2r=function(t,e,n){return g(b(t),e,n)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=x,t.r2c=function(e){var n=x(e);return void 0!==n?n:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(b(t))},t.r2p=t.d2p,t.p2r=b,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),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.cleanRange=function(e){e||(e="range");var n,r,i=o.nestedProperty(t,e).get(),s=(t._id||"x").charAt(0);if(r="date"===t.type?o.dfltRange(t.calendar):"y"===s?p.DFLTRANGEY:p.DFLTRANGEX,r=r.slice(),!i||2!==i.length)return void o.nestedProperty(t,e).set(r);for("date"===t.type&&(i[0]=o.cleanDate(i[0],d,t.calendar),i[1]=o.cleanDate(i[1],d,t.calendar)),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(i[n],t.calendar)){t[e]=r;break}if(t.r2l(i[0])===t.r2l(i[1])){var l=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(l-1e3),i[1]=t.l2r(l+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]<-h?i[n]=-h:i[n]>h&&(i[n]=h),i[0]===i[1]){var u=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=u,i[1]+=u}}},t.setScale=function(n){var r=e._size,i=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=m.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var s=n&&t._r?"_r":"range",l=t.calendar;t.cleanRange(s);var u=t.r2l(t[s][0],l),c=t.r2l(t[s][1],l);if("y"===i?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,n){var r,i,a,o="date"===t.type&&e[n+"calendar"];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?i.dateTick0(e.calendar):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":329,"../../lib":344,"fast-isnumeric":12}],400:[function(t,e,n){"use strict";var r=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,n,u){function c(e,n){function r(e,n){for(i=0;in.duration?(d(),k=window.cancelAnimationFrame(m)):k=window.requestAnimationFrame(m)}var g=t._fullLayout,v=[],y=function(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=g[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,v.push(s),o[s]=a}return o}(e),x=Object.keys(y),_=function(t,e,n){var r,i,a,o=t._plots,s=[];for(r in o){var l=o[r];if(-1===s.indexOf(l)){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]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(g,x,y);if(!_.length)return!1;var b;u&&(b=u());var w,M,k,A=r.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(k),k=null,p()}),w=Date.now(),k=window.requestAnimationFrame(m),Promise.resolve()}},{"../../components/drawing":255,"../../plotly":374,"../../registry":423,"./axes":379,d3:8}],401:[function(t,e,n){"use strict";function r(t,e){if("-"===t.type){var n=t._id,r=n.charAt(0);-1!==n.indexOf("scene")&&(n=r);var u=i(e,n,r);if(u){if("histogram"===u.type&&r==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=r+"calendar",f=u[c];if(o(u,r)){for(var h,d=a(u),p=[],m=0;m0?".":"")+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":344,"./convert_text_opts":408}],411:[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={_arrayAttrRegexps:[/^mapbox([2-9]|[1-9][0-9]+)?\.layers/],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":231,"../../lib":344,"../../traces/scatter/attributes":434,"../font_attributes":403}],412:[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()?" - ":"")}},g.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"});return r.append("input").attr({type:"text",name:"data"}).node().value=g.graphJson(t,!1,"keepdata"),r.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1},g.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||g.createTransitionData(t),n._initialAutoSizeIsDone){var u=n.width,f=n.height;g.supplyLayoutGlobalDefaults(a,r),a.width||(r.width=u),a.height||(r.height=f)}else{g.supplyLayoutGlobalDefaults(a,r);var h=!a.width||!a.height,d=r.autosize,p=t._context&&t._context.autosizable;h&&(d||p)?g.plotAutoSize(t,a,r):h&&g.sanitizeMargins(t),!d&&h&&(a.width=r.width,a.height=r.height)}r._initialAutoSizeIsDone=!0,r._dataLength=l.length,r._globalTransforms=(t._context||{}).globalTransforms,g.supplyDataDefaults(l,s,a,r),r._has=g._hasPlotType.bind(r);var m=r._modules;for(e=0;e0){var c=o(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,p=1-2*s,m=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};r=Math.round(p*(m.width-f)),i=Math.round(p*(m.height-h))}else{var v=l?window.getComputedStyle(t):{};r=parseFloat(v.width)||n.width,i=parseFloat(v.height)||n.height}var y=g.layoutAttributes.width.min,x=g.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}),g.sanitizeMargins(n)},g.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];r._replotting||g.doAutoMargin(t)}},g.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(!1!==e.margin.autoexpand){l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}};for(var f=Object.keys(l),h=0;hg){var k=(v*w+(M-e.width)*g)/(w-g),A=(M*(1-g)+(v-e.width)*(1-w))/(w-g);k>=0&&A>=0&&k+A>i+a&&(i=k,a=A)}}if(u(x)&&l[b].t){var S=l[b].t.val,T=l[b].t.size;if(S>y){var z=(x*S+(T-e.height)*y)/(S-y),E=(T*(1-y)+(x-e.height)*(1-S))/(S-y);z>=0&&E>=0&&z+E>s+o&&(s=z,o=E)}}}}if(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,!e._replotting&&"{}"!==r&&r!==JSON.stringify(e._size))return c.plot(t)},g.graphJson=function(t,e,n,r,i){function a(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,r,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===n){if("src"===e.substr(e.length-3))continue}else if("keepstream"===n){if("string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==n&&"string"==typeof(r=t[e+"src"])&&r.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):d.isJSDate(t)?d.ms2DateTimeLocal(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&g.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var n=a(t);return e&&delete n.fit,n})};return e||(u.layout=a(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=a(l)),"object"===r?u:JSON.stringify(u)},g.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(){_=!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,h=t._fullLayout._basePlotModules,p=!1;if(n)for(s=0;s=0,z=T?f.angularAxis.domain:r.extent(M),E=Math.abs(M[1]-M[0]);A&&!k&&(E=0);var L=z.slice();S&&k&&(L[1]+=E);var I=f.angularAxis.ticksCount||4;I>8&&(I=I/(I/8)+I%8),f.angularAxis.ticksStep&&(I=(L[1]-L[0])/I);var D=f.angularAxis.ticksStep||(L[1]-L[0])/(I*(f.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),L[2]||(L[2]=D);var C=r.range.apply(this,L);if(C=C.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=r.scale.linear().domain(L.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),c.layout.angularAxis.domain=s.domain(),c.layout.angularAxis.endPadding=S?E:0,void 0===(e=r.select(this).select("svg.chart-root"))||e.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),O=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));e=r.select(O)}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,R=e.select(".chart-group"),j={fill:"none",stroke:f.tickColor},N={"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 B=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=void 0===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:F,elements:B,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), +b=[f.margin.left+x,f.margin.top+x],i.range([0,x]),c.layout.radialAxis.domain=i.domain(),F.attr("transform","translate("+[b[0]+x,b[1]-x]+")")}else F=e.select(".legend-group").style({display:"none"});e.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),R.attr("transform","translate("+b+")").style({cursor:"crosshair"});var q=[(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(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 U=e.select("g.title-group text").style(N).text(f.title),G=U.node().getBBox();U.attr({x:b[0]-G.width/2,y:b[1]-x-20})}var H=e.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var Z=H.selectAll("circle.grid-circle").data(i.ticks(5));Z.enter().append("circle").attr({class:"grid-circle"}).style(j),Z.attr("r",i),Z.exit().remove()}H.select("circle.outside-circle").attr({r:x}).style(j);var X=e.select("circle.background-circle").attr({r:x}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var Y=r.svg.axis().scale(i).ticks(5).tickSize(5);H.call(Y).attr({transform:"rotate("+f.radialAxis.orientation+")"}),H.selectAll(".domain").style(j),H.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(N).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,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),H.selectAll("g>line").style({stroke:"black"})}var W=e.select(".angular.axis-group").selectAll("g.angular-tick").data(C),Q=W.enter().append("g").classed("angular-tick",!0);W.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),W.exit().remove(),Q.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),Q.selectAll(".minor").style({stroke:f.minorTickColor}),W.select("line.grid-line").attr({x1:f.tickLength?x-f.tickLength:0,x2:x}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Q.append("text").classed("axis-text",!0).style(N);var J=W.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?"":w?w[t]+f.angularAxis.ticksSuffix:t+f.angularAxis.ticksSuffix}).style(N);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var $=r.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[x+$,f.margin.top]+")"});var K=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||K){var et=[];d.forEach(function(t,e){var n={};n.radialScale=i,n.angularScale=s,n.container=tt.filter(function(t,n){return n==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,et.push({data:t,geometryConfig:n})});var nt=r.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),rt=[];nt.forEach(function(t,e){"unstacked"===t.key?rt=rt.concat(t.values.map(function(t,e){return[t]})):rt.push(t.values)}),rt.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 it,at,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ft=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var n=o.util.getMousePos(X).angle;ft.attr({x2:-x,transform:"rotate("+n+")"}).style({opacity:.5});var r=(n+180+360-f.orientation)%360;it=s.invert(r);var i=o.util.convertToCartesian(x+12,n+180);lt.text(o.util.round(it)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ht=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(X).radius;ht.attr({r:n}).style({opacity:.5}),at=i.invert(o.util.getMousePos(X).radius);var r=o.util.convertToCartesian(n,f.radialAxis.orientation);ut.text(o.util.round(at)).move([r[0]+b[0],r[1]+b[1]])}).on("mouseout.radial-guide",function(t,e){ht.style({opacity:0}),ct.hide(),lt.hide(),ut.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])};k&&(u.t=w[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];ct.config({color:s}).text(c),ct.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){if(0!=r.event.which)return!1;r.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange: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}}},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;return r.range(0,360+n,n).map(function(e,n){var r=e*Math.PI/180;return[e,t(r)]})},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(void 0===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-2===n},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,n){return n.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var n=e*Math.PI/180;return[t*Math.cos(n),t*Math.sin(n)]},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 i[e[r].data.strokeDash]},opacity:function(t,n,r){return e[r].data.opacity},display:function(t,n,r){return void 0===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=[o.PolyChart.defaultConfig()],n=r.dispatch("hover"),i={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,n){e[n]||(e[n]={}),a(e[n],o.PolyChart.defaultConfig()),a(e[n],t)}),this):e},t.getColorScale=function(){},r.rebind(t,n,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:r.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){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||void 0===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":-1!=r.svg.symbolTypes.indexOf(t)?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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,n,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=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+10,dy:.3*+i.fontSize}),l};return l.text=function(a){var o=r.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(c);var f=i.padding,h=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},p=h.width+2*f+10,m=h.height+2*f;return n.attr({d:"M"+[[10,-m/2],[10,-m/4],[i.hasTick?0:10,0],[10,m/4],[10,m/2],[p,m/2],[p,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-m/2+2*f]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return a(i,t),l},l},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);return[[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"]]].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",!0===r.dotVisible?(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);-1!=r&&(n.data[e].groupId=r)})}if(t.layout){var s=a({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,n){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};r.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":344,d3:8}],420:[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":231,"../../lib":344,"./micropolar":419,"./undo_manager":421,d3:8}],421:[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-1!==r},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)),h=t._context||{};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")?"":e.html(t).text()});return e.remove(),n}function i(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var a=t("d3"),o=t("../components/drawing"),s=t("../components/color"),l=t("../constants/xmlns_namespaces"),u=/"/g,c=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var n,f=t._fullLayout,h=f._paper,d=f._toppaper;h.insert("rect",":first-child").call(o.setRect,0,0,f.width,f.height).call(s.fill,f.paper_bgcolor);var p=f._basePlotModules||[];for(n=0;nm&&d.splice(m,d.length-m),p.length>m&&p.splice(m,p.length-m);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(n=e.marker,u=n.size,Array.isArray(u)){var y={type:"linear"};i.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>m&&u.splice(m,u.length-m)}var x,_=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/_),3)}:function(t){return Math.max((t||0)/_,3)},g.ppad=v.ppad=Array.isArray(u)?u.map(x):x(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,i.expand(f,d,g),i.expand(h,p,v);var b=new Array(m);for(c=0;c=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===n.xaxis&&a.yaxis===n.yaxis){a.opacity=void 0;break}}}}}},{}],437:[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":234,"../../components/colorscale":245,"../../lib":344,"../../plots/plots":415,"fast-isnumeric":12}],438:[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":237,"../../components/colorscale/has_colorscale":244,"./subtypes":454}],439:[function(t,e,n){"use strict";e.exports={PTS_LINESONLY:20}},{}],440:[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,p,m),v=gq!=P>=q&&(I=E[T-1][0],D=E[T][0],L=I+(D-I)*(q-C)/(P-C),j=Math.min(j,L),N=Math.max(N,L));j=Math.max(j,0),N=Math.min(N,h._length);var U=s.defaultLine;return s.opacity(f.fillcolor)?U=f.fillcolor:s.opacity((f.line||{}).color)&&(U=f.line.color),r.extendFlat(t,{distance:l+10,x0:j,x1:N,y0:q,y1:q,color:U}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":231,"../../components/errorbars":261,"../../components/fx":272,"../../lib":344,"./get_trace_color":442}],444:[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":389,"./arrays_to_calcdata":433,"./attributes":434,"./calc":435,"./clean_data":436,"./colorbar":437,"./defaults":440,"./hover":443,"./plot":451,"./select":452,"./style":453,"./subtypes":454}],445:[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,s){var l=(t.marker||{}).color;if(o("line.color",n),r(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||n)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":240,"../../components/colorscale/has_colorscale":244}],446:[function(t,e,n){"use strict";var r=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function n(e){var n=b.c2p(t[e].x),i=w.c2p(t[e].y);return n!==r&&i!==r&&[n,i]}function i(t){var e=t[0]/b._length,n=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-n,n-1))*A}var a,o,s,l,u,c,f,h,d,p,m,g,v,y,x,_,b=e.xaxis,w=e.yaxis,M=e.simplify,k=e.connectGaps,A=e.baseTolerance,S=e.linear,T=[],z=.2,E=new Array(t.length),L=0;for(M||(A=z=-1),a=0;ai(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>m?(m=v,l=c,h=!1):v=t.length||!c)break;E[L++]=c,o=c}}else E[L++]=l}T.push(E.slice(0,L))}return T}},{"../../constants/numerical":329}],447:[function(t,e,n){"use strict";e.exports=function(t,e,n){"spline"===n("line.shape")&&n("line.smoothing")}},{}],448:[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}],450:[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,u){var c,f=o.isBubble(t),h=(t.line||{}).color;if(u=u||{},h&&(n=h),l("marker.symbol"),l("marker.opacity",f?.7:1),l("marker.size"),l("marker.color",n),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=h&&!Array.isArray(h)&&e.marker.color!==h?h:f?r.background:r.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",f?1:0)),f&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":231,"../../components/colorscale/defaults":240,"../../components/colorscale/has_colorscale":244,"./subtypes":454}],451:[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,h,p){function m(t){return M?t.transition():t}function g(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function x(){return!1}function _(e){var n,r,i,a=e[0].trace,u=o.select(this),f=c.hasMarkers(a),h=c.hasText(a),d=y(a),p=x,v=x;f&&(p=a.marker.maxdisplayed||a._needsCull?g:s.identity),h&&(v=a.marker.maxdisplayed||a._needsCull?g:s.identity),r=u.selectAll("path.point"),n=r.data(p,d);var _=n.enter().append("path").classed("point",!0);M&&_.call(l.pointStyle,a,t).call(l.translatePoints,k,A,a).style("opacity",0).transition().style("opacity",1);var b=f&&l.tryColorscale(a.marker,""),w=f&&l.tryColorscale(a.marker,"line");n.order(),n.each(function(e){var n=o.select(this),r=m(n);i=l.translatePoint(e,r,k,A),i?(l.singlePointStyle(e,r,a,b,w,t),a.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):r.remove()}),M?n.exit().transition().style("opacity",0).remove():n.exit().remove(),r=u.selectAll("g"),n=r.data(v,d),n.enter().append("g").classed("textpoint",!0).append("text"),n.order(),n.each(function(t){var e=o.select(this),n=m(e.select("text"));(i=l.translatePoint(t,n,k,A))||e.remove()}),n.selectAll("text").call(l.textPointStyle,a,t).each(function(t){var e=t.xp||k.c2p(t.x),n=t.yp||A.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){m(o.select(this)).attr({x:e,y:n})})}),n.exit().remove()}var b,w;a(t,e,n,r,i);var M=!!p&&p.duration>0,k=n.xaxis,A=n.yaxis,S=r[0].trace,T=S.line,z=o.select(h);if(z.call(u.plot,n,p),!0===S.visible){m(z).style("opacity",S.opacity);var E,L,I=S.fill.charAt(S.fill.length-1);"x"!==I&&"y"!==I&&(I=""),r[0].node3=z;var D="",C=[],P=S._prevtrace;P&&(D=P._prevRevpath||"",L=P._nextFill,C=P._polygons);var O,F,R,j,N,B,V,q,U,G="",H="",Z=[],X=[],Y=s.noop;if(E=S._ownFill,c.hasLines(S)||"none"!==S.fill){for(L&&L.datum(r),-1!==["hv","vh","hvh","vhv"].indexOf(T.shape)?(R=l.steps(T.shape),j=l.steps(T.shape.split("").reverse().join(""))):R=j="spline"===T.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),T.smoothing):l.smoothopen(t,T.smoothing)}:function(t){return"M"+t.join("L")},N=function(t){return j(t.reverse())},Z=f(r,{xaxis:k,yaxis:A,connectGaps:S.connectgaps,baseTolerance:Math.max(T.width||1,3)/4,linear:"linear"===T.shape,simplify:T.simplify}),U=S._polygons=new Array(Z.length),w=0;w1}),Y=function(t){return function(e){if(O=R(e),F=N(e),G?I?(G+="L"+O.substr(1),H=F+"L"+H.substr(1)):(G+="Z"+O,H=F+"Z"+H):(G=O,H=F),c.hasLines(S)&&e.length>1){var n=o.select(this);if(n.datum(r),t)m(n.style("opacity",0).attr("d",O).call(l.lineGroupStyle)).style("opacity",1);else{var i=m(n);i.attr("d",O),l.singleLineStyle(r,i)}}}}}var W=z.selectAll(".js-line").data(X);m(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(Y(!0)),Z.length&&(E?B&&q&&(I?("y"===I?B[1]=q[1]=A.c2p(0,!0):"x"===I&&(B[0]=q[0]=k.c2p(0,!0)),m(E).attr("d","M"+q+"L"+B+"L"+G.substr(1)).call(l.singleFillStyle)):m(E).attr("d",G+"Z").call(l.singleFillStyle)):"tonext"===S.fill.substr(0,6)&&G&&D&&("tonext"===S.fill?m(L).attr("d",G+"Z"+D+"Z").call(l.singleFillStyle):m(L).attr("d",G+"L"+D.substr(1)+"Z").call(l.singleFillStyle),S._polygons=S._polygons.concat(C)),S._prevRevpath=H,S._prevPolygons=U);var Q=z.selectAll(".points");b=Q.data([r]),Q.each(_),b.enter().append("g").classed("points",!0).each(_),b.exit().remove()}}function a(t,e,n,r,i){var a=n.xaxis,l=n.yaxis,u=o.extent(s.simpleMap(a.range,a.r2c)),f=o.extent(s.simpleMap(l.range,l.r2c)),h=r[0].trace;if(c.hasMarkers(h)){var d=h.marker.maxdisplayed;if(0!==d){var p=r.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),m=Math.ceil(p.length/d),g=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),h(t,e,n),r(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),g){s&&(d=s());o.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).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":255,"../../components/errorbars":261,"../../lib":344,"../../lib/polygon":354,"./line_points":446,"./link_traces":448,"./subtypes":454,d3:8}],452:[function(t,e,n){"use strict";var r=t("./subtypes");e.exports=function(t,e){var n,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],f=s[0].trace,h=f.marker,d=!r.hasMarkers(f)&&!r.hasText(f);if(!0===f.visible&&!d){var p=Array.isArray(h.opacity)?1:h.opacity;if(!1===e)for(n=0;n")}var i=t("../../components/fx"),a=t("../scatter/get_trace_color"),o=t("../../constants/numerical").BADNUM;e.exports=function(t,e,n){function s(t){var e=t.lonlat;if(e[0]===o)return 1/0;var r=Math.abs(c.c2p(e)-c.c2p([p,e[1]])),i=Math.abs(f.c2p(e)-f.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 l=t.cd,u=l[0].trace,c=t.xa,f=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),d=360*h,p=e-d;if(i.getClosest(l,s,t),!1!==t.index){var m=l[t.index],g=m.lonlat,v=[g[0]+d,g[1]],y=c.c2p(v),x=f.c2p(v),_=m.mrc||1;return t.x0=y-_,t.x1=y+_,t.y0=x-_,t.y1=x+_,t.color=a(u,m),t.extraText=r(u,m),[t]}}},{"../../components/fx":272,"../../constants/numerical":329,"../scatter/get_trace_color":442}],464:[function(t,e,n){"use strict";var r={};r.attributes=t("./attributes"),r.supplyDefaults=t("./defaults"),r.colorbar=t("../scatter/colorbar"),r.calc=t("../scattergeo/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":409,"../scatter/colorbar":437,"../scattergeo/calc":458,"./attributes":459,"./defaults":461,"./event_data":462,"./hover":463,"./plot":465}],465:[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":460}]},{},[4])(4)}); \ No newline at end of file diff --git a/dist/plotly-with-meta.js b/dist/plotly-with-meta.js index 2edab431416..b1d8906955d 100644 --- a/dist/plotly-with-meta.js +++ b/dist/plotly-with-meta.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.27.1 +* plotly.js v1.28.0 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -69,7 +69,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":709}],2:[function(require,module,exports){ +},{"../src/lib":721}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -208,7 +208,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":840}],4:[function(require,module,exports){ +},{"../src/traces/bar":852}],4:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -221,7 +221,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/traces/box'); -},{"../src/traces/box":852}],5:[function(require,module,exports){ +},{"../src/traces/box":864}],5:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -234,7 +234,7 @@ module.exports = require('../src/traces/box'); module.exports = require('../src/components/calendars'); -},{"../src/components/calendars":588}],6:[function(require,module,exports){ +},{"../src/components/calendars":598}],6:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -247,7 +247,7 @@ module.exports = require('../src/components/calendars'); module.exports = require('../src/traces/candlestick'); -},{"../src/traces/candlestick":860}],7:[function(require,module,exports){ +},{"../src/traces/candlestick":872}],7:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -260,7 +260,7 @@ module.exports = require('../src/traces/candlestick'); module.exports = require('../src/traces/carpet'); -},{"../src/traces/carpet":881}],8:[function(require,module,exports){ +},{"../src/traces/carpet":893}],8:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -273,7 +273,7 @@ module.exports = require('../src/traces/carpet'); module.exports = require('../src/traces/choropleth'); -},{"../src/traces/choropleth":896}],9:[function(require,module,exports){ +},{"../src/traces/choropleth":908}],9:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -286,7 +286,7 @@ module.exports = require('../src/traces/choropleth'); module.exports = require('../src/traces/contour'); -},{"../src/traces/contour":907}],10:[function(require,module,exports){ +},{"../src/traces/contour":919}],10:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -299,7 +299,7 @@ module.exports = require('../src/traces/contour'); module.exports = require('../src/traces/contourcarpet'); -},{"../src/traces/contourcarpet":922}],11:[function(require,module,exports){ +},{"../src/traces/contourcarpet":934}],11:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -312,7 +312,7 @@ module.exports = require('../src/traces/contourcarpet'); module.exports = require('../src/core'); -},{"../src/core":693}],12:[function(require,module,exports){ +},{"../src/core":705}],12:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -325,7 +325,7 @@ module.exports = require('../src/core'); module.exports = require('../src/transforms/filter'); -},{"../src/transforms/filter":1077}],13:[function(require,module,exports){ +},{"../src/transforms/filter":1093}],13:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -338,7 +338,7 @@ module.exports = require('../src/transforms/filter'); module.exports = require('../src/transforms/groupby'); -},{"../src/transforms/groupby":1078}],14:[function(require,module,exports){ +},{"../src/transforms/groupby":1094}],14:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -351,7 +351,7 @@ module.exports = require('../src/transforms/groupby'); module.exports = require('../src/traces/heatmap'); -},{"../src/traces/heatmap":936}],15:[function(require,module,exports){ +},{"../src/traces/heatmap":948}],15:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -364,7 +364,7 @@ module.exports = require('../src/traces/heatmap'); module.exports = require('../src/traces/heatmapgl'); -},{"../src/traces/heatmapgl":945}],16:[function(require,module,exports){ +},{"../src/traces/heatmapgl":957}],16:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -377,7 +377,7 @@ module.exports = require('../src/traces/heatmapgl'); module.exports = require('../src/traces/histogram'); -},{"../src/traces/histogram":953}],17:[function(require,module,exports){ +},{"../src/traces/histogram":965}],17:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -390,7 +390,7 @@ module.exports = require('../src/traces/histogram'); module.exports = require('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":958}],18:[function(require,module,exports){ +},{"../src/traces/histogram2d":970}],18:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -403,7 +403,7 @@ module.exports = require('../src/traces/histogram2d'); module.exports = require('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":962}],19:[function(require,module,exports){ +},{"../src/traces/histogram2dcontour":974}],19:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -487,7 +487,7 @@ module.exports = Plotly; module.exports = require('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":966}],21:[function(require,module,exports){ +},{"../src/traces/mesh3d":980}],21:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -500,7 +500,7 @@ module.exports = require('../src/traces/mesh3d'); module.exports = require('../src/traces/ohlc'); -},{"../src/traces/ohlc":971}],22:[function(require,module,exports){ +},{"../src/traces/ohlc":985}],22:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -513,7 +513,7 @@ module.exports = require('../src/traces/ohlc'); module.exports = require('../src/traces/parcoords'); -},{"../src/traces/parcoords":980}],23:[function(require,module,exports){ +},{"../src/traces/parcoords":994}],23:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -526,7 +526,7 @@ module.exports = require('../src/traces/parcoords'); module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":989}],24:[function(require,module,exports){ +},{"../src/traces/pie":1003}],24:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -539,7 +539,7 @@ module.exports = require('../src/traces/pie'); module.exports = require('../src/traces/pointcloud'); -},{"../src/traces/pointcloud":998}],25:[function(require,module,exports){ +},{"../src/traces/pointcloud":1012}],25:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -552,7 +552,7 @@ module.exports = require('../src/traces/pointcloud'); module.exports = require('../src/traces/sankey'); -},{"../src/traces/sankey":1004}],26:[function(require,module,exports){ +},{"../src/traces/sankey":1018}],26:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -565,7 +565,7 @@ module.exports = require('../src/traces/sankey'); module.exports = require('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":1036}],27:[function(require,module,exports){ +},{"../src/traces/scatter3d":1050}],27:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -578,7 +578,7 @@ module.exports = require('../src/traces/scatter3d'); module.exports = require('../src/traces/scattercarpet'); -},{"../src/traces/scattercarpet":1041}],28:[function(require,module,exports){ +},{"../src/traces/scattercarpet":1055}],28:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -591,7 +591,7 @@ module.exports = require('../src/traces/scattercarpet'); module.exports = require('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":1050}],29:[function(require,module,exports){ +},{"../src/traces/scattergeo":1064}],29:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -604,7 +604,7 @@ module.exports = require('../src/traces/scattergeo'); module.exports = require('../src/traces/scattergl'); -},{"../src/traces/scattergl":1055}],30:[function(require,module,exports){ +},{"../src/traces/scattergl":1070}],30:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -617,7 +617,7 @@ module.exports = require('../src/traces/scattergl'); module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":1061}],31:[function(require,module,exports){ +},{"../src/traces/scattermapbox":1077}],31:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -630,7 +630,7 @@ module.exports = require('../src/traces/scattermapbox'); module.exports = require('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":1067}],32:[function(require,module,exports){ +},{"../src/traces/scatterternary":1083}],32:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -643,7 +643,7 @@ module.exports = require('../src/traces/scatterternary'); module.exports = require('../src/transforms/sort'); -},{"../src/transforms/sort":1079}],33:[function(require,module,exports){ +},{"../src/transforms/sort":1095}],33:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -656,7 +656,7 @@ module.exports = require('../src/transforms/sort'); module.exports = require('../src/traces/surface'); -},{"../src/traces/surface":1076}],34:[function(require,module,exports){ +},{"../src/traces/surface":1092}],34:[function(require,module,exports){ 'use strict' module.exports = createCamera @@ -885,7 +885,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":35,"mouse-change":445,"mouse-event-offset":446,"mouse-wheel":448,"right-now":494}],35:[function(require,module,exports){ +},{"3d-view":35,"mouse-change":448,"mouse-event-offset":449,"mouse-wheel":451,"right-now":498}],35:[function(require,module,exports){ 'use strict' module.exports = createViewController @@ -1008,7 +1008,7 @@ function createViewController(options) { matrix: matrix }, mode) } -},{"matrix-camera-controller":443,"orbit-camera-controller":465,"turntable-camera-controller":530}],36:[function(require,module,exports){ +},{"matrix-camera-controller":446,"orbit-camera-controller":469,"turntable-camera-controller":534}],36:[function(require,module,exports){ // https://github.com/d3/d3-sankey Version 0.5.0. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-interpolate')) : @@ -1325,7 +1325,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); }))); -},{"d3-array":110,"d3-collection":111,"d3-interpolate":115}],37:[function(require,module,exports){ +},{"d3-array":112,"d3-collection":113,"d3-interpolate":117}],37:[function(require,module,exports){ 'use strict' var weakMap = typeof WeakMap === 'undefined' ? require('weak-map') : WeakMap @@ -1356,7 +1356,7 @@ function createABigTriangle(gl) { module.exports = createABigTriangle -},{"gl-buffer":152,"gl-vao":266,"weak-map":551}],38:[function(require,module,exports){ +},{"gl-buffer":154,"gl-vao":269,"weak-map":555}],38:[function(require,module,exports){ var padLeft = require('pad-left') module.exports = addLineNumbers @@ -1374,7 +1374,7 @@ function addLineNumbers (string, start, delim) { }).join('\n') } -},{"pad-left":466}],39:[function(require,module,exports){ +},{"pad-left":470}],39:[function(require,module,exports){ 'use strict' module.exports = affineHull @@ -1426,7 +1426,7 @@ function affineHull(points) { } return index } -},{"robust-orientation":500}],40:[function(require,module,exports){ +},{"robust-orientation":504}],40:[function(require,module,exports){ 'use strict' module.exports = alphaComplex @@ -1443,7 +1443,7 @@ function alphaComplex(alpha, points) { return circumradius(simplex) * alpha < 1 }) } -},{"circumradius":83,"delaunay-triangulate":119}],41:[function(require,module,exports){ +},{"circumradius":85,"delaunay-triangulate":121}],41:[function(require,module,exports){ module.exports = alphaShape var ac = require('alpha-complex') @@ -1452,7 +1452,77 @@ var bnd = require('simplicial-complex-boundary') function alphaShape(alpha, points) { return bnd(ac(alpha, points)) } -},{"alpha-complex":40,"simplicial-complex-boundary":508}],42:[function(require,module,exports){ +},{"alpha-complex":40,"simplicial-complex-boundary":512}],42:[function(require,module,exports){ +'use strict' + +module.exports = normalize; + +function normalize (arr, dim) { + if (!arr || arr.length == null) throw Error('Argument should be an array') + + if (dim == null) dim = 1 + else dim = Math.floor(dim) + + var bounds = Array(dim * 2) + + for (var offset = 0; offset < dim; offset++) { + var max = -Infinity, min = Infinity, i = offset, l = arr.length; + + for (; i < l; i+=dim) { + if (arr[i] > max) max = arr[i]; + if (arr[i] < min) min = arr[i]; + } + + bounds[offset] = min + bounds[dim + offset] = max + } + + return bounds; +} + +},{}],43:[function(require,module,exports){ +'use strict' + +var getBounds = require('array-bounds') + +module.exports = normalize; + +function normalize (arr, dim, bounds) { + if (!arr || arr.length == null) throw Error('Argument should be an array') + + if (dim == null) dim = 1 + if (bounds == null) bounds = getBounds(arr, dim) + + for (var offset = 0; offset < dim; offset++) { + var max = bounds[dim + offset], min = bounds[offset], i = offset, l = arr.length; + + if (max === Infinity && min === -Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === max ? 1 : arr[i] === min ? 0 : .5 + } + } + else if (max === Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === max ? 1 : 0 + } + } + else if (min === -Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === min ? 0 : 1 + } + } + else { + var range = max - min + for (i = offset; i < l; i+=dim) { + arr[i] = (arr[i] - min) / range + } + } + } + + return arr; +} + +},{"array-bounds":42}],44:[function(require,module,exports){ 'use strict'; var arraytools = function () { @@ -1641,7 +1711,7 @@ var arraytools = function () { module.exports = arraytools(); -},{}],43:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2135,12 +2205,12 @@ var objectKeys = Object.keys || function (obj) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"util/":541}],44:[function(require,module,exports){ +},{"util/":545}],46:[function(require,module,exports){ module.exports = function _atob(str) { return atob(str) } -},{}],45:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ 'use strict' module.exports = barycentric @@ -2188,7 +2258,7 @@ function barycentric(simplex, point) { } return y } -},{"robust-linear-solve":499}],46:[function(require,module,exports){ +},{"robust-linear-solve":503}],48:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2201,7 +2271,7 @@ function add(a, b) { a[1].mul(b[1])) } -},{"./lib/rationalize":56}],47:[function(require,module,exports){ +},{"./lib/rationalize":58}],49:[function(require,module,exports){ 'use strict' module.exports = cmp @@ -2210,7 +2280,7 @@ function cmp(a, b) { return a[0].mul(b[1]).cmp(b[0].mul(a[1])) } -},{}],48:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2221,7 +2291,7 @@ function div(a, b) { return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) } -},{"./lib/rationalize":56}],49:[function(require,module,exports){ +},{"./lib/rationalize":58}],51:[function(require,module,exports){ 'use strict' var isRat = require('./is-rat') @@ -2283,7 +2353,7 @@ function makeRational(numer, denom) { return rationalize(a, b) } -},{"./div":48,"./is-rat":50,"./lib/is-bn":54,"./lib/num-to-bn":55,"./lib/rationalize":56,"./lib/str-to-bn":57}],50:[function(require,module,exports){ +},{"./div":50,"./is-rat":52,"./lib/is-bn":56,"./lib/num-to-bn":57,"./lib/rationalize":58,"./lib/str-to-bn":59}],52:[function(require,module,exports){ 'use strict' var isBN = require('./lib/is-bn') @@ -2294,7 +2364,7 @@ function isRat(x) { return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) } -},{"./lib/is-bn":54}],51:[function(require,module,exports){ +},{"./lib/is-bn":56}],53:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2305,7 +2375,7 @@ function sign (x) { return x.cmp(new BN(0)) } -},{"bn.js":64}],52:[function(require,module,exports){ +},{"bn.js":66}],54:[function(require,module,exports){ 'use strict' var sign = require('./bn-sign') @@ -2330,7 +2400,7 @@ function bn2num(b) { return sign(b) * out } -},{"./bn-sign":51}],53:[function(require,module,exports){ +},{"./bn-sign":53}],55:[function(require,module,exports){ 'use strict' var db = require('double-bits') @@ -2351,7 +2421,7 @@ function ctzNumber(x) { return h + 32 } -},{"bit-twiddle":63,"double-bits":120}],54:[function(require,module,exports){ +},{"bit-twiddle":65,"double-bits":122}],56:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2364,7 +2434,7 @@ function isBN(x) { return x && typeof x === 'object' && Boolean(x.words) } -},{"bn.js":64}],55:[function(require,module,exports){ +},{"bn.js":66}],57:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2381,7 +2451,7 @@ function num2bn(x) { } } -},{"bn.js":64,"double-bits":120}],56:[function(require,module,exports){ +},{"bn.js":66,"double-bits":122}],58:[function(require,module,exports){ 'use strict' var num2bn = require('./num-to-bn') @@ -2409,7 +2479,7 @@ function rationalize(numer, denom) { return [ numer, denom ] } -},{"./bn-sign":51,"./num-to-bn":55}],57:[function(require,module,exports){ +},{"./bn-sign":53,"./num-to-bn":57}],59:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2420,7 +2490,7 @@ function str2BN(x) { return new BN(x) } -},{"bn.js":64}],58:[function(require,module,exports){ +},{"bn.js":66}],60:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2431,7 +2501,7 @@ function mul(a, b) { return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) } -},{"./lib/rationalize":56}],59:[function(require,module,exports){ +},{"./lib/rationalize":58}],61:[function(require,module,exports){ 'use strict' var bnsign = require('./lib/bn-sign') @@ -2442,7 +2512,7 @@ function sign(x) { return bnsign(x[0]) * bnsign(x[1]) } -},{"./lib/bn-sign":51}],60:[function(require,module,exports){ +},{"./lib/bn-sign":53}],62:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2453,7 +2523,7 @@ function sub(a, b) { return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) } -},{"./lib/rationalize":56}],61:[function(require,module,exports){ +},{"./lib/rationalize":58}],63:[function(require,module,exports){ 'use strict' var bn2num = require('./lib/bn-to-num') @@ -2491,7 +2561,7 @@ function roundRat (f) { } } -},{"./lib/bn-to-num":52,"./lib/ctz":53}],62:[function(require,module,exports){ +},{"./lib/bn-to-num":54,"./lib/ctz":55}],64:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, useNdarray, earlyOut) { @@ -2553,7 +2623,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],63:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ /** * Bit twiddling hacks for JavaScript. * @@ -2759,7 +2829,7 @@ exports.nextCombination = function(v) { } -},{}],64:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -6188,7 +6258,7 @@ exports.nextCombination = function(v) { }; })(typeof module === 'undefined' || module, this); -},{}],65:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -6224,7 +6294,7 @@ function boundary (cells) { return result } -},{}],66:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ 'use strict' module.exports = boxIntersectWrapper @@ -6363,7 +6433,7 @@ function boxIntersectWrapper(arg0, arg1, arg2) { throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":68,"./lib/sweep":72,"typedarray-pool":533}],67:[function(require,module,exports){ +},{"./lib/intersect":70,"./lib/sweep":74,"typedarray-pool":537}],69:[function(require,module,exports){ 'use strict' var DIMENSION = 'd' @@ -6508,7 +6578,7 @@ function bruteForcePlanner(full) { exports.partial = bruteForcePlanner(false) exports.full = bruteForcePlanner(true) -},{}],68:[function(require,module,exports){ +},{}],70:[function(require,module,exports){ 'use strict' module.exports = boxIntersectIter @@ -7003,7 +7073,7 @@ function boxIntersectIter( } } } -},{"./brute":67,"./median":69,"./partition":70,"./sweep":72,"bit-twiddle":63,"typedarray-pool":533}],69:[function(require,module,exports){ +},{"./brute":69,"./median":71,"./partition":72,"./sweep":74,"bit-twiddle":65,"typedarray-pool":537}],71:[function(require,module,exports){ 'use strict' module.exports = findMedian @@ -7146,7 +7216,7 @@ function findMedian(d, axis, start, end, boxes, ids) { start, mid, boxes, ids, boxes[elemSize*mid+axis]) } -},{"./partition":70}],70:[function(require,module,exports){ +},{"./partition":72}],72:[function(require,module,exports){ 'use strict' module.exports = genPartition @@ -7167,7 +7237,7 @@ function genPartition(predicate, args) { .replace('$', predicate)) return Function.apply(void 0, fargs) } -},{}],71:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ 'use strict'; //This code is extracted from ndarray-sort @@ -7404,7 +7474,7 @@ function quickSort(left, right, data) { quickSort(less, great, data); } } -},{}],72:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ 'use strict' module.exports = { @@ -7839,7 +7909,7 @@ red_loop: } } } -},{"./sort":71,"bit-twiddle":63,"typedarray-pool":533}],73:[function(require,module,exports){ +},{"./sort":73,"bit-twiddle":65,"typedarray-pool":537}],75:[function(require,module,exports){ /*! * The buffer module from node.js, for the browser. * @@ -9547,7 +9617,7 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -},{"base64-js":74,"ieee754":283}],74:[function(require,module,exports){ +},{"base64-js":76,"ieee754":286}],76:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -9663,7 +9733,7 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],75:[function(require,module,exports){ +},{}],77:[function(require,module,exports){ 'use strict' var monotoneTriangulate = require('./lib/monotone') @@ -9747,7 +9817,7 @@ function cdt2d(points, edges, options) { } } -},{"./lib/delaunay":76,"./lib/filter":77,"./lib/monotone":78,"./lib/triangulation":79}],76:[function(require,module,exports){ +},{"./lib/delaunay":78,"./lib/filter":79,"./lib/monotone":80,"./lib/triangulation":81}],78:[function(require,module,exports){ 'use strict' var inCircle = require('robust-in-sphere')[4] @@ -9864,7 +9934,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":80,"robust-in-sphere":498}],77:[function(require,module,exports){ +},{"binary-search-bounds":82,"robust-in-sphere":502}],79:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -10046,7 +10116,7 @@ function classifyFaces(triangulation, target, infinity) { return result } -},{"binary-search-bounds":80}],78:[function(require,module,exports){ +},{"binary-search-bounds":82}],80:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -10235,7 +10305,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":80,"robust-orientation":500}],79:[function(require,module,exports){ +},{"binary-search-bounds":82,"robust-orientation":504}],81:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -10341,7 +10411,7 @@ function createTriangulation(numVerts, edges) { return new Triangulation(stars, edges) } -},{"binary-search-bounds":80}],80:[function(require,module,exports){ +},{"binary-search-bounds":82}],82:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, earlyOut) { @@ -10395,7 +10465,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],81:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ 'use strict' module.exports = orientation @@ -10414,7 +10484,7 @@ function orientation(s) { return p } -},{}],82:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ "use strict" var dup = require("dup") @@ -10483,7 +10553,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":121,"robust-linear-solve":499}],83:[function(require,module,exports){ +},{"dup":123,"robust-linear-solve":503}],85:[function(require,module,exports){ module.exports = circumradius var circumcenter = require('circumcenter') @@ -10499,7 +10569,7 @@ function circumradius(points) { } return Math.sqrt(avgDist / points.length) } -},{"circumcenter":82}],84:[function(require,module,exports){ +},{"circumcenter":84}],86:[function(require,module,exports){ module.exports = clamp function clamp(value, min, max) { @@ -10508,7 +10578,7 @@ function clamp(value, min, max) { : (value < max ? max : value > min ? min : value) } -},{}],85:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ 'use strict' module.exports = cleanPSLG @@ -10891,7 +10961,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":86,"big-rat":49,"big-rat/cmp":47,"big-rat/to-float":61,"box-intersect":66,"nextafter":461,"rat-vec":487,"robust-segment-intersect":503,"union-find":534}],86:[function(require,module,exports){ +},{"./lib/rat-seg-intersect":88,"big-rat":51,"big-rat/cmp":49,"big-rat/to-float":63,"box-intersect":68,"nextafter":464,"rat-vec":491,"robust-segment-intersect":507,"union-find":538}],88:[function(require,module,exports){ 'use strict' module.exports = solveIntersection @@ -10935,7 +11005,7 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":48,"big-rat/mul":58,"big-rat/sign":59,"big-rat/sub":60,"rat-vec/add":486,"rat-vec/muls":488,"rat-vec/sub":489}],87:[function(require,module,exports){ +},{"big-rat/div":50,"big-rat/mul":60,"big-rat/sign":61,"big-rat/sub":62,"rat-vec/add":490,"rat-vec/muls":492,"rat-vec/sub":493}],89:[function(require,module,exports){ (function (Buffer){ var clone = (function() { 'use strict'; @@ -11099,14 +11169,16 @@ if (typeof module === 'object' && module.exports) { } }).call(this,require("buffer").Buffer) -},{"buffer":73}],88:[function(require,module,exports){ -/** @module color-number */ +},{"buffer":75}],90:[function(require,module,exports){ +/** @module color-id */ 'use strict' var clamp = require('clamp') module.exports = toNumber +module.exports.to = toNumber +module.exports.from = fromNumber function toNumber (rgba, normalized) { if(normalized == null) normalized = true @@ -11132,8 +11204,21 @@ function toNumber (rgba, normalized) { return n } + +function fromNumber (n, normalized) { + n = +n + + var r = n >>> 24 + var g = (n & 0x00ff0000) >>> 16 + var b = (n & 0x0000ff00) >>> 8 + var a = n & 0x000000ff + + if (normalized === false) return [r, g, b, a] + + return [r/255, g/255, b/255, a/255] +} -},{"clamp":84}],89:[function(require,module,exports){ +},{"clamp":86}],91:[function(require,module,exports){ module.exports = { "aliceblue": [240, 248, 255], "antiquewhite": [250, 235, 215], @@ -11284,7 +11369,7 @@ module.exports = { "yellow": [255, 255, 0], "yellowgreen": [154, 205, 50] }; -},{}],90:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ /** * @module color-parse */ @@ -11461,7 +11546,7 @@ function parse (cstr) { }; } -},{"color-name":89,"is-plain-obj":290}],91:[function(require,module,exports){ +},{"color-name":91,"is-plain-obj":293}],93:[function(require,module,exports){ /** @module color-rgba */ 'use strict' @@ -11500,7 +11585,7 @@ module.exports = function rgba (color, normalize) { } -},{"clamp":84,"color-parse":90,"color-space/hsl":92}],92:[function(require,module,exports){ +},{"clamp":86,"color-parse":92,"color-space/hsl":94}],94:[function(require,module,exports){ /** * @module color-space/hsl */ @@ -11609,7 +11694,7 @@ rgb.hsl = function(rgb) { return [h, s * 100, l * 100]; }; -},{"./rgb":93}],93:[function(require,module,exports){ +},{"./rgb":95}],95:[function(require,module,exports){ /** * RGB space. * @@ -11625,7 +11710,7 @@ module.exports = { alias: ['RGB'] }; -},{}],94:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ module.exports={ "jet":[{"index":0,"rgb":[0,0,131]},{"index":0.125,"rgb":[0,60,170]},{"index":0.375,"rgb":[5,255,255]},{"index":0.625,"rgb":[255,255,0]},{"index":0.875,"rgb":[250,0,0]},{"index":1,"rgb":[128,0,0]}], @@ -11718,7 +11803,7 @@ module.exports={ "cubehelix": [{"index":0,"rgb":[0,0,0]},{"index":0.07,"rgb":[22,5,59]},{"index":0.13,"rgb":[60,4,105]},{"index":0.2,"rgb":[109,1,135]},{"index":0.27,"rgb":[161,0,147]},{"index":0.33,"rgb":[210,2,142]},{"index":0.4,"rgb":[251,11,123]},{"index":0.47,"rgb":[255,29,97]},{"index":0.53,"rgb":[255,54,69]},{"index":0.6,"rgb":[255,85,46]},{"index":0.67,"rgb":[255,120,34]},{"index":0.73,"rgb":[255,157,37]},{"index":0.8,"rgb":[241,191,57]},{"index":0.87,"rgb":[224,220,93]},{"index":0.93,"rgb":[218,241,142]},{"index":1,"rgb":[227,253,198]}] }; -},{}],95:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ /* * Ben Postlethwaite * January 2013 @@ -11855,7 +11940,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScales":94,"arraytools":42,"clone":87}],96:[function(require,module,exports){ +},{"./colorScales":96,"arraytools":44,"clone":89}],98:[function(require,module,exports){ "use strict" module.exports = compareAngle @@ -11941,7 +12026,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":500,"robust-product":501,"robust-sum":505,"signum":507,"two-sum":532}],97:[function(require,module,exports){ +},{"robust-orientation":504,"robust-product":505,"robust-sum":509,"signum":511,"two-sum":536}],99:[function(require,module,exports){ module.exports = compareCells var min = Math.min @@ -11997,7 +12082,7 @@ function compareCells(a, b) { } } -},{}],98:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ 'use strict' var compareCells = require('compare-cell') @@ -12009,7 +12094,7 @@ function compareOrientedCells(a, b) { return compareCells(a, b) || parity(a) - parity(b) } -},{"cell-orientation":81,"compare-cell":97}],99:[function(require,module,exports){ +},{"cell-orientation":83,"compare-cell":99}],101:[function(require,module,exports){ "use strict" var convexHull1d = require('./lib/ch1d') @@ -12035,7 +12120,7 @@ function convexHull(points) { } return convexHullnd(points, d) } -},{"./lib/ch1d":100,"./lib/ch2d":101,"./lib/chnd":102}],100:[function(require,module,exports){ +},{"./lib/ch1d":102,"./lib/ch2d":103,"./lib/chnd":104}],102:[function(require,module,exports){ "use strict" module.exports = convexHull1d @@ -12059,7 +12144,7 @@ function convexHull1d(points) { return [[lo]] } } -},{}],101:[function(require,module,exports){ +},{}],103:[function(require,module,exports){ 'use strict' module.exports = convexHull2D @@ -12082,7 +12167,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":444}],102:[function(require,module,exports){ +},{"monotone-convex-hull-2d":447}],104:[function(require,module,exports){ 'use strict' module.exports = convexHullnD @@ -12143,7 +12228,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":39,"incremental-convex-hull":284}],103:[function(require,module,exports){ +},{"affine-hull":39,"incremental-convex-hull":287}],105:[function(require,module,exports){ module.exports = { AFG: 'afghan', ALA: '\\b\\wland', @@ -12402,7 +12487,7 @@ module.exports = { ZWE: 'zimbabwe|^(?!.*northern).*rhodesia' } -},{}],104:[function(require,module,exports){ +},{}],106:[function(require,module,exports){ // (c) Dean McNamee , 2012. // // https://github.com/deanm/css-color-parser-js @@ -12605,7 +12690,7 @@ function parseCSSColor(css_str) { try { exports.parseCSSColor = parseCSSColor } catch(e) { } -},{}],105:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ "use strict" function dcubicHermite(p0, v0, p1, v1, t, f) { @@ -12645,564 +12730,568 @@ function cubicHermite(p0, v0, p1, v1, t, f) { module.exports = cubicHermite module.exports.derivative = dcubicHermite -},{}],106:[function(require,module,exports){ -"use strict" - -var createThunk = require("./lib/thunk.js") - -function Procedure() { - this.argTypes = [] - this.shimArgs = [] - this.arrayArgs = [] - this.arrayBlockIndices = [] - this.scalarArgs = [] - this.offsetArgs = [] - this.offsetArgIndex = [] - this.indexArgs = [] - this.shapeArgs = [] - this.funcName = "" - this.pre = null - this.body = null - this.post = null - this.debug = false -} - -function compileCwise(user_args) { - //Create procedure - var proc = new Procedure() - - //Parse blocks - proc.pre = user_args.pre - proc.body = user_args.body - proc.post = user_args.post - - //Parse arguments - var proc_args = user_args.args.slice(0) - proc.argTypes = proc_args - for(var i=0; i0) { - throw new Error("cwise: pre() block may not reference array args") - } - if(i < proc.post.args.length && proc.post.args[i].count>0) { - throw new Error("cwise: post() block may not reference array args") - } - } else if(arg_type === "scalar") { - proc.scalarArgs.push(i) - proc.shimArgs.push("scalar" + i) - } else if(arg_type === "index") { - proc.indexArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { - throw new Error("cwise: pre() block may not reference array index") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array index") - } - if(i < proc.post.args.length && proc.post.args[i].count > 0) { - throw new Error("cwise: post() block may not reference array index") - } - } else if(arg_type === "shape") { - proc.shapeArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { - throw new Error("cwise: pre() block may not write to array shape") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array shape") - } - if(i < proc.post.args.length && proc.post.args[i].lvalue) { - throw new Error("cwise: post() block may not write to array shape") - } - } else if(typeof arg_type === "object" && arg_type.offset) { - proc.argTypes[i] = "offset" - proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) - proc.offsetArgIndex.push(i) - } else { - throw new Error("cwise: Unknown argument type " + proc_args[i]) - } - } - - //Make sure at least one array argument was specified - if(proc.arrayArgs.length <= 0) { - throw new Error("cwise: No array arguments specified") - } - - //Make sure arguments are correct - if(proc.pre.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in pre() block") - } - if(proc.body.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in body() block") - } - if(proc.post.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in post() block") - } - - //Check debug flag - proc.debug = !!user_args.printCode || !!user_args.debug - - //Retrieve name - proc.funcName = user_args.funcName || "cwise" - - //Read in block size - proc.blockSize = user_args.blockSize || 64 - - return createThunk(proc) -} - -module.exports = compileCwise +},{}],108:[function(require,module,exports){ +"use strict" -},{"./lib/thunk.js":108}],107:[function(require,module,exports){ -"use strict" - -var uniq = require("uniq") - -// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) -// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. -function innerFill(order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , has_index = proc.indexArgs.length>0 - , code = [] - , vars = [] - , idx=0, pidx=0, i, j - for(i=0; i=0; --i) { // Start at largest stride and work your way inwards - idx = order[i] - code.push(["for(i",i,"=0;i",i," 0) { - code.push(["index[",pidx,"]-=s",pidx].join("")) - } - code.push(["++index[",idx,"]"].join("")) - } - code.push("}") - } - return code.join("\n") -} - -// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. -// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. -// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. -function outerFill(matched, order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , blockSize = proc.blockSize - , has_index = proc.indexArgs.length > 0 - , code = [] - for(var i=0; i0;){"].join("")) // Iterate back to front - code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). - code.push(["s",order[i],"=j",i].join("")) - code.push(["j",i,"=0"].join("")) - code.push(["}else{s",order[i],"=",blockSize].join("")) - code.push(["j",i,"-=",blockSize,"}"].join("")) - if(has_index) { - code.push(["index[",order[i],"]=j",i].join("")) - } - } - for(var i=0; i 0) { - allEqual = allEqual && summary[i] === summary[i-1] - } - } - if(allEqual) { - return summary[0] - } - return summary.join("") -} - -//Generates a cwise operator -function generateCWiseOp(proc, typesig) { - - //Compute dimension - // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. - var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 - var orders = new Array(proc.arrayArgs.length) - var dtypes = new Array(proc.arrayArgs.length) - for(var i=0; i 0) { - vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) - } - if(proc.indexArgs.length > 0) { - // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. - var zeros = new Array(dimension) - for(var i=0; i 3) { - code.push(processBlock(proc.pre, proc, dtypes)) - } - - //Process body - var body = processBlock(proc.body, proc, dtypes) - var matched = countMatches(loopOrders) - if(matched < dimension) { - code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. - } else { - code.push(innerFill(loopOrders[0], proc, body)) - } - - //Inline epilog - if(proc.post.body.length > 3) { - code.push(processBlock(proc.post, proc, dtypes)) - } - - if(proc.debug) { - console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") - } - - var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") - var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) - return f() -} -module.exports = generateCWiseOp - -},{"uniq":535}],108:[function(require,module,exports){ -"use strict" - -// The function below is called when constructing a cwise function object, and does the following: -// A function object is constructed which accepts as argument a compilation function and returns another function. -// It is this other function that is eventually returned by createThunk, and this function is the one that actually -// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. -// The compilation passed to the first function object is used for compiling new functions. -// Once this function object is created, it is called with compile as argument, where the first argument of compile -// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). -// So createThunk roughly works like this: -// function createThunk(proc) { -// var thunk = function(compileBound) { -// var CACHED = {} -// return function(arrays and scalars) { -// if (dtype and order of arrays in CACHED) { -// var func = CACHED[dtype and order of arrays] -// } else { -// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) -// } -// return func(arrays and scalars) -// } -// } -// return thunk(compile.bind1(proc)) -// } - -var compile = require("./compile.js") - -function createThunk(proc) { - var code = ["'use strict'", "var CACHED={}"] - var vars = [] - var thunkName = proc.funcName + "_cwise_thunk" - - //Build thunk - code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) - var typesig = [] - var string_typesig = [] - var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). - Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] - var shapeLengthConditions = [], shapeConditions = [] - // Process array arguments - for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) - shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) - shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") - } - } - // Check for shape equality - if (proc.arrayArgs.length > 1) { - code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") - code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") - code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") - code.push("}") - } - // Process scalar arguments - for(var i=0; i0) { + throw new Error("cwise: pre() block may not reference array args") + } + if(i < proc.post.args.length && proc.post.args[i].count>0) { + throw new Error("cwise: post() block may not reference array args") + } + } else if(arg_type === "scalar") { + proc.scalarArgs.push(i) + proc.shimArgs.push("scalar" + i) + } else if(arg_type === "index") { + proc.indexArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { + throw new Error("cwise: pre() block may not reference array index") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array index") + } + if(i < proc.post.args.length && proc.post.args[i].count > 0) { + throw new Error("cwise: post() block may not reference array index") + } + } else if(arg_type === "shape") { + proc.shapeArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { + throw new Error("cwise: pre() block may not write to array shape") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array shape") + } + if(i < proc.post.args.length && proc.post.args[i].lvalue) { + throw new Error("cwise: post() block may not write to array shape") + } + } else if(typeof arg_type === "object" && arg_type.offset) { + proc.argTypes[i] = "offset" + proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) + proc.offsetArgIndex.push(i) + } else { + throw new Error("cwise: Unknown argument type " + proc_args[i]) + } + } + + //Make sure at least one array argument was specified + if(proc.arrayArgs.length <= 0) { + throw new Error("cwise: No array arguments specified") + } + + //Make sure arguments are correct + if(proc.pre.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in pre() block") + } + if(proc.body.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in body() block") + } + if(proc.post.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in post() block") + } + + //Check debug flag + proc.debug = !!user_args.printCode || !!user_args.debug + + //Retrieve name + proc.funcName = user_args.funcName || "cwise" + + //Read in block size + proc.blockSize = user_args.blockSize || 64 + + return createThunk(proc) +} + +module.exports = compileCwise + +},{"./lib/thunk.js":110}],109:[function(require,module,exports){ +"use strict" + +var uniq = require("uniq") + +// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) +// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. +function innerFill(order, proc, body) { + var dimension = order.length + , nargs = proc.arrayArgs.length + , has_index = proc.indexArgs.length>0 + , code = [] + , vars = [] + , idx=0, pidx=0, i, j + for(i=0; i 0) { + code.push("var " + vars.join(",")) + } + //Scan loop + for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards + idx = order[i] + code.push(["for(i",i,"=0;i",i," 0) { + code.push(["index[",pidx,"]-=s",pidx].join("")) + } + code.push(["++index[",idx,"]"].join("")) + } + code.push("}") + } + return code.join("\n") +} + +// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. +// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. +// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. +function outerFill(matched, order, proc, body) { + var dimension = order.length + , nargs = proc.arrayArgs.length + , blockSize = proc.blockSize + , has_index = proc.indexArgs.length > 0 + , code = [] + for(var i=0; i0;){"].join("")) // Iterate back to front + code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). + code.push(["s",order[i],"=j",i].join("")) + code.push(["j",i,"=0"].join("")) + code.push(["}else{s",order[i],"=",blockSize].join("")) + code.push(["j",i,"-=",blockSize,"}"].join("")) + if(has_index) { + code.push(["index[",order[i],"]=j",i].join("")) + } + } + for(var i=0; i 0) { + allEqual = allEqual && summary[i] === summary[i-1] + } + } + if(allEqual) { + return summary[0] + } + return summary.join("") +} + +//Generates a cwise operator +function generateCWiseOp(proc, typesig) { + + //Compute dimension + // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. + var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 + var orders = new Array(proc.arrayArgs.length) + var dtypes = new Array(proc.arrayArgs.length) + for(var i=0; i 0) { + vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) + } + if(proc.indexArgs.length > 0) { + // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. + var zeros = new Array(dimension) + for(var i=0; i 0) { + code.push("var " + vars.join(",")) + } + for(var i=0; i 3) { + code.push(processBlock(proc.pre, proc, dtypes)) + } + + //Process body + var body = processBlock(proc.body, proc, dtypes) + var matched = countMatches(loopOrders) + if(matched < dimension) { + code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. + } else { + code.push(innerFill(loopOrders[0], proc, body)) + } + + //Inline epilog + if(proc.post.body.length > 3) { + code.push(processBlock(proc.post, proc, dtypes)) + } + + if(proc.debug) { + console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") + } + + var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") + var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) + return f() +} +module.exports = generateCWiseOp + +},{"uniq":539}],110:[function(require,module,exports){ +"use strict" + +// The function below is called when constructing a cwise function object, and does the following: +// A function object is constructed which accepts as argument a compilation function and returns another function. +// It is this other function that is eventually returned by createThunk, and this function is the one that actually +// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. +// The compilation passed to the first function object is used for compiling new functions. +// Once this function object is created, it is called with compile as argument, where the first argument of compile +// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). +// So createThunk roughly works like this: +// function createThunk(proc) { +// var thunk = function(compileBound) { +// var CACHED = {} +// return function(arrays and scalars) { +// if (dtype and order of arrays in CACHED) { +// var func = CACHED[dtype and order of arrays] +// } else { +// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) +// } +// return func(arrays and scalars) +// } +// } +// return thunk(compile.bind1(proc)) +// } + +var compile = require("./compile.js") + +function createThunk(proc) { + var code = ["'use strict'", "var CACHED={}"] + var vars = [] + var thunkName = proc.funcName + "_cwise_thunk" + + //Build thunk + code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) + var typesig = [] + var string_typesig = [] + var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). + Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] + var shapeLengthConditions = [], shapeConditions = [] + // Process array arguments + for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) + shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) + shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") + } + } + // Check for shape equality + if (proc.arrayArgs.length > 1) { + code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") + code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") + code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") + code.push("}") + } + // Process scalar arguments + for(var i=0; i * but significantly simplified and sped up by ignoring number and string constructors @@ -28458,7 +28547,7 @@ module.exports = function(n) { return n - n < 1; }; -},{}],128:[function(require,module,exports){ +},{}],130:[function(require,module,exports){ 'use strict'; module.exports = createFilter; @@ -28542,7 +28631,7 @@ function compare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],129:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ 'use strict' module.exports = createFilteredVector @@ -28835,32 +28924,35 @@ function createFilteredVector(initState, initVelocity, initTime) { } } -},{"binary-search-bounds":62,"cubic-hermite":105}],130:[function(require,module,exports){ +},{"binary-search-bounds":64,"cubic-hermite":107}],132:[function(require,module,exports){ +/** + * @module font-atlas-sdf + */ + 'use strict' var SDF = require('tiny-sdf') +var optical = require('optical-properties') module.exports = atlas + function atlas(options) { options = options || {} var canvas = options.canvas || document.createElement('canvas') - var family = options.family || 'monospace' + var family = options.family || 'sans-serif' var shape = options.shape || [512, 512] var step = options.step || [32, 32] - var size = options.size || 16 + var size = parseFloat(options.size) || 16 var chars = options.chars || [32, 126] var bufferSize = Math.floor((step[0] - size)/2) var radius = options.radius || bufferSize*1.5 var sdf = new SDF(size, bufferSize, radius, 0, family) - var vAlign = options.align || true + var vAlign = options.align == null ? 'optical' : options.align + var fit = options.fit == null || options.fit == true ? .5 : options.fit var i, j - if (typeof size === 'number') { - size = size + 'px' - } - if (!Array.isArray(chars)) { chars = String(chars).split('') } @@ -28886,28 +28978,69 @@ function atlas(options) { ctx.fillStyle = '#000' ctx.fillRect(0, 0, canvas.width, canvas.height) - ctx.font = size + ' ' + family ctx.textBaseline = 'middle' + var w = step[0], h = step[1] var x = 0 var y = 0 - var len = Math.min(chars.length, Math.floor(shape[0]/step[0]) * Math.ceil(shape[1]/step[1])) + var ratio = size/h + var len = Math.min(chars.length, Math.floor(shape[0]/w) * Math.ceil(shape[1]/h)) // hack tiny-sdf to render centered //FIXME: get rif of it by [possibly] PR to tiny-sdf var align = sdf.ctx.textAlign var buffer = sdf.buffer + var middle = sdf.middle sdf.ctx.textAlign = 'center' sdf.buffer = sdf.size/2 for (i = 0; i < len; i++) { - var data = sdf.draw(chars[i]) + if (!chars[i]) continue; + + var props = getProps(chars[i], family, ratio) + var scale = 1, diff = [0, 0] + + //hack tinysdf char-draw method + if (fit) { + var fitRatio = fit + if (Array.isArray(fit)) { + fitRatio = fit[i] + } + var vert = (props.bounds[3]-props.bounds[1])*.5 + var horiz = (props.bounds[2]-props.bounds[0])*.5 + var maxSide = Math.max( vert , horiz ) + var diag = Math.sqrt(vert*vert + horiz*horiz) + var maxDist = props.radius*.333 + maxSide*.333 + diag*.333 + + scale = h*fitRatio / (maxDist*h*2) + sdf.ctx.font = size*scale + 'px ' + family; + } + else { + sdf.ctx.font = size + 'px ' + family; + } + + if (vAlign) { + if (vAlign === 'optical' || vAlign === true) { + diff = [ + w*.5 - w*props.center[0], + h*.5 - h*props.center[1] + ] + } + else { + diff = [ + w*.5 - w*(props.bounds[2] + props.bounds[0])*.5, + h*.5 - h*(props.bounds[3] + props.bounds[1])*.5 + ] + } + sdf.middle = middle + diff[1]*scale + } - var offY = 0 - if (vAlign) offY = getAlignOffset(data) + //calc sdf + var data = sdf.draw(chars[i]) - ctx.putImageData(data, x, y - offY) + // ctx.putImageData(data, x + diff[0]*scale, y + diff[1]*scale, 0, -diff[1]*scale, data.width, data.height) + ctx.putImageData(data, x + diff[0]*scale, y) x += step[0] if (x > shape[0] - step[0]) { @@ -28919,49 +29052,38 @@ function atlas(options) { // unhack tiny-sdf sdf.ctx.textAlign = align sdf.buffer = buffer + sdf.middle = middle return canvas +} +var cache = {} +function getProps(char, family, ratio) { + if (cache[family] && cache[family][char]) return cache[family][char] + + var propsSize = 200 + var propsFs = propsSize * ratio + var props = optical(char, {size: propsSize, fontSize: propsFs, fontFamily: family}) + + if (!cache[family]) cache[family] = {} + + var relProps = { + center: [ + props.center[0]/propsSize, + props.center[1]/propsSize + ], + bounds: props.bounds.map(function (v) { + return v/propsSize + }), + radius: props.radius/propsSize + } - function getAlignOffset (data) { - var buf = data.data, w = data.width, h = data.height - - var top = 0, bottom = 0, x, y, r, line - - //find top boundary - for (y = 0; y < h; y++) { - line = y * w * 4 - for (x = 0; x < w; x++) { - r = buf[line + x * 4] - - if (r > 0) { - top = y - break - } - } - if (top) break - } - - //find bottom boundary - for (y = h; y--;) { - line = y * w * 4 - for (x = 0; x < w; x++) { - r = buf[line + x * 4] - - if (r > 0) { - bottom = y - break - } - } - if (bottom) break - } + cache[family][char] = relProps - return top - .5 * (top + (h - bottom)) - } + return relProps } - -},{"tiny-sdf":525}],131:[function(require,module,exports){ +},{"optical-properties":467,"tiny-sdf":529}],133:[function(require,module,exports){ "use strict" module.exports = createRBTree @@ -29958,7 +30080,7 @@ function defaultCompare(a, b) { function createRBTree(compare) { return new RedBlackTree(compare || defaultCompare, null) } -},{}],132:[function(require,module,exports){ +},{}],134:[function(require,module,exports){ // transliterated from the python snippet here: // http://en.wikipedia.org/wiki/Lanczos_approximation @@ -30027,7 +30149,7 @@ module.exports = function gamma (z) { module.exports.log = lngamma; -},{}],133:[function(require,module,exports){ +},{}],135:[function(require,module,exports){ var wgs84 = require('wgs84'); module.exports.geometry = geometry; @@ -30093,7 +30215,7 @@ function rad(_) { return _ * Math.PI / 180; } -},{"wgs84":557}],134:[function(require,module,exports){ +},{"wgs84":561}],136:[function(require,module,exports){ var geojsonArea = require('geojson-area'); module.exports = rewind; @@ -30144,7 +30266,7 @@ function cw(_) { return geojsonArea.ring(_) >= 0; } -},{"geojson-area":133}],135:[function(require,module,exports){ +},{"geojson-area":135}],137:[function(require,module,exports){ 'use strict'; module.exports = clip; @@ -30295,7 +30417,7 @@ function newSlice(slices, slice, area, dist, outer) { return []; } -},{"./feature":137}],136:[function(require,module,exports){ +},{"./feature":139}],138:[function(require,module,exports){ 'use strict'; module.exports = convert; @@ -30418,7 +30540,7 @@ function calcSize(points) { points.dist = dist; } -},{"./feature":137,"./simplify":139}],137:[function(require,module,exports){ +},{"./feature":139,"./simplify":141}],139:[function(require,module,exports){ 'use strict'; module.exports = createFeature; @@ -30463,7 +30585,7 @@ function calcRingBBox(min, max, points) { } } -},{}],138:[function(require,module,exports){ +},{}],140:[function(require,module,exports){ 'use strict'; module.exports = geojsonvt; @@ -30707,7 +30829,7 @@ function isClippedSquare(tile, extent, buffer) { return true; } -},{"./clip":135,"./convert":136,"./tile":140,"./transform":141,"./wrap":142}],139:[function(require,module,exports){ +},{"./clip":137,"./convert":138,"./tile":142,"./transform":143,"./wrap":144}],141:[function(require,module,exports){ 'use strict'; module.exports = simplify; @@ -30783,7 +30905,7 @@ function getSqSegDist(p, a, b) { return dx * dx + dy * dy; } -},{}],140:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ 'use strict'; module.exports = createTile; @@ -30891,7 +31013,7 @@ function signedArea(ring) { return sum; } -},{}],141:[function(require,module,exports){ +},{}],143:[function(require,module,exports){ 'use strict'; exports.tile = transformTile; @@ -30934,7 +31056,7 @@ function transformPoint(p, extent, z2, tx, ty) { return [x, y]; } -},{}],142:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ 'use strict'; var clip = require('./clip'); @@ -30992,7 +31114,7 @@ function shiftCoords(points, offset) { return newPoints; } -},{"./clip":135,"./feature":137}],143:[function(require,module,exports){ +},{"./clip":137,"./feature":139}],145:[function(require,module,exports){ module.exports = getCanvasContext function getCanvasContext (type, opts) { if (typeof type !== 'string') { @@ -31032,7 +31154,7 @@ function getCanvasContext (type, opts) { return (gl || null) // ensure null on fail } -},{}],144:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ 'use strict' module.exports = createAxes @@ -31555,7 +31677,7 @@ function createAxes(gl, options) { return axes } -},{"./lib/background.js":145,"./lib/cube.js":146,"./lib/lines.js":147,"./lib/text.js":149,"./lib/ticks.js":150}],145:[function(require,module,exports){ +},{"./lib/background.js":147,"./lib/cube.js":148,"./lib/lines.js":149,"./lib/text.js":151,"./lib/ticks.js":152}],147:[function(require,module,exports){ 'use strict' module.exports = createBackgroundCube @@ -31667,7 +31789,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":148,"gl-buffer":152,"gl-vao":266}],146:[function(require,module,exports){ +},{"./shaders":150,"gl-buffer":154,"gl-vao":269}],148:[function(require,module,exports){ "use strict" module.exports = getCubeEdges @@ -31908,7 +32030,7 @@ function getCubeEdges(model, view, projection, bounds) { //Return result return CUBE_RESULT } -},{"bit-twiddle":63,"gl-mat4/invert":176,"gl-mat4/multiply":178,"robust-orientation":500,"split-polygon":518}],147:[function(require,module,exports){ +},{"bit-twiddle":65,"gl-mat4/invert":179,"gl-mat4/multiply":181,"robust-orientation":504,"split-polygon":522}],149:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -32114,7 +32236,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":148,"gl-buffer":152,"gl-vao":266}],148:[function(require,module,exports){ +},{"./shaders":150,"gl-buffer":154,"gl-vao":269}],150:[function(require,module,exports){ 'use strict' @@ -32145,7 +32267,7 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":250}],149:[function(require,module,exports){ +},{"gl-shader":253}],151:[function(require,module,exports){ (function (process){ "use strict" @@ -32347,7 +32469,7 @@ function createTextSprites( } }).call(this,require('_process')) -},{"./shaders":148,"_process":479,"gl-buffer":152,"gl-vao":266,"vectorize-text":546}],150:[function(require,module,exports){ +},{"./shaders":150,"_process":483,"gl-buffer":154,"gl-vao":269,"vectorize-text":550}],152:[function(require,module,exports){ 'use strict' exports.create = defaultTicks @@ -32428,7 +32550,7 @@ function ticksEqual(ticksA, ticksB) { } return true } -},{}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ "use strict" module.exports = axesProperties @@ -32570,7 +32692,7 @@ i_loop: return ranges } -},{"./lib/cube.js":146,"extract-frustum-planes":126,"gl-mat4/multiply":178,"gl-mat4/transpose":186,"gl-vec4/transformMat4":272,"split-polygon":518}],152:[function(require,module,exports){ +},{"./lib/cube.js":148,"extract-frustum-planes":128,"gl-mat4/multiply":181,"gl-mat4/transpose":189,"gl-vec4/transformMat4":275,"split-polygon":522}],154:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -32724,7 +32846,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":460,"ndarray-ops":454,"typedarray-pool":533}],153:[function(require,module,exports){ +},{"ndarray":463,"ndarray-ops":457,"typedarray-pool":537}],155:[function(require,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -33024,14 +33146,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],154:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ var gl10 = require('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":153}],155:[function(require,module,exports){ +},{"./1.0/numbers":155}],157:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -33296,7 +33418,7 @@ function createError2D (plot, options) { return errorBars } -},{"./lib/shaders":156,"gl-buffer":152,"gl-shader":250,"typedarray-pool":533}],156:[function(require,module,exports){ +},{"./lib/shaders":158,"gl-buffer":154,"gl-shader":253,"typedarray-pool":537}],158:[function(require,module,exports){ module.exports = { @@ -33304,7 +33426,7 @@ module.exports = { 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" } -},{}],157:[function(require,module,exports){ +},{}],159:[function(require,module,exports){ 'use strict' module.exports = createErrorBars @@ -33361,12 +33483,13 @@ proto.drawTransparent = proto.draw = function(cameraParams) { var cw = view[15] var pixelScaleF = this.pixelRatio * (projection[3]*cx + projection[7]*cy + projection[11]*cz + projection[15]*cw) / gl.drawingBufferHeight - this.vao.bind() for(var i=0; i<3; ++i) { gl.lineWidth(this.lineWidth[i]) uniforms.capSize = this.capSize[i] * pixelScaleF - gl.drawArrays(gl.LINES, this.lineOffset[i], this.lineCount[i]) + if (this.lineCount[i]) { + gl.drawArrays(gl.LINES, this.lineOffset[i], this.lineCount[i]) + } } this.vao.unbind() } @@ -33541,24 +33664,36 @@ function createErrorBars(options) { return result } -},{"./shaders/index":158,"gl-buffer":152,"gl-vao":266}],158:[function(require,module,exports){ -'use strict' +},{"./shaders/index":161,"gl-buffer":154,"gl-vao":269}],160:[function(require,module,exports){ +module.exports = function(strings) { + if (typeof strings === 'string') strings = [strings] + var exprs = [].slice.call(arguments,1) + var parts = [] + for (var i = 0; i < strings.length-1; i++) { + parts.push(strings[i], exprs[i] || '') + } + parts.push(strings[i]) + return parts.join('') +} +},{}],161:[function(require,module,exports){ +'use strict' +var glslify = require('glslify') var createShader = require('gl-shader') -var vertSrc = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}" -var fragSrc = "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}" +var vertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]) +var fragSrc = glslify(["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}"]) module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ {name: 'position', type: 'vec3'}, - {name: 'offset', type: 'vec3'}, - {name: 'color', type: 'vec4'} + {name: 'color', type: 'vec4'}, + {name: 'offset', type: 'vec3'} ]) } -},{"gl-shader":250}],159:[function(require,module,exports){ +},{"gl-shader":253,"glslify":160}],162:[function(require,module,exports){ 'use strict' var createTexture = require('gl-texture2d') @@ -34025,7 +34160,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":262}],160:[function(require,module,exports){ +},{"gl-texture2d":265}],163:[function(require,module,exports){ var sprintf = require('sprintf-js').sprintf; var glConstants = require('gl-constants/lookup'); @@ -34080,7 +34215,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":38,"gl-constants/lookup":154,"glsl-shader-name":274,"sprintf-js":519}],161:[function(require,module,exports){ +},{"add-line-numbers":38,"gl-constants/lookup":156,"glsl-shader-name":277,"sprintf-js":523}],164:[function(require,module,exports){ 'use strict' module.exports = createHeatmap2D @@ -34398,7 +34533,7 @@ function createHeatmap2D (plot, options) { return heatmap } -},{"./lib/shaders":162,"binary-search-bounds":163,"gl-buffer":152,"gl-shader":250,"iota-array":287,"typedarray-pool":533}],162:[function(require,module,exports){ +},{"./lib/shaders":165,"binary-search-bounds":166,"gl-buffer":154,"gl-shader":253,"iota-array":290,"typedarray-pool":537}],165:[function(require,module,exports){ 'use strict' @@ -34410,9 +34545,9 @@ module.exports = { pickVertex: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n" } -},{}],163:[function(require,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"dup":80}],164:[function(require,module,exports){ +},{}],166:[function(require,module,exports){ +arguments[4][82][0].apply(exports,arguments) +},{"dup":82}],167:[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 (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}" @@ -34423,7 +34558,7 @@ exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute 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 (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}" -},{}],165:[function(require,module,exports){ +},{}],168:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -34936,7 +35071,7 @@ function createLinePlot(plot, options) { linePlot.update(options) return linePlot } -},{"./lib/shaders":164,"gl-buffer":152,"gl-shader":250,"gl-texture2d":262,"ndarray":460,"typedarray-pool":533}],166:[function(require,module,exports){ +},{"./lib/shaders":167,"gl-buffer":154,"gl-shader":253,"gl-texture2d":265,"ndarray":463,"typedarray-pool":537}],169:[function(require,module,exports){ var createShader = require('gl-shader') @@ -34960,7 +35095,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":250}],167:[function(require,module,exports){ +},{"gl-shader":253}],170:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -35330,7 +35465,7 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":166,"binary-search-bounds":62,"gl-buffer":152,"gl-texture2d":262,"gl-vao":266,"glsl-read-float":273,"ndarray":460}],168:[function(require,module,exports){ +},{"./lib/shaders":169,"binary-search-bounds":64,"gl-buffer":154,"gl-texture2d":265,"gl-vao":269,"glsl-read-float":276,"ndarray":463}],171:[function(require,module,exports){ module.exports = invert /** @@ -35359,7 +35494,7 @@ function invert(out, a) { return out } -},{}],169:[function(require,module,exports){ +},{}],172:[function(require,module,exports){ module.exports = invert /** @@ -35398,7 +35533,7 @@ function invert(out, a) { return out } -},{}],170:[function(require,module,exports){ +},{}],173:[function(require,module,exports){ module.exports = clone; /** @@ -35427,7 +35562,7 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],171:[function(require,module,exports){ +},{}],174:[function(require,module,exports){ module.exports = create; /** @@ -35455,7 +35590,7 @@ function create() { out[15] = 1; return out; }; -},{}],172:[function(require,module,exports){ +},{}],175:[function(require,module,exports){ module.exports = determinant; /** @@ -35486,7 +35621,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],173:[function(require,module,exports){ +},{}],176:[function(require,module,exports){ module.exports = fromQuat; /** @@ -35534,7 +35669,7 @@ function fromQuat(out, q) { return out; }; -},{}],174:[function(require,module,exports){ +},{}],177:[function(require,module,exports){ module.exports = fromRotationTranslation; /** @@ -35588,7 +35723,7 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],175:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ module.exports = identity; /** @@ -35616,7 +35751,7 @@ function identity(out) { out[15] = 1; return out; }; -},{}],176:[function(require,module,exports){ +},{}],179:[function(require,module,exports){ module.exports = invert; /** @@ -35672,7 +35807,7 @@ function invert(out, a) { return out; }; -},{}],177:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ var identity = require('./identity'); module.exports = lookAt; @@ -35763,7 +35898,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":175}],178:[function(require,module,exports){ +},{"./identity":178}],181:[function(require,module,exports){ module.exports = multiply; /** @@ -35806,7 +35941,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],179:[function(require,module,exports){ +},{}],182:[function(require,module,exports){ module.exports = perspective; /** @@ -35840,7 +35975,7 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],180:[function(require,module,exports){ +},{}],183:[function(require,module,exports){ module.exports = rotate; /** @@ -35905,7 +36040,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],181:[function(require,module,exports){ +},{}],184:[function(require,module,exports){ module.exports = rotateX; /** @@ -35950,7 +36085,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],182:[function(require,module,exports){ +},{}],185:[function(require,module,exports){ module.exports = rotateY; /** @@ -35995,7 +36130,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],183:[function(require,module,exports){ +},{}],186:[function(require,module,exports){ module.exports = rotateZ; /** @@ -36040,7 +36175,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],184:[function(require,module,exports){ +},{}],187:[function(require,module,exports){ module.exports = scale; /** @@ -36072,7 +36207,7 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],185:[function(require,module,exports){ +},{}],188:[function(require,module,exports){ module.exports = translate; /** @@ -36111,7 +36246,7 @@ function translate(out, a, v) { return out; }; -},{}],186:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ module.exports = transpose; /** @@ -36161,7 +36296,7 @@ function transpose(out, a) { return out; }; -},{}],187:[function(require,module,exports){ +},{}],190:[function(require,module,exports){ 'use strict' module.exports = invert @@ -36192,7 +36327,7 @@ function invert(out, M) { } return out } -},{"gl-mat2/invert":168,"gl-mat3/invert":169,"gl-mat4/invert":176}],188:[function(require,module,exports){ +},{"gl-mat2/invert":171,"gl-mat3/invert":172,"gl-mat4/invert":179}],191:[function(require,module,exports){ /** * @fileoverview gl-matrix - High performance matrix and vector operations * @author Brandon Jones @@ -36230,7 +36365,7 @@ exports.quat = require("./gl-matrix/quat.js"); exports.vec2 = require("./gl-matrix/vec2.js"); exports.vec3 = require("./gl-matrix/vec3.js"); exports.vec4 = require("./gl-matrix/vec4.js"); -},{"./gl-matrix/common.js":189,"./gl-matrix/mat2.js":190,"./gl-matrix/mat2d.js":191,"./gl-matrix/mat3.js":192,"./gl-matrix/mat4.js":193,"./gl-matrix/quat.js":194,"./gl-matrix/vec2.js":195,"./gl-matrix/vec3.js":196,"./gl-matrix/vec4.js":197}],189:[function(require,module,exports){ +},{"./gl-matrix/common.js":192,"./gl-matrix/mat2.js":193,"./gl-matrix/mat2d.js":194,"./gl-matrix/mat3.js":195,"./gl-matrix/mat4.js":196,"./gl-matrix/quat.js":197,"./gl-matrix/vec2.js":198,"./gl-matrix/vec3.js":199,"./gl-matrix/vec4.js":200}],192:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36302,7 +36437,7 @@ glMatrix.equals = function(a, b) { module.exports = glMatrix; -},{}],190:[function(require,module,exports){ +},{}],193:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36740,7 +36875,7 @@ mat2.multiplyScalarAndAdd = function(out, a, b, scale) { module.exports = mat2; -},{"./common.js":189}],191:[function(require,module,exports){ +},{"./common.js":192}],194:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -37211,7 +37346,7 @@ mat2d.equals = function (a, b) { module.exports = mat2d; -},{"./common.js":189}],192:[function(require,module,exports){ +},{"./common.js":192}],195:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -37959,7 +38094,7 @@ mat3.equals = function (a, b) { module.exports = mat3; -},{"./common.js":189}],193:[function(require,module,exports){ +},{"./common.js":192}],196:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -40097,7 +40232,7 @@ mat4.equals = function (a, b) { module.exports = mat4; -},{"./common.js":189}],194:[function(require,module,exports){ +},{"./common.js":192}],197:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -40699,7 +40834,7 @@ quat.equals = vec4.equals; module.exports = quat; -},{"./common.js":189,"./mat3.js":192,"./vec3.js":196,"./vec4.js":197}],195:[function(require,module,exports){ +},{"./common.js":192,"./mat3.js":195,"./vec3.js":199,"./vec4.js":200}],198:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -41288,7 +41423,7 @@ vec2.equals = function (a, b) { module.exports = vec2; -},{"./common.js":189}],196:[function(require,module,exports){ +},{"./common.js":192}],199:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -42067,7 +42202,7 @@ vec3.equals = function (a, b) { module.exports = vec3; -},{"./common.js":189}],197:[function(require,module,exports){ +},{"./common.js":192}],200:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -42678,7 +42813,7 @@ vec4.equals = function (a, b) { module.exports = vec4; -},{"./common.js":189}],198:[function(require,module,exports){ +},{"./common.js":192}],201:[function(require,module,exports){ 'use strict' var barycentric = require('barycentric') @@ -42776,7 +42911,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":45,"polytope-closest-point/lib/closest_point_2d.js":478}],199:[function(require,module,exports){ +},{"barycentric":47,"polytope-closest-point/lib/closest_point_2d.js":482}],202:[function(require,module,exports){ var triVertSrc = "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}" @@ -42845,7 +42980,7 @@ exports.contourShader = { ] } -},{}],200:[function(require,module,exports){ +},{}],203:[function(require,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -43171,10 +43306,15 @@ proto.update = function(params) { var intensityHi = -Infinity if(!vertexUVs && !cellUVs) { if(vertexIntensity) { - for(var i=0; i this.snapThreshold +proto.drawPick = function(offset) { + var pick = offset !== undefined + var plot = this.plot + var pointCount = this.pointCount + var snap = pointCount > this.snapThreshold - if(!pointCount) { - return offset - } + if(!pointCount) { + return offset + } - calcScales.call(this) + calcScales.call(this) - var gl = plot.gl - var shader = pick ? this.pickShader : this.shader - var blend = gl.isEnabled(gl.BLEND) + var gl = plot.gl + var shader = pick ? this.pickShader : this.shader + var blend = gl.isEnabled(gl.BLEND) - shader.bind() + shader.bind() - if(pick) { - this.pickOffset = offset + if(pick) { + this.pickOffset = offset - for (var i = 0; i < 4; ++i) { - PICK_OFFSET[i] = (offset >> (i * 8)) & 0xff - } + for (var i = 0; i < 4; ++i) { + PICK_OFFSET[i] = (offset >> (i * 8)) & 0xff + } - shader.uniforms.pickOffset = PICK_OFFSET + shader.uniforms.pickOffset = PICK_OFFSET - this.idBuffer.bind() - shader.attributes.id.pointer(gl.UNSIGNED_BYTE, false) + this.idBuffer.bind() + shader.attributes.id.pointer(gl.UNSIGNED_BYTE, false) - } else { - gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.blendColor(0,0,0,1); - if (!blend) gl.enable(gl.BLEND) + } else { + gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + gl.blendColor(0,0,0,1); + if (!blend) gl.enable(gl.BLEND) - this.colorBuffer.bind() - shader.attributes.color.pointer(gl.UNSIGNED_BYTE, false) + this.colorBuffer.bind() + shader.attributes.color.pointer(gl.UNSIGNED_BYTE, false) - this.charBuffer.bind() - shader.attributes.char.pointer(gl.UNSIGNED_BYTE, false) + this.charBuffer.bind() + shader.attributes.char.pointer(gl.UNSIGNED_BYTE, false) - shader.uniforms.chars = this.charTexture.bind(0) - shader.uniforms.charsShape = [this.charCanvas.width, this.charCanvas.height] - shader.uniforms.charsStep = this.charStep - shader.uniforms.palette = this.paletteTexture.bind(1) - } + shader.uniforms.chars = this.charTexture.bind(0) + shader.uniforms.charsShape = [this.charCanvas.width, this.charCanvas.height] + shader.uniforms.charsStep = this.charStep + shader.uniforms.palette = this.paletteTexture.bind(1) + } - this.sizeBuffer.bind() - shader.attributes.size.pointer(gl.FLOAT, false, 8, 0) - if (!pick) shader.attributes.border.pointer(gl.FLOAT, false, 8, 4) + this.sizeBuffer.bind() + shader.attributes.size.pointer(gl.FLOAT, false, 8, 0) + if (!pick) shader.attributes.border.pointer(gl.FLOAT, false, 8, 4) - this.positionBuffer.bind() - shader.attributes.positionHi.pointer(gl.FLOAT, false, 16, 0) - shader.attributes.positionLo.pointer(gl.FLOAT, false, 16, 8) + this.positionBuffer.bind() + shader.attributes.positionHi.pointer(gl.FLOAT, false, 16, 0) + shader.attributes.positionLo.pointer(gl.FLOAT, false, 16, 8) - shader.uniforms.pixelRatio = plot.pixelRatio - shader.uniforms.scaleHi = SCALE_HI - shader.uniforms.scaleLo = SCALE_LO - shader.uniforms.translateHi = TRANSLATE_HI - shader.uniforms.translateLo = TRANSLATE_LO - shader.uniforms.viewBox = plot.viewBox + shader.uniforms.pixelRatio = plot.pixelRatio + shader.uniforms.scaleHi = SCALE_HI + shader.uniforms.scaleLo = SCALE_LO + shader.uniforms.translateHi = TRANSLATE_HI + shader.uniforms.translateLo = TRANSLATE_LO + shader.uniforms.viewBox = plot.viewBox - var scales = this.scales + var scales = this.scales - if (snap) { - for (var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { - var lod = scales[scaleNum] - if(lod.pixelSize && (lod.pixelSize < pixelSize * 1.25) && scaleNum > 1) { - continue - } + if (snap) { + for (var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { + var lod = scales[scaleNum] + if(lod.pixelSize && (lod.pixelSize < pixelSize * 1.25) && scaleNum > 1) { + continue + } - var intervalStart = lod.offset - var intervalEnd = lod.count + intervalStart + var intervalStart = lod.offset + var intervalEnd = lod.count + intervalStart - var startOffset = search.ge(this.xCoords, xStart, intervalStart, intervalEnd - 1) - var endOffset = search.lt(this.xCoords, xEnd, startOffset, intervalEnd - 1) + 1 + var startOffset = search.ge(this.xCoords, xStart, intervalStart, intervalEnd - 1) + var endOffset = search.lt(this.xCoords, xEnd, startOffset, intervalEnd - 1) + 1 - if (endOffset > startOffset) { - gl.drawArrays(gl.POINTS, startOffset, (endOffset - startOffset)) - } - } - } - else { - gl.drawArrays(gl.POINTS, 0, pointCount) + if (endOffset > startOffset) { + gl.drawArrays(gl.POINTS, startOffset, (endOffset - startOffset)) + } } + } + else { + gl.drawArrays(gl.POINTS, 0, pointCount) + } - if (pick) return offset + pointCount + if (pick) return offset + pointCount + else { + if (!blend) gl.disable(gl.BLEND) else { - if (!blend) gl.disable(gl.BLEND) - else { - gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) - } + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) } } -})() + +} proto.draw = proto.drawPick @@ -47894,36 +48037,69 @@ proto.pick = function(x, y, value) { proto.update = function(options) { options = options || {} - var positions = options.positions || [] + var positions = options.positions || [] var colors = options.colors || [] var glyphs = options.glyphs || [] var sizes = options.sizes || [] var borderWidths = options.borderWidths || [] var borderColors = options.borderColors || [] var gl = this.plot.gl + var pointCount = this.pointCount + var snap = pointCount > this.snapThreshold - this.points = positions + //update positions + if (options.positions != null) { + this.points = positions - //create packed positions here - var pointCount = this.points.length / 2 - var packedId = pool.mallocInt32(pointCount) - var packedW = pool.mallocFloat32(2 * pointCount) - var packed = pool.mallocFloat64(2 * pointCount) - packed.set(this.points) + pointCount = this.points.length / 2 - this.pointCount = pointCount + snap = pointCount > this.snapThreshold - var snap = pointCount > this.snapThreshold + //create packed positions here + var packedW = pool.mallocFloat32(2 * pointCount) + var packed = pool.mallocFloat64(2 * pointCount) + var v_ids = pool.mallocUint32(pointCount) + var v_position = pool.mallocFloat32(4 * pointCount) - if (snap) { - this.scales = snapPoints(packed, packedId, packedW) + packed.set(this.points) + + if (snap) { + if (this.i2idx) pool.free(this.i2idx) + this.i2idx = pool.mallocInt32(pointCount) + this.scales = snapPoints(packed, this.i2idx, packedW) + } + + this.pointCount = pointCount + + + for(var i = 0; i < pointCount; ++i) { + var id = snap ? this.i2idx[i] : i + + v_ids[i] = id + + //collect buffers data + var x = positions[2 * id] + var y = positions[2 * id + 1] + + //write hi- and lo- position parts + v_position[4 * i] = x + v_position[4 * i + 1] = y + v_position[4 * i + 2] = x - v_position[4 * i] + v_position[4 * i + 3] = y - v_position[4 * i + 1] + + this.xCoords[i] = x + } + + this.idBuffer.update(v_ids) + this.positionBuffer.update(v_position) + pool.free(v_position) + pool.free(v_ids) + pool.free(packed) + pool.free(packedW) } - //v_position contains normalized positions to the available range of positions - var v_position = pool.mallocFloat32(4 * pointCount) var v_sizeWidth = pool.mallocFloat32(2 * pointCount) var v_color = pool.mallocUint8(2 * pointCount) - var v_ids = pool.mallocUint32(pointCount) var v_chars = pool.mallocUint8(2 * pointCount) //aggregate colors @@ -47992,31 +48168,21 @@ proto.update = function(options) { shape: [atlasW, atlasH], step: [step, step], chars: chars, - align: true + align: true, + fit: this.charFit }) this.chars = chars } - //collect buffers data for(var i = 0; i < pointCount; ++i) { - var id = snap ? packedId[i] : i - var x = positions[2 * id] - var y = positions[2 * id + 1] + var id = snap ? this.i2idx[i] : i + var s = sizes[id] var w = borderWidths[id] - //write hi- and lo- position parts - v_position[4 * i] = x - v_position[4 * i + 1] = y - v_position[4 * i + 2] = x - v_position[4 * i] - v_position[4 * i + 3] = y - v_position[4 * i + 1] - - this.xCoords[i] = x - //size is doubled bc character SDF is twice less than character step v_sizeWidth[2 * i] = s*2 v_sizeWidth[2 * i + 1] = w - v_ids[i] = id //color/bufferColor indexes var cId = colorIds[id] @@ -48033,13 +48199,9 @@ proto.update = function(options) { v_chars[2 * i] = charId % cols } - // if (!v_color.length) return - //fill buffes - this.positionBuffer.update(v_position) this.sizeBuffer.update(v_sizeWidth) this.colorBuffer.update(v_color) - this.idBuffer.update(v_ids) this.charBuffer.update(v_chars) //update char/color textures @@ -48049,14 +48211,9 @@ proto.update = function(options) { } this.paletteTexture.setPixels(ndarray(paletteColors.slice(0, 256*4), [256, 1, 4])) - pool.free(v_position) pool.free(v_sizeWidth) pool.free(v_color) - pool.free(v_ids) pool.free(v_chars) - pool.free(packed) - pool.free(packedId) - pool.free(packedW) } proto.dispose = function() { @@ -48099,257 +48256,308 @@ function createFancyScatter2D(plot, options) { return scatter } -},{"./lib/shaders":227,"binary-search-bounds":228,"clamp":84,"color-id":88,"font-atlas-sdf":130,"gl-buffer":152,"gl-shader":229,"gl-texture2d":262,"ndarray":460,"snap-points-2d":237,"typedarray-pool":533}],239:[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((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((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}" +},{"./lib/shaders":230,"binary-search-bounds":231,"clamp":86,"color-id":90,"font-atlas-sdf":132,"gl-buffer":154,"gl-shader":232,"gl-texture2d":265,"ndarray":463,"snap-points-2d":240,"typedarray-pool":537}],242:[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((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((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}" -},{}],240:[function(require,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"dup":80}],241:[function(require,module,exports){ -arguments[4][236][0].apply(exports,arguments) -},{"dup":236}],242:[function(require,module,exports){ -arguments[4][237][0].apply(exports,arguments) -},{"./lib/sort":241,"dup":237,"typedarray-pool":533}],243:[function(require,module,exports){ -'use strict' - -var createShader = require('gl-shader') -var createBuffer = require('gl-buffer') -var search = require('binary-search-bounds') -var snapPoints = require('snap-points-2d') -var pool = require('typedarray-pool') -var SHADERS = require('./lib/shader') - -module.exports = createScatter2D - -function Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) { - this.plot = plot - this.positionBufferHi = positionBufferHi - this.positionBufferLo = positionBufferLo - this.pickBuffer = pickBuffer - this.weightBuffer = weightBuffer - this.shader = shader - this.pickShader = pickShader - this.scales = [] - this.size = 12.0 - this.borderSize = 1.0 - this.pointCount = 0 - this.color = [1, 0, 0, 1] - this.borderColor = [0, 0, 0, 1] - this.bounds = [Infinity, Infinity, -Infinity, -Infinity] - this.pickOffset = 0 - this.points = null - this.xCoords = null -} - -var proto = Scatter2D.prototype -var scaleHi = new Float32Array(2) -var scaleLo = new Float32Array(2) -var translateHi = new Float32Array(2) -var translateLo = new Float32Array(2) -var PICK_VEC4 = [0, 0, 0, 0] - -proto.dispose = function() { - this.shader.dispose() - this.pickShader.dispose() - this.positionBufferHi.dispose() - this.positionBufferLo.dispose() - this.pickBuffer.dispose() - if(this.xCoords) pool.free(this.xCoords) - this.plot.removeObject(this) -} - -proto.update = function(options) { - options = options || {} - - function dflt(opt, value) { - return opt in options ? options[opt] : value - } - - this.size = dflt('size', 12) - this.color = dflt('color', [1, 0, 0, 1]).slice() - this.borderSize = dflt('borderSize', 1) - this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() - - if(this.xCoords) pool.free(this.xCoords) - - this.points = options.positions - var pointCount = this.points.length >>> 1 - var packedId = pool.mallocInt32(pointCount) - var packedW = pool.mallocFloat32(2 * pointCount) - var packed = pool.mallocFloat64(2 * pointCount) - packed.set(this.points) - this.scales = snapPoints(packed, packedId, packedW, this.bounds) - - var xCoords = pool.mallocFloat64(pointCount) - var packedHi = pool.mallocFloat32(2 * pointCount) - var packedLo = pool.mallocFloat32(2 * pointCount) - packedHi.set(packed) - for(var i = 0, j = 0; i < pointCount; i++, j += 2) { - packedLo[j] = packed[j] - packedHi[j] - packedLo[j + 1] = packed[j + 1] - packedHi[j + 1] - xCoords[i] = packed[j] - } - this.positionBufferHi.update(packedHi) - this.positionBufferLo.update(packedLo) - this.pickBuffer.update(packedId) - this.weightBuffer.update(packedW) - - pool.free(packedId) - pool.free(packed) - pool.free(packedHi) - pool.free(packedLo) - pool.free(packedW) - - this.xCoords = xCoords - this.pointCount = pointCount - this.pickOffset = 0 -} - -proto.draw = function(pickOffset) { - - var pick = pickOffset !== void(0) - - var plot = this.plot - var shader = pick ? this.pickShader : this.shader - var scales = this.scales - var positionBufferHi = this.positionBufferHi - var positionBufferLo = this.positionBufferLo - var pickBuffer = this.pickBuffer - var bounds = this.bounds - var size = this.size - var borderSize = this.borderSize - var gl = plot.gl - var pixelRatio = pick ? plot.pickPixelRatio : plot.pixelRatio - var viewBox = plot.viewBox - var dataBox = plot.dataBox - - if(this.pointCount === 0) - return pickOffset - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - var screenX = (viewBox[2] - viewBox[0]) * pixelRatio / plot.pixelRatio - var screenY = (viewBox[3] - viewBox[1]) * pixelRatio / plot.pixelRatio - - var pixelSize = Math.min(dataX / screenX, dataY / screenY) - - var scaleX = 2 * boundX / dataX - var scaleY = 2 * boundY / dataY - - scaleHi[0] = scaleX - scaleHi[1] = scaleY - - scaleLo[0] = scaleX - scaleHi[0] - scaleLo[1] = scaleY - scaleHi[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 - - translateLo[0] = translateX - translateHi[0] - translateLo[1] = translateY - translateHi[1] - - shader.bind() - shader.uniforms.scaleHi = scaleHi - shader.uniforms.scaleLo = scaleLo - shader.uniforms.translateHi = translateHi - shader.uniforms.translateLo = translateLo - shader.uniforms.color = this.color - shader.uniforms.borderColor = this.borderColor - shader.uniforms.pointSize = pixelRatio * (size + borderSize) - shader.uniforms.centerFraction = this.borderSize === 0 ? 2 : size / (size + borderSize + 1.25) - - positionBufferHi.bind() - shader.attributes.positionHi.pointer() - - positionBufferLo.bind() - shader.attributes.positionLo.pointer() - - if(pick) { - - this.pickOffset = pickOffset - PICK_VEC4[0] = ( pickOffset & 0xff) - PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) - PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) - PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) - shader.uniforms.pickOffset = PICK_VEC4 - - pickBuffer.bind() - shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) - - } else { - - shader.uniforms.useWeight = 1 - this.weightBuffer.bind() - shader.attributes.weight.pointer() - - } - - var xCoords = this.xCoords - var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX - var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX - - var firstLevel = true - - for(var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { - var lod = scales[scaleNum] - if(lod.pixelSize < pixelSize && scaleNum > 1) - continue - - var intervalStart = lod.offset - var intervalEnd = lod.count + intervalStart - - var startOffset = search.ge(xCoords, xStart, intervalStart, intervalEnd - 1) - var endOffset = search.lt(xCoords, xEnd, startOffset, intervalEnd - 1) + 1 - - if(endOffset > startOffset) - gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset) - - if(!pick && firstLevel) { - firstLevel = false - shader.uniforms.useWeight = 0 - } - } - - return pickOffset + this.pointCount -} - -proto.drawPick = proto.draw - -proto.pick = function(x, y, value) { - var pointId = value - this.pickOffset - return pointId < 0 || pointId >= this.pointCount - ? null : { - object: this, - pointId: pointId, - dataCoord: [ this.points[2 * pointId], this.points[2 * pointId + 1] ] - } -} - -function createScatter2D(plot, options) { - var gl = plot.gl - var positionBufferHi = createBuffer(gl) - var positionBufferLo = createBuffer(gl) - var pickBuffer = createBuffer(gl) - var weightBuffer = createBuffer(gl) - var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) - var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) - - var result = new Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) - result.update(options) - - plot.addObject(result) // register with plot +},{}],243:[function(require,module,exports){ +arguments[4][82][0].apply(exports,arguments) +},{"dup":82}],244:[function(require,module,exports){ +arguments[4][239][0].apply(exports,arguments) +},{"dup":239}],245:[function(require,module,exports){ +arguments[4][240][0].apply(exports,arguments) +},{"./lib/sort":244,"dup":240,"typedarray-pool":537}],246:[function(require,module,exports){ +'use strict' + +var createShader = require('gl-shader') +var createBuffer = require('gl-buffer') +var search = require('binary-search-bounds') +var snapPoints = require('snap-points-2d') +var pool = require('typedarray-pool') +var SHADERS = require('./lib/shader') +var normalize = require('array-normalize') +var getBounds = require('array-bounds') + +module.exports = createScatter2D + +function Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) { + this.plot = plot + this.positionBufferHi = positionBufferHi + this.positionBufferLo = positionBufferLo + this.pickBuffer = pickBuffer + this.weightBuffer = weightBuffer + this.shader = shader + this.pickShader = pickShader + this.scales = [] + this.size = 12.0 + this.borderSize = 1.0 + this.pointCount = 0 + this.color = [1, 0, 0, 1] + this.borderColor = [0, 0, 0, 1] + this.bounds = [Infinity, Infinity, -Infinity, -Infinity] + this.pickOffset = 0 + this.points = null + this.xCoords = null + this.snapPoints = true +} + +var proto = Scatter2D.prototype +var scaleHi = new Float32Array(2) +var scaleLo = new Float32Array(2) +var translateHi = new Float32Array(2) +var translateLo = new Float32Array(2) +var PICK_VEC4 = [0, 0, 0, 0] + +proto.dispose = function() { + this.shader.dispose() + this.pickShader.dispose() + this.positionBufferHi.dispose() + this.positionBufferLo.dispose() + this.pickBuffer.dispose() + if(this.xCoords) pool.free(this.xCoords) + this.plot.removeObject(this) +} + +proto.update = function(options) { + options = options || {} + + function dflt(opt, value) { + return opt in options ? options[opt] : value + } + + this.size = dflt('size', 12) + this.color = dflt('color', [1, 0, 0, 1]).slice() + this.borderSize = dflt('borderSize', 1) + this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() + this.snapPoints = dflt('snapPoints', true) + + if(this.xCoords) pool.free(this.xCoords) + + //do not recalc points if there is no positions + if (options.positions != null) { + this.points = options.positions + var pointCount = this.points.length >>> 1 + + var packedId = pool.mallocInt32(pointCount) + var packedW = pool.mallocFloat32(pointCount) + var packed = pool.mallocFloat64(2 * pointCount) + packed.set(this.points) + + if (this.snapPoints) { + this.scales = snapPoints(packed, packedId, packedW, this.bounds) + } + else { + //get bounds + this.bounds = getBounds(packed, 2) + + // rescale packed to unit box + normalize(packed, 2, this.bounds) + + // generate fake ids + for (var i = 0; i < pointCount; i++) { + packedId[i] = i + packedW[i] = 1 + } + } + + var xCoords = pool.mallocFloat64(pointCount) + var packedHi = pool.mallocFloat32(2 * pointCount) + var packedLo = pool.mallocFloat32(2 * pointCount) + packedHi.set(packed) + for(var i = 0, j = 0; i < pointCount; i++, j += 2) { + packedLo[j] = packed[j] - packedHi[j] + packedLo[j + 1] = packed[j + 1] - packedHi[j + 1] + xCoords[i] = packed[j] + } + this.positionBufferHi.update(packedHi) + this.positionBufferLo.update(packedLo) + this.pickBuffer.update(packedId) + this.weightBuffer.update(packedW) + + pool.free(packedHi) + pool.free(packedLo) + pool.free(packedW) + pool.free(packed) + pool.free(packedId) + + this.xCoords = xCoords + this.pointCount = pointCount + this.pickOffset = 0 + } +} + +proto.draw = function(pickOffset) { + var pick = pickOffset !== void(0) + + var plot = this.plot + var shader = pick ? this.pickShader : this.shader + var scales = this.scales + var positionBufferHi = this.positionBufferHi + var positionBufferLo = this.positionBufferLo + var pickBuffer = this.pickBuffer + var bounds = this.bounds + var size = this.size + var borderSize = this.borderSize + var gl = plot.gl + var pixelRatio = pick ? plot.pickPixelRatio : plot.pixelRatio + var viewBox = plot.viewBox + var dataBox = plot.dataBox + + if(this.pointCount === 0) + return pickOffset + + var boundX = bounds[2] - bounds[0] + var boundY = bounds[3] - bounds[1] + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] + var screenX = (viewBox[2] - viewBox[0]) * pixelRatio / plot.pixelRatio + var screenY = (viewBox[3] - viewBox[1]) * pixelRatio / plot.pixelRatio + + var pixelSize = this.pixelSize = Math.min(dataX / screenX, dataY / screenY) + + var scaleX = 2 * boundX / dataX + var scaleY = 2 * boundY / dataY + + scaleHi[0] = scaleX + scaleHi[1] = scaleY + + scaleLo[0] = scaleX - scaleHi[0] + scaleLo[1] = scaleY - scaleHi[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 + + translateLo[0] = translateX - translateHi[0] + translateLo[1] = translateY - translateHi[1] + + shader.bind() + shader.uniforms.scaleHi = scaleHi + shader.uniforms.scaleLo = scaleLo + shader.uniforms.translateHi = translateHi + shader.uniforms.translateLo = translateLo + shader.uniforms.color = this.color + shader.uniforms.borderColor = this.borderColor + shader.uniforms.pointSize = pixelRatio * (size + borderSize) + shader.uniforms.centerFraction = this.borderSize === 0 ? 2 : size / (size + borderSize + 1.25) + + positionBufferHi.bind() + shader.attributes.positionHi.pointer() + + positionBufferLo.bind() + shader.attributes.positionLo.pointer() + + if(pick) { + this.pickOffset = pickOffset + PICK_VEC4[0] = ( pickOffset & 0xff) + PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) + PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) + PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) + shader.uniforms.pickOffset = PICK_VEC4 + + pickBuffer.bind() + shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) + + } else { + + shader.uniforms.useWeight = 1 + this.weightBuffer.bind() + shader.attributes.weight.pointer() + + } + + + var firstLevel = true + + if (this.snapPoints) { + for(var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { + var lod = scales[scaleNum] + if(lod.pixelSize < pixelSize && scaleNum > 1) + continue + + var range = this.getVisibleRange(lod) + var startOffset = range[0], endOffset = range[1] + + if(endOffset > startOffset) + gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset) + + if(!pick && firstLevel) { + firstLevel = false + shader.uniforms.useWeight = 0 + } + } + } + else { + gl.drawArrays(gl.POINTS, 0, this.pointCount) + } + + return pickOffset + this.pointCount +} + +proto.getVisibleRange = function (lod) { + var dataBox = this.plot.dataBox, + bounds = this.bounds, + pixelSize = this.pixelSize, + size = this.size, + pixelRatio = this.plot.pixelRatio, + boundX = bounds[2] - bounds[0], + boundY = bounds[3] - bounds[1] + + if (!lod) { + for(var scaleNum = this.scales.length - 1, lod; scaleNum >= 0; scaleNum--) { + lod = this.scales[scaleNum]; + if(!(lod.pixelSize < pixelSize && scaleNum > 1)) break; + } + } + + var xCoords = this.xCoords + var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX + var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX + + var intervalStart = lod.offset + var intervalEnd = lod.count + intervalStart + + var startOffset = search.ge(xCoords, xStart, intervalStart, intervalEnd - 1) + var endOffset = search.lt(xCoords, xEnd, startOffset, intervalEnd - 1) + 1 + + return [startOffset, endOffset] +} + +proto.drawPick = proto.draw + +proto.pick = function(x, y, value) { + var pointId = value - this.pickOffset + return pointId < 0 || pointId >= this.pointCount + ? null : { + object: this, + pointId: pointId, + dataCoord: [ this.points[2 * pointId], this.points[2 * pointId + 1] ] + } +} + +function createScatter2D(plot, options) { + var gl = plot.gl + var positionBufferHi = createBuffer(gl) + var positionBufferLo = createBuffer(gl) + var pickBuffer = createBuffer(gl) + var weightBuffer = createBuffer(gl) + var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) + var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) + + var result = new Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) + result.update(options) + + plot.addObject(result) // register with plot + + return result +} - return result -} -},{"./lib/shader":239,"binary-search-bounds":240,"gl-buffer":152,"gl-shader":250,"snap-points-2d":242,"typedarray-pool":533}],244:[function(require,module,exports){ +},{"./lib/shader":242,"array-bounds":42,"array-normalize":43,"binary-search-bounds":243,"gl-buffer":154,"gl-shader":253,"snap-points-2d":245,"typedarray-pool":537}],247:[function(require,module,exports){ "use strict" var vectorizeText = require("vectorize-text") @@ -48395,7 +48603,7 @@ function getGlyph(symbol, font) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":546}],245:[function(require,module,exports){ +},{"vectorize-text":550}],248:[function(require,module,exports){ var createShaderWrapper = require('gl-shader') @@ -48472,7 +48680,7 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":250}],246:[function(require,module,exports){ +},{"gl-shader":253}],249:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -49232,7 +49440,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/glyphs":244,"./lib/shaders":245,"gl-buffer":152,"gl-mat4/multiply":178,"gl-vao":266,"typedarray-pool":533}],247:[function(require,module,exports){ +},{"./lib/glyphs":247,"./lib/shaders":248,"gl-buffer":154,"gl-mat4/multiply":181,"gl-vao":269,"typedarray-pool":537}],250:[function(require,module,exports){ 'use strict' @@ -49240,7 +49448,7 @@ function createPointCloud(options) { exports.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" exports.boxFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n" -},{}],248:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -49366,7 +49574,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":247,"gl-buffer":152,"gl-shader":250}],249:[function(require,module,exports){ +},{"./lib/shaders":250,"gl-buffer":154,"gl-shader":253}],252:[function(require,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -49377,7 +49585,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>=' @@ -53193,7 +53401,7 @@ module.exports = [ , '}' ] -},{}],281:[function(require,module,exports){ +},{}],284:[function(require,module,exports){ var tokenize = require('./index') module.exports = tokenizeString @@ -53208,7 +53416,7 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":275}],282:[function(require,module,exports){ +},{"./index":278}],285:[function(require,module,exports){ 'use strict'; module.exports = GridIndex; @@ -53370,7 +53578,7 @@ GridIndex.prototype.toArrayBuffer = function() { return array.buffer; }; -},{}],283:[function(require,module,exports){ +},{}],286:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -53456,7 +53664,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],284:[function(require,module,exports){ +},{}],287:[function(require,module,exports){ "use strict" //High level idea: @@ -53903,7 +54111,7 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":500,"simplicial-complex":511}],285:[function(require,module,exports){ +},{"robust-orientation":504,"simplicial-complex":515}],288:[function(require,module,exports){ "use strict" var bounds = require("binary-search-bounds") @@ -54270,7 +54478,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":62}],286:[function(require,module,exports){ +},{"binary-search-bounds":64}],289:[function(require,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -54282,7 +54490,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],287:[function(require,module,exports){ +},{}],290:[function(require,module,exports){ "use strict" function iota(n) { @@ -54294,7 +54502,7 @@ function iota(n) { } module.exports = iota -},{}],288:[function(require,module,exports){ +},{}],291:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -54317,7 +54525,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],289:[function(require,module,exports){ +},{}],292:[function(require,module,exports){ module.exports = isMobile; function isMobile (ua) { @@ -54331,7 +54539,7 @@ function isMobile (ua) { } -},{}],290:[function(require,module,exports){ +},{}],293:[function(require,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -54340,7 +54548,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],291:[function(require,module,exports){ +},{}],294:[function(require,module,exports){ 'use strict'; var sort = require('./sort'); @@ -54386,7 +54594,7 @@ KDBush.prototype = { function defaultGetX(p) { return p[0]; } function defaultGetY(p) { return p[1]; } -},{"./range":292,"./sort":293,"./within":294}],292:[function(require,module,exports){ +},{"./range":295,"./sort":296,"./within":297}],295:[function(require,module,exports){ 'use strict'; module.exports = range; @@ -54434,7 +54642,7 @@ function range(ids, coords, minX, minY, maxX, maxY, nodeSize) { return result; } -},{}],293:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ 'use strict'; module.exports = sortKD; @@ -54502,7 +54710,7 @@ function swap(arr, i, j) { arr[j] = tmp; } -},{}],294:[function(require,module,exports){ +},{}],297:[function(require,module,exports){ 'use strict'; module.exports = within; @@ -54554,7 +54762,7 @@ function sqDist(ax, ay, bx, by) { return dx * dx + dy * dy; } -},{}],295:[function(require,module,exports){ +},{}],298:[function(require,module,exports){ 'use strict'; function createFunction(parameters, defaultType) { @@ -54727,7 +54935,7 @@ module.exports['piecewise-constant'] = function(parameters) { return createFunction(parameters, 'interval'); }; -},{}],296:[function(require,module,exports){ +},{}],299:[function(require,module,exports){ var path = require('path'); @@ -54789,7 +54997,7 @@ module.exports = { module.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":468}],297:[function(require,module,exports){ +},{"path":472}],300:[function(require,module,exports){ 'use strict'; var format = require('util').format; @@ -54807,7 +55015,7 @@ function ValidationError(key, value /*, message, ...*/) { module.exports = ValidationError; -},{"util":541}],298:[function(require,module,exports){ +},{"util":545}],301:[function(require,module,exports){ 'use strict'; module.exports = function (output) { @@ -54820,7 +55028,7 @@ module.exports = function (output) { return output; }; -},{}],299:[function(require,module,exports){ +},{}],302:[function(require,module,exports){ 'use strict'; module.exports = function getType(val) { @@ -54839,7 +55047,7 @@ module.exports = function getType(val) { } }; -},{}],300:[function(require,module,exports){ +},{}],303:[function(require,module,exports){ 'use strict'; // Turn jsonlint-lines-primitives objects into primitive objects @@ -54851,7 +55059,7 @@ module.exports = function unbundle(value) { } }; -},{}],301:[function(require,module,exports){ +},{}],304:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -54918,7 +55126,7 @@ module.exports = function validate(options) { } }; -},{"../error/validation_error":297,"../util/extend":298,"../util/get_type":299,"./validate_array":302,"./validate_boolean":303,"./validate_color":304,"./validate_constants":305,"./validate_enum":306,"./validate_filter":307,"./validate_function":308,"./validate_layer":310,"./validate_number":312,"./validate_object":313,"./validate_source":315,"./validate_string":316}],302:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/extend":301,"../util/get_type":302,"./validate_array":305,"./validate_boolean":306,"./validate_color":307,"./validate_constants":308,"./validate_enum":309,"./validate_filter":310,"./validate_function":311,"./validate_layer":313,"./validate_number":315,"./validate_object":316,"./validate_source":318,"./validate_string":319}],305:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -54972,7 +55180,7 @@ module.exports = function validateArray(options) { return errors; }; -},{"../error/validation_error":297,"../util/get_type":299,"./validate":301}],303:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"./validate":304}],306:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -54990,7 +55198,7 @@ module.exports = function validateBoolean(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299}],304:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],307:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55013,7 +55221,7 @@ module.exports = function validateColor(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299,"csscolorparser":104}],305:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"csscolorparser":106}],308:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55047,7 +55255,7 @@ module.exports = function validateConstants(options) { }; -},{"../error/validation_error":297,"../util/get_type":299}],306:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],309:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55065,7 +55273,7 @@ module.exports = function validateEnum(options) { return errors; }; -},{"../error/validation_error":297,"../util/unbundle_jsonlint":300}],307:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/unbundle_jsonlint":303}],310:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55170,7 +55378,7 @@ module.exports = function validateFilter(options) { return errors; }; -},{"../error/validation_error":297,"../util/get_type":299,"../util/unbundle_jsonlint":300,"./validate_enum":306}],308:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"../util/unbundle_jsonlint":303,"./validate_enum":309}],311:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55304,7 +55512,7 @@ module.exports = function validateFunction(options) { }; -},{"../error/validation_error":297,"../util/get_type":299,"./validate":301,"./validate_array":302,"./validate_number":312,"./validate_object":313}],309:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"./validate":304,"./validate_array":305,"./validate_number":315,"./validate_object":316}],312:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55328,7 +55536,7 @@ module.exports = function(options) { return errors; }; -},{"../error/validation_error":297,"./validate_string":316}],310:[function(require,module,exports){ +},{"../error/validation_error":300,"./validate_string":319}],313:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55441,7 +55649,7 @@ module.exports = function validateLayer(options) { return errors; }; -},{"../error/validation_error":297,"../util/extend":298,"../util/unbundle_jsonlint":300,"./validate_filter":307,"./validate_layout_property":311,"./validate_object":313,"./validate_paint_property":314}],311:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/extend":301,"../util/unbundle_jsonlint":303,"./validate_filter":310,"./validate_layout_property":314,"./validate_object":316,"./validate_paint_property":317}],314:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -55480,7 +55688,7 @@ module.exports = function validateLayoutProperty(options) { }; -},{"../error/validation_error":297,"./validate":301}],312:[function(require,module,exports){ +},{"../error/validation_error":300,"./validate":304}],315:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -55507,7 +55715,7 @@ module.exports = function validateNumber(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299}],313:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],316:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55560,7 +55768,7 @@ module.exports = function validateObject(options) { return errors; }; -},{"../error/validation_error":297,"../util/get_type":299,"./validate":301}],314:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"./validate":304}],317:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -55600,7 +55808,7 @@ module.exports = function validatePaintProperty(options) { }; -},{"../error/validation_error":297,"./validate":301}],315:[function(require,module,exports){ +},{"../error/validation_error":300,"./validate":304}],318:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55677,7 +55885,7 @@ module.exports = function validateSource(options) { } }; -},{"../error/validation_error":297,"../util/unbundle_jsonlint":300,"./validate_enum":306,"./validate_object":313}],316:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/unbundle_jsonlint":303,"./validate_enum":309,"./validate_object":316}],319:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -55695,7 +55903,7 @@ module.exports = function validateString(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299}],317:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],320:[function(require,module,exports){ 'use strict'; var validateConstants = require('./validate/validate_constants'); @@ -55765,12 +55973,12 @@ function wrapCleanErrors(inner) { module.exports = validateStyleMin; -},{"../reference/latest.min":318,"./validate/validate":301,"./validate/validate_constants":305,"./validate/validate_filter":307,"./validate/validate_glyphs_url":309,"./validate/validate_layer":310,"./validate/validate_layout_property":311,"./validate/validate_paint_property":314,"./validate/validate_source":315}],318:[function(require,module,exports){ +},{"../reference/latest.min":321,"./validate/validate":304,"./validate/validate_constants":308,"./validate/validate_filter":310,"./validate/validate_glyphs_url":312,"./validate/validate_layer":313,"./validate/validate_layout_property":314,"./validate/validate_paint_property":317,"./validate/validate_source":318}],321:[function(require,module,exports){ module.exports = require('./v8.min.json'); -},{"./v8.min.json":319}],319:[function(require,module,exports){ +},{"./v8.min.json":322}],322:[function(require,module,exports){ module.exports={"$version":8,"$root":{"version":{"required":true,"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":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"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":true,"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":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"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":false},"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":true,"values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":false,"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":true,"property-function":true,"requires":["icon-image","icon-text-fit","text-field"]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"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":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"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":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"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":true,"property-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"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":true,"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":true,"property-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"property-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"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":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],320:[function(require,module,exports){ +},{}],323:[function(require,module,exports){ 'use strict'; if (typeof module !== 'undefined' && module.exports) { @@ -55901,7 +56109,7 @@ function isWebGLSupported(failIfMajorPerformanceCaveat) { } } -},{}],321:[function(require,module,exports){ +},{}],324:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -55997,7 +56205,7 @@ ArrayGroup.prototype.getTransferables = function(transferables) { } }; -},{"../util/util":435}],322:[function(require,module,exports){ +},{"../util/util":438}],325:[function(require,module,exports){ 'use strict'; var featureFilter = require('feature-filter'); @@ -56515,7 +56723,7 @@ function createGetUniform(attribute, stopOffset) { }; } -},{"../util/struct_array":433,"../util/util":435,"./array_group":321,"./bucket/circle_bucket":323,"./bucket/fill_bucket":324,"./bucket/line_bucket":325,"./bucket/symbol_bucket":326,"./buffer_group":328,"assert":43,"feature-filter":128}],323:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"./array_group":324,"./bucket/circle_bucket":326,"./bucket/fill_bucket":327,"./bucket/line_bucket":328,"./bucket/symbol_bucket":329,"./buffer_group":331,"assert":45,"feature-filter":130}],326:[function(require,module,exports){ 'use strict'; var Bucket = require('../bucket'); @@ -56637,7 +56845,7 @@ CircleBucket.prototype.addFeature = function(feature) { this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup, startIndex); }; -},{"../../util/util":435,"../bucket":322,"../load_geometry":330}],324:[function(require,module,exports){ +},{"../../util/util":438,"../bucket":325,"../load_geometry":333}],327:[function(require,module,exports){ 'use strict'; var Bucket = require('../bucket'); @@ -56748,7 +56956,7 @@ FillBucket.prototype.addPolygon = function(polygon) { } }; -},{"../../util/classify_rings":423,"../../util/util":435,"../bucket":322,"../load_geometry":330,"earcut":122}],325:[function(require,module,exports){ +},{"../../util/classify_rings":426,"../../util/util":438,"../bucket":325,"../load_geometry":333,"earcut":124}],328:[function(require,module,exports){ 'use strict'; var Bucket = require('../bucket'); @@ -57175,7 +57383,7 @@ LineBucket.prototype.addPieSliceVertex = function(currentVertex, distance, extru } }; -},{"../../util/util":435,"../bucket":322,"../load_geometry":330}],326:[function(require,module,exports){ +},{"../../util/util":438,"../bucket":325,"../load_geometry":333}],329:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -57821,7 +58029,7 @@ SymbolBucket.prototype.addSymbolQuad = function(symbolQuad) { symbolQuad.minScale); }; -},{"../../symbol/anchor":384,"../../symbol/clip_line":386,"../../symbol/collision_feature":388,"../../symbol/get_anchors":390,"../../symbol/mergelines":393,"../../symbol/quads":394,"../../symbol/resolve_text":395,"../../symbol/shaping":396,"../../util/token":434,"../../util/util":435,"../bucket":322,"../load_geometry":330,"point-geometry":476}],327:[function(require,module,exports){ +},{"../../symbol/anchor":387,"../../symbol/clip_line":389,"../../symbol/collision_feature":391,"../../symbol/get_anchors":393,"../../symbol/mergelines":396,"../../symbol/quads":397,"../../symbol/resolve_text":398,"../../symbol/shaping":399,"../../util/token":437,"../../util/util":438,"../bucket":325,"../load_geometry":333,"point-geometry":480}],330:[function(require,module,exports){ 'use strict'; module.exports = Buffer; @@ -57922,7 +58130,7 @@ Buffer.BufferType = { ELEMENT: 'ELEMENT_ARRAY_BUFFER' }; -},{}],328:[function(require,module,exports){ +},{}],331:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -57977,7 +58185,7 @@ BufferGroup.prototype.destroy = function(gl) { } }; -},{"../render/vertex_array_object":350,"../util/util":435,"./buffer":327}],329:[function(require,module,exports){ +},{"../render/vertex_array_object":353,"../util/util":438,"./buffer":330}],332:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -58276,7 +58484,7 @@ function offsetLine(rings, offset) { return newRings; } -},{"../util/dictionary_coder":425,"../util/intersection_tests":430,"../util/struct_array":433,"../util/util":435,"../util/vectortile_to_geojson":436,"./bucket":322,"./load_geometry":330,"feature-filter":128,"grid-index":282,"pbf":470,"point-geometry":476,"vector-tile":542}],330:[function(require,module,exports){ +},{"../util/dictionary_coder":428,"../util/intersection_tests":433,"../util/struct_array":436,"../util/util":438,"../util/vectortile_to_geojson":439,"./bucket":325,"./load_geometry":333,"feature-filter":130,"grid-index":285,"pbf":474,"point-geometry":480,"vector-tile":546}],333:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -58332,7 +58540,7 @@ module.exports = function loadGeometry(feature, bits) { return geometry; }; -},{"../util/util":435,"./bucket":322,"assert":43}],331:[function(require,module,exports){ +},{"../util/util":438,"./bucket":325,"assert":45}],334:[function(require,module,exports){ 'use strict'; module.exports = Coordinate; @@ -58411,7 +58619,7 @@ Coordinate.prototype = { } }; -},{}],332:[function(require,module,exports){ +},{}],335:[function(require,module,exports){ 'use strict'; module.exports = LngLat; @@ -58503,7 +58711,7 @@ LngLat.convert = function (input) { return input; }; -},{"../util/util":435}],333:[function(require,module,exports){ +},{"../util/util":438}],336:[function(require,module,exports){ 'use strict'; module.exports = LngLatBounds; @@ -58695,7 +58903,7 @@ LngLatBounds.convert = function (input) { return new LngLatBounds(input); }; -},{"./lng_lat":332}],334:[function(require,module,exports){ +},{"./lng_lat":335}],337:[function(require,module,exports){ 'use strict'; var LngLat = require('./lng_lat'), @@ -59169,7 +59377,7 @@ Transform.prototype = { } }; -},{"../data/bucket":322,"../source/tile_coord":362,"../util/interpolate":429,"../util/util":435,"./coordinate":331,"./lng_lat":332,"gl-matrix":188,"point-geometry":476}],335:[function(require,module,exports){ +},{"../data/bucket":325,"../source/tile_coord":365,"../util/interpolate":432,"../util/util":438,"./coordinate":334,"./lng_lat":335,"gl-matrix":191,"point-geometry":480}],338:[function(require,module,exports){ 'use strict'; // Font data From Hershey Simplex Font @@ -59302,7 +59510,7 @@ module.exports = function textVertices(text, left, baseline, scale) { return strokes; }; -},{}],336:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ 'use strict'; // jshint -W079 @@ -59369,7 +59577,7 @@ Object.defineProperty(mapboxgl, 'accessToken', { * mapboxgl.supported() // = true */ -},{"../package.json":437,"./geo/lng_lat":332,"./geo/lng_lat_bounds":333,"./style/style":371,"./ui/control/attribution":402,"./ui/control/control":403,"./ui/control/geolocate":404,"./ui/control/navigation":405,"./ui/map":414,"./ui/marker":415,"./ui/popup":416,"./util/ajax":418,"./util/browser":419,"./util/config":424,"./util/evented":427,"./util/util":435,"point-geometry":476}],337:[function(require,module,exports){ +},{"../package.json":440,"./geo/lng_lat":335,"./geo/lng_lat_bounds":336,"./style/style":374,"./ui/control/attribution":405,"./ui/control/control":406,"./ui/control/geolocate":407,"./ui/control/navigation":408,"./ui/map":417,"./ui/marker":418,"./ui/popup":419,"./util/ajax":421,"./util/browser":422,"./util/config":427,"./util/evented":430,"./util/util":438,"point-geometry":480}],340:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -59389,7 +59597,7 @@ module.exports = function(uniforms) { return pragmas; }; -},{"assert":43}],338:[function(require,module,exports){ +},{"assert":45}],341:[function(require,module,exports){ 'use strict'; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); @@ -59482,7 +59690,7 @@ function drawBackground(painter, source, layer) { gl.stencilFunc(gl.EQUAL, 0x80, 0x80); } -},{"../source/pixels_to_tile_units":356,"./create_uniform_pragmas":337}],339:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359,"./create_uniform_pragmas":340}],342:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -59547,7 +59755,7 @@ function drawCircles(painter, source, layer, coords) { } } -},{"../util/browser":419}],340:[function(require,module,exports){ +},{"../util/browser":422}],343:[function(require,module,exports){ 'use strict'; module.exports = drawCollisionDebug; @@ -59582,7 +59790,7 @@ function drawCollisionDebug(painter, source, layer, coords) { } } -},{}],341:[function(require,module,exports){ +},{}],344:[function(require,module,exports){ 'use strict'; var textVertices = require('../lib/debugtext'); @@ -59643,7 +59851,7 @@ function drawDebugTile(painter, source, coord) { gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } -},{"../data/bucket":322,"../data/buffer":327,"../lib/debugtext":335,"../util/browser":419,"./vertex_array_object":350,"gl-matrix":188}],342:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../lib/debugtext":338,"../util/browser":422,"./vertex_array_object":353,"gl-matrix":191}],345:[function(require,module,exports){ 'use strict'; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); @@ -59840,7 +60048,7 @@ function setPattern(image, opacity, tile, coord, painter, program) { painter.spriteAtlas.bind(gl, true); } -},{"../source/pixels_to_tile_units":356}],343:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359}],346:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -60005,7 +60213,7 @@ module.exports = function drawLine(painter, source, layer, coords) { }; -},{"../source/pixels_to_tile_units":356,"../util/browser":419,"gl-matrix":188}],344:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359,"../util/browser":422,"gl-matrix":191}],347:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -60151,7 +60359,7 @@ function getOpacities(tile, parentTile, layer, transform) { return opacity; } -},{"../util/struct_array":433,"../util/util":435}],345:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438}],348:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -60367,7 +60575,7 @@ function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isTex } } -},{"../source/pixels_to_tile_units":356,"../util/browser":419,"./draw_collision_debug":340}],346:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359,"../util/browser":422,"./draw_collision_debug":343}],349:[function(require,module,exports){ 'use strict'; module.exports = FrameHistory; @@ -60439,7 +60647,7 @@ FrameHistory.prototype.bind = function(gl) { } }; -},{}],347:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -60586,7 +60794,7 @@ LineAtlas.prototype.bind = function(gl) { } }; -},{"../util/util":435}],348:[function(require,module,exports){ +},{"../util/util":438}],351:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -60930,7 +61138,7 @@ Painter.prototype.showOverdrawInspector = function(enabled) { } }; -},{"../data/bucket":322,"../data/buffer":327,"../source/pixels_to_tile_units":356,"../source/source_cache":360,"../util/browser":419,"../util/struct_array":433,"../util/util":435,"./create_uniform_pragmas":337,"./draw_background":338,"./draw_circle":339,"./draw_debug":341,"./draw_fill":342,"./draw_line":343,"./draw_raster":344,"./draw_symbol":345,"./frame_history":346,"./painter/use_program":349,"./vertex_array_object":350,"gl-matrix":188}],349:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../source/pixels_to_tile_units":359,"../source/source_cache":363,"../util/browser":422,"../util/struct_array":436,"../util/util":438,"./create_uniform_pragmas":340,"./draw_background":341,"./draw_circle":342,"./draw_debug":344,"./draw_fill":345,"./draw_line":346,"./draw_raster":347,"./draw_symbol":348,"./frame_history":349,"./painter/use_program":352,"./vertex_array_object":353,"gl-matrix":191}],352:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -61027,7 +61235,7 @@ function applyPragmas(source, pragmas) { }); } -},{"../../util/util":435,"assert":43,"mapbox-gl-shaders":296}],350:[function(require,module,exports){ +},{"../../util/util":438,"assert":45,"mapbox-gl-shaders":299}],353:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -61125,7 +61333,7 @@ VertexArrayObject.prototype.destroy = function(gl) { } }; -},{"assert":43}],351:[function(require,module,exports){ +},{"assert":45}],354:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -61349,7 +61557,7 @@ GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototy } }); -},{"../data/bucket":322,"../util/evented":427,"../util/util":435,"resolve-url":493}],352:[function(require,module,exports){ +},{"../data/bucket":325,"../util/evented":430,"../util/util":438,"resolve-url":497}],355:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -61487,7 +61695,7 @@ GeoJSONWorkerSource.prototype = util.inherit(VectorTileWorkerSource, /** @lends } }); -},{"../util/ajax":418,"../util/util":435,"./geojson_wrapper":353,"./vector_tile_worker_source":364,"geojson-rewind":134,"geojson-vt":138,"supercluster":521,"vt-pbf":548}],353:[function(require,module,exports){ +},{"../util/ajax":421,"../util/util":438,"./geojson_wrapper":356,"./vector_tile_worker_source":367,"geojson-rewind":136,"geojson-vt":140,"supercluster":525,"vt-pbf":552}],356:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -61563,7 +61771,7 @@ FeatureWrapper.prototype.bbox = function() { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON; -},{"../data/bucket":322,"point-geometry":476,"vector-tile":542}],354:[function(require,module,exports){ +},{"../data/bucket":325,"point-geometry":480,"vector-tile":546}],357:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -61742,7 +61950,7 @@ ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype * } }); -},{"../data/bucket":322,"../data/buffer":327,"../geo/lng_lat":332,"../render/draw_raster":344,"../render/vertex_array_object":350,"../util/ajax":418,"../util/evented":427,"../util/util":435,"./tile_coord":362,"point-geometry":476}],355:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../geo/lng_lat":335,"../render/draw_raster":347,"../render/vertex_array_object":353,"../util/ajax":421,"../util/evented":430,"../util/util":438,"./tile_coord":365,"point-geometry":480}],358:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); var ajax = require('../util/ajax'); @@ -61773,7 +61981,7 @@ module.exports = function(options, callback) { }; -},{"../util/ajax":418,"../util/browser":419,"../util/mapbox":432,"../util/util":435}],356:[function(require,module,exports){ +},{"../util/ajax":421,"../util/browser":422,"../util/mapbox":435,"../util/util":438}],359:[function(require,module,exports){ 'use strict'; var Bucket = require('../data/bucket'); @@ -61798,7 +62006,7 @@ module.exports = function(tile, pixelValue, z) { }; -},{"../data/bucket":322}],357:[function(require,module,exports){ +},{"../data/bucket":325}],360:[function(require,module,exports){ 'use strict'; var TileCoord = require('./tile_coord'); @@ -61869,7 +62077,7 @@ function mergeRenderedFeatureLayers(tiles) { } -},{"./tile_coord":362}],358:[function(require,module,exports){ +},{"./tile_coord":365}],361:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -61966,7 +62174,7 @@ RasterTileSource.prototype = util.inherit(Evented, { } }); -},{"../util/ajax":418,"../util/evented":427,"../util/mapbox":432,"../util/util":435,"./load_tilejson":355}],359:[function(require,module,exports){ +},{"../util/ajax":421,"../util/evented":430,"../util/mapbox":435,"../util/util":438,"./load_tilejson":358}],362:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -62137,7 +62345,7 @@ exports.setType = function (name, type) { * @instance */ -},{"../source/geojson_source":351,"../source/image_source":354,"../source/raster_tile_source":358,"../source/vector_tile_source":363,"../source/video_source":365,"../util/util":435}],360:[function(require,module,exports){ +},{"../source/geojson_source":354,"../source/image_source":357,"../source/raster_tile_source":361,"../source/vector_tile_source":366,"../source/video_source":368,"../util/util":438}],363:[function(require,module,exports){ 'use strict'; var Source = require('./source'); @@ -62675,7 +62883,7 @@ function compareKeyZoom(a, b) { return (a % 32) - (b % 32); } -},{"../data/bucket":322,"../geo/coordinate":331,"../util/evented":427,"../util/lru_cache":431,"../util/util":435,"./source":359,"./tile":361,"./tile_coord":362}],361:[function(require,module,exports){ +},{"../data/bucket":325,"../geo/coordinate":334,"../util/evented":430,"../util/lru_cache":434,"../util/util":438,"./source":362,"./tile":364,"./tile_coord":365}],364:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -62877,7 +63085,7 @@ function unserializeBuckets(input, style) { return output; } -},{"../data/bucket":322,"../data/feature_index":329,"../symbol/collision_box":387,"../symbol/collision_tile":389,"../symbol/symbol_instances":398,"../symbol/symbol_quads":399,"../util/util":435,"../util/vectortile_to_geojson":436,"feature-filter":128,"pbf":470,"vector-tile":542}],362:[function(require,module,exports){ +},{"../data/bucket":325,"../data/feature_index":332,"../symbol/collision_box":390,"../symbol/collision_tile":392,"../symbol/symbol_instances":401,"../symbol/symbol_quads":402,"../util/util":438,"../util/vectortile_to_geojson":439,"feature-filter":130,"pbf":474,"vector-tile":546}],365:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -63071,7 +63279,7 @@ TileCoord.cover = function(z, bounds, actualZ) { }); }; -},{"../geo/coordinate":331,"assert":43,"whoots-js":558}],363:[function(require,module,exports){ +},{"../geo/coordinate":334,"assert":45,"whoots-js":562}],366:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -63178,7 +63386,7 @@ VectorTileSource.prototype = util.inherit(Evented, { } }); -},{"../util/evented":427,"../util/mapbox":432,"../util/util":435,"./load_tilejson":355}],364:[function(require,module,exports){ +},{"../util/evented":430,"../util/mapbox":435,"../util/util":438,"./load_tilejson":358}],367:[function(require,module,exports){ 'use strict'; var ajax = require('../util/ajax'); var vt = require('vector-tile'); @@ -63326,7 +63534,7 @@ VectorTileWorkerSource.prototype = { } }; -},{"../util/ajax":418,"./worker_tile":367,"pbf":470,"vector-tile":542}],365:[function(require,module,exports){ +},{"../util/ajax":421,"./worker_tile":370,"pbf":474,"vector-tile":546}],368:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -63530,7 +63738,7 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * } }); -},{"../data/bucket":322,"../data/buffer":327,"../geo/lng_lat":332,"../render/draw_raster":344,"../render/vertex_array_object":350,"../util/ajax":418,"../util/evented":427,"../util/util":435,"./tile_coord":362,"point-geometry":476}],366:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../geo/lng_lat":335,"../render/draw_raster":347,"../render/vertex_array_object":353,"../util/ajax":421,"../util/evented":430,"../util/util":438,"./tile_coord":365,"point-geometry":480}],369:[function(require,module,exports){ 'use strict'; var Actor = require('../util/actor'); @@ -63694,7 +63902,7 @@ function createLayerFamilies(layers) { return families; } -},{"../style/style_layer":374,"../util/actor":417,"../util/util":435,"./geojson_worker_source":352,"./vector_tile_worker_source":364}],367:[function(require,module,exports){ +},{"../style/style_layer":377,"../util/actor":420,"../util/util":438,"./geojson_worker_source":355,"./vector_tile_worker_source":367}],370:[function(require,module,exports){ 'use strict'; var FeatureIndex = require('../data/feature_index'); @@ -63967,7 +64175,7 @@ function getLayerId(layer) { return layer.id; } -},{"../data/bucket":322,"../data/feature_index":329,"../symbol/collision_box":387,"../symbol/collision_tile":389,"../symbol/symbol_instances":398,"../symbol/symbol_quads":399,"../util/dictionary_coder":425,"../util/util":435}],368:[function(require,module,exports){ +},{"../data/bucket":325,"../data/feature_index":332,"../symbol/collision_box":390,"../symbol/collision_tile":392,"../symbol/symbol_instances":401,"../symbol/symbol_quads":402,"../util/dictionary_coder":428,"../util/util":438}],371:[function(require,module,exports){ 'use strict'; module.exports = AnimationLoop; @@ -63999,7 +64207,7 @@ AnimationLoop.prototype.cancel = function(n) { }); }; -},{}],369:[function(require,module,exports){ +},{}],372:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -64080,7 +64288,7 @@ ImageSprite.prototype.getSpritePosition = function(name) { return new SpritePosition(); }; -},{"../util/ajax":418,"../util/browser":419,"../util/evented":427,"../util/mapbox":432}],370:[function(require,module,exports){ +},{"../util/ajax":421,"../util/browser":422,"../util/evented":430,"../util/mapbox":435}],373:[function(require,module,exports){ 'use strict'; var parseColorString = require('csscolorparser').parseCSSColor; @@ -64122,7 +64330,7 @@ module.exports = function parseColor(input) { } }; -},{"../util/util":435,"./style_function":373,"csscolorparser":104}],371:[function(require,module,exports){ +},{"../util/util":438,"./style_function":376,"csscolorparser":106}],374:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -64903,7 +65111,7 @@ Style.prototype = util.inherit(Evented, { }); -},{"../render/line_atlas":347,"../source/query_features":357,"../source/source":359,"../source/source_cache":360,"../symbol/glyph_source":392,"../symbol/sprite_atlas":397,"../util/ajax":418,"../util/browser":419,"../util/dispatcher":426,"../util/evented":427,"../util/mapbox":432,"../util/util":435,"./animation_loop":368,"./image_sprite":369,"./style_function":373,"./style_layer":374,"./style_spec":381,"./validate_style":383}],372:[function(require,module,exports){ +},{"../render/line_atlas":350,"../source/query_features":360,"../source/source":362,"../source/source_cache":363,"../symbol/glyph_source":395,"../symbol/sprite_atlas":400,"../util/ajax":421,"../util/browser":422,"../util/dispatcher":429,"../util/evented":430,"../util/mapbox":435,"../util/util":438,"./animation_loop":371,"./image_sprite":372,"./style_function":376,"./style_layer":377,"./style_spec":384,"./validate_style":386}],375:[function(require,module,exports){ 'use strict'; var MapboxGLFunction = require('./style_function'); @@ -64987,7 +65195,7 @@ function transitioned(calculate) { }; } -},{"../util/util":435,"./parse_color":370,"./style_function":373}],373:[function(require,module,exports){ +},{"../util/util":438,"./parse_color":373,"./style_function":376}],376:[function(require,module,exports){ 'use strict'; var MapboxGLFunction = require('mapbox-gl-function'); @@ -65014,7 +65222,7 @@ exports['piecewise-constant'] = function(parameters) { exports.isFunctionDefinition = MapboxGLFunction.isFunctionDefinition; -},{"mapbox-gl-function":295}],374:[function(require,module,exports){ +},{"mapbox-gl-function":298}],377:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -65361,7 +65569,7 @@ function getDeclarationValue(declaration) { return declaration.value; } -},{"../util/evented":427,"../util/util":435,"./parse_color":370,"./style_declaration":372,"./style_layer/background_style_layer":375,"./style_layer/circle_style_layer":376,"./style_layer/fill_style_layer":377,"./style_layer/line_style_layer":378,"./style_layer/raster_style_layer":379,"./style_layer/symbol_style_layer":380,"./style_spec":381,"./style_transition":382,"./validate_style":383}],375:[function(require,module,exports){ +},{"../util/evented":430,"../util/util":438,"./parse_color":373,"./style_declaration":375,"./style_layer/background_style_layer":378,"./style_layer/circle_style_layer":379,"./style_layer/fill_style_layer":380,"./style_layer/line_style_layer":381,"./style_layer/raster_style_layer":382,"./style_layer/symbol_style_layer":383,"./style_spec":384,"./style_transition":385,"./validate_style":386}],378:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65375,7 +65583,7 @@ module.exports = BackgroundStyleLayer; BackgroundStyleLayer.prototype = util.inherit(StyleLayer, {}); -},{"../../util/util":435,"../style_layer":374}],376:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],379:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65389,7 +65597,7 @@ module.exports = CircleStyleLayer; CircleStyleLayer.prototype = util.inherit(StyleLayer, {}); -},{"../../util/util":435,"../style_layer":374}],377:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],380:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65445,7 +65653,7 @@ FillStyleLayer.prototype = util.inherit(StyleLayer, { module.exports = FillStyleLayer; -},{"../../util/util":435,"../style_layer":374}],378:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],381:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65479,7 +65687,7 @@ LineStyleLayer.prototype = util.inherit(StyleLayer, { } }); -},{"../../util/util":435,"../style_layer":374}],379:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],382:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65493,7 +65701,7 @@ module.exports = RasterStyleLayer; RasterStyleLayer.prototype = util.inherit(StyleLayer, {}); -},{"../../util/util":435,"../style_layer":374}],380:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],383:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65536,12 +65744,12 @@ SymbolStyleLayer.prototype = util.inherit(StyleLayer, { }); -},{"../../util/util":435,"../style_layer":374}],381:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],384:[function(require,module,exports){ 'use strict'; module.exports = require('mapbox-gl-style-spec/reference/latest.min'); -},{"mapbox-gl-style-spec/reference/latest.min":318}],382:[function(require,module,exports){ +},{"mapbox-gl-style-spec/reference/latest.min":321}],385:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -65626,7 +65834,7 @@ function interpZoomTransitioned(from, to, t) { } } -},{"../util/interpolate":429,"../util/util":435}],383:[function(require,module,exports){ +},{"../util/interpolate":432,"../util/util":438}],386:[function(require,module,exports){ 'use strict'; module.exports = require('mapbox-gl-style-spec/lib/validate_style.min'); @@ -65650,7 +65858,7 @@ module.exports.throwErrors = function throwErrors(emitter, errors) { } }; -},{"mapbox-gl-style-spec/lib/validate_style.min":317}],384:[function(require,module,exports){ +},{"mapbox-gl-style-spec/lib/validate_style.min":320}],387:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -65673,7 +65881,7 @@ Anchor.prototype.clone = function() { return new Anchor(this.x, this.y, this.angle, this.segment); }; -},{"point-geometry":476}],385:[function(require,module,exports){ +},{"point-geometry":480}],388:[function(require,module,exports){ 'use strict'; module.exports = checkMaxAngle; @@ -65753,7 +65961,7 @@ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) { return true; } -},{}],386:[function(require,module,exports){ +},{}],389:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -65827,7 +66035,7 @@ function clipLine(lines, x1, y1, x2, y2) { return clippedLines; } -},{"point-geometry":476}],387:[function(require,module,exports){ +},{"point-geometry":480}],390:[function(require,module,exports){ 'use strict'; var StructArrayType = require('../util/struct_array'); @@ -65908,7 +66116,7 @@ util.extendAll(CollisionBoxArray.prototype.StructType.prototype, { } }); -},{"../util/struct_array":433,"../util/util":435,"point-geometry":476}],388:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"point-geometry":480}],391:[function(require,module,exports){ 'use strict'; module.exports = CollisionFeature; @@ -66042,7 +66250,7 @@ CollisionFeature.prototype._addLineCollisionBoxes = function(collisionBoxArray, return bboxes; }; -},{}],389:[function(require,module,exports){ +},{}],392:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -66343,7 +66551,7 @@ CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minP } }; -},{"../data/bucket":322,"grid-index":282,"point-geometry":476}],390:[function(require,module,exports){ +},{"../data/bucket":325,"grid-index":285,"point-geometry":480}],393:[function(require,module,exports){ 'use strict'; var interpolate = require('../util/interpolate'); @@ -66447,7 +66655,7 @@ function resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, return anchors; } -},{"../symbol/anchor":384,"../util/interpolate":429,"./check_max_angle":385}],391:[function(require,module,exports){ +},{"../symbol/anchor":387,"../util/interpolate":432,"./check_max_angle":388}],394:[function(require,module,exports){ 'use strict'; var ShelfPack = require('shelf-pack'); @@ -66616,7 +66824,7 @@ GlyphAtlas.prototype.updateTexture = function(gl) { } }; -},{"../util/util":435,"shelf-pack":506}],392:[function(require,module,exports){ +},{"../util/util":438,"shelf-pack":510}],395:[function(require,module,exports){ 'use strict'; var normalizeURL = require('../util/mapbox').normalizeGlyphsURL; @@ -66757,7 +66965,7 @@ function glyphUrl(fontstack, range, url, subdomains) { .replace('{range}', range); } -},{"../symbol/glyph_atlas":391,"../util/ajax":418,"../util/glyphs":428,"../util/mapbox":432,"pbf":470}],393:[function(require,module,exports){ +},{"../symbol/glyph_atlas":394,"../util/ajax":421,"../util/glyphs":431,"../util/mapbox":435,"pbf":474}],396:[function(require,module,exports){ 'use strict'; module.exports = function (features, textFeatures, geometries) { @@ -66848,7 +67056,7 @@ module.exports = function (features, textFeatures, geometries) { }; }; -},{}],394:[function(require,module,exports){ +},{}],397:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -67131,7 +67339,7 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { return placementScale; } -},{"point-geometry":476}],395:[function(require,module,exports){ +},{"point-geometry":480}],398:[function(require,module,exports){ 'use strict'; var resolveTokens = require('../util/token'); @@ -67174,7 +67382,7 @@ function resolveText(features, layoutProperties, codepoints) { return textFeatures; } -},{"../util/token":434}],396:[function(require,module,exports){ +},{"../util/token":437}],399:[function(require,module,exports){ 'use strict'; module.exports = { @@ -67355,7 +67563,7 @@ function PositionedIcon(image, top, bottom, left, right) { this.right = right; } -},{}],397:[function(require,module,exports){ +},{}],400:[function(require,module,exports){ 'use strict'; var ShelfPack = require('shelf-pack'); @@ -67588,7 +67796,7 @@ function AtlasImage(rect, width, height, sdf, pixelRatio) { this.pixelRatio = pixelRatio; } -},{"../util/browser":419,"../util/util":435,"shelf-pack":506}],398:[function(require,module,exports){ +},{"../util/browser":422,"../util/util":438,"shelf-pack":510}],401:[function(require,module,exports){ 'use strict'; var StructArrayType = require('../util/struct_array'); @@ -67633,7 +67841,7 @@ util.extendAll(SymbolInstancesArray.prototype.StructType.prototype, { -},{"../util/struct_array":433,"../util/util":435,"point-geometry":476}],399:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"point-geometry":480}],402:[function(require,module,exports){ 'use strict'; var StructArrayType = require('../util/struct_array'); @@ -67707,7 +67915,7 @@ util.extendAll(SymbolQuadsArray.prototype.StructType.prototype, { }); -},{"../util/struct_array":433,"../util/util":435,"./quads":394,"point-geometry":476}],400:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"./quads":397,"point-geometry":480}],403:[function(require,module,exports){ 'use strict'; var DOM = require('../util/dom'); @@ -67882,7 +68090,7 @@ module.exports = function bindHandlers(map, options) { * property. */ -},{"../util/dom":421,"./handler/box_zoom":406,"./handler/dblclick_zoom":407,"./handler/drag_pan":408,"./handler/drag_rotate":409,"./handler/keyboard":410,"./handler/scroll_zoom":411,"./handler/touch_zoom_rotate":412,"point-geometry":476}],401:[function(require,module,exports){ +},{"../util/dom":424,"./handler/box_zoom":409,"./handler/dblclick_zoom":410,"./handler/drag_pan":411,"./handler/drag_rotate":412,"./handler/keyboard":413,"./handler/scroll_zoom":414,"./handler/touch_zoom_rotate":415,"point-geometry":480}],404:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -68669,7 +68877,7 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ * @property {MapEventData} data */ -},{"../geo/lng_lat":332,"../geo/lng_lat_bounds":333,"../util/browser":419,"../util/interpolate":429,"../util/util":435,"point-geometry":476}],402:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../geo/lng_lat_bounds":336,"../util/browser":422,"../util/interpolate":432,"../util/util":438,"point-geometry":480}],405:[function(require,module,exports){ 'use strict'; var Control = require('./control'); @@ -68752,7 +68960,7 @@ Attribution.prototype = util.inherit(Control, { } }); -},{"../../util/dom":421,"../../util/util":435,"./control":403}],403:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438,"./control":406}],406:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -68807,7 +69015,7 @@ Control.prototype = { util.extend(Control.prototype, Evented); -},{"../../util/evented":427,"../../util/util":435}],404:[function(require,module,exports){ +},{"../../util/evented":430,"../../util/util":438}],407:[function(require,module,exports){ 'use strict'; var Control = require('./control'); @@ -68909,7 +69117,7 @@ Geolocate.prototype = util.inherit(Control, { * */ -},{"../../util/browser":419,"../../util/dom":421,"../../util/util":435,"./control":403}],405:[function(require,module,exports){ +},{"../../util/browser":422,"../../util/dom":424,"../../util/util":438,"./control":406}],408:[function(require,module,exports){ 'use strict'; var Control = require('./control'); @@ -69030,7 +69238,7 @@ function copyMouseEvent(e) { }); } -},{"../../util/dom":421,"../../util/util":435,"./control":403}],406:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438,"./control":406}],409:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -69217,7 +69425,7 @@ BoxZoomHandler.prototype = { * @property {MapBoxZoomEvent} data */ -},{"../../geo/lng_lat_bounds":333,"../../util/dom":421,"../../util/util":435}],407:[function(require,module,exports){ +},{"../../geo/lng_lat_bounds":336,"../../util/dom":424,"../../util/util":438}],410:[function(require,module,exports){ 'use strict'; module.exports = DoubleClickZoomHandler; @@ -69280,7 +69488,7 @@ DoubleClickZoomHandler.prototype = { } }; -},{}],408:[function(require,module,exports){ +},{}],411:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -69516,7 +69724,7 @@ DragPanHandler.prototype = { * @property {MapMouseEvent | MapTouchEvent} data */ -},{"../../util/dom":421,"../../util/util":435}],409:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438}],412:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -69770,7 +69978,7 @@ DragRotateHandler.prototype = { * @property {MapMouseEvent | MapTouchEvent} data */ -},{"../../util/dom":421,"../../util/util":435,"point-geometry":476}],410:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438,"point-geometry":480}],413:[function(require,module,exports){ 'use strict'; module.exports = KeyboardHandler; @@ -69902,7 +70110,7 @@ KeyboardHandler.prototype = { } }; -},{}],411:[function(require,module,exports){ +},{}],414:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -70085,7 +70293,7 @@ ScrollZoomHandler.prototype = { * @property {MapMouseEvent | MapTouchEvent} data */ -},{"../../util/browser":419,"../../util/dom":421,"../../util/util":435}],412:[function(require,module,exports){ +},{"../../util/browser":422,"../../util/dom":424,"../../util/util":438}],415:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -70300,7 +70508,7 @@ TouchZoomRotateHandler.prototype = { } }; -},{"../../util/dom":421,"../../util/util":435}],413:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438}],416:[function(require,module,exports){ 'use strict'; /* @@ -70375,7 +70583,7 @@ Hash.prototype = { } }; -},{"../util/util":435}],414:[function(require,module,exports){ +},{"../util/util":438}],417:[function(require,module,exports){ 'use strict'; var Canvas = require('../util/canvas'); @@ -71815,7 +72023,7 @@ function removeNode(node) { * @property {{error: {message: string}}} data */ -},{"../geo/lng_lat":332,"../geo/lng_lat_bounds":333,"../geo/transform":334,"../render/painter":348,"../style/animation_loop":368,"../style/style":371,"../util/browser":419,"../util/canvas":420,"../util/dom":421,"../util/evented":427,"../util/util":435,"./bind_handlers":400,"./camera":401,"./control/attribution":402,"./hash":413,"point-geometry":476}],415:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../geo/lng_lat_bounds":336,"../geo/transform":337,"../render/painter":351,"../style/animation_loop":371,"../style/style":374,"../util/browser":422,"../util/canvas":423,"../util/dom":424,"../util/evented":430,"../util/util":438,"./bind_handlers":403,"./camera":404,"./control/attribution":405,"./hash":416,"point-geometry":480}],418:[function(require,module,exports){ /* eslint-disable */ 'use strict'; @@ -71910,7 +72118,7 @@ Marker.prototype = { } }; -},{"../geo/lng_lat":332,"../util/dom":421,"point-geometry":476}],416:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../util/dom":424,"point-geometry":480}],419:[function(require,module,exports){ 'use strict'; module.exports = Popup; @@ -72164,7 +72372,7 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ } }); -},{"../geo/lng_lat":332,"../util/dom":421,"../util/evented":427,"../util/util":435}],417:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../util/dom":424,"../util/evented":430,"../util/util":438}],420:[function(require,module,exports){ 'use strict'; module.exports = Actor; @@ -72236,7 +72444,7 @@ Actor.prototype.postMessage = function(message, transferList) { this.target.postMessage(message, transferList); }; -},{}],418:[function(require,module,exports){ +},{}],421:[function(require,module,exports){ 'use strict'; exports.getJSON = function(url, callback) { @@ -72326,7 +72534,7 @@ exports.getVideo = function(urls, callback) { return video; }; -},{}],419:[function(require,module,exports){ +},{}],422:[function(require,module,exports){ 'use strict'; /** @@ -72421,7 +72629,7 @@ webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ// exports.supportsGeolocation = !!navigator.geolocation; -},{"mapbox-gl-supported":320}],420:[function(require,module,exports){ +},{"mapbox-gl-supported":323}],423:[function(require,module,exports){ 'use strict'; var util = require('../util'); @@ -72465,7 +72673,7 @@ Canvas.prototype.getElement = function() { return this.canvas; }; -},{"../util":435,"mapbox-gl-supported":320}],421:[function(require,module,exports){ +},{"../util":438,"mapbox-gl-supported":323}],424:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -72540,7 +72748,7 @@ exports.touchPos = function (el, e) { return points; }; -},{"point-geometry":476}],422:[function(require,module,exports){ +},{"point-geometry":480}],425:[function(require,module,exports){ 'use strict'; var WebWorkify = require('webworkify'); @@ -72548,7 +72756,7 @@ module.exports = function () { return new WebWorkify(require('../../source/worker')); }; -},{"../../source/worker":366,"webworkify":556}],423:[function(require,module,exports){ +},{"../../source/worker":369,"webworkify":560}],426:[function(require,module,exports){ 'use strict'; var quickselect = require('quickselect'); @@ -72608,7 +72816,7 @@ function calculateSignedArea(ring) { return sum; } -},{"quickselect":485}],424:[function(require,module,exports){ +},{"quickselect":489}],427:[function(require,module,exports){ 'use strict'; module.exports = { @@ -72616,7 +72824,7 @@ module.exports = { REQUIRE_ACCESS_TOKEN: true }; -},{}],425:[function(require,module,exports){ +},{}],428:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -72643,7 +72851,7 @@ DictionaryCoder.prototype.decode = function(n) { return this._numberToString[n]; }; -},{"assert":43}],426:[function(require,module,exports){ +},{"assert":45}],429:[function(require,module,exports){ 'use strict'; var util = require('./util'); @@ -72718,7 +72926,7 @@ Dispatcher.prototype = { } }; -},{"./actor":417,"./util":435,"./web_worker":422}],427:[function(require,module,exports){ +},{"./actor":420,"./util":438,"./web_worker":425}],430:[function(require,module,exports){ 'use strict'; var util = require('./util'); @@ -72841,7 +73049,7 @@ var Evented = { module.exports = Evented; -},{"./util":435}],428:[function(require,module,exports){ +},{"./util":438}],431:[function(require,module,exports){ 'use strict'; module.exports = Glyphs; @@ -72876,7 +73084,7 @@ function readGlyph(tag, glyph, pbf) { else if (tag === 7) glyph.advance = pbf.readVarint(); } -},{}],429:[function(require,module,exports){ +},{}],432:[function(require,module,exports){ 'use strict'; module.exports = interpolate; @@ -72917,7 +73125,7 @@ interpolate.array = function(from, to, t) { }); }; -},{}],430:[function(require,module,exports){ +},{}],433:[function(require,module,exports){ 'use strict'; module.exports = { @@ -73083,7 +73291,7 @@ function polygonContainsPoint(ring, p) { return c; } -},{}],431:[function(require,module,exports){ +},{}],434:[function(require,module,exports){ 'use strict'; module.exports = LRUCache; @@ -73208,7 +73416,7 @@ LRUCache.prototype.setMaxSize = function(max) { return this; }; -},{}],432:[function(require,module,exports){ +},{}],435:[function(require,module,exports){ 'use strict'; var config = require('./config'); @@ -73336,7 +73544,7 @@ function replaceTempAccessToken(query) { } } -},{"./browser":419,"./config":424,"./util":435,"url":537}],433:[function(require,module,exports){ +},{"./browser":422,"./config":427,"./util":438,"url":541}],436:[function(require,module,exports){ 'use strict'; // Note: all "sizes" are measured in bytes @@ -73684,7 +73892,7 @@ StructArray.prototype.toArray = function(startIndex, endIndex) { return array; }; -},{"assert":43}],434:[function(require,module,exports){ +},{"assert":45}],437:[function(require,module,exports){ 'use strict'; module.exports = resolveTokens; @@ -73703,7 +73911,7 @@ function resolveTokens(properties, text) { }); } -},{}],435:[function(require,module,exports){ +},{}],438:[function(require,module,exports){ 'use strict'; var UnitBezier = require('unitbezier'); @@ -74162,7 +74370,7 @@ exports.warnOnce = function(message) { } }; -},{"../geo/coordinate":331,"unitbezier":536}],436:[function(require,module,exports){ +},{"../geo/coordinate":334,"unitbezier":540}],439:[function(require,module,exports){ 'use strict'; module.exports = Feature; @@ -74207,7 +74415,7 @@ Feature.prototype = { } }; -},{}],437:[function(require,module,exports){ +},{}],440:[function(require,module,exports){ module.exports={ "_args": [ [ @@ -74248,7 +74456,6 @@ module.exports={ "type": "range" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz", @@ -74548,7 +74755,7 @@ module.exports={ "version": "0.22.1" } -},{}],438:[function(require,module,exports){ +},{}],441:[function(require,module,exports){ 'use strict' module.exports = createTable @@ -74614,7 +74821,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":99}],439:[function(require,module,exports){ +},{"convex-hull":101}],442:[function(require,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -74794,7 +75001,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":440,"gl-mat4/clone":170,"gl-mat4/create":171,"gl-mat4/determinant":172,"gl-mat4/invert":176,"gl-mat4/transpose":186,"gl-vec3/cross":267,"gl-vec3/dot":268,"gl-vec3/length":269,"gl-vec3/normalize":271}],440:[function(require,module,exports){ +},{"./normalize":443,"gl-mat4/clone":173,"gl-mat4/create":174,"gl-mat4/determinant":175,"gl-mat4/invert":179,"gl-mat4/transpose":189,"gl-vec3/cross":270,"gl-vec3/dot":271,"gl-vec3/length":272,"gl-vec3/normalize":274}],443:[function(require,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -74805,7 +75012,7 @@ module.exports = function normalize(out, mat) { out[i] = mat[i] * scale return true } -},{}],441:[function(require,module,exports){ +},{}],444:[function(require,module,exports){ var lerp = require('gl-vec3/lerp') var recompose = require('mat4-recompose') @@ -74858,7 +75065,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":172,"gl-vec3/lerp":270,"mat4-decompose":439,"mat4-recompose":442,"quat-slerp":481}],442:[function(require,module,exports){ +},{"gl-mat4/determinant":175,"gl-vec3/lerp":273,"mat4-decompose":442,"mat4-recompose":445,"quat-slerp":485}],445:[function(require,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -74919,7 +75126,7 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":171,"gl-mat4/fromRotationTranslation":174,"gl-mat4/identity":175,"gl-mat4/multiply":178,"gl-mat4/scale":184,"gl-mat4/translate":185}],443:[function(require,module,exports){ +},{"gl-mat4/create":174,"gl-mat4/fromRotationTranslation":177,"gl-mat4/identity":178,"gl-mat4/multiply":181,"gl-mat4/scale":187,"gl-mat4/translate":188}],446:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -75119,7 +75326,7 @@ function createMatrixCameraController(options) { return new MatrixCameraController(matrix) } -},{"binary-search-bounds":62,"gl-mat4/invert":176,"gl-mat4/lookAt":177,"gl-mat4/rotateX":181,"gl-mat4/rotateY":182,"gl-mat4/rotateZ":183,"gl-mat4/scale":184,"gl-mat4/translate":185,"gl-vec3/normalize":271,"mat4-interpolate":441}],444:[function(require,module,exports){ +},{"binary-search-bounds":64,"gl-mat4/invert":179,"gl-mat4/lookAt":180,"gl-mat4/rotateX":184,"gl-mat4/rotateY":185,"gl-mat4/rotateZ":186,"gl-mat4/scale":187,"gl-mat4/translate":188,"gl-vec3/normalize":274,"mat4-interpolate":444}],447:[function(require,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -75201,7 +75408,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":500}],445:[function(require,module,exports){ +},{"robust-orientation":504}],448:[function(require,module,exports){ 'use strict' module.exports = mouseListen @@ -75408,7 +75615,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":447}],446:[function(require,module,exports){ +},{"mouse-event":450}],449:[function(require,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -75435,7 +75642,7 @@ function getBoundingClientOffset (element) { } } -},{}],447:[function(require,module,exports){ +},{}],450:[function(require,module,exports){ 'use strict' function mouseButtons(ev) { @@ -75497,7 +75704,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],448:[function(require,module,exports){ +},{}],451:[function(require,module,exports){ 'use strict' var toPX = require('to-px') @@ -75539,7 +75746,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":527}],449:[function(require,module,exports){ +},{"to-px":531}],452:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -75955,19 +76162,19 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":533}],450:[function(require,module,exports){ +},{"typedarray-pool":537}],453:[function(require,module,exports){ "use strict" -var fill = require('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":false,"rvalue":true,"count":1},{"name":"_inline_4_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_4_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) +var fill = require('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":false,"rvalue":true,"count":1},{"name":"_inline_7_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_7_arg2_","lvalue":false,"rvalue":true,"count":1}],"thisVars":[],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"cwise","blockSize":64}) module.exports = function(array, f) { fill(array, f) return array } -},{"cwise/lib/wrapper":109}],451:[function(require,module,exports){ +},{"cwise/lib/wrapper":111}],454:[function(require,module,exports){ 'use strict' module.exports = gradient @@ -76265,7 +76472,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":106,"dup":121}],452:[function(require,module,exports){ +},{"cwise-compiler":108,"dup":123}],455:[function(require,module,exports){ 'use strict' var warp = require('ndarray-warp') @@ -76295,7 +76502,7 @@ function applyHomography(dest, src, Xi) { }) return dest } -},{"gl-matrix-invert":187,"ndarray-warp":459}],453:[function(require,module,exports){ +},{"gl-matrix-invert":190,"ndarray-warp":462}],456:[function(require,module,exports){ "use strict" function interp1d(arr, x) { @@ -76406,7 +76613,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],454:[function(require,module,exports){ +},{}],457:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -76869,7 +77076,7 @@ exports.equals = compile({ -},{"cwise-compiler":106}],455:[function(require,module,exports){ +},{"cwise-compiler":108}],458:[function(require,module,exports){ "use strict" var ndarray = require("ndarray") @@ -76892,10 +77099,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":456,"ndarray":460}],456:[function(require,module,exports){ +},{"./doConvert.js":459,"ndarray":463}],459:[function(require,module,exports){ module.exports=require('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":106}],457:[function(require,module,exports){ +},{"cwise-compiler":108}],460:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -77624,7 +77831,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":533}],458:[function(require,module,exports){ +},{"typedarray-pool":537}],461:[function(require,module,exports){ "use strict" var compile = require("./lib/compile_sort.js") @@ -77644,19 +77851,19 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":457}],459:[function(require,module,exports){ +},{"./lib/compile_sort.js":460}],462:[function(require,module,exports){ 'use strict' var interp = require('ndarray-linear-interpolate') -var do_warp = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_21_arg4_)}","args":[{"name":"_inline_21_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_21_arg4_","lvalue":false,"rvalue":true,"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":false,"rvalue":true,"count":1},{"name":"_inline_22_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_22_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_22_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) +var do_warp = require('cwise/lib/wrapper')({"args":["index","array","scalar","scalar","scalar"],"pre":{"body":"{this_warped=new Array(_inline_33_arg4_)}","args":[{"name":"_inline_33_arg0_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg1_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg2_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg3_","lvalue":false,"rvalue":false,"count":0},{"name":"_inline_33_arg4_","lvalue":false,"rvalue":true,"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":false,"rvalue":true,"count":1},{"name":"_inline_34_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_34_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_34_arg4_","lvalue":false,"rvalue":false,"count":0}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warpND","blockSize":64}) -var do_warp_1 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_25_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_25_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_25_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) +var do_warp_1 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_37_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_37_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_37_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp1D","blockSize":64}) -var do_warp_2 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_28_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_28_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_28_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) +var do_warp_2 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_40_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_40_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_40_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp2D","blockSize":64}) -var do_warp_3 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_31_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_31_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_31_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) +var do_warp_3 = require('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":false,"rvalue":true,"count":1},{"name":"_inline_43_arg1_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_43_arg2_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg3_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_43_arg4_","lvalue":false,"rvalue":true,"count":1}],"thisVars":["this_warped"],"localVars":[]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"debug":false,"funcName":"warp3D","blockSize":64}) module.exports = function warp(dest, src, func) { switch(src.shape.length) { @@ -77676,7 +77883,7 @@ module.exports = function warp(dest, src, func) { return dest } -},{"cwise/lib/wrapper":109,"ndarray-linear-interpolate":453}],460:[function(require,module,exports){ +},{"cwise/lib/wrapper":111,"ndarray-linear-interpolate":456}],463:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -78021,7 +78228,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":287,"is-buffer":288}],461:[function(require,module,exports){ +},{"iota-array":290,"is-buffer":291}],464:[function(require,module,exports){ "use strict" var doubleBits = require("double-bits") @@ -78064,7 +78271,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":120}],462:[function(require,module,exports){ +},{"double-bits":122}],465:[function(require,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -78189,7 +78396,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],463:[function(require,module,exports){ +},{}],466:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -78281,7 +78488,167 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],464:[function(require,module,exports){ +},{}],467:[function(require,module,exports){ +/** + * @module optical-properties + */ +'use strict' + +module.exports = measure + +var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d') + +canvas.width = 200, canvas.height = 200 + +measure.canvas = canvas + +//returns character [x, y, scale] optical params +function measure (char, options) { + var data, w, h, params + + //figure out argument imageData + if (typeof char === 'string') { + data = getCharImageData(char, options) + w = data.width, h = data.height + } + else if (char instanceof HTMLCanvasElement) { + w = char.width, h = char.height + char = char.getContext('2d') + data = char.getImageData(0, 0, w, h) + } + else if (char instanceof ImageData) { + w = char.width, h = char.height + data = char + } + + params = getOpticalParams(data) + + return params +} + +//draw character in canvas and get it's imagedata +function getCharImageData (char, options) { + if (!options) options = {} + var family = options.family || 'sans-serif' + var w = canvas.width, h = canvas.height + + var size = options.width || options.height || options.size + if (size && size != w) { + w = h = canvas.width = canvas.height = size + } + + var fs = options.fontSize || w/2 + + ctx.fillStyle = '#000' + ctx.fillRect(0, 0, w, h) + + ctx.font = fs + 'px ' + family + ctx.textBaseline = 'middle' + ctx.textAlign = 'center' + ctx.fillStyle = 'white' + ctx.fillText(char, w/2, h/2) + + return ctx.getImageData(0, 0, w, h) +} + + +//walks over imagedata, returns params +function getOpticalParams (data) { + var buf = data.data, w = data.width, h = data.height + + var x, y, r, i, j, sum, xSum, ySum, rowAvg = Array(h), rowAvgX = Array(h), cx, cy, bounds, avg, top = 0, bottom = 0, left = w, right = 0, maxR = 0, rowBounds = Array(h), r2 + + for (y = 0; y < h; y++) { + sum = 0, xSum = 0, j = y*4*w + + bounds = getBounds(buf.subarray(j, j + 4*w), 4) + + if (bounds[0] === bounds[1]) { + continue + } + else { + if (!top) top = y + bottom = y + } + + for (x = bounds[0]; x < bounds[1]; x++) { + i = x*4 + r = buf[j + i] + sum += r + xSum += x*r + } + + rowAvg[y] = sum === 0 ? 0 : sum/w + rowAvgX[y] = sum === 0 ? 0 : xSum/sum + + if (bounds[0] < left) left = bounds[0] + if (bounds[1] > right) right = bounds[1] + + rowBounds[y] = bounds + } + + sum = 0, ySum = 0, xSum = 0 + for (y = 0; y < h; y++) { + avg = rowAvg[y] + if (!avg) continue; + + ySum += avg*y + sum += avg + xSum += rowAvgX[y]*avg + } + + cy = ySum/sum + cx = xSum/sum + + maxR = 0, r2 = 0 + for (y = 0; y < h; y++) { + bounds = rowBounds[y] + if (!bounds) continue + + r2 = Math.max( + dist2(cx - bounds[0], cy - y), + dist2(cx - bounds[1], cy - y) + ) + if (r2 > maxR) { + maxR = r2 + } + } + + return { + center: [cx, cy], + bounds: [left, top, right, bottom+1], + radius: Math.sqrt(maxR) + } +} + +//get [leftId, rightId] pair of bounding values for an array +function getBounds (arr, stride) { + var left = 0, right = arr.length, i = 0 + + if (!stride) stride = 4 + + //find left non-zero value + while (!arr[i] && i < right) { + i+=stride + } + left = i + + //find right non-zero value + i = arr.length + while (!arr[i] && i > left) { + i-=stride + } + right = i + + return [left/stride, right/stride] +} + +function dist2 (x, y) { + return x*x + y*y +} + +},{}],468:[function(require,module,exports){ 'use strict' module.exports = quatFromFrame @@ -78323,7 +78690,7 @@ function quatFromFrame( } return out } -},{}],465:[function(require,module,exports){ +},{}],469:[function(require,module,exports){ 'use strict' module.exports = createOrbitController @@ -78717,7 +79084,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":464,"filtered-vector":129,"gl-mat4/fromQuat":173,"gl-mat4/invert":176,"gl-mat4/lookAt":177}],466:[function(require,module,exports){ +},{"./lib/quatFromFrame":468,"filtered-vector":131,"gl-mat4/fromQuat":176,"gl-mat4/invert":179,"gl-mat4/lookAt":180}],470:[function(require,module,exports){ /*! * pad-left * @@ -78733,7 +79100,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":492}],467:[function(require,module,exports){ +},{"repeat-string":496}],471:[function(require,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -78744,7 +79111,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],468:[function(require,module,exports){ +},{}],472:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -78972,7 +79339,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":479}],469:[function(require,module,exports){ +},{"_process":483}],473:[function(require,module,exports){ 'use strict'; // lightweight Buffer shim for pbf browser build @@ -79133,7 +79500,7 @@ function encodeString(str) { return bytes; } -},{"ieee754":283}],470:[function(require,module,exports){ +},{"ieee754":286}],474:[function(require,module,exports){ (function (global){ 'use strict'; @@ -79559,7 +79926,7 @@ function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pb function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":469}],471:[function(require,module,exports){ +},{"./buffer":473}],475:[function(require,module,exports){ "use strict" module.exports = permutationSign @@ -79611,7 +79978,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":533}],472:[function(require,module,exports){ +},{"typedarray-pool":537}],476:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -79698,7 +80065,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":286,"typedarray-pool":533}],473:[function(require,module,exports){ +},{"invert-permutation":289,"typedarray-pool":537}],477:[function(require,module,exports){ "use strict" module.exports = planarDual @@ -79829,7 +80196,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":96}],474:[function(require,module,exports){ +},{"compare-angle":98}],478:[function(require,module,exports){ 'use strict' module.exports = trimLeaves @@ -79885,7 +80252,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":123}],475:[function(require,module,exports){ +},{"edges-to-adjacency-list":125}],479:[function(require,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -80090,7 +80457,7 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":474,"edges-to-adjacency-list":123,"planar-dual":473,"point-in-big-polygon":477,"robust-sum":505,"two-product":531,"uniq":535}],476:[function(require,module,exports){ +},{"./lib/trim-leaves":478,"edges-to-adjacency-list":125,"planar-dual":477,"point-in-big-polygon":481,"robust-sum":509,"two-product":535,"uniq":539}],480:[function(require,module,exports){ 'use strict'; module.exports = Point; @@ -80223,7 +80590,7 @@ Point.convert = function (a) { return a; }; -},{}],477:[function(require,module,exports){ +},{}],481:[function(require,module,exports){ module.exports = preprocessPolygon var orient = require('robust-orientation')[3] @@ -80375,7 +80742,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":62,"interval-tree-1d":285,"robust-orientation":500,"slab-decomposition":517}],478:[function(require,module,exports){ +},{"binary-search-bounds":64,"interval-tree-1d":288,"robust-orientation":504,"slab-decomposition":521}],482:[function(require,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -80573,7 +80940,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],479:[function(require,module,exports){ +},{}],483:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -80744,6 +81111,10 @@ process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -80755,7 +81126,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],480:[function(require,module,exports){ +},{}],484:[function(require,module,exports){ (function (global){ /*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { @@ -81292,9 +81663,9 @@ process.umask = function() { return 0; }; }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],481:[function(require,module,exports){ +},{}],485:[function(require,module,exports){ module.exports = require('gl-quat/slerp') -},{"gl-quat/slerp":226}],482:[function(require,module,exports){ +},{"gl-quat/slerp":229}],486:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -81380,7 +81751,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],483:[function(require,module,exports){ +},{}],487:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -81467,13 +81838,13 @@ var objectKeys = Object.keys || function (obj) { return res; }; -},{}],484:[function(require,module,exports){ +},{}],488:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); -},{"./decode":482,"./encode":483}],485:[function(require,module,exports){ +},{"./decode":486,"./encode":487}],489:[function(require,module,exports){ 'use strict'; module.exports = partialSort; @@ -81535,7 +81906,7 @@ function defaultCompare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],486:[function(require,module,exports){ +},{}],490:[function(require,module,exports){ 'use strict' var bnadd = require('big-rat/add') @@ -81551,7 +81922,7 @@ function add (a, b) { return r } -},{"big-rat/add":46}],487:[function(require,module,exports){ +},{"big-rat/add":48}],491:[function(require,module,exports){ 'use strict' module.exports = float2rat @@ -81566,7 +81937,7 @@ function float2rat(v) { return result } -},{"big-rat":49}],488:[function(require,module,exports){ +},{"big-rat":51}],492:[function(require,module,exports){ 'use strict' var rat = require('big-rat') @@ -81584,7 +81955,7 @@ function muls(a, x) { return r } -},{"big-rat":49,"big-rat/mul":58}],489:[function(require,module,exports){ +},{"big-rat":51,"big-rat/mul":60}],493:[function(require,module,exports){ 'use strict' var bnsub = require('big-rat/sub') @@ -81600,7 +81971,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":60}],490:[function(require,module,exports){ +},{"big-rat/sub":62}],494:[function(require,module,exports){ 'use strict' var compareCell = require('compare-cell') @@ -81633,7 +82004,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":81,"compare-cell":97,"compare-oriented-cell":98}],491:[function(require,module,exports){ +},{"cell-orientation":83,"compare-cell":99,"compare-oriented-cell":100}],495:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -91138,7 +91509,7 @@ return wrapREGL; }))); -},{}],492:[function(require,module,exports){ +},{}],496:[function(require,module,exports){ /*! * repeat-string * @@ -91210,7 +91581,7 @@ function repeat(str, num) { return res; } -},{}],493:[function(require,module,exports){ +},{}],497:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -91259,7 +91630,7 @@ void (function(root, factory) { })); -},{}],494:[function(require,module,exports){ +},{}],498:[function(require,module,exports){ (function (global){ module.exports = global.performance && @@ -91270,7 +91641,7 @@ module.exports = } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],495:[function(require,module,exports){ +},{}],499:[function(require,module,exports){ "use strict" module.exports = compressExpansion @@ -91305,7 +91676,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],496:[function(require,module,exports){ +},{}],500:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91409,7 +91780,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":495,"robust-scale":502,"robust-sum":505,"two-product":531}],497:[function(require,module,exports){ +},{"robust-compress":499,"robust-scale":506,"robust-sum":509,"two-product":535}],501:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91424,7 +91795,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":505,"two-product":531}],498:[function(require,module,exports){ +},{"robust-sum":509,"two-product":535}],502:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91592,7 +91963,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":502,"robust-subtract":504,"robust-sum":505,"two-product":531}],499:[function(require,module,exports){ +},{"robust-scale":506,"robust-subtract":508,"robust-sum":509,"two-product":535}],503:[function(require,module,exports){ "use strict" var determinant = require("robust-determinant") @@ -91664,7 +92035,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":496}],500:[function(require,module,exports){ +},{"robust-determinant":500}],504:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91855,7 +92226,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":502,"robust-subtract":504,"robust-sum":505,"two-product":531}],501:[function(require,module,exports){ +},{"robust-scale":506,"robust-subtract":508,"robust-sum":509,"two-product":535}],505:[function(require,module,exports){ "use strict" var robustSum = require("robust-sum") @@ -91885,7 +92256,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":502,"robust-sum":505}],502:[function(require,module,exports){ +},{"robust-scale":506,"robust-sum":509}],506:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91936,7 +92307,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":531,"two-sum":532}],503:[function(require,module,exports){ +},{"two-product":535,"two-sum":536}],507:[function(require,module,exports){ "use strict" module.exports = segmentsIntersect @@ -91984,7 +92355,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":500}],504:[function(require,module,exports){ +},{"robust-orientation":504}],508:[function(require,module,exports){ "use strict" module.exports = robustSubtract @@ -92141,7 +92512,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],505:[function(require,module,exports){ +},{}],509:[function(require,module,exports){ "use strict" module.exports = linearExpansionSum @@ -92298,7 +92669,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],506:[function(require,module,exports){ +},{}],510:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -92553,7 +92924,7 @@ Shelf.prototype.resize = function(w) { return ShelfPack; })); -},{}],507:[function(require,module,exports){ +},{}],511:[function(require,module,exports){ "use strict" module.exports = function signum(x) { @@ -92561,7 +92932,7 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],508:[function(require,module,exports){ +},{}],512:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -92573,7 +92944,7 @@ function boundary(cells) { return reduce(bnd(cells)) } -},{"boundary-cells":65,"reduce-simplicial-complex":490}],509:[function(require,module,exports){ +},{"boundary-cells":67,"reduce-simplicial-complex":494}],513:[function(require,module,exports){ 'use strict' module.exports = extractContour @@ -92736,7 +93107,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":510,"ndarray":460,"ndarray-sort":458,"typedarray-pool":533}],510:[function(require,module,exports){ +},{"./lib/codegen":514,"ndarray":463,"ndarray-sort":461,"typedarray-pool":537}],514:[function(require,module,exports){ 'use strict' module.exports = getPolygonizer @@ -92833,7 +93204,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":438,"typedarray-pool":533}],511:[function(require,module,exports){ +},{"marching-simplex-table":441,"typedarray-pool":537}],515:[function(require,module,exports){ "use strict"; "use restrict"; var bits = require("bit-twiddle") @@ -93177,11 +93548,11 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":63,"union-find":534}],512:[function(require,module,exports){ -arguments[4][63][0].apply(exports,arguments) -},{"dup":63}],513:[function(require,module,exports){ -arguments[4][511][0].apply(exports,arguments) -},{"bit-twiddle":512,"dup":511,"union-find":514}],514:[function(require,module,exports){ +},{"bit-twiddle":65,"union-find":538}],516:[function(require,module,exports){ +arguments[4][65][0].apply(exports,arguments) +},{"dup":65}],517:[function(require,module,exports){ +arguments[4][515][0].apply(exports,arguments) +},{"bit-twiddle":516,"dup":515,"union-find":518}],518:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -93238,7 +93609,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],515:[function(require,module,exports){ +},{}],519:[function(require,module,exports){ "use strict" module.exports = simplifyPolygon @@ -93510,7 +93881,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":500,"simplicial-complex":513}],516:[function(require,module,exports){ +},{"robust-orientation":504,"simplicial-complex":517}],520:[function(require,module,exports){ "use strict" module.exports = orderSegments @@ -93606,7 +93977,7 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":500}],517:[function(require,module,exports){ +},{"robust-orientation":504}],521:[function(require,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -93837,7 +94208,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":516,"binary-search-bounds":62,"functional-red-black-tree":131,"robust-orientation":500}],518:[function(require,module,exports){ +},{"./lib/order-segments":520,"binary-search-bounds":64,"functional-red-black-tree":133,"robust-orientation":504}],522:[function(require,module,exports){ "use strict" var robustDot = require("robust-dot-product") @@ -93929,44 +94300,52 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":497,"robust-sum":505}],519:[function(require,module,exports){ -(function(window) { +},{"robust-dot-product":501,"robust-sum":509}],523:[function(require,module,exports){ +/* global window, exports, define */ + +!function() { + 'use strict' + var re = { not_string: /[^s]/, + not_bool: /[^t]/, + not_type: /[^T]/, + not_primitive: /[^v]/, number: /[diefg]/, + numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[\+\-]/ } - function sprintf() { - var key = arguments[0], cache = sprintf.cache - if (!(cache[key] && cache.hasOwnProperty(key))) { - cache[key] = sprintf.parse(key) - } - return sprintf.format.call(null, cache[key], arguments) + function sprintf(key) { + // `arguments` is not an array, but should be fine for this call + return sprintf_format(sprintf_parse(key), arguments) } - sprintf.format = function(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + function vsprintf(fmt, argv) { + return sprintf.apply(null, [fmt].concat(argv || [])) + } + + function sprintf_format(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign for (i = 0; i < tree_length; i++) { - node_type = get_type(parse_tree[i]) - if (node_type === "string") { - output[output.length] = parse_tree[i] + if (typeof parse_tree[i] === 'string') { + output += parse_tree[i] } - else if (node_type === "array") { + else if (Array.isArray(parse_tree[i])) { match = parse_tree[i] // convenience purposes only if (match[2]) { // keyword argument arg = argv[cursor] for (k = 0; k < match[2].length; k++) { if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) } arg = arg[match[2][k]] } @@ -93978,12 +94357,12 @@ function negative(points, plane) { arg = argv[cursor++] } - if (get_type(arg) == "function") { + if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) { arg = arg() } - if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { - throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) { + throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) } if (re.number.test(match[8])) { @@ -93991,96 +94370,113 @@ function negative(points, plane) { } switch (match[8]) { - case "b": - arg = arg.toString(2) - break - case "c": - arg = String.fromCharCode(arg) - break - case "d": - case "i": + case 'b': + arg = parseInt(arg, 10).toString(2) + break + case 'c': + arg = String.fromCharCode(parseInt(arg, 10)) + break + case 'd': + case 'i': arg = parseInt(arg, 10) - break - case "j": + break + case 'j': arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) - break - case "e": - arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() - break - case "f": + break + case 'e': + arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() + break + case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) - break - case "g": - arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) - break - case "o": - arg = arg.toString(8) - break - case "s": - arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) - break - case "u": - arg = arg >>> 0 - break - case "x": - arg = arg.toString(16) - break - case "X": - arg = arg.toString(16).toUpperCase() - break + break + case 'g': + arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg) + break + case 'o': + arg = (parseInt(arg, 10) >>> 0).toString(8) + break + case 's': + arg = String(arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 't': + arg = String(!!arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'T': + arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'u': + arg = parseInt(arg, 10) >>> 0 + break + case 'v': + arg = arg.valueOf() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'x': + arg = (parseInt(arg, 10) >>> 0).toString(16) + break + case 'X': + arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() + break } if (re.json.test(match[8])) { - output[output.length] = arg + output += arg } else { if (re.number.test(match[8]) && (!is_positive || match[3])) { - sign = is_positive ? "+" : "-" - arg = arg.toString().replace(re.sign, "") + sign = is_positive ? '+' : '-' + arg = arg.toString().replace(re.sign, '') } else { - sign = "" + sign = '' } - pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' pad_length = match[6] - (sign + arg).length - pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" - output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' + output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) } } } - return output.join("") + return output } - sprintf.cache = {} + var sprintf_cache = Object.create(null) + + function sprintf_parse(fmt) { + if (sprintf_cache[fmt]) { + return sprintf_cache[fmt] + } - sprintf.parse = function(fmt) { - var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + var _fmt = fmt, match, parse_tree = [], arg_names = 0 while (_fmt) { if ((match = re.text.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = match[0] + parse_tree.push(match[0]) } else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = "%" + parse_tree.push('%') } else if ((match = re.placeholder.exec(_fmt)) !== null) { if (match[2]) { arg_names |= 1 var field_list = [], replacement_field = match[2], field_match = [] if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + field_list.push(field_match[1]) + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } } } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } match[2] = field_list } @@ -94088,58 +94484,43 @@ function negative(points, plane) { arg_names |= 2 } if (arg_names === 3) { - throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') } - parse_tree[parse_tree.length] = match + parse_tree.push(match) } else { - throw new SyntaxError("[sprintf] unexpected placeholder") + throw new SyntaxError('[sprintf] unexpected placeholder') } _fmt = _fmt.substring(match[0].length) } - return parse_tree - } - - var vsprintf = function(fmt, argv, _argv) { - _argv = (argv || []).slice(0) - _argv.splice(0, 0, fmt) - return sprintf.apply(null, _argv) - } - - /** - * helpers - */ - function get_type(variable) { - return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() - } - - function str_repeat(input, multiplier) { - return Array(multiplier + 1).join(input) + return sprintf_cache[fmt] = parse_tree } /** * export to either browser or node.js */ - if (typeof exports !== "undefined") { - exports.sprintf = sprintf - exports.vsprintf = vsprintf + /* eslint-disable quote-props */ + if (typeof exports !== 'undefined') { + exports['sprintf'] = sprintf + exports['vsprintf'] = vsprintf } - else { - window.sprintf = sprintf - window.vsprintf = vsprintf + if (typeof window !== 'undefined') { + window['sprintf'] = sprintf + window['vsprintf'] = vsprintf - if (typeof define === "function" && define.amd) { + if (typeof define === 'function' && define['amd']) { define(function() { return { - sprintf: sprintf, - vsprintf: vsprintf + 'sprintf': sprintf, + 'vsprintf': vsprintf } }) } } -})(typeof window === "undefined" ? this : window); + /* eslint-enable quote-props */ +}() -},{}],520:[function(require,module,exports){ +},{}],524:[function(require,module,exports){ "use strict" module.exports = stronglyConnectedComponents @@ -94255,7 +94636,7 @@ function stronglyConnectedComponents(adjList) { return {components: components, adjacencyList: sccAdjList} } -},{}],521:[function(require,module,exports){ +},{}],525:[function(require,module,exports){ 'use strict'; var kdbush = require('kdbush'); @@ -94589,7 +94970,7 @@ function getY(p) { return p.y; } -},{"kdbush":291}],522:[function(require,module,exports){ +},{"kdbush":294}],526:[function(require,module,exports){ 'use strict' module.exports = toSuperScript @@ -94644,7 +95025,7 @@ function toSuperScript(x) { }).join('') } -},{}],523:[function(require,module,exports){ +},{}],527:[function(require,module,exports){ "use strict" module.exports = surfaceNets @@ -94852,7 +95233,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":449,"triangulate-hypercube":529,"zero-crossings":576}],524:[function(require,module,exports){ +},{"ndarray-extract-contour":452,"triangulate-hypercube":533,"zero-crossings":580}],528:[function(require,module,exports){ (function (process){ 'use strict' @@ -94942,7 +95323,7 @@ function textGet(font, text, opts) { } }).call(this,require('_process')) -},{"_process":479,"vectorize-text":546}],525:[function(require,module,exports){ +},{"_process":483,"vectorize-text":550}],529:[function(require,module,exports){ 'use strict'; module.exports = TinySDF; @@ -95051,7 +95432,7 @@ function edt1d(f, d, v, z, n) { } } -},{}],526:[function(require,module,exports){ +},{}],530:[function(require,module,exports){ // TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -96248,7 +96629,7 @@ else { })(Math); -},{}],527:[function(require,module,exports){ +},{}],531:[function(require,module,exports){ 'use strict' var parseUnit = require('parse-unit') @@ -96309,7 +96690,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":467}],528:[function(require,module,exports){ +},{"parse-unit":471}],532:[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) : @@ -96829,7 +97210,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); }))); -},{}],529:[function(require,module,exports){ +},{}],533:[function(require,module,exports){ "use strict" module.exports = triangulateCube @@ -96863,7 +97244,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":132,"permutation-parity":471,"permutation-rank":472}],530:[function(require,module,exports){ +},{"gamma":134,"permutation-parity":475,"permutation-rank":476}],534:[function(require,module,exports){ 'use strict' module.exports = createTurntableController @@ -97436,7 +97817,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":129,"gl-mat4/invert":176,"gl-mat4/rotate":180,"gl-vec3/cross":267,"gl-vec3/dot":268,"gl-vec3/normalize":271}],531:[function(require,module,exports){ +},{"filtered-vector":131,"gl-mat4/invert":179,"gl-mat4/rotate":183,"gl-vec3/cross":270,"gl-vec3/dot":271,"gl-vec3/normalize":274}],535:[function(require,module,exports){ "use strict" module.exports = twoProduct @@ -97470,7 +97851,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],532:[function(require,module,exports){ +},{}],536:[function(require,module,exports){ "use strict" module.exports = fastTwoSum @@ -97488,7 +97869,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],533:[function(require,module,exports){ +},{}],537:[function(require,module,exports){ (function (global,Buffer){ 'use strict' @@ -97705,7 +98086,7 @@ exports.clearCache = function clearCache() { } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bit-twiddle":63,"buffer":73,"dup":121}],534:[function(require,module,exports){ +},{"bit-twiddle":65,"buffer":75,"dup":123}],538:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -97768,7 +98149,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],535:[function(require,module,exports){ +},{}],539:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -97827,7 +98208,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],536:[function(require,module,exports){ +},{}],540:[function(require,module,exports){ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * @@ -97934,7 +98315,7 @@ UnitBezier.prototype.solve = function(x, epsilon) { return this.sampleCurveY(this.solveCurveX(x, epsilon)); }; -},{}],537:[function(require,module,exports){ +},{}],541:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -98668,7 +99049,7 @@ Url.prototype.parseHost = function() { if (host) this.hostname = host; }; -},{"./util":538,"punycode":480,"querystring":484}],538:[function(require,module,exports){ +},{"./util":542,"punycode":484,"querystring":488}],542:[function(require,module,exports){ 'use strict'; module.exports = { @@ -98686,7 +99067,7 @@ module.exports = { } }; -},{}],539:[function(require,module,exports){ +},{}],543:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -98711,14 +99092,14 @@ if (typeof Object.create === 'function') { } } -},{}],540:[function(require,module,exports){ +},{}],544:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],541:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -99308,12 +99689,12 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":540,"_process":479,"inherits":539}],542:[function(require,module,exports){ +},{"./support/isBuffer":544,"_process":483,"inherits":543}],546:[function(require,module,exports){ module.exports.VectorTile = require('./lib/vectortile.js'); module.exports.VectorTileFeature = require('./lib/vectortilefeature.js'); module.exports.VectorTileLayer = require('./lib/vectortilelayer.js'); -},{"./lib/vectortile.js":543,"./lib/vectortilefeature.js":544,"./lib/vectortilelayer.js":545}],543:[function(require,module,exports){ +},{"./lib/vectortile.js":547,"./lib/vectortilefeature.js":548,"./lib/vectortilelayer.js":549}],547:[function(require,module,exports){ 'use strict'; var VectorTileLayer = require('./vectortilelayer'); @@ -99332,7 +99713,7 @@ function readTile(tag, layers, pbf) { } -},{"./vectortilelayer":545}],544:[function(require,module,exports){ +},{"./vectortilelayer":549}],548:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -99567,7 +99948,7 @@ function signedArea(ring) { return sum; } -},{"point-geometry":476}],545:[function(require,module,exports){ +},{"point-geometry":480}],549:[function(require,module,exports){ 'use strict'; var VectorTileFeature = require('./vectortilefeature.js'); @@ -99630,7 +100011,7 @@ VectorTileLayer.prototype.feature = function(i) { return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values); }; -},{"./vectortilefeature.js":544}],546:[function(require,module,exports){ +},{"./vectortilefeature.js":548}],550:[function(require,module,exports){ "use strict" module.exports = createText @@ -99657,7 +100038,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":547}],547:[function(require,module,exports){ +},{"./lib/vtext":551}],551:[function(require,module,exports){ "use strict" module.exports = vectorizeText @@ -99863,7 +100244,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":75,"clean-pslg":85,"ndarray":460,"planar-graph-to-polyline":475,"simplify-planar-graph":515,"surface-nets":523}],548:[function(require,module,exports){ +},{"cdt2d":77,"clean-pslg":87,"ndarray":463,"planar-graph-to-polyline":479,"simplify-planar-graph":519,"surface-nets":527}],552:[function(require,module,exports){ var Pbf = require('pbf') var vtpb = require('./vector-tile-pb') var GeoJSONWrapper = require('./lib/geojson_wrapper') @@ -100019,7 +100400,7 @@ function wrapValue (value) { return result } -},{"./lib/geojson_wrapper":549,"./vector-tile-pb":550,"pbf":470}],549:[function(require,module,exports){ +},{"./lib/geojson_wrapper":553,"./vector-tile-pb":554,"pbf":474}],553:[function(require,module,exports){ 'use strict' var Point = require('point-geometry') @@ -100087,7 +100468,7 @@ FeatureWrapper.prototype.bbox = function () { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON -},{"point-geometry":476,"vector-tile":542}],550:[function(require,module,exports){ +},{"point-geometry":480,"vector-tile":546}],554:[function(require,module,exports){ 'use strict'; // tile ======================================== @@ -100193,7 +100574,7 @@ function writeLayer(layer, pbf) { if (layer.extent !== undefined) pbf.writeVarintField(5, layer.extent); } -},{}],551:[function(require,module,exports){ +},{}],555:[function(require,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -100880,7 +101261,7 @@ function writeLayer(layer, pbf) { } })(); -},{}],552:[function(require,module,exports){ +},{}],556:[function(require,module,exports){ var hiddenStore = require('./hidden-store.js'); module.exports = createStore; @@ -100901,7 +101282,7 @@ function createStore() { }; } -},{"./hidden-store.js":553}],553:[function(require,module,exports){ +},{"./hidden-store.js":557}],557:[function(require,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -100919,7 +101300,7 @@ function hiddenStore(obj, key) { return store; } -},{}],554:[function(require,module,exports){ +},{}],558:[function(require,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -100950,14 +101331,14 @@ function weakMap() { } } -},{"./create-store.js":552}],555:[function(require,module,exports){ +},{"./create-store.js":556}],559:[function(require,module,exports){ var getContext = require('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":143}],556:[function(require,module,exports){ +},{"get-canvas-context":145}],560:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -101040,12 +101421,12 @@ module.exports = function (fn, options) { return worker; }; -},{}],557:[function(require,module,exports){ +},{}],561:[function(require,module,exports){ module.exports.RADIUS = 6378137; module.exports.FLATTENING = 1/298.257223563; module.exports.POLAR_RADIUS = 6356752.3142; -},{}],558:[function(require,module,exports){ +},{}],562:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -101135,7 +101516,7 @@ exports.getMercCoords = getMercCoords; Object.defineProperty(exports, '__esModule', { value: true }); })); -},{}],559:[function(require,module,exports){ +},{}],563:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -101868,7 +102249,7 @@ function toSolar(yearOrDate, monthOrResult, day, isIntercalaryOrResult, result) } -},{"../main":573,"object-assign":463}],560:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],564:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102052,7 +102433,7 @@ assign(CopticCalendar.prototype, { main.calendars.coptic = CopticCalendar; -},{"../main":573,"object-assign":463}],561:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],565:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102280,7 +102661,7 @@ var centuries = { main.calendars.discworld = DiscworldCalendar; -},{"../main":573,"object-assign":463}],562:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],566:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102464,7 +102845,7 @@ assign(EthiopianCalendar.prototype, { main.calendars.ethiopian = EthiopianCalendar; -},{"../main":573,"object-assign":463}],563:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],567:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102738,7 +103119,7 @@ function mod(a, b) { main.calendars.hebrew = HebrewCalendar; -},{"../main":573,"object-assign":463}],564:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],568:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102919,7 +103300,7 @@ assign(IslamicCalendar.prototype, { main.calendars.islamic = IslamicCalendar; -},{"../main":573,"object-assign":463}],565:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],569:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103102,7 +103483,7 @@ assign(JulianCalendar.prototype, { main.calendars.julian = JulianCalendar; -},{"../main":573,"object-assign":463}],566:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],570:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103397,7 +103778,7 @@ function amod(a, b) { main.calendars.mayan = MayanCalendar; -},{"../main":573,"object-assign":463}],567:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],571:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103577,7 +103958,7 @@ assign(NanakshahiCalendar.prototype, { main.calendars.nanakshahi = NanakshahiCalendar; -},{"../main":573,"object-assign":463}],568:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],572:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104000,7 +104381,7 @@ assign(NepaliCalendar.prototype, { main.calendars.nepali = NepaliCalendar; -},{"../main":573,"object-assign":463}],569:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],573:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104190,7 +104571,7 @@ main.calendars.persian = PersianCalendar; main.calendars.jalali = PersianCalendar; -},{"../main":573,"object-assign":463}],570:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],574:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104376,7 +104757,7 @@ assign(TaiwanCalendar.prototype, { main.calendars.taiwan = TaiwanCalendar; -},{"../main":573,"object-assign":463}],571:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],575:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104562,7 +104943,7 @@ assign(ThaiCalendar.prototype, { main.calendars.thai = ThaiCalendar; -},{"../main":573,"object-assign":463}],572:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],576:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104927,7 +105308,7 @@ var ummalqura_dat = [ 79990]; -},{"../main":573,"object-assign":463}],573:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],577:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -105832,7 +106213,7 @@ _exports.baseCalendar = BaseCalendar; _exports.calendars.gregorian = GregorianCalendar; -},{"object-assign":463}],574:[function(require,module,exports){ +},{"object-assign":466}],578:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -106334,7 +106715,7 @@ assign(main.baseCalendar.prototype, { }); -},{"./main":573,"object-assign":463}],575:[function(require,module,exports){ +},{"./main":577,"object-assign":466}],579:[function(require,module,exports){ module.exports = require('cwise-compiler')({ args: ['array', { offset: [1], @@ -106386,7 +106767,7 @@ module.exports = require('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":106}],576:[function(require,module,exports){ +},{"cwise-compiler":108}],580:[function(require,module,exports){ "use strict" module.exports = findZeroCrossings @@ -106399,7 +106780,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":575}],577:[function(require,module,exports){ +},{"./lib/zc-core":579}],581:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -106412,9 +106793,8 @@ function findZeroCrossings(array, level) { 'use strict'; var Lib = require('../../lib'); -var Color = require('../color'); var Axes = require('../../plots/cartesian/axes'); - +var handleAnnotationCommonDefaults = require('./common_defaults'); var attributes = require('./attributes'); @@ -106431,26 +106811,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op if(!(visible || clickToShow)) return annOut; - coerce('opacity'); - var bgColor = coerce('bgcolor'); - - var borderColor = coerce('bordercolor'), - borderOpacity = Color.opacity(borderColor); - - coerce('borderpad'); - - var borderWidth = coerce('borderwidth'); - var showArrow = coerce('showarrow'); - - coerce('text', showArrow ? ' ' : 'new text'); - coerce('textangle'); - Lib.coerceFont(coerce, 'font', fullLayout.font); + handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); - coerce('width'); - coerce('align'); - - var h = coerce('height'); - if(h) coerce('valign'); + var showArrow = annOut.showarrow; // positioning var axLetters = ['x', 'y'], @@ -106492,14 +106855,8 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + // if you have one part of arrow length you should have both if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('standoff'); - - // if you have one part of arrow length you should have both Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); } @@ -106509,34 +106866,18 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // put the actual click data to bind to into private attributes // so we don't have to do this little bit of logic on every hover event - annOut._xclick = (xClick === undefined) ? annOut.x : xClick; - annOut._yclick = (yClick === undefined) ? annOut.y : yClick; + annOut._xclick = (xClick === undefined) ? + annOut.x : + Axes.cleanPosition(xClick, gdMock, annOut.xref); + annOut._yclick = (yClick === undefined) ? + annOut.y : + Axes.cleanPosition(yClick, gdMock, annOut.yref); } - var hoverText = coerce('hovertext'); - var globalHoverLabel = fullLayout.hoverlabel || {}; - - if(hoverText) { - var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || - (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) - ); - - var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || - Color.contrast(hoverBG) - ); - - Lib.coerceFont(coerce, 'hoverlabel.font', { - family: globalHoverLabel.font.family, - size: globalHoverLabel.font.size, - color: globalHoverLabel.font.color || hoverBorder - }); - } - coerce('captureevents', !!hoverText); - return annOut; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../color":590,"./attributes":579}],578:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./attributes":583,"./common_defaults":586}],582:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -106601,7 +106942,7 @@ module.exports = [ } ]; -},{}],579:[function(require,module,exports){ +},{}],583:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107061,7 +107402,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/cartesian/constants":753,"../../plots/font_attributes":772,"./arrow_paths":578}],580:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/constants":765,"../../plots/font_attributes":784,"./arrow_paths":582}],584:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107164,7 +107505,7 @@ function annAutorange(gd) { }); } -},{"../../lib":709,"../../plots/cartesian/axes":748,"./draw":584}],581:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./draw":589}],585:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107250,18 +107591,22 @@ function getToggleSets(gd, hoverData) { explicitOffSet = [], hoverLen = (hoverData || []).length; - var i, j, anni, showMode, pointj, toggleType; + var i, j, anni, showMode, pointj, xa, ya, toggleType; for(i = 0; i < annotations.length; i++) { anni = annotations[i]; showMode = anni.clicktoshow; + if(showMode) { for(j = 0; j < hoverLen; j++) { pointj = hoverData[j]; - if(pointj.xaxis._id === anni.xref && - pointj.yaxis._id === anni.yref && - pointj.xaxis.d2r(pointj.x) === anni._xclick && - pointj.yaxis.d2r(pointj.y) === anni._yclick + xa = pointj.xaxis; + ya = pointj.yaxis; + + if(xa._id === anni.xref && + ya._id === anni.yref && + xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && + ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) ) { // match! toggle this annotation // regardless of its clicktoshow mode @@ -107289,7 +107634,80 @@ function getToggleSets(gd, hoverData) { return {on: onSet, off: offSet, explicitOff: explicitOffSet}; } -},{"../../plotly":743}],582:[function(require,module,exports){ +// to handle log axes until v2 +function clickData2r(d, ax) { + return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); +} + +},{"../../plotly":755}],586:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Color = require('../color'); + +// defaults common to 'annotations' and 'annotations3d' +module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { + coerce('opacity'); + var bgColor = coerce('bgcolor'); + + var borderColor = coerce('bordercolor'); + var borderOpacity = Color.opacity(borderColor); + + coerce('borderpad'); + + var borderWidth = coerce('borderwidth'); + var showArrow = coerce('showarrow'); + + coerce('text', showArrow ? ' ' : 'new text'); + coerce('textangle'); + Lib.coerceFont(coerce, 'font', fullLayout.font); + + coerce('width'); + coerce('align'); + + var h = coerce('height'); + if(h) coerce('valign'); + + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + coerce('standoff'); + + } + + var hoverText = coerce('hovertext'); + var globalHoverLabel = fullLayout.hoverlabel || {}; + + if(hoverText) { + var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || + (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) + ); + + var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || + Color.contrast(hoverBG) + ); + + Lib.coerceFont(coerce, 'hoverlabel.font', { + family: globalHoverLabel.font.family, + size: globalHoverLabel.font.size, + color: globalHoverLabel.font.color || hoverBorder + }); + } + + coerce('captureevents', !!hoverText); +}; + +},{"../../lib":721,"../color":600}],587:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107352,7 +107770,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":729,"fast-isnumeric":127}],583:[function(require,module,exports){ +},{"../../lib/to_log_range":741,"fast-isnumeric":129}],588:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107377,7 +107795,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":745,"./annotation_defaults":577}],584:[function(require,module,exports){ +},{"../../plots/array_container_defaults":757,"./annotation_defaults":581}],589:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107416,7 +107834,8 @@ var drawArrowHead = require('./draw_arrow_head'); module.exports = { draw: draw, - drawOne: drawOne + drawOne: drawOne, + drawRaw: drawRaw }; /* @@ -107437,37 +107856,61 @@ function draw(gd) { } /* - * drawOne: draw a single annotation, potentially with modifications + * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications * * index (int): the annotation to draw */ function drawOne(gd, index) { - var layout = gd.layout, - fullLayout = gd._fullLayout, - gs = gd._fullLayout._size; + var fullLayout = gd._fullLayout; + var options = fullLayout.annotations[index] || {}; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); - // remove the existing annotation if there is one - fullLayout._infolayer.selectAll('.annotation[data-index="' + index + '"]').remove(); + drawRaw(gd, options, index, false, xa, ya); +} - // remember a few things about what was already there, - var optionsIn = (layout.annotations || [])[index], - options = fullLayout.annotations[index]; +/** + * drawRaw: draw a single annotation, potentially with modifications + * + * @param {DOM element} gd + * @param {object} options : this annotation's fullLayout options + * @param {integer} index : index in 'annotations' container of the annotation to draw + * @param {string} subplotId : id of the annotation's subplot + * - use false for 2d (i.e. cartesian or paper-ref) annotations + * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px + * @param {object | undefined} ya : ... y-axis + */ +function drawRaw(gd, options, index, subplotId, xa, ya) { + var fullLayout = gd._fullLayout; + var gs = gd._fullLayout._size; + var className; + var annbase; + + if(subplotId) { + className = 'annotation-' + subplotId; + annbase = subplotId + '.annotations[' + index + ']'; + } else { + className = 'annotation'; + annbase = 'annotations[' + index + ']'; + } + + // remove the existing annotation if there is one + fullLayout._infolayer + .selectAll('.' + className + '[data-index="' + index + '"]') + .remove(); var annClipID = 'clip' + fullLayout._uid + '_ann' + index; // this annotation is gone - quit now after deleting it // TODO: use d3 idioms instead of deleting and redrawing every time - if(!optionsIn || options.visible === false) { + if(!options._input || options.visible === false) { d3.selectAll('#' + annClipID).remove(); return; } - var xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - - // calculated pixel positions - // x & y each will get text, head, and tail as appropriate - annPosPx = {x: {}, y: {}}, + // calculated pixel positions + // x & y each will get text, head, and tail as appropriate + var annPosPx = {x: {}, y: {}}, textangle = +options.textangle || 0; // create the components @@ -107475,26 +107918,32 @@ function drawOne(gd, index) { // with border/arrow together this could handle a whole bunch of // cleanup at this point, but works for now var annGroup = fullLayout._infolayer.append('g') - .classed('annotation', true) + .classed(className, true) .attr('data-index', String(index)) .style('opacity', options.opacity); // another group for text+background so that they can rotate together var annTextGroup = annGroup.append('g') - .classed('annotation-text-g', true) - .attr('data-index', String(index)); + .classed('annotation-text-g', true); var annTextGroupInner = annTextGroup.append('g') .style('pointer-events', options.captureevents ? 'all' : null) .call(setCursor, 'default') .on('click', function() { gd._dragging = false; - gd.emit('plotly_clickannotation', { + + var eventData = { index: index, - annotation: optionsIn, + annotation: options._input, fullAnnotation: options, event: d3.event - }); + }; + + if(subplotId) { + eventData.subplotId = subplotId; + } + + gd.emit('plotly_clickannotation', eventData); }); if(options.hovertext) { @@ -107517,7 +107966,8 @@ function drawOne(gd, index) { fontColor: hoverFont.color }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); }) .on('mouseout', function() { @@ -107550,8 +108000,7 @@ function drawOne(gd, index) { var font = options.font; var annText = annTextGroupInner.append('text') - .classed('annotation', true) - .attr('data-unformatted', options.text) + .classed('annotation-text', true) .text(options.text); function textLayout(s) { @@ -107563,29 +108012,24 @@ function drawOne(gd, index) { }[options.align] || 'middle' }); - svgTextUtils.convertToTspans(s, drawGraphicalElements); + svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); return s; } function drawGraphicalElements() { // if the text has *only* a link, make the whole box into a link - var anchor = annText.selectAll('a'); - if(anchor.size() === 1 && anchor.text() === annText.text()) { + var anchor3 = annText.selectAll('a'); + if(anchor3.size() === 1 && anchor3.text() === annText.text()) { var wholeLink = annTextGroupInner.insert('a', ':first-child').attr({ - 'xlink:xlink:href': anchor.attr('xlink:href'), - 'xlink:xlink:show': anchor.attr('xlink:show') + 'xlink:xlink:href': anchor3.attr('xlink:href'), + 'xlink:xlink:show': anchor3.attr('xlink:show') }) .style({cursor: 'pointer'}); wholeLink.node().appendChild(annTextBG.node()); } - - // make sure lines are aligned the way they will be - // at the end, even if their position changes - annText.selectAll('tspan.line').attr({y: 0, x: 0}); - - var mathjaxGroup = annTextGroupInner.select('.annotation-math-group'); + var mathjaxGroup = annTextGroupInner.select('.annotation-text-math-group'); var hasMathjax = !mathjaxGroup.empty(); var anntextBB = Drawing.bBox( (hasMathjax ? mathjaxGroup : annText).node()); @@ -107618,10 +108062,13 @@ function drawOne(gd, index) { } var annotationIsOffscreen = false; - ['x', 'y'].forEach(function(axLetter) { - var axRef = options[axLetter + 'ref'] || axLetter, + var letters = ['x', 'y']; + + for(var i = 0; i < letters.length; i++) { + var axLetter = letters[i], + axRef = options[axLetter + 'ref'] || axLetter, tailRef = options['a' + axLetter + 'ref'], - ax = Axes.getFromId(gd, axRef), + ax = {x: xa, y: ya}[axLetter], dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, // note that these two can be either positive or negative annSizeFromWidth = outerWidth * Math.cos(dimAngle), @@ -107661,7 +108108,7 @@ function drawOne(gd, index) { annotationIsOffscreen = true; } - if(annotationIsOffscreen) return; + if(annotationIsOffscreen) continue; } basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; @@ -107743,7 +108190,7 @@ function drawOne(gd, index) { // size/shift are used during dragging options['_' + axLetter + 'size'] = annSize; options['_' + axLetter + 'shift'] = textShift; - }); + } if(annotationIsOffscreen) { annTextGroupInner.remove(); @@ -107768,14 +108215,11 @@ function drawOne(gd, index) { .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } else { - var texty = borderfull + yShift - anntextBB.top, - textx = borderfull + xShift - anntextBB.left; - annText.attr({ - x: textx, - y: texty - }) - .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); - annText.selectAll('tspan.line').attr({y: texty, x: textx}); + var texty = borderfull + yShift - anntextBB.top; + var textx = borderfull + xShift - anntextBB.left; + + annText.call(svgTextUtils.positionText, textx, texty) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } annTextClip.select('rect').call(Drawing.setRect, borderfull, borderfull, @@ -107797,8 +108241,6 @@ function drawOne(gd, index) { annTextGroup.attr({transform: 'rotate(' + textangle + ',' + annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - var annbase = 'annotations[' + index + ']'; - /* * add the arrow * uses options[arrowwidth,arrowcolor,arrowhead] for styling @@ -107806,8 +108248,8 @@ function drawOne(gd, index) { * while the head stays put, dx and dy are the pixel offsets */ var drawArrow = function(dx, dy) { - d3.select(gd) - .selectAll('.annotation-arrow-g[data-index="' + index + '"]') + annGroup + .selectAll('.annotation-arrow-g') .remove(); var headX = annPosPx.x.head, @@ -107864,8 +108306,7 @@ function drawOne(gd, index) { var arrowGroup = annGroup.append('g') .style({opacity: Color.opacity(arrowColor)}) - .classed('annotation-arrow-g', true) - .attr('data-index', String(index)); + .classed('annotation-arrow-g', true); var arrow = arrowGroup.append('path') .attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) @@ -107876,7 +108317,7 @@ function drawOne(gd, index) { // the arrow dragger is a small square right at the head, then a line to the tail, // all expanded by a stroke width of 6px plus the arrow line width - if(gd._context.editable && arrow.node().parentNode) { + if(gd._context.editable && arrow.node().parentNode && !subplotId) { var arrowDragHeadX = headX; var arrowDragHeadY = headY; if(options.standoff) { @@ -107885,10 +108326,9 @@ function drawOne(gd, index) { arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; } var arrowDrag = arrowGroup.append('path') - .classed('annotation', true) + .classed('annotation-arrow', true) .classed('anndrag', true) .attr({ - 'data-index': String(index), d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' }) @@ -107904,6 +108344,7 @@ function drawOne(gd, index) { // (head/tail/text) all together dragElement.init({ element: arrowDrag.node(), + gd: gd, prepFn: function() { var pos = Drawing.getTranslate(annTextGroupInner); @@ -107966,6 +108407,7 @@ function drawOne(gd, index) { // textbox and tail, leave the head untouched dragElement.init({ element: annTextGroupInner.node(), + gd: gd, prepFn: function() { baseTextTransform = annTextGroup.attr('transform'); update = {}; @@ -107987,7 +108429,7 @@ function drawOne(gd, index) { drawArrow(dx, dy); } - else { + else if(!subplotId) { if(xa) update[annbase + '.x'] = options.x + dx / xa._m; else { var widthFraction = options._xsize / gs.w, @@ -108015,6 +108457,7 @@ function drawOne(gd, index) { ); } } + else return; annTextGroup.attr({ transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform @@ -108035,20 +108478,22 @@ function drawOne(gd, index) { } if(gd._context.editable) { - annText.call(svgTextUtils.makeEditable, annTextGroupInner) + annText.call(svgTextUtils.makeEditable, {delegate: annTextGroupInner, gd: gd}) .call(textLayout) .on('edit', function(_text) { options.text = _text; - this.attr({'data-unformatted': options.text}); this.call(textLayout); + var update = {}; - update['annotations[' + index + '].text'] = options.text; + update[annbase + '.text'] = options.text; + if(xa && xa.autorange) { update[xa._name + '.autorange'] = true; } if(ya && ya.autorange) { update[ya._name + '.autorange'] = true; } + Plotly.relayout(gd, update); }); } @@ -108076,7 +108521,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":709,"../../lib/setcursor":724,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../color":590,"../dragelement":611,"../drawing":614,"../fx":631,"./draw_arrow_head":585,"d3":118}],585:[function(require,module,exports){ +},{"../../lib":721,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../color":600,"../dragelement":621,"../drawing":624,"../fx":641,"./draw_arrow_head":590,"d3":120}],590:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108190,7 +108635,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { function drawhead(p, rot) { if(!headStyle.path) return; if(style > 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -108210,7 +108655,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":590,"../drawing":614,"./arrow_paths":578,"d3":118,"fast-isnumeric":127}],586:[function(require,module,exports){ +},{"../color":600,"../drawing":624,"./arrow_paths":582,"d3":120,"fast-isnumeric":129}],591:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108235,6 +108680,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -108242,7 +108688,324 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":579,"./calc_autorange":580,"./click":581,"./convert_coords":582,"./defaults":583,"./draw":584}],587:[function(require,module,exports){ +},{"./attributes":583,"./calc_autorange":584,"./click":585,"./convert_coords":587,"./defaults":588,"./draw":589}],592:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + role: 'info', + description: [ + 'Sets the annotation\'s x position.' + ].join(' ') + }, + y: { + valType: 'any', + role: 'info', + description: [ + 'Sets the annotation\'s y position.' + ].join(' ') + }, + z: { + valType: 'any', + role: 'info', + description: [ + 'Sets the annotation\'s z position.' + ].join(' ') + }, + ax: { + valType: 'number', + role: 'info', + description: [ + 'Sets the x component of the arrow tail about the arrow head (in pixels).' + ].join(' ') + }, + ay: { + valType: 'number', + role: 'info', + description: [ + 'Sets the y component of the arrow tail about the arrow head (in pixels).' + ].join(' ') + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":583}],593:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":721,"../../plots/cartesian/axes":760}],594:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":721,"../../plots/array_container_defaults":757,"../../plots/cartesian/axes":760,"../annotations/common_defaults":586,"./attributes":592}],595:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":812,"../annotations/draw":589}],596:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":592,"./convert":593,"./defaults":594,"./draw":595}],597:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108275,7 +109038,7 @@ require('world-calendars/dist/calendars/taiwan'); require('world-calendars/dist/calendars/thai'); require('world-calendars/dist/calendars/ummalqura'); -},{"world-calendars/dist/calendars/chinese":559,"world-calendars/dist/calendars/coptic":560,"world-calendars/dist/calendars/discworld":561,"world-calendars/dist/calendars/ethiopian":562,"world-calendars/dist/calendars/hebrew":563,"world-calendars/dist/calendars/islamic":564,"world-calendars/dist/calendars/julian":565,"world-calendars/dist/calendars/mayan":566,"world-calendars/dist/calendars/nanakshahi":567,"world-calendars/dist/calendars/nepali":568,"world-calendars/dist/calendars/persian":569,"world-calendars/dist/calendars/taiwan":570,"world-calendars/dist/calendars/thai":571,"world-calendars/dist/calendars/ummalqura":572,"world-calendars/dist/main":573,"world-calendars/dist/plus":574}],588:[function(require,module,exports){ +},{"world-calendars/dist/calendars/chinese":563,"world-calendars/dist/calendars/coptic":564,"world-calendars/dist/calendars/discworld":565,"world-calendars/dist/calendars/ethiopian":566,"world-calendars/dist/calendars/hebrew":567,"world-calendars/dist/calendars/islamic":568,"world-calendars/dist/calendars/julian":569,"world-calendars/dist/calendars/mayan":570,"world-calendars/dist/calendars/nanakshahi":571,"world-calendars/dist/calendars/nepali":572,"world-calendars/dist/calendars/persian":573,"world-calendars/dist/calendars/taiwan":574,"world-calendars/dist/calendars/thai":575,"world-calendars/dist/calendars/ummalqura":576,"world-calendars/dist/main":577,"world-calendars/dist/plus":578}],598:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108534,7 +109297,7 @@ module.exports = { worldCalFmt: worldCalFmt }; -},{"../../constants/numerical":690,"../../lib":709,"./calendars":587}],589:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"./calendars":597}],599:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108574,7 +109337,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],590:[function(require,module,exports){ +},{}],600:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108745,7 +109508,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":589,"fast-isnumeric":127,"tinycolor2":526}],591:[function(require,module,exports){ +},{"./attributes":599,"fast-isnumeric":129,"tinycolor2":530}],601:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108941,7 +109704,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/cartesian/layout_attributes":759,"../../plots/font_attributes":772}],592:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/layout_attributes":771,"../../plots/font_attributes":784}],602:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109008,7 +109771,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":709,"../../plots/cartesian/tick_label_defaults":766,"../../plots/cartesian/tick_mark_defaults":767,"../../plots/cartesian/tick_value_defaults":768,"./attributes":591}],593:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/tick_label_defaults":778,"../../plots/cartesian/tick_mark_defaults":779,"../../plots/cartesian/tick_value_defaults":780,"./attributes":601}],603:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109034,6 +109797,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -109307,7 +110072,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -109319,8 +110084,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -109333,8 +110097,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -109567,6 +110330,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -109641,7 +110405,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":709,"../../lib/extend":701,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_defaults":750,"../../plots/cartesian/layout_attributes":759,"../../plots/cartesian/position_defaults":762,"../../plots/plots":811,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"../titles":679,"./attributes":591,"d3":118,"tinycolor2":526}],594:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib":721,"../../lib/extend":713,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_defaults":762,"../../plots/cartesian/layout_attributes":771,"../../plots/cartesian/position_defaults":774,"../../plots/plots":823,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"../titles":689,"./attributes":601,"d3":120,"tinycolor2":530}],604:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109660,7 +110424,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":709}],595:[function(require,module,exports){ +},{"../../lib":721}],605:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109733,7 +110497,7 @@ module.exports = { } }; -},{}],596:[function(require,module,exports){ +},{}],606:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109812,7 +110576,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":709,"./flip_scale":601,"./scales":608}],597:[function(require,module,exports){ +},{"../../lib":721,"./flip_scale":611,"./scales":618}],607:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109902,7 +110666,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":701,"./attributes":595,"./scales.js":608}],598:[function(require,module,exports){ +},{"../../lib/extend":713,"./attributes":605,"./scales.js":618}],608:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109918,7 +110682,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":608}],599:[function(require,module,exports){ +},{"./scales":618}],609:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109982,7 +110746,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":709,"../colorbar/defaults":592,"../colorbar/has_colorbar":594,"./flip_scale":601,"./is_valid_scale":605,"fast-isnumeric":127}],600:[function(require,module,exports){ +},{"../../lib":721,"../colorbar/defaults":602,"../colorbar/has_colorbar":604,"./flip_scale":611,"./is_valid_scale":615,"fast-isnumeric":129}],610:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110019,7 +110783,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],601:[function(require,module,exports){ +},{}],611:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110044,7 +110808,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],602:[function(require,module,exports){ +},{}],612:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110084,7 +110848,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":598,"./is_valid_scale_array":606,"./scales":608}],603:[function(require,module,exports){ +},{"./default_scale":608,"./is_valid_scale_array":616,"./scales":618}],613:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110130,7 +110894,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":709,"./is_valid_scale":605,"fast-isnumeric":127}],604:[function(require,module,exports){ +},{"../../lib":721,"./is_valid_scale":615,"fast-isnumeric":129}],614:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110164,7 +110928,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":595,"./calc":596,"./default_scale":598,"./defaults":599,"./extract_scale":600,"./flip_scale":601,"./get_scale":602,"./has_colorscale":603,"./is_valid_scale":605,"./make_color_scale_func":607,"./scales":608}],605:[function(require,module,exports){ +},{"./attributes":605,"./calc":606,"./default_scale":608,"./defaults":609,"./extract_scale":610,"./flip_scale":611,"./get_scale":612,"./has_colorscale":613,"./is_valid_scale":615,"./make_color_scale_func":617,"./scales":618}],615:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110185,7 +110949,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":606,"./scales":608}],606:[function(require,module,exports){ +},{"./is_valid_scale_array":616,"./scales":618}],616:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110222,7 +110986,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":526}],607:[function(require,module,exports){ +},{"tinycolor2":530}],617:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110318,7 +111082,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":590,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],608:[function(require,module,exports){ +},{"../color":600,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],618:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110449,7 +111213,7 @@ module.exports = { ] }; -},{}],609:[function(require,module,exports){ +},{}],619:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110482,7 +111246,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],610:[function(require,module,exports){ +},{}],620:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110520,7 +111284,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":709}],611:[function(require,module,exports){ +},{"../../lib":721}],621:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110549,6 +111313,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -110567,28 +111340,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -110639,10 +111404,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -110689,10 +111450,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -110722,7 +111479,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":689,"../../lib":709,"../../plotly":743,"../../plots/cartesian/constants":753,"./align":609,"./cursor":610,"./unhover":612}],612:[function(require,module,exports){ +},{"../../constants/interactions":701,"../../lib":721,"../../plotly":755,"../../plots/cartesian/constants":765,"./align":619,"./cursor":620,"./unhover":622}],622:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110778,7 +111535,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":700}],613:[function(require,module,exports){ +},{"../../lib/events":712}],623:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110806,7 +111563,7 @@ exports.dash = { ].join(' ') }; -},{}],614:[function(require,module,exports){ +},{}],624:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110829,6 +111586,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -110850,13 +111610,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -110865,7 +111631,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -110880,7 +111646,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -110966,6 +111731,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -111192,7 +111967,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -111200,7 +111975,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -111221,9 +111995,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -111254,21 +112027,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -111407,34 +112175,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -111455,18 +112276,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -111621,17 +112453,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":692,"../../lib":709,"../../lib/svg_text_utils":728,"../../registry":826,"../../traces/scatter/make_bubble_size_func":1023,"../../traces/scatter/subtypes":1028,"../color":590,"../colorscale":604,"./symbol_defs":615,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],615:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../constants/xmlns_namespaces":704,"../../lib":721,"../../lib/svg_text_utils":740,"../../registry":838,"../../traces/scatter/make_bubble_size_func":1037,"../../traces/scatter/subtypes":1042,"../color":600,"../colorscale":614,"./symbol_defs":625,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],625:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112107,7 +112929,7 @@ module.exports = { } }; -},{"d3":118}],616:[function(require,module,exports){ +},{"d3":120}],626:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112249,7 +113071,7 @@ module.exports = { } }; -},{}],617:[function(require,module,exports){ +},{}],627:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112312,7 +113134,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":748,"../../registry":826,"./compute_error":618,"fast-isnumeric":127}],618:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../../registry":838,"./compute_error":628,"fast-isnumeric":129}],628:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112408,7 +113230,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],619:[function(require,module,exports){ +},{}],629:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112485,7 +113307,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":709,"../../registry":826,"./attributes":616,"fast-isnumeric":127}],620:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838,"./attributes":626,"fast-isnumeric":129}],630:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112544,7 +113366,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":616,"./calc":617,"./defaults":619,"./plot":621,"./style":622}],621:[function(require,module,exports){ +},{"./attributes":626,"./calc":627,"./defaults":629,"./plot":631,"./style":632}],631:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112708,7 +113530,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":1028,"d3":118,"fast-isnumeric":127}],622:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":1042,"d3":120,"fast-isnumeric":129}],632:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112745,7 +113567,7 @@ module.exports = function style(traces) { }); }; -},{"../color":590,"d3":118}],623:[function(require,module,exports){ +},{"../color":600,"d3":120}],633:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112785,7 +113607,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772}],624:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784}],634:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112801,30 +113623,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; + + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":709,"../../registry":826}],625:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838}],635:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112836,10 +113674,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -112853,7 +113700,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":826}],626:[function(require,module,exports){ +},{"../../registry":838,"./hover":639}],636:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112885,7 +113732,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],627:[function(require,module,exports){ +},{}],637:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112908,7 +113755,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":709,"./attributes":623,"./hoverlabel_defaults":630}],628:[function(require,module,exports){ +},{"../../lib":721,"./attributes":633,"./hoverlabel_defaults":640}],638:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112919,6 +113766,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -112995,7 +113843,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":626}],629:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":721,"./constants":636}],639:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -113064,7 +113938,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -113076,13 +113950,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -113159,15 +114033,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -113352,11 +114226,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -113455,6 +114329,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -113488,7 +114363,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -113502,7 +114377,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -113521,7 +114396,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -113556,7 +114431,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -113593,23 +114468,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -113625,14 +114493,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -113722,7 +114585,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -113738,12 +114603,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -113755,11 +114618,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -114027,17 +114888,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -114054,6 +114910,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -114121,7 +115001,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -114131,29 +115011,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -114305,7 +115162,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":709,"../../lib/events":700,"../../lib/override_cursor":718,"../../lib/svg_text_utils":728,"../../plots/cartesian/axes":748,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"./constants":626,"./helpers":628,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],630:[function(require,module,exports){ +},{"../../lib":721,"../../lib/events":712,"../../lib/override_cursor":730,"../../lib/svg_text_utils":740,"../../plots/cartesian/axes":760,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"./constants":636,"./helpers":638,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],640:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114326,7 +115183,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":709}],631:[function(require,module,exports){ +},{"../../lib":721}],641:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114364,7 +115221,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -114386,23 +115246,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":709,"../dragelement":611,"./attributes":623,"./calc":624,"./click":625,"./constants":626,"./defaults":627,"./helpers":628,"./hover":629,"./layout_attributes":632,"./layout_defaults":633,"./layout_global_defaults":634,"d3":118}],632:[function(require,module,exports){ +},{"../../lib":721,"../dragelement":621,"./attributes":633,"./calc":634,"./click":635,"./constants":636,"./defaults":637,"./helpers":638,"./hover":639,"./layout_attributes":642,"./layout_defaults":643,"./layout_global_defaults":644,"d3":120}],642:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114464,7 +115322,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"./constants":626}],633:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"./constants":636}],643:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114512,7 +115370,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":709,"./layout_attributes":632}],634:[function(require,module,exports){ +},{"../../lib":721,"./layout_attributes":642}],644:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114535,7 +115393,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":709,"./hoverlabel_defaults":630,"./layout_attributes":632}],635:[function(require,module,exports){ +},{"../../lib":721,"./hoverlabel_defaults":640,"./layout_attributes":642}],645:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114704,7 +115562,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":753}],636:[function(require,module,exports){ +},{"../../plots/cartesian/constants":765}],646:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114787,7 +115645,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":729,"fast-isnumeric":127}],637:[function(require,module,exports){ +},{"../../lib/to_log_range":741,"fast-isnumeric":129}],647:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114848,7 +115706,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":709,"../../plots/array_container_defaults":745,"../../plots/cartesian/axes":748,"./attributes":635}],638:[function(require,module,exports){ +},{"../../lib":721,"../../plots/array_container_defaults":757,"../../plots/cartesian/axes":760,"./attributes":645}],648:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115069,7 +115927,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":692,"../../plots/cartesian/axes":748,"../drawing":614,"d3":118}],639:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../../plots/cartesian/axes":760,"../drawing":624,"d3":120}],649:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115092,7 +115950,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":635,"./convert_coords":636,"./defaults":637,"./draw":638}],640:[function(require,module,exports){ +},{"./attributes":645,"./convert_coords":646,"./defaults":647,"./draw":648}],650:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115141,7 +115999,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],641:[function(require,module,exports){ +},{}],651:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115256,7 +116114,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"../color/attributes":589}],642:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"../color/attributes":599}],652:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115274,7 +116132,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],643:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115367,7 +116225,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":709,"../../plots/layout_attributes":802,"../../registry":826,"./attributes":641,"./helpers":646}],644:[function(require,module,exports){ +},{"../../lib":721,"../../plots/layout_attributes":814,"../../registry":838,"./attributes":651,"./helpers":656}],654:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115392,6 +116250,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -115481,7 +116341,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -115687,6 +116547,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -115738,30 +116599,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -115926,20 +116781,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -115947,18 +116803,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -116193,7 +117050,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":689,"../../lib":709,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/plots":811,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"./anchor_utils":640,"./constants":642,"./get_legend_data":645,"./helpers":646,"./style":648,"d3":118}],645:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../constants/interactions":701,"../../lib":721,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/plots":823,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"./anchor_utils":650,"./constants":652,"./get_legend_data":655,"./helpers":656,"./style":658,"d3":120}],655:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116298,7 +117155,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":826,"./helpers":646}],646:[function(require,module,exports){ +},{"../../registry":838,"./helpers":656}],656:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116329,7 +117186,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":826}],647:[function(require,module,exports){ +},{"../../registry":838}],657:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116353,7 +117210,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":641,"./defaults":643,"./draw":644,"./style":648}],648:[function(require,module,exports){ +},{"./attributes":651,"./defaults":653,"./draw":654,"./style":658}],658:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116376,7 +117233,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -116414,179 +117271,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } -},{"../../lib":709,"../../registry":826,"../../traces/pie/style_one":994,"../../traces/scatter/subtypes":1028,"../color":590,"../drawing":614,"d3":118}],649:[function(require,module,exports){ + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; + +},{"../../lib":721,"../../registry":838,"../../traces/pie/style_one":1008,"../../traces/scatter/subtypes":1042,"../color":600,"../drawing":624,"d3":120}],659:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117164,7 +118021,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":709,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../../snapshot/download":828}],650:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":721,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../../snapshot/download":840}],660:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117178,7 +118035,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":651}],651:[function(require,module,exports){ +},{"./manage":661}],661:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117302,7 +118159,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -117354,7 +118211,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -117406,7 +118263,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":748,"../../traces/scatter/subtypes":1028,"./buttons":649,"./modebar":652}],652:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../../traces/scatter/subtypes":1042,"./buttons":659,"./modebar":662}],662:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117700,7 +118557,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":709,"d3":118}],653:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":721,"d3":120}],663:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117805,7 +118662,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"../color/attributes":589,"./button_attributes":654}],654:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"../color/attributes":599,"./button_attributes":664}],664:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117863,7 +118720,7 @@ module.exports = { } }; -},{}],655:[function(require,module,exports){ +},{}],665:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117892,7 +118749,7 @@ module.exports = { darkAmount: 10 }; -},{}],656:[function(require,module,exports){ +},{}],666:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117991,7 +118848,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":709,"../color":590,"./attributes":653,"./button_attributes":654,"./constants":655}],657:[function(require,module,exports){ +},{"../../lib":721,"../color":600,"./attributes":663,"./button_attributes":664,"./constants":665}],667:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118013,6 +118870,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -118053,7 +118912,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -118140,11 +118999,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -118176,26 +119033,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -118214,13 +119068,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -118266,7 +119115,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/cartesian/axis_ids":751,"../../plots/plots":811,"../color":590,"../drawing":614,"../legend/anchor_utils":640,"./constants":655,"./get_update_object":658,"d3":118}],658:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axis_ids":763,"../../plots/plots":823,"../color":600,"../drawing":624,"../legend/anchor_utils":650,"./constants":665,"./get_update_object":668,"d3":120}],668:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118323,7 +119172,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":118}],659:[function(require,module,exports){ +},{"d3":120}],669:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118350,7 +119199,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":653,"./defaults":656,"./draw":657}],660:[function(require,module,exports){ +},{"./attributes":663,"./defaults":666,"./draw":667}],670:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118435,7 +119284,7 @@ module.exports = { } }; -},{"../color/attributes":589}],661:[function(require,module,exports){ +},{"../color/attributes":599}],671:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118471,7 +119320,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":748,"./constants":662}],662:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"./constants":672}],672:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118523,7 +119372,7 @@ module.exports = { extraPad: 15 }; -},{}],663:[function(require,module,exports){ +},{}],673:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118580,7 +119429,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":709,"./attributes":660}],664:[function(require,module,exports){ +},{"../../lib":721,"./attributes":670}],674:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119131,7 +119980,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":709,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian":758,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../color":590,"../dragelement":611,"../drawing":614,"./constants":662,"d3":118}],665:[function(require,module,exports){ +},{"../../lib":721,"../../lib/setcursor":736,"../../plotly":755,"../../plots/cartesian":770,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../color":600,"../dragelement":621,"../drawing":624,"./constants":672,"d3":120}],675:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119158,7 +120007,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":660,"./calc_autorange":661,"./defaults":663,"./draw":664}],666:[function(require,module,exports){ +},{"./attributes":670,"./calc_autorange":671,"./defaults":673,"./draw":674}],676:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119324,7 +120173,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../traces/scatter/attributes":1008,"../annotations/attributes":579,"../drawing/attributes":613}],667:[function(require,module,exports){ +},{"../../lib/extend":713,"../../traces/scatter/attributes":1022,"../annotations/attributes":583,"../drawing/attributes":623}],677:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119370,7 +120219,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -119401,7 +120250,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":709,"../../plots/cartesian/axes":748,"./constants":668,"./helpers":671}],668:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./constants":678,"./helpers":681}],678:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119465,7 +120314,7 @@ module.exports = { } }; -},{}],669:[function(require,module,exports){ +},{}],679:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119490,7 +120339,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":745,"./shape_defaults":673}],670:[function(require,module,exports){ +},{"../../plots/array_container_defaults":757,"./shape_defaults":683}],680:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119623,8 +120472,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -119633,6 +120482,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -119865,7 +120716,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":709,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian/axes":748,"../color":590,"../dragelement":611,"../drawing":614,"./constants":668,"./helpers":671}],671:[function(require,module,exports){ +},{"../../lib":721,"../../lib/setcursor":736,"../../plotly":755,"../../plots/cartesian/axes":760,"../color":600,"../dragelement":621,"../drawing":624,"./constants":678,"./helpers":681}],681:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119946,7 +120797,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],672:[function(require,module,exports){ +},{}],682:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119972,7 +120823,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":666,"./calc_autorange":667,"./defaults":669,"./draw":670}],673:[function(require,module,exports){ +},{"./attributes":676,"./calc_autorange":677,"./defaults":679,"./draw":680}],683:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120071,7 +120922,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"./attributes":666,"./helpers":671}],674:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./attributes":676,"./helpers":681}],684:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120094,11 +120945,15 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', role: 'info', description: [ - 'Sets the Plotly method to be called when the slider value is changed.' + 'Sets the Plotly method to be called when the slider value is changed.', + 'If the `skip` method is used, the API slider will function as normal', + 'but will perform no API calls and will not bind automatically to state', + 'updates. This may be used to create a component interface and attach to', + 'slider events manually via JavaScript.' ].join(' ') }, args: { @@ -120127,6 +120982,18 @@ var stepsAttrs = { 'Sets the value of the slider step, used to refer to the step programatically.', 'Defaults to the slider label if not provided.' ].join(' ') + }, + execute: { + valType: 'boolean', + role: 'info', + dflt: true, + description: [ + 'When true, the API method is executed. When false, all other behaviors are the same', + 'and command execution is skipped. This may be useful when hooking into, for example,', + 'the `plotly_sliderchange` method and executing the API command manually without losing', + 'the benefit of the slider automatically binding to the state of the plot through the', + 'specification of `method` and `args`.' + ].join(' ') } }; @@ -120345,7 +121212,7 @@ module.exports = { }, }; -},{"../../lib/extend":701,"../../plots/animation_attributes":744,"../../plots/font_attributes":772,"../../plots/pad_attributes":810,"./constants":675}],675:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/animation_attributes":756,"../../plots/font_attributes":784,"../../plots/pad_attributes":822,"./constants":685}],685:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120393,9 +121260,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -120442,7 +121306,7 @@ module.exports = { currentValueInset: 0, }; -},{}],676:[function(require,module,exports){ +},{}],686:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120540,14 +121404,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -120555,7 +121421,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":709,"../../plots/array_container_defaults":745,"./attributes":674,"./constants":675}],677:[function(require,module,exports){ +},{"../../lib":721,"../../plots/array_container_defaults":757,"./attributes":684,"./constants":685}],687:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120576,11 +121442,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -120644,24 +121511,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -120689,14 +121550,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -120706,26 +121565,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -120752,6 +121593,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -120843,7 +121709,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -120860,9 +121729,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); + + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + svgTextUtils.positionText(text, x0, y0); return text; } @@ -120894,11 +121768,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -120925,7 +121802,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -120967,7 +121850,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -121157,7 +122042,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":728,"../../plots/plots":811,"../color":590,"../drawing":614,"../legend/anchor_utils":640,"./constants":675,"d3":118}],678:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib/svg_text_utils":740,"../../plots/plots":823,"../color":600,"../drawing":624,"../legend/anchor_utils":650,"./constants":685,"d3":120}],688:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121180,7 +122065,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":674,"./constants":675,"./defaults":676,"./draw":677}],679:[function(require,module,exports){ +},{"./attributes":684,"./constants":685,"./defaults":686,"./draw":687}],689:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121203,6 +122088,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -121235,29 +122121,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -121266,7 +122157,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -121275,6 +122166,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -121294,11 +122188,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -121310,33 +122201,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -121367,8 +122258,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -121376,8 +122266,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -121388,11 +122277,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -121402,18 +122291,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":689,"../../lib":709,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/plots":811,"../color":590,"../drawing":614,"d3":118,"fast-isnumeric":127}],680:[function(require,module,exports){ +},{"../../constants/interactions":701,"../../lib":721,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/plots":823,"../color":600,"../drawing":624,"d3":120,"fast-isnumeric":129}],690:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121434,11 +122319,15 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', role: 'info', description: [ - 'Sets the Plotly method to be called on click.' + 'Sets the Plotly method to be called on click.', + 'If the `skip` method is used, the API updatemenu will function as normal', + 'but will perform no API calls and will not bind automatically to state', + 'updates. This may be used to create a component interface and attach to', + 'updatemenu events manually via JavaScript.' ].join(' ') }, args: { @@ -121460,6 +122349,18 @@ var buttonsAttrs = { role: 'info', dflt: '', description: 'Sets the text label to appear on the button.' + }, + execute: { + valType: 'boolean', + role: 'info', + dflt: true, + description: [ + 'When true, the API method is executed. When false, all other behaviors are the same', + 'and command execution is skipped. This may be useful when hooking into, for example,', + 'the `plotly_buttonclicked` method and executing the API command manually without losing', + 'the benefit of the updatemenu automatically binding to the state of the plot through the', + 'specification of `method` and `args`.' + ].join(' ') } }; @@ -121586,7 +122487,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"../../plots/pad_attributes":810,"../color/attributes":589}],681:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"../../plots/pad_attributes":822,"../color/attributes":599}],691:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121633,9 +122534,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -121659,10 +122557,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],682:[function(require,module,exports){ +},{}],692:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121741,13 +122647,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -121756,7 +122664,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":709,"../../plots/array_container_defaults":745,"./attributes":680,"./constants":681}],683:[function(require,module,exports){ +},{"../../lib":721,"../../plots/array_container_defaults":757,"./attributes":690,"./constants":691}],693:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121776,6 +122684,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -121961,7 +122871,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -121973,7 +122883,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -122081,7 +122991,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -122090,7 +123000,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -122191,9 +123103,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -122213,18 +123125,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -122275,19 +123190,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -122381,34 +123295,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -122424,8 +123333,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -122436,9 +123345,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":728,"../../plots/plots":811,"../color":590,"../drawing":614,"../legend/anchor_utils":640,"./constants":681,"./scrollbox":685,"d3":118}],684:[function(require,module,exports){ -arguments[4][678][0].apply(exports,arguments) -},{"./attributes":680,"./constants":681,"./defaults":682,"./draw":683,"dup":678}],685:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib/svg_text_utils":740,"../../plots/plots":823,"../color":600,"../drawing":624,"../legend/anchor_utils":650,"./constants":691,"./scrollbox":695,"d3":120}],694:[function(require,module,exports){ +arguments[4][688][0].apply(exports,arguments) +},{"./attributes":690,"./constants":691,"./defaults":692,"./draw":693,"dup":688}],695:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122909,7 +123818,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":709,"../color":590,"../drawing":614,"d3":118}],686:[function(require,module,exports){ +},{"../../lib":721,"../color":600,"../drawing":624,"d3":120}],696:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],697:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122930,7 +123875,141 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],687:[function(require,module,exports){ +},{}],698:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 extendFlat = require('../lib/extend').extendFlat; + +var symbolsWithOpenSupport = { + 'circle': { + unicode: '●' + }, + 'square': { + unicode: '■' + }, + 'diamond': { + unicode: '◆' + }, + 'cross': { + unicode: '✚' + }, + 'x': { + unicode: '❌' + }, + 'triangle-up': { + unicode: '▲' + }, + 'triangle-down': { + unicode: '▼' + }, + 'triangle-left': { + unicode: '◄' + }, + 'triangle-right': { + unicode: '►' + }, + 'triangle-ne': { + unicode: '◥' + }, + 'triangle-nw': { + unicode: '◤' + }, + 'triangle-se': { + unicode: '◢' + }, + 'triangle-sw': { + unicode: '◣' + }, + 'pentagon': { + unicode: '⬟' + }, + 'hexagon': { + unicode: '⬢' + }, + 'hexagon2': { + unicode: '⬣' + }, + 'star': { + unicode: '★' + }, + 'diamond-tall': { + unicode: '♦' + }, + 'bowtie': { + unicode: '⧓' + }, + 'diamond-x': { + unicode: '❖' + }, + 'cross-thin': { + unicode: '+', + noBorder: true + }, + 'asterisk': { + unicode: '✳', + noBorder: true + }, + 'y-up': { + unicode: '⅄', + noBorder: true + }, + 'y-down': { + unicode: 'Y', + noBorder: true + }, + 'line-ew': { + unicode: '─', + noBorder: true + }, + 'line-ns': { + unicode: '│', + noBorder: true + } +}; + +var openSymbols = {}; +var keys = Object.keys(symbolsWithOpenSupport); + +for(var i = 0; i < keys.length; i++) { + var k = keys[i]; + openSymbols[k + '-open'] = extendFlat({}, symbolsWithOpenSupport[k]); +} + +var otherSymbols = { + 'circle-cross-open': { + unicode: '⨁', + noFill: true + }, + 'circle-x-open': { + unicode: '⨂', + noFill: true + }, + 'square-cross-open': { + unicode: '⊞', + noFill: true + }, + 'square-x-open': { + unicode: '⊠', + noFill: true + } +}; + +module.exports = extendFlat({}, + symbolsWithOpenSupport, + openSymbols, + otherSymbols +); + +},{"../lib/extend":713}],699:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122951,7 +124030,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],688:[function(require,module,exports){ +},{}],700:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122974,7 +124053,7 @@ module.exports = { x: '❌' }; -},{}],689:[function(require,module,exports){ +},{}],701:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122998,7 +124077,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],690:[function(require,module,exports){ +},{}],702:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123051,7 +124130,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],691:[function(require,module,exports){ +},{}],703:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123089,7 +124168,7 @@ module.exports = { }; -},{}],692:[function(require,module,exports){ +},{}],704:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123113,7 +124192,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],693:[function(require,module,exports){ +},{}],705:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123131,7 +124210,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -123172,6 +124251,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -123193,7 +124273,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":586,"./components/fx":631,"./components/images":639,"./components/legend":647,"./components/rangeselector":659,"./components/rangeslider":665,"./components/shapes":672,"./components/sliders":678,"./components/updatemenus":684,"./fonts/mathjax_config":694,"./lib/queue":721,"./plot_api/plot_schema":737,"./plot_api/register":738,"./plot_api/set_plot_config":739,"./plot_api/to_image":741,"./plot_api/validate":742,"./plotly":743,"./snapshot":831,"./snapshot/download":828,"./traces/scatter":1018,"d3":118,"es6-promise":124}],694:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":591,"./components/annotations3d":596,"./components/fx":641,"./components/images":649,"./components/legend":657,"./components/rangeselector":669,"./components/rangeslider":675,"./components/shapes":682,"./components/sliders":688,"./components/updatemenus":694,"./fonts/mathjax_config":706,"./lib/queue":733,"./plot_api/plot_schema":749,"./plot_api/register":750,"./plot_api/set_plot_config":751,"./plot_api/to_image":753,"./plot_api/validate":754,"./plotly":755,"./snapshot":843,"./snapshot/download":840,"./traces/scatter":1032,"d3":120,"es6-promise":126}],706:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123226,7 +124306,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],695:[function(require,module,exports){ +},{}],707:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123243,7 +124323,7 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { if(Array.isArray(traceAttr)) calcItem[calcAttr] = traceAttr[i]; }; -},{}],696:[function(require,module,exports){ +},{}],708:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123276,7 +124356,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":690,"fast-isnumeric":127}],697:[function(require,module,exports){ +},{"../constants/numerical":702,"fast-isnumeric":129}],709:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123291,6 +124371,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -123322,6 +124403,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -123475,7 +124570,7 @@ exports.valObjects = { 'Values in `extras` cannot be combined.' ].join(' '), requiredOpts: ['flags'], - otherOpts: ['dflt', 'extras'], + otherOpts: ['dflt', 'extras', 'arrayOk'], coerceFunction: function(v, propOut, dflt, opts) { if(typeof v !== 'string') { propOut.set(dflt); @@ -123617,6 +124712,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -123636,7 +124760,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":602,"../components/colorscale/scales":608,"./nested_property":715,"fast-isnumeric":127,"tinycolor2":526}],698:[function(require,module,exports){ +},{"../components/colorscale/get_scale":612,"../components/colorscale/scales":618,"../plots/attributes":758,"./nested_property":727,"fast-isnumeric":129,"tinycolor2":530}],710:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124264,7 +125388,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":690,"../registry":826,"./loggers":712,"./mod":714,"d3":118,"fast-isnumeric":127}],699:[function(require,module,exports){ +},{"../constants/numerical":702,"../registry":838,"./loggers":724,"./mod":726,"d3":120,"fast-isnumeric":129}],711:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124293,7 +125417,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],700:[function(require,module,exports){ +},{}],712:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124459,7 +125583,7 @@ var Events = { module.exports = Events; -},{"events":125}],701:[function(require,module,exports){ +},{"events":127}],713:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124573,7 +125697,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":711}],702:[function(require,module,exports){ +},{"./is_plain_object.js":723}],714:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124624,7 +125748,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],703:[function(require,module,exports){ +},{}],715:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124655,7 +125779,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],704:[function(require,module,exports){ +},{}],716:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124717,7 +125841,7 @@ function countryNameToISO3(countryName) { return false; } -},{"../lib":709,"country-regex":103}],705:[function(require,module,exports){ +},{"../lib":721,"country-regex":105}],717:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124854,7 +125978,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":690}],706:[function(require,module,exports){ +},{"../constants/numerical":702}],718:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124942,7 +126066,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":589,"../components/colorscale":604,"color-rgba":91,"fast-isnumeric":127}],707:[function(require,module,exports){ +},{"../components/color/attributes":599,"../components/colorscale":614,"color-rgba":93,"fast-isnumeric":129}],719:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125011,7 +126135,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":691,"superscript-text":522}],708:[function(require,module,exports){ +},{"../constants/string_mappings":703,"superscript-text":526}],720:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125027,7 +126151,7 @@ module.exports = convertHTMLToUnicode; module.exports = function identity(d) { return d; }; -},{}],709:[function(require,module,exports){ +},{}],721:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125040,6 +126164,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -125056,6 +126185,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -125117,6 +126247,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -125367,6 +126504,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -125374,6 +126520,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -125414,7 +126605,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -125444,13 +126635,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -125691,7 +126875,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":696,"./coerce":697,"./dates":698,"./ensure_array":699,"./extend":701,"./filter_unique":702,"./filter_visible":703,"./identity":708,"./is_array":710,"./is_plain_object":711,"./loggers":712,"./matrix":713,"./mod":714,"./nested_property":715,"./noop":716,"./notifier":717,"./push_unique":720,"./relink_private":722,"./search":723,"./stats":726,"./to_log_range":729,"d3":118}],710:[function(require,module,exports){ +},{"../constants/numerical":702,"./clean_number":708,"./coerce":709,"./dates":710,"./ensure_array":711,"./extend":713,"./filter_unique":714,"./filter_visible":715,"./identity":720,"./is_array":722,"./is_plain_object":723,"./loggers":724,"./matrix":725,"./mod":726,"./nested_property":727,"./noop":728,"./notifier":729,"./push_unique":732,"./relink_private":734,"./search":735,"./stats":738,"./to_log_range":741,"d3":120,"fast-isnumeric":129}],722:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125715,7 +126899,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],711:[function(require,module,exports){ +},{}],723:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125744,7 +126928,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],712:[function(require,module,exports){ +},{}],724:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125818,7 +127002,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":736}],713:[function(require,module,exports){ +},{"../plot_api/plot_config":748}],725:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125928,7 +127112,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],714:[function(require,module,exports){ +},{}],726:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125948,7 +127132,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],715:[function(require,module,exports){ +},{}],727:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126252,7 +127436,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":732,"./is_array":710,"./is_plain_object":711,"fast-isnumeric":127}],716:[function(require,module,exports){ +},{"../plot_api/container_array_match":744,"./is_array":722,"./is_plain_object":723,"fast-isnumeric":129}],728:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126268,7 +127452,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],717:[function(require,module,exports){ +},{}],729:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126350,7 +127534,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":118,"fast-isnumeric":127}],718:[function(require,module,exports){ +},{"d3":120,"fast-isnumeric":129}],730:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126399,7 +127583,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":724}],719:[function(require,module,exports){ +},{"./setcursor":736}],731:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126640,7 +127824,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":690,"./matrix":713}],720:[function(require,module,exports){ +},{"../constants/numerical":702,"./matrix":725}],732:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126678,7 +127862,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],721:[function(require,module,exports){ +},{}],733:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126889,7 +128073,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":709,"../plot_api/plot_config":736}],722:[function(require,module,exports){ +},{"../lib":721,"../plot_api/plot_config":748}],734:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126946,7 +128130,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":710,"./is_plain_object":711}],723:[function(require,module,exports){ +},{"./is_array":722,"./is_plain_object":723}],735:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127057,7 +128241,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":712,"fast-isnumeric":127}],724:[function(require,module,exports){ +},{"./loggers":724,"fast-isnumeric":129}],736:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127080,7 +128264,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],725:[function(require,module,exports){ +},{}],737:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127129,7 +128313,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":590}],726:[function(require,module,exports){ +},{"../components/color":600}],738:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127225,7 +128409,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":127}],727:[function(require,module,exports){ +},{"fast-isnumeric":129}],739:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127246,7 +128430,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-rgba":91}],728:[function(require,module,exports){ +},{"color-rgba":93}],740:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127265,62 +128449,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -127328,42 +128457,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); - - result = _context.appendSVG(converted); + .style('white-space', 'pre'); - if(!result) _context.text(str); + var hasLink = buildSVGText(_context.node(), str); - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -127371,14 +128502,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -127393,7 +128525,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -127410,36 +128546,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -127452,9 +128588,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -127485,23 +128624,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -127512,24 +128663,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -127540,26 +128710,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -127569,122 +128745,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -127721,28 +128972,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title - -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ + +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + context.style({'pointer-events': _delegate ? 'none' : 'all'}); + + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -127757,63 +129021,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -127825,10 +129088,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":691,"../constants/xmlns_namespaces":692,"../lib":709,"d3":118}],729:[function(require,module,exports){ +},{"../constants/alignment":696,"../constants/string_mappings":703,"../constants/xmlns_namespaces":704,"../lib":721,"d3":120}],741:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127856,7 +129119,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":127}],730:[function(require,module,exports){ +},{"fast-isnumeric":129}],742:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127892,7 +129155,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":774,"topojson-client":528}],731:[function(require,module,exports){ +},{"../plots/geo/constants":786,"topojson-client":532}],743:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127926,7 +129189,7 @@ module.exports = function truncate(arrayIn, len) { throw new Error('This array type is not yet supported by `truncate`.'); }; -},{}],732:[function(require,module,exports){ +},{}],744:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127984,7 +129247,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":826}],733:[function(require,module,exports){ +},{"../registry":838}],745:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -128202,7 +129465,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -128335,18 +129597,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -128402,7 +129684,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -128505,7 +129787,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":590,"../lib":709,"../plots/cartesian/axes":748,"../plots/plots":811,"../registry":826,"fast-isnumeric":127,"gl-mat4/fromQuat":173}],734:[function(require,module,exports){ +},{"../components/color":600,"../lib":721,"../plots/cartesian/axes":760,"../plots/plots":823,"../registry":838,"fast-isnumeric":129,"gl-mat4/fromQuat":176}],746:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -128719,7 +130001,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":711,"../lib/loggers":712,"../lib/nested_property":715,"../lib/noop":716,"../lib/search":723,"../registry":826,"./container_array_match":732}],735:[function(require,module,exports){ +},{"../lib/is_plain_object":723,"../lib/loggers":724,"../lib/nested_property":727,"../lib/noop":728,"../lib/search":735,"../registry":838,"./container_array_match":744}],747:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -128754,7 +130036,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -128911,9 +130195,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -128942,19 +130224,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; - - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); + if(JSON.stringify(fullLayout._size) === oldmargins) return; - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -128992,7 +130274,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -129092,6 +130377,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -129189,7 +130475,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -129198,9 +130484,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -129215,11 +130502,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -130105,6 +131391,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -130204,6 +131491,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -130635,10 +131925,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -130660,7 +131952,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -130668,7 +131961,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -130681,11 +131974,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -130765,6 +132072,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -130863,7 +132171,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -130911,7 +132228,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -131745,7 +133062,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":614,"../components/errorbars":620,"../constants/xmlns_namespaces":692,"../lib":709,"../lib/events":700,"../lib/queue":721,"../lib/svg_text_utils":728,"../plotly":743,"../plots/cartesian/axis_ids":751,"../plots/cartesian/constants":753,"../plots/cartesian/constraints":755,"../plots/cartesian/graph_interact":757,"../plots/plots":811,"../plots/polar":814,"../registry":826,"./helpers":733,"./manage_arrays":734,"./subroutines":740,"d3":118,"fast-isnumeric":127}],736:[function(require,module,exports){ +},{"../components/drawing":624,"../components/errorbars":630,"../constants/xmlns_namespaces":704,"../lib":721,"../lib/events":712,"../lib/queue":733,"../lib/svg_text_utils":740,"../plotly":755,"../plots/cartesian/axis_ids":763,"../plots/cartesian/constants":765,"../plots/cartesian/constraints":767,"../plots/cartesian/graph_interact":769,"../plots/plots":823,"../plots/polar":826,"../registry":838,"./helpers":745,"./manage_arrays":746,"./subroutines":752,"d3":120,"fast-isnumeric":129}],748:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -131871,7 +133188,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],737:[function(require,module,exports){ +},{}],749:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132030,7 +133347,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -132050,9 +133370,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -132280,7 +133599,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":709,"../plots/animation_attributes":744,"../plots/attributes":746,"../plots/frame_attributes":773,"../plots/layout_attributes":802,"../plots/polar/area_attributes":812,"../plots/polar/axis_attributes":813,"../registry":826}],738:[function(require,module,exports){ +},{"../lib":721,"../plots/animation_attributes":756,"../plots/attributes":758,"../plots/frame_attributes":785,"../plots/layout_attributes":814,"../plots/polar/area_attributes":824,"../plots/polar/axis_attributes":825,"../registry":838}],750:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132379,7 +133698,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":709,"../registry":826}],739:[function(require,module,exports){ +},{"../lib":721,"../registry":838}],751:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132405,7 +133724,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":709,"../plotly":743}],740:[function(require,module,exports){ +},{"../lib":721,"../plotly":755}],752:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132534,15 +133853,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -132662,27 +133982,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -132783,19 +134105,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -132812,7 +134137,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":590,"../components/drawing":614,"../components/modebar":650,"../components/titles":679,"../lib":709,"../plotly":743,"../plots/cartesian/graph_interact":757,"../plots/plots":811,"../registry":826,"d3":118}],741:[function(require,module,exports){ +},{"../components/color":600,"../components/drawing":624,"../components/modebar":660,"../components/titles":689,"../lib":721,"../plotly":755,"../plots/cartesian/graph_interact":769,"../plots/plots":823,"../registry":838,"d3":120}],753:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132922,7 +134247,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":709,"../plotly":743,"../snapshot/cloneplot":827,"../snapshot/helpers":830,"../snapshot/svgtoimg":832,"../snapshot/tosvg":834,"fast-isnumeric":127}],742:[function(require,module,exports){ +},{"../lib":721,"../plotly":755,"../snapshot/cloneplot":839,"../snapshot/helpers":842,"../snapshot/svgtoimg":844,"../snapshot/tosvg":846,"fast-isnumeric":129}],754:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133144,6 +134469,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -133192,6 +134522,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -133209,7 +134549,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -133226,8 +134566,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -133293,7 +134633,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":709,"../plots/plots":811,"./plot_schema":737}],743:[function(require,module,exports){ +},{"../lib":721,"../plots/plots":823,"./plot_schema":749}],755:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133327,7 +134667,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":650,"./plot_api/plot_api":735,"./plot_api/plot_config":736,"./plots/cartesian/axes":748,"./plots/plots":811}],744:[function(require,module,exports){ +},{"./components/modebar":660,"./plot_api/plot_api":747,"./plot_api/plot_config":748,"./plots/cartesian/axes":760,"./plots/plots":823}],756:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133451,7 +134791,7 @@ module.exports = { } }; -},{}],745:[function(require,module,exports){ +},{}],757:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133532,7 +134872,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":709}],746:[function(require,module,exports){ +},{"../lib":721}],758:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133604,11 +134944,28 @@ module.exports = { role: 'info', dflt: '' }, + ids: { + valType: 'data_array', + description: [ + 'Assigns id labels to each datum.', + 'These ids for object constancy of data points during animation.' + ].join(' ') + }, + customdata: { + valType: 'data_array', + description: [ + 'Assigns extra data each datum.', + 'This may be useful when listening to hover, click and selection events.', + 'Note that, *scatter* traces also appends customdata items in the markers', + 'DOM elements' + ].join(' ') + }, hoverinfo: { valType: 'flaglist', role: 'info', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', description: [ 'Determines which trace information appear on hover.', @@ -133644,7 +135001,7 @@ module.exports = { } }; -},{"../components/fx/attributes":623}],747:[function(require,module,exports){ +},{"../components/fx/attributes":633}],759:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133683,7 +135040,7 @@ module.exports = { } }; -},{}],748:[function(require,module,exports){ +},{}],760:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -133713,7 +135070,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -133786,33 +135142,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -134053,6 +135403,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -134148,6 +135501,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -135499,10 +136859,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -135535,17 +136895,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -136011,7 +137364,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":590,"../../components/drawing":614,"../../components/titles":679,"../../constants/numerical":690,"../../lib":709,"../../lib/svg_text_utils":728,"../../registry":826,"./axis_autotype":749,"./axis_ids":751,"./layout_attributes":759,"./layout_defaults":760,"./set_convert":765,"d3":118,"fast-isnumeric":127}],749:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/titles":689,"../../constants/numerical":702,"../../lib":721,"../../lib/svg_text_utils":740,"../../registry":838,"./axis_autotype":761,"./axis_ids":763,"./layout_attributes":771,"./layout_defaults":772,"./set_convert":777,"d3":120,"fast-isnumeric":129}],761:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136086,7 +137439,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],750:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],762:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136209,7 +137562,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":589,"../../lib":709,"../../registry":826,"./category_order_defaults":752,"./layout_attributes":759,"./ordered_categories":761,"./set_convert":765,"./tick_label_defaults":766,"./tick_mark_defaults":767,"./tick_value_defaults":768,"tinycolor2":526}],751:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib":721,"../../registry":838,"./category_order_defaults":764,"./layout_attributes":771,"./ordered_categories":773,"./set_convert":777,"./tick_label_defaults":778,"./tick_mark_defaults":779,"./tick_value_defaults":780,"tinycolor2":530}],763:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136331,7 +137684,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":709,"../../registry":826,"../plots":811,"./constants":753}],752:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838,"../plots":823,"./constants":765}],764:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136365,7 +137718,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],753:[function(require,module,exports){ +},{}],765:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136420,7 +137773,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],754:[function(require,module,exports){ +},{}],766:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136438,10 +137791,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); + + if(containerOut.fixedrange) return; + + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(!containerIn.scaleanchor) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -136460,7 +137828,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -136559,7 +137927,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":709,"./axis_ids":751}],755:[function(require,module,exports){ +},{"../../lib":721,"./axis_ids":763}],767:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136576,12 +137944,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -136597,12 +137967,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -136610,32 +137986,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; + + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } + } + } + } +}; + +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; } } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } } }; -},{"../../constants/numerical":690,"./axis_ids":751,"./scale_zoom":763}],756:[function(require,module,exports){ +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":696,"../../constants/numerical":702,"./axis_ids":763,"./scale_zoom":775}],768:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136658,6 +138155,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -136767,7 +138267,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -136821,6 +138320,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -136919,8 +138421,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -136953,7 +138455,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -136972,11 +138475,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -137161,6 +138664,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -137180,8 +138685,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -137278,24 +138788,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -137330,11 +138833,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -137345,7 +138852,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -137354,7 +138861,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -137437,7 +138944,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -137453,13 +138960,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -137636,7 +139145,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":590,"../../components/dragelement":611,"../../components/drawing":614,"../../lib":709,"../../lib/setcursor":724,"../../lib/svg_text_utils":728,"../../plotly":743,"../../registry":826,"./axes":748,"./axis_ids":751,"./constants":753,"./scale_zoom":763,"./select":764,"d3":118,"tinycolor2":526}],757:[function(require,module,exports){ +},{"../../components/color":600,"../../components/dragelement":621,"../../components/drawing":624,"../../constants/alignment":696,"../../lib":721,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../registry":838,"../plots":823,"./axes":760,"./axis_ids":763,"./constants":765,"./scale_zoom":775,"./select":776,"d3":120,"tinycolor2":530}],769:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -137659,7 +139168,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -137677,8 +139186,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -137736,7 +139243,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -137797,7 +139304,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":611,"../../components/fx":631,"./constants":753,"./dragbox":756,"fast-isnumeric":127}],758:[function(require,module,exports){ +},{"../../components/dragelement":621,"../../components/fx":641,"./constants":765,"./dragbox":768,"fast-isnumeric":129}],770:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -137984,6 +139491,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -138186,7 +139698,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":709,"../plots":811,"./attributes":747,"./axis_ids":751,"./constants":753,"./layout_attributes":759,"./transition_axes":769,"d3":118}],759:[function(require,module,exports){ +},{"../../lib":721,"../plots":823,"./attributes":759,"./axis_ids":763,"./constants":765,"./layout_attributes":771,"./transition_axes":781,"d3":120}],771:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138316,14 +139828,16 @@ module.exports = { ], role: 'info', description: [ - 'If set to an opposite-letter axis id (e.g. `x2`, `y`), the range of this axis', - 'changes together with the range of the corresponding opposite-letter axis.', + 'If set to another axis id (e.g. `x2`, `y`), the range of this axis', + 'changes together with the range of the corresponding axis', 'such that the scale of pixels per unit is in a constant ratio.', 'Both axes are still zoomable, but when you zoom one, the other will', 'zoom the same amount, keeping a fixed midpoint.', - 'Autorange will also expand about the midpoints to satisfy the constraint.', + '`constrain` and `constraintoward` determine how we enforce the constraint.', 'You can chain these, ie `yaxis: {scaleanchor: *x*}, xaxis2: {scaleanchor: *y*}`', 'but you can only link axes of the same `type`.', + 'The linked axis can have the opposite letter (to constrain the aspect ratio)', + 'or the same letter (to match scales across subplots).', 'Loops (`yaxis: {scaleanchor: *x*}, xaxis: {scaleanchor: *y*}` or longer) are redundant', 'and the last constraint encountered will be ignored to avoid possible', 'inconsistent constraints via `scaleratio`.' @@ -138342,6 +139856,29 @@ module.exports = { 'is exaggerated a fixed amount with respect to the horizontal.' ].join(' ') }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + role: 'info', + description: [ + 'If this axis needs to be compressed (either due to its own `scaleanchor` and', + '`scaleratio` or those of the other axis), determines how that happens:', + 'by increasing the *range* (default), or by decreasing the *domain*.' + ].join(' ') + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + role: 'info', + description: [ + 'If this axis needs to be compressed (either due to its own `scaleanchor` and', + '`scaleratio` or those of the other axis), determines which direction we push', + 'the originally specified plot area. Options are *left*, *center* (default),', + 'and *right* for x axes, and *top*, *middle* (default), and *bottom* for y axes.' + ].join(' ') + }, // ticks tickmode: { valType: 'enumerated', @@ -138804,7 +140341,7 @@ module.exports = { } }; -},{"../../components/color/attributes":589,"../../components/drawing/attributes":613,"../../lib/extend":701,"../font_attributes":772,"./constants":753}],760:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../components/drawing/attributes":623,"../../lib/extend":713,"../font_attributes":784,"./constants":765}],772:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139077,7 +140614,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":590,"../../lib":709,"../../registry":826,"../layout_attributes":802,"./axis_defaults":750,"./axis_ids":751,"./constants":753,"./constraint_defaults":754,"./layout_attributes":759,"./position_defaults":762,"./type_defaults":770}],761:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../registry":838,"../layout_attributes":814,"./axis_defaults":762,"./axis_ids":763,"./constants":765,"./constraint_defaults":766,"./layout_attributes":771,"./position_defaults":774,"./type_defaults":782}],773:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139156,7 +140693,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":118}],762:[function(require,module,exports){ +},{"d3":120}],774:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139221,7 +140758,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":709,"fast-isnumeric":127}],763:[function(require,module,exports){ +},{"../../lib":721,"fast-isnumeric":129}],775:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139233,20 +140770,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],764:[function(require,module,exports){ +},{"../../constants/alignment":696}],776:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139260,6 +140800,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -139400,7 +140941,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -139446,7 +140989,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":590,"../../lib/polygon":719,"./axes":748,"./constants":753}],765:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":600,"../../components/fx/helpers":638,"../../lib/polygon":731,"./axes":760,"./constants":765}],777:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139465,6 +141025,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -139477,13 +141038,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -139601,7 +141155,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -139614,8 +141168,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -139631,10 +141185,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -139642,16 +141198,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -139669,26 +141227,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -139889,7 +141459,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":690,"../../lib":709,"./axis_ids":751,"./constants":753,"d3":118,"fast-isnumeric":127}],766:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"./axis_ids":763,"./constants":765,"d3":120,"fast-isnumeric":129}],778:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139973,7 +141543,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":709}],767:[function(require,module,exports){ +},{"../../lib":721}],779:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140006,7 +141576,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":709,"./layout_attributes":759}],768:[function(require,module,exports){ +},{"../../lib":721,"./layout_attributes":771}],780:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140090,7 +141660,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],769:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],781:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140406,7 +141976,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":614,"../../plotly":743,"../../registry":826,"./axes":748,"d3":118}],770:[function(require,module,exports){ +},{"../../components/drawing":624,"../../plotly":755,"../../registry":838,"./axes":760,"d3":120}],782:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140534,7 +142104,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":826,"./axis_autotype":749,"./axis_ids":751}],771:[function(require,module,exports){ +},{"../../registry":838,"./axis_autotype":761,"./axis_ids":763}],783:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140799,6 +142369,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -140959,7 +142531,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":709,"../plotly":743}],772:[function(require,module,exports){ +},{"../lib":721,"../plotly":755}],784:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141001,7 +142573,7 @@ module.exports = { } }; -},{}],773:[function(require,module,exports){ +},{}],785:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141063,7 +142635,7 @@ module.exports = { } }; -},{}],774:[function(require,module,exports){ +},{}],786:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141223,7 +142795,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],775:[function(require,module,exports){ +},{}],787:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141696,7 +143268,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":590,"../../components/drawing":614,"../../components/fx":631,"../../lib/topojson_utils":730,"../cartesian/axes":748,"../plots":811,"./constants":774,"./projections":782,"./set_scale":783,"./zoom":784,"./zoom_reset":785,"d3":118,"topojson-client":528}],776:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/fx":641,"../../lib/topojson_utils":742,"../cartesian/axes":760,"../plots":823,"./constants":786,"./projections":794,"./set_scale":795,"./zoom":796,"./zoom_reset":797,"d3":120,"topojson-client":532}],788:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141776,7 +143348,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":811,"./geo":775,"./layout/attributes":777,"./layout/defaults":780,"./layout/layout_attributes":781}],777:[function(require,module,exports){ +},{"../../plots/plots":823,"./geo":787,"./layout/attributes":789,"./layout/defaults":792,"./layout/layout_attributes":793}],789:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141804,7 +143376,7 @@ module.exports = { } }; -},{}],778:[function(require,module,exports){ +},{}],790:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141867,7 +143439,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":589}],779:[function(require,module,exports){ +},{"../../../components/color/attributes":599}],791:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141941,7 +143513,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":709,"../constants":774,"./axis_attributes":778}],780:[function(require,module,exports){ +},{"../../../lib":721,"../constants":786,"./axis_attributes":790}],792:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142060,7 +143632,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":818,"../constants":774,"./axis_defaults":779,"./layout_attributes":781}],781:[function(require,module,exports){ +},{"../../subplot_defaults":830,"../constants":786,"./axis_defaults":791,"./layout_attributes":793}],793:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142319,7 +143891,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":589,"../constants":774,"./axis_attributes":778}],782:[function(require,module,exports){ +},{"../../../components/color/attributes":599,"../constants":786,"./axis_attributes":790}],794:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142765,7 +144337,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],783:[function(require,module,exports){ +},{}],795:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142916,7 +144488,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":774,"d3":118}],784:[function(require,module,exports){ +},{"./constants":786,"d3":120}],796:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143343,7 +144915,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":118}],785:[function(require,module,exports){ +},{"d3":120}],797:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143372,7 +144944,7 @@ module.exports = function createGeoZoomReset(geo, geoLayout) { return zoomReset; }; -},{}],786:[function(require,module,exports){ +},{}],798:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143506,7 +145078,7 @@ function createCamera(scene) { if(Math.abs(dx * dydx) > Math.abs(dy)) { result.boxEnd[1] = result.boxStart[1] + - Math.abs(dx) * dydx * (Math.sign(dy) || 1); + Math.abs(dx) * dydx * (dy >= 0 ? 1 : -1); // gl-select-box clips to the plot area bounds, // which breaks the axis constraint, so don't allow @@ -143524,7 +145096,7 @@ function createCamera(scene) { } else { result.boxEnd[0] = result.boxStart[0] + - Math.abs(dy) / dydx * (Math.sign(dx) || 1); + Math.abs(dy) / dydx * (dx >= 0 ? 1 : -1); if(result.boxEnd[0] < dataBox[0]) { result.boxEnd[0] = dataBox[0]; @@ -143654,7 +145226,7 @@ function createCamera(scene) { return result; } -},{"../cartesian/constants":753,"mouse-change":445,"mouse-wheel":448}],787:[function(require,module,exports){ +},{"../cartesian/constants":765,"mouse-change":448,"mouse-wheel":451}],799:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143900,7 +145472,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":707,"../../lib/str2rgbarray":727,"../cartesian/axes":748,"../plots":811}],788:[function(require,module,exports){ +},{"../../lib/html2unicode":719,"../../lib/str2rgbarray":739,"../cartesian/axes":760,"../plots":823}],800:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143915,7 +145487,8 @@ module.exports = createAxes2D; var Scene2D = require('./scene2d'); var Plots = require('../plots'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); - +var constants = require('../cartesian/constants'); +var Cartesian = require('../cartesian'); exports.name = 'gl2d'; @@ -143923,15 +145496,9 @@ exports.attr = ['xaxis', 'yaxis']; exports.idRoot = ['x', 'y']; -exports.idRegex = { - x: /^x([2-9]|[1-9][0-9]+)?$/, - y: /^y([2-9]|[1-9][0-9]+)?$/ -}; +exports.idRegex = constants.idRegex; -exports.attrRegex = { - x: /^xaxis([2-9]|[1-9][0-9]+)?$/, - y: /^yaxis([2-9]|[1-9][0-9]+)?$/ -}; +exports.attrRegex = constants.attrRegex; exports.attributes = require('../cartesian/attributes'); @@ -143985,6 +145552,15 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) delete oldFullLayout._plots[id]; } } + + // since we use cartesian interactions, do cartesian clean + Cartesian.clean.apply(this, arguments); +}; + +exports.drawFramework = function(gd) { + if(!gd._context.staticPlot) { + Cartesian.drawFramework(gd); + } }; exports.toSVG = function(gd) { @@ -144012,7 +145588,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":692,"../cartesian/attributes":747,"../plots":811,"./scene2d":789}],789:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../cartesian":770,"../cartesian/attributes":759,"../cartesian/constants":765,"../plots":823,"./scene2d":801}],801:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144037,7 +145613,9 @@ var createOptions = require('./convert'); var createCamera = require('./camera'); var convertHTMLToUnicode = require('../../lib/html2unicode'); var showNoWebGlMsg = require('../../lib/show_no_webgl_msg'); -var enforceAxisConstraints = require('../../plots/cartesian/constraints'); +var axisConstraints = require('../../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var AXES = ['xaxis', 'yaxis']; var STATIC_CANVAS, STATIC_CONTEXT; @@ -144082,6 +145660,11 @@ function Scene2D(options, fullLayout) { // last pick result this.pickResult = null; + // is the mouse over the plot? + // it's OK if this says true when it's not, so long as + // when we get a mouseout we set it to false before handling + this.isMouseOver = true; + this.bounds = [Infinity, Infinity, -Infinity, -Infinity]; // flag to stop render loop @@ -144162,12 +145745,22 @@ proto.makeFramework = function() { // create div to catch the mouse event var mouseContainer = this.mouseContainer = document.createElement('div'); mouseContainer.style.position = 'absolute'; + mouseContainer.style['pointer-events'] = 'auto'; // append canvas, hover svg and mouse div to container var container = this.container; container.appendChild(canvas); container.appendChild(svgContainer); container.appendChild(mouseContainer); + + var self = this; + mouseContainer.addEventListener('mouseout', function() { + self.isMouseOver = false; + self.unhover(); + }); + mouseContainer.addEventListener('mouseover', function() { + self.isMouseOver = true; + }); }; proto.toImage = function(format) { @@ -144258,13 +145851,6 @@ proto.computeTickMarks = function() { this.xaxis.setScale(); this.yaxis.setScale(); - // override _length from backward compatibility - // even though setScale 'should' give the correct result - this.xaxis._length = - this.glplot.viewBox[2] - this.glplot.viewBox[0]; - this.yaxis._length = - this.glplot.viewBox[3] - this.glplot.viewBox[1]; - var nextTicks = [ Axes.calcTicks(this.xaxis), Axes.calcTicks(this.yaxis) @@ -144386,6 +145972,7 @@ proto.plot = function(fullData, calcData, fullLayout) { this.updateRefs(fullLayout); this.updateTraces(fullData, calcData); + this.updateFx(fullLayout.dragmode); var width = fullLayout.width, height = fullLayout.height; @@ -144396,6 +145983,15 @@ proto.plot = function(fullData, calcData, fullLayout) { options.merge(fullLayout); options.screenBox = [0, 0, width, height]; + var mockGraphDiv = {_fullLayout: { + _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, + xaxis: this.xaxis, + yaxis: this.yaxis + }}; + + cleanAxisConstraints(mockGraphDiv, this.xaxis); + cleanAxisConstraints(mockGraphDiv, this.yaxis); + var size = fullLayout._size, domainX = this.xaxis.domain, domainY = this.yaxis.domain; @@ -144442,12 +146038,7 @@ proto.plot = function(fullData, calcData, fullLayout) { ax.setScale(); } - var mockLayout = { - _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, - xaxis: this.xaxis, - yaxis: this.yaxis - }; - enforceAxisConstraints({_fullLayout: mockLayout}); + enforceAxisConstraints(mockGraphDiv); options.ticks = this.computeTickMarks(); @@ -144522,11 +146113,19 @@ proto.updateTraces = function(fullData, calcData) { this.glplot.objects.sort(function(a, b) { return a._trace.index - b._trace.index; }); +}; +proto.updateFx = function(dragmode) { + if(dragmode === 'lasso' || dragmode === 'select') { + this.mouseContainer.style['pointer-events'] = 'none'; + } else { + this.mouseContainer.style['pointer-events'] = 'auto'; + } }; proto.emitPointAction = function(nextSelection, eventType) { var uid = nextSelection.trace.uid; + var ptNumber = nextSelection.pointIndex; var trace; for(var i = 0; i < this.fullData.length; i++) { @@ -144535,18 +146134,20 @@ proto.emitPointAction = function(nextSelection, eventType) { } } - this.graphDiv.emit(eventType, { - points: [{ - x: nextSelection.traceCoord[0], - y: nextSelection.traceCoord[1], - curveNumber: trace.index, - pointNumber: nextSelection.pointIndex, - data: trace._input, - fullData: this.fullData, - xaxis: this.xaxis, - yaxis: this.yaxis - }] - }); + var pointData = { + x: nextSelection.traceCoord[0], + y: nextSelection.traceCoord[1], + curveNumber: trace.index, + pointNumber: ptNumber, + data: trace._input, + fullData: this.fullData, + xaxis: this.xaxis, + yaxis: this.yaxis + }; + + Fx.appendArrayPointValue(pointData, trace, ptNumber); + + this.graphDiv.emit(eventType, {points: [pointData]}); }; proto.draw = function() { @@ -144589,7 +146190,7 @@ proto.draw = function() { glplot.setDirty(); } - else if(!camera.panning) { + else if(!camera.panning && this.isMouseOver) { this.selectBox.enabled = false; var size = fullLayout._size, @@ -144638,8 +146239,11 @@ proto.draw = function() { // also it's important to copy, otherwise data is lost by the time event data is read this.emitPointAction(nextSelection, 'plotly_hover'); - var hoverinfo = selection.hoverinfo; - if(hoverinfo !== 'all') { + var trace = this.fullData[selection.trace.index] || {}; + var ptNumber = selection.pointIndex; + var hoverinfo = Fx.castHoverinfo(trace, fullLayout, ptNumber); + + if(hoverinfo && hoverinfo !== 'all') { var parts = hoverinfo.split('+'); if(parts.indexOf('x') === -1) selection.traceCoord[0] = undefined; if(parts.indexOf('y') === -1) selection.traceCoord[1] = undefined; @@ -144648,9 +146252,6 @@ proto.draw = function() { if(parts.indexOf('name') === -1) selection.name = undefined; } - var trace = this.fullData[selection.trace.index] || {}; - var ptNumber = selection.pointIndex; - Fx.loneHover({ x: selection.screenCoord[0], y: selection.screenCoord[1], @@ -144665,7 +146266,8 @@ proto.draw = function() { fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') }, { - container: this.svgContainer + container: this.svgContainer, + gd: this.graphDiv }); } } @@ -144673,14 +146275,20 @@ proto.draw = function() { // Remove hover effects if we're not over a point OR // if we're zooming or panning (in which case result is not set) - if(!result && this.lastPickResult) { + if(!result) { + this.unhover(); + } + + glplot.draw(); +}; + +proto.unhover = function() { + if(this.lastPickResult) { this.spikes.update({}); this.lastPickResult = null; this.graphDiv.emit('plotly_unhover'); Fx.loneUnhover(this.svgContainer); } - - glplot.draw(); }; proto.hoverFormatter = function(axisName, val) { @@ -144690,7 +146298,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/fx":631,"../../lib/html2unicode":707,"../../lib/show_no_webgl_msg":725,"../../plots/cartesian/axes":748,"../../plots/cartesian/constraints":755,"../../registry":826,"./camera":786,"./convert":787,"gl-plot2d":214,"gl-select-box":248,"gl-spikes2d":257,"webgl-context":555}],790:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib/html2unicode":719,"../../lib/show_no_webgl_msg":737,"../../plots/cartesian/axes":760,"../../plots/cartesian/constraints":767,"../../registry":838,"./camera":798,"./convert":799,"gl-plot2d":217,"gl-select-box":251,"gl-spikes2d":260,"webgl-context":559}],802:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144707,6 +146315,7 @@ var now = require('right-now'); var createView = require('3d-view'); var mouseChange = require('mouse-change'); var mouseWheel = require('mouse-wheel'); +var mouseOffset = require('mouse-event-offset'); function createCamera(element, options) { element = element || document.body; @@ -144872,8 +146481,24 @@ function createCamera(element, options) { return false; }); - var lastX = 0, lastY = 0; - mouseChange(element, function(buttons, x, y, mods) { + var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}; + mouseChange(element, handleInteraction); + + // enable simple touch interactions + element.addEventListener('touchstart', function(ev) { + var xy = mouseOffset(ev.changedTouches[0], element); + handleInteraction(0, xy[0], xy[1], lastMods); + handleInteraction(1, xy[0], xy[1], lastMods); + }); + element.addEventListener('touchmove', function(ev) { + var xy = mouseOffset(ev.changedTouches[0], element); + handleInteraction(1, xy[0], xy[1], lastMods); + }); + element.addEventListener('touchend', function() { + handleInteraction(0, lastX, lastY, lastMods); + }); + + function handleInteraction(buttons, x, y, mods) { var keyBindingMode = camera.keyBindingMode; if(keyBindingMode === false) return; @@ -144918,9 +146543,10 @@ function createCamera(element, options) { lastX = x; lastY = y; + lastMods = mods; return true; - }); + } mouseWheel(element, function(dx, dy) { if(camera.keyBindingMode === false) return; @@ -144939,7 +146565,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":35,"mouse-change":445,"mouse-wheel":448,"right-now":494}],791:[function(require,module,exports){ +},{"3d-view":35,"mouse-change":448,"mouse-event-offset":449,"mouse-wheel":451,"right-now":498}],803:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145015,6 +146641,12 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) if(!newFullLayout[oldSceneKey] && !!oldFullLayout[oldSceneKey]._scene) { oldFullLayout[oldSceneKey]._scene.destroy(); + + if(oldFullLayout._infolayer) { + oldFullLayout._infolayer + .selectAll('.annotation-' + oldSceneKey) + .remove(); + } } } }; @@ -145056,7 +146688,7 @@ exports.cleanId = function cleanId(id) { return 'scene' + sceneNum; }; -},{"../../constants/xmlns_namespaces":692,"../../lib":709,"../plots":811,"./layout/attributes":792,"./layout/defaults":796,"./layout/layout_attributes":797,"./scene":801}],792:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../../lib":721,"../plots":823,"./layout/attributes":804,"./layout/defaults":808,"./layout/layout_attributes":809,"./scene":813}],804:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145084,7 +146716,7 @@ module.exports = { } }; -},{}],793:[function(require,module,exports){ +},{}],805:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145201,7 +146833,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":590,"../../../lib/extend":701,"../../cartesian/layout_attributes":759}],794:[function(require,module,exports){ +},{"../../../components/color":600,"../../../lib/extend":713,"../../cartesian/layout_attributes":771}],806:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145273,7 +146905,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":709,"../../cartesian/axis_defaults":750,"../../cartesian/type_defaults":770,"./axis_attributes":793,"tinycolor2":526}],795:[function(require,module,exports){ +},{"../../../lib":721,"../../cartesian/axis_defaults":762,"../../cartesian/type_defaults":782,"./axis_attributes":805,"tinycolor2":530}],807:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145436,7 +147068,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":707,"../../../lib/str2rgbarray":727}],796:[function(require,module,exports){ +},{"../../../lib/html2unicode":719,"../../../lib/str2rgbarray":739}],808:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145450,10 +147082,11 @@ module.exports = createAxesOptions; var Lib = require('../../../lib'); var Color = require('../../../components/color'); +var Registry = require('../../../registry'); var handleSubplotDefaults = require('../../subplot_defaults'); -var layoutAttributes = require('./layout_attributes'); var supplyGl3dAxisLayoutDefaults = require('./axis_defaults'); +var layoutAttributes = require('./layout_attributes'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { @@ -145472,6 +147105,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { type: 'gl3d', attributes: layoutAttributes, handleDefaults: handleGl3dDefaults, + fullLayout: layoutOut, font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, @@ -145536,11 +147170,15 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { calendar: opts.calendar }); + Registry.getComponentMethod('annotations3d', 'handleDefaults')( + sceneLayoutIn, sceneLayoutOut, opts + ); + coerce('dragmode', opts.getDfltFromLayout('dragmode')); coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":590,"../../../lib":709,"../../subplot_defaults":818,"./axis_defaults":794,"./layout_attributes":797}],797:[function(require,module,exports){ +},{"../../../components/color":600,"../../../lib":721,"../../../registry":838,"../../subplot_defaults":830,"./axis_defaults":806,"./layout_attributes":809}],809:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145576,6 +147214,8 @@ function makeVector(x, y, z) { } module.exports = { + _arrayAttrRegexps: [/^scene([2-9]|[1-9][0-9]+)?\.annotations/], + bgcolor: { valType: 'color', role: 'style', @@ -145710,7 +147350,7 @@ module.exports = { } }; -},{"../../../lib/extend":701,"./axis_attributes":793}],798:[function(require,module,exports){ +},{"../../../lib/extend":713,"./axis_attributes":805}],810:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145762,7 +147402,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":727}],799:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":739}],811:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145858,7 +147498,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":709,"../../../lib/html2unicode":707,"../../cartesian/axes":748}],800:[function(require,module,exports){ +},{"../../../lib":721,"../../../lib/html2unicode":719,"../../cartesian/axes":760}],812:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145892,7 +147532,7 @@ function project(camera, v) { module.exports = project; -},{}],801:[function(require,module,exports){ +},{}],813:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145907,6 +147547,7 @@ module.exports = project; var createPlot = require('gl-plot3d'); var getContext = require('webgl-context'); +var Registry = require('../../registry'); var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); @@ -145924,7 +147565,6 @@ var computeTickMarks = require('./layout/tick_marks'); var STATIC_CANVAS, STATIC_CONTEXT; function render(scene) { - var trace; // update size of svg container @@ -145962,8 +147602,8 @@ function render(scene) { if(lastPicked !== null) { var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate); trace = lastPicked.data; - var hoverinfo = trace.hoverinfo; var ptNumber = selection.index; + var hoverinfo = Fx.castHoverinfo(trace, scene.fullLayout, ptNumber); var xVal = formatter('xaxis', selection.traceCoordinate[0]), yVal = formatter('yaxis', selection.traceCoordinate[1]), @@ -145993,22 +147633,25 @@ function render(scene) { fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') }, { - container: svgContainer + container: svgContainer, + gd: scene.graphDiv }); } - var eventData = { - points: [{ - x: selection.traceCoordinate[0], - y: selection.traceCoordinate[1], - z: selection.traceCoordinate[2], - data: trace._input, - fullData: trace, - curveNumber: trace.index, - pointNumber: ptNumber - }] + var pointData = { + x: selection.traceCoordinate[0], + y: selection.traceCoordinate[1], + z: selection.traceCoordinate[2], + data: trace._input, + fullData: trace, + curveNumber: trace.index, + pointNumber: ptNumber }; + Fx.appendArrayPointValue(pointData, trace, ptNumber); + + var eventData = {points: [pointData]}; + if(selection.buttons && selection.distance < 5) { scene.graphDiv.emit('plotly_click', eventData); } @@ -146022,6 +147665,8 @@ function render(scene) { Fx.loneUnhover(svgContainer); scene.graphDiv.emit('plotly_unhover', oldEventData); } + + scene.drawAnnotations(scene); } function initializeGLPlot(scene, fullLayout, canvas, gl) { @@ -146074,7 +147719,7 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) { if(scene.fullSceneLayout.dragmode === false) return; var update = {}; - update[scene.id] = getLayoutCamera(scene.camera); + update[scene.id + '.camera'] = getLayoutCamera(scene.camera); scene.saveCamera(scene.graphDiv.layout); scene.graphDiv.emit('plotly_relayout', update); }; @@ -146164,6 +147809,9 @@ function Scene(options, fullLayout) { this.contourLevels = [ [], [], [] ]; + this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert'); + this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw'); + if(!initializeGLPlot(this, fullLayout)) return; // todo check the necessity for this line } @@ -146288,6 +147936,9 @@ proto.plot = function(sceneData, fullLayout, layout) { // Save scale this.dataScale = dataScale; + // after computeTraceBounds where ax._categories are filled in + this.convertAnnotations(this); + // Update traces for(i = 0; i < sceneData.length; ++i) { data = sceneData[i]; @@ -146347,13 +147998,28 @@ proto.plot = function(sceneData, fullLayout, layout) { if(axis.autorange) { sceneBounds[0][i] = Infinity; sceneBounds[1][i] = -Infinity; - for(j = 0; j < this.glplot.objects.length; ++j) { - var objBounds = this.glplot.objects[j].bounds; - sceneBounds[0][i] = Math.min(sceneBounds[0][i], - objBounds[0][i] / dataScale[i]); - sceneBounds[1][i] = Math.max(sceneBounds[1][i], - objBounds[1][i] / dataScale[i]); + + var objects = this.glplot.objects; + var annotations = this.fullSceneLayout.annotations || []; + var axLetter = axis._name.charAt(0); + + for(j = 0; j < objects.length; j++) { + var objBounds = objects[j].bounds; + sceneBounds[0][i] = Math.min(sceneBounds[0][i], objBounds[0][i] / dataScale[i]); + sceneBounds[1][i] = Math.max(sceneBounds[1][i], objBounds[1][i] / dataScale[i]); + } + + for(j = 0; j < annotations.length; j++) { + var ann = annotations[j]; + + // N.B. not taking into consideration the arrowhead + if(ann.visible) { + var pos = axis.r2l(ann[axLetter]); + sceneBounds[0][i] = Math.min(sceneBounds[0][i], pos); + sceneBounds[1][i] = Math.max(sceneBounds[1][i], pos); + } } + if('rangemode' in axis && axis.rangemode === 'tozero') { sceneBounds[0][i] = Math.min(sceneBounds[0][i], 0); sceneBounds[1][i] = Math.max(sceneBounds[1][i], 0); @@ -146367,9 +148033,9 @@ proto.plot = function(sceneData, fullLayout, layout) { sceneBounds[1][i] += d / 32.0; } } else { - var range = fullSceneLayout[axisProperties[i]].range; - sceneBounds[0][i] = range[0]; - sceneBounds[1][i] = range[1]; + var range = axis.range; + sceneBounds[0][i] = axis.r2l(range[0]); + sceneBounds[1][i] = axis.r2l(range[1]); } if(sceneBounds[0][i] === sceneBounds[1][i]) { sceneBounds[0][i] -= 1; @@ -146611,7 +148277,7 @@ proto.toImage = function(format) { }; proto.setConvert = function() { - for(var i = 0; i < 3; ++i) { + for(var i = 0; i < 3; i++) { var ax = this.fullSceneLayout[axisProperties[i]]; Axes.setConvert(ax, this.fullLayout); ax.setScale = Lib.noop; @@ -146620,7 +148286,7 @@ proto.setConvert = function() { module.exports = Scene; -},{"../../components/fx":631,"../../lib":709,"../../lib/show_no_webgl_msg":725,"../../lib/str2rgbarray":727,"../../plots/cartesian/axes":748,"./camera":790,"./layout/convert":795,"./layout/spikes":798,"./layout/tick_marks":799,"./project":800,"gl-plot3d":216,"webgl-context":555}],802:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib":721,"../../lib/show_no_webgl_msg":737,"../../lib/str2rgbarray":739,"../../plots/cartesian/axes":760,"../../registry":838,"./camera":802,"./layout/convert":807,"./layout/spikes":810,"./layout/tick_marks":811,"./project":812,"gl-plot3d":219,"webgl-context":559}],814:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146795,7 +148461,7 @@ module.exports = { } }; -},{"../components/color/attributes":589,"../lib":709,"./font_attributes":772}],803:[function(require,module,exports){ +},{"../components/color/attributes":599,"../lib":721,"./font_attributes":784}],815:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146825,7 +148491,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],804:[function(require,module,exports){ +},{}],816:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146899,7 +148565,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":709}],805:[function(require,module,exports){ +},{"../../lib":721}],817:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -147047,7 +148713,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":692,"../plots":811,"./constants":803,"./layout_attributes":807,"./layout_defaults":808,"./mapbox":809,"mapbox-gl":336}],806:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../plots":823,"./constants":815,"./layout_attributes":819,"./layout_defaults":820,"./mapbox":821,"mapbox-gl":339}],818:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -147272,7 +148938,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":709,"./convert_text_opts":804}],807:[function(require,module,exports){ +},{"../../lib":721,"./convert_text_opts":816}],819:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -147540,7 +149206,7 @@ module.exports = { }; -},{"../../components/color":590,"../../lib":709,"../../traces/scatter/attributes":1008,"../font_attributes":772}],808:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../traces/scatter/attributes":1022,"../font_attributes":784}],820:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -147636,7 +149302,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":709,"../subplot_defaults":818,"./layout_attributes":807}],809:[function(require,module,exports){ +},{"../../lib":721,"../subplot_defaults":830,"./layout_attributes":819}],821:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -148100,7 +149766,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../components/fx":631,"../../lib":709,"./constants":803,"./layers":806,"./layout_attributes":807,"mapbox-gl":336}],810:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib":721,"./constants":815,"./layers":818,"./layout_attributes":819,"mapbox-gl":339}],822:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -148138,7 +149804,7 @@ module.exports = { } }; -},{}],811:[function(require,module,exports){ +},{}],823:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -148154,6 +149820,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -148646,12 +150313,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -148976,12 +150669,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -148994,7 +150687,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -149927,6 +151623,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -150142,7 +151842,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -150163,6 +151869,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -150210,25 +151917,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -150237,11 +151930,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -150314,7 +152003,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":590,"../components/errorbars":620,"../constants/numerical":690,"../lib":709,"../plotly":743,"../registry":826,"./animation_attributes":744,"./attributes":746,"./command":771,"./font_attributes":772,"./frame_attributes":773,"./layout_attributes":802,"d3":118,"fast-isnumeric":127}],812:[function(require,module,exports){ +},{"../components/color":600,"../components/errorbars":630,"../constants/numerical":702,"../lib":721,"../plot_api/plot_schema":749,"../plotly":755,"../registry":838,"./animation_attributes":756,"./attributes":758,"./command":783,"./font_attributes":784,"./frame_attributes":785,"./layout_attributes":814,"d3":120,"fast-isnumeric":129}],824:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150339,7 +152028,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":1008}],813:[function(require,module,exports){ +},{"../../traces/scatter/attributes":1022}],825:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150489,7 +152178,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../cartesian/layout_attributes":759}],814:[function(require,module,exports){ +},{"../../lib/extend":713,"../cartesian/layout_attributes":771}],826:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150504,7 +152193,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":815,"./micropolar_manager":816}],815:[function(require,module,exports){ +},{"./micropolar":827,"./micropolar_manager":828}],827:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151923,7 +153612,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":709,"d3":118}],816:[function(require,module,exports){ +},{"../../lib":721,"d3":120}],828:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152009,7 +153698,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":590,"../../lib":709,"./micropolar":815,"./undo_manager":817,"d3":118}],817:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"./micropolar":827,"./undo_manager":829,"d3":120}],829:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152075,7 +153764,7 @@ module.exports = function UndoManager() { }; }; -},{}],818:[function(require,module,exports){ +},{}],830:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152150,7 +153839,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":709,"./plots":811}],819:[function(require,module,exports){ +},{"../lib":721,"./plots":823}],831:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152224,7 +153913,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":811,"./layout/attributes":820,"./layout/defaults":823,"./layout/layout_attributes":824,"./ternary":825}],820:[function(require,module,exports){ +},{"../../plots/plots":823,"./layout/attributes":832,"./layout/defaults":835,"./layout/layout_attributes":836,"./ternary":837}],832:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152250,7 +153939,7 @@ module.exports = { } }; -},{}],821:[function(require,module,exports){ +},{}],833:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152315,7 +154004,7 @@ module.exports = { } }; -},{"../../../lib/extend":701,"../../cartesian/layout_attributes":759}],822:[function(require,module,exports){ +},{"../../../lib/extend":713,"../../cartesian/layout_attributes":771}],834:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152399,7 +154088,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":709,"../../cartesian/tick_label_defaults":766,"../../cartesian/tick_mark_defaults":767,"../../cartesian/tick_value_defaults":768,"./axis_attributes":821,"tinycolor2":526}],823:[function(require,module,exports){ +},{"../../../lib":721,"../../cartesian/tick_label_defaults":778,"../../cartesian/tick_mark_defaults":779,"../../cartesian/tick_value_defaults":780,"./axis_attributes":833,"tinycolor2":530}],835:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152462,7 +154151,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":590,"../../subplot_defaults":818,"./axis_defaults":822,"./layout_attributes":824}],824:[function(require,module,exports){ +},{"../../../components/color":600,"../../subplot_defaults":830,"./axis_defaults":834,"./layout_attributes":836}],836:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152527,7 +154216,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":589,"./axis_attributes":821}],825:[function(require,module,exports){ +},{"../../../components/color/attributes":599,"./axis_attributes":833}],837:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153161,7 +154850,7 @@ proto.initInteractions = function() { }; dragger.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, _this.id); }; dragElement.init(dragOptions); @@ -153173,7 +154862,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":590,"../../components/dragelement":611,"../../components/drawing":614,"../../components/fx":631,"../../components/titles":679,"../../lib":709,"../../lib/extend":701,"../../plotly":743,"../cartesian/axes":748,"../cartesian/constants":753,"../cartesian/select":764,"../cartesian/set_convert":765,"../plots":811,"d3":118,"tinycolor2":526}],826:[function(require,module,exports){ +},{"../../components/color":600,"../../components/dragelement":621,"../../components/drawing":624,"../../components/fx":641,"../../components/titles":689,"../../lib":721,"../../lib/extend":713,"../../plotly":755,"../cartesian/axes":760,"../cartesian/constants":765,"../cartesian/select":776,"../cartesian/set_convert":777,"../plots":823,"d3":120,"tinycolor2":530}],838:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153364,7 +155053,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":712,"./lib/noop":716,"./lib/push_unique":720,"./plots/attributes":746}],827:[function(require,module,exports){ +},{"./lib/loggers":724,"./lib/noop":728,"./lib/push_unique":732,"./plots/attributes":758}],839:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153536,7 +155225,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":709,"../plots/plots":811}],828:[function(require,module,exports){ +},{"../lib":721,"../plots/plots":823}],840:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153602,7 +155291,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":709,"../plot_api/to_image":741,"./filesaver":829}],829:[function(require,module,exports){ +},{"../lib":721,"../plot_api/to_image":753,"./filesaver":841}],841:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153670,7 +155359,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],830:[function(require,module,exports){ +},{}],842:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153703,7 +155392,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],831:[function(require,module,exports){ +},{}],843:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153729,7 +155418,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":827,"./download":828,"./helpers":830,"./svgtoimg":832,"./toimage":833,"./tosvg":834}],832:[function(require,module,exports){ +},{"./cloneplot":839,"./download":840,"./helpers":842,"./svgtoimg":844,"./toimage":845,"./tosvg":846}],844:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153767,7 +155456,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -153860,7 +155549,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":709,"events":125}],833:[function(require,module,exports){ +},{"../lib":721,"events":127}],845:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153940,7 +155629,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":709,"../plotly":743,"./cloneplot":827,"./helpers":830,"./svgtoimg":832,"./tosvg":834,"events":125}],834:[function(require,module,exports){ +},{"../lib":721,"../plotly":755,"./cloneplot":839,"./helpers":842,"./svgtoimg":844,"./tosvg":846,"events":127}],846:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153954,12 +155643,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} + +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -154012,20 +155718,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -154033,10 +155741,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -154050,16 +155769,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":590,"../components/drawing":614,"../constants/xmlns_namespaces":692,"../lib/svg_text_utils":728,"d3":118}],835:[function(require,module,exports){ +},{"../components/color":600,"../components/drawing":624,"../constants/xmlns_namespaces":704,"d3":120}],847:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154092,7 +155811,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":709}],836:[function(require,module,exports){ +},{"../../lib":721}],848:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154242,7 +155961,7 @@ module.exports = { } }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/errorbars/attributes":616,"../../lib/extend":701,"../../plots/font_attributes":772,"../scatter/attributes":1008}],837:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/errorbars/attributes":626,"../../lib/extend":713,"../../plots/font_attributes":784,"../scatter/attributes":1022}],849:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154335,7 +156054,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"../../plots/cartesian/axes":748,"./arrays_to_calcdata":835,"fast-isnumeric":127}],838:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"../../plots/cartesian/axes":760,"./arrays_to_calcdata":847,"fast-isnumeric":129}],850:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154395,7 +156114,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":590,"../../components/errorbars/defaults":619,"../../lib":709,"../bar/style_defaults":847,"../scatter/xy_defaults":1030,"./attributes":836}],839:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars/defaults":629,"../../lib":721,"../bar/style_defaults":859,"../scatter/xy_defaults":1044,"./attributes":848}],851:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154507,7 +156226,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":590,"../../components/errorbars":620,"../../components/fx":631}],840:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars":630,"../../components/fx":641}],852:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154548,7 +156267,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":758,"../scatter/colorbar":1011,"./arrays_to_calcdata":835,"./attributes":836,"./calc":837,"./defaults":838,"./hover":839,"./layout_attributes":841,"./layout_defaults":842,"./plot":843,"./set_positions":844,"./style":846}],841:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../scatter/colorbar":1025,"./arrays_to_calcdata":847,"./attributes":848,"./calc":849,"./defaults":850,"./hover":851,"./layout_attributes":853,"./layout_defaults":854,"./plot":855,"./set_positions":856,"./style":858}],853:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154613,7 +156332,7 @@ module.exports = { } }; -},{}],842:[function(require,module,exports){ +},{}],854:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154671,7 +156390,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"./layout_attributes":841}],843:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"./layout_attributes":853}],855:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154813,22 +156532,17 @@ module.exports = function plot(gd, plotinfo, cdbar) { function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { function appendTextNode(bar, text, textFont) { var textSelection = bar.append('text') - // prohibit tex interpretation until we can handle - // tex and regular text together - .attr('data-notex', 1) .text(text) .attr({ 'class': 'bartext', transform: '', - 'data-bb': '', 'text-anchor': 'middle', - x: 0, - y: 0 + // prohibit tex interpretation until we can handle + // tex and regular text together + 'data-notex': 1 }) - .call(Drawing.font, textFont); - - textSelection.call(svgTextUtils.convertToTspans); - textSelection.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(Drawing.font, textFont) + .call(svgTextUtils.convertToTspans, gd); return textSelection; } @@ -155191,7 +156905,7 @@ function coerceColor(attributeDefinition, value, defaultValue) { attributeDefinition.dflt; } -},{"../../components/color":590,"../../components/drawing":614,"../../components/errorbars":620,"../../lib":709,"../../lib/svg_text_utils":728,"./attributes":836,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],844:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/errorbars":630,"../../lib":721,"../../lib/svg_text_utils":740,"./attributes":848,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],856:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155791,7 +157505,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../constants/numerical":690,"../../plots/cartesian/axes":748,"../../registry":826,"./sieve.js":845,"fast-isnumeric":127}],845:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../plots/cartesian/axes":760,"../../registry":838,"./sieve.js":857,"fast-isnumeric":129}],857:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155893,7 +157607,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":690,"../../lib":709}],846:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721}],858:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155963,15 +157677,12 @@ module.exports = function style(gd) { p.call(Color.stroke, lineColor); } }); - // TODO: text markers on bars, either extra text or just bar values - // d3.select(this).selectAll('text') - // .call(Drawing.textPointStyle,d.t||d[0].t); }); s.call(ErrorBars.style); }; -},{"../../components/color":590,"../../components/drawing":614,"../../components/errorbars":620,"d3":118}],847:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/errorbars":630,"d3":120}],859:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156008,7 +157719,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":590,"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603}],848:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613}],860:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156188,7 +157899,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../scatter/attributes":1008}],849:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../scatter/attributes":1022}],861:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156337,7 +158048,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"fast-isnumeric":127}],850:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"fast-isnumeric":129}],862:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156410,7 +158121,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../lib":709,"../../registry":826,"./attributes":848}],851:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../registry":838,"./attributes":860}],863:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156519,7 +158230,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":590,"../../components/fx":631,"../../lib":709,"../../plots/cartesian/axes":748}],852:[function(require,module,exports){ +},{"../../components/color":600,"../../components/fx":641,"../../lib":721,"../../plots/cartesian/axes":760}],864:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156565,7 +158276,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":758,"./attributes":848,"./calc":849,"./defaults":850,"./hover":851,"./layout_attributes":853,"./layout_defaults":854,"./plot":855,"./set_positions":856,"./style":857}],853:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":860,"./calc":861,"./defaults":862,"./hover":863,"./layout_attributes":865,"./layout_defaults":866,"./plot":867,"./set_positions":868,"./style":869}],865:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156616,7 +158327,7 @@ module.exports = { } }; -},{}],854:[function(require,module,exports){ +},{}],866:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156650,7 +158361,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":709,"../../registry":826,"./layout_attributes":853}],855:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838,"./layout_attributes":865}],867:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156890,7 +158601,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":614,"../../lib":709,"d3":118}],856:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"d3":120}],868:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156984,7 +158695,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826}],857:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838}],869:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157019,11 +158730,11 @@ module.exports = function style(gd) { }) .call(Color.stroke, trace.line.color); d3.select(this).selectAll('g.points path') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, gd); }); }; -},{"../../components/color":590,"../../components/drawing":614,"d3":118}],858:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"d3":120}],870:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157081,7 +158792,7 @@ module.exports = { whiskerwidth: Lib.extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }) }; -},{"../../lib":709,"../box/attributes":848,"../ohlc/attributes":967}],859:[function(require,module,exports){ +},{"../../lib":721,"../box/attributes":860,"../ohlc/attributes":981}],871:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157129,7 +158840,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor'); } -},{"../../lib":709,"../ohlc/direction_defaults":969,"../ohlc/helpers":970,"../ohlc/ohlc_defaults":972,"./attributes":858}],860:[function(require,module,exports){ +},{"../../lib":721,"../ohlc/direction_defaults":983,"../ohlc/helpers":984,"../ohlc/ohlc_defaults":986,"./attributes":870}],872:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157171,7 +158882,7 @@ module.exports = { register(require('../box')); register(require('./transform')); -},{"../../plot_api/register":738,"../../plots/cartesian":758,"../box":852,"./attributes":858,"./defaults":859,"./transform":861}],861:[function(require,module,exports){ +},{"../../plot_api/register":750,"../../plots/cartesian":770,"../box":864,"./attributes":870,"./defaults":871,"./transform":873}],873:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157183,6 +158894,8 @@ register(require('./transform')); 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); var helpers = require('../ohlc/helpers'); @@ -157289,7 +159002,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { }; for(var i = 0; i < len; i++) { - if(filterFn(open[i], close[i])) { + if(filterFn(open[i], close[i]) && isNumeric(high[i]) && isNumeric(low[i])) { appendX(i); appendY(open[i], high[i], low[i], close[i]); } @@ -157299,7 +159012,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { trace.y = y; }; -},{"../../lib":709,"../ohlc/helpers":970}],862:[function(require,module,exports){ +},{"../../lib":721,"../ohlc/helpers":984,"fast-isnumeric":129}],874:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157367,7 +159080,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { }); } -},{"./axis_defaults":867}],863:[function(require,module,exports){ +},{"./axis_defaults":879}],875:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157412,7 +159125,7 @@ function minMax(a, depth) { return [min, max]; } -},{}],864:[function(require,module,exports){ +},{}],876:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157535,7 +159248,7 @@ module.exports = { }, }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../../plots/font_attributes":772,"./axis_attributes":866}],865:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../../plots/font_attributes":784,"./axis_attributes":878}],877:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157640,7 +159353,7 @@ module.exports = function(carpet, carpetcd, a, b) { return segments; }; -},{}],866:[function(require,module,exports){ +},{}],878:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158087,7 +159800,7 @@ module.exports = { }, }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../../plots/font_attributes":772}],867:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../../plots/font_attributes":784}],879:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158320,7 +160033,7 @@ function setAutoType(ax, data) { ax.type = autoType(data, calendar); } -},{"../../components/color":590,"../../lib":709,"../../plots/cartesian/axis_autotype":749,"../../plots/cartesian/category_order_defaults":752,"../../plots/cartesian/ordered_categories":761,"../../plots/cartesian/set_convert":765,"../../plots/cartesian/tick_label_defaults":766,"../../plots/cartesian/tick_value_defaults":768,"../../registry":826,"./attributes":864}],868:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../plots/cartesian/axis_autotype":761,"../../plots/cartesian/category_order_defaults":764,"../../plots/cartesian/ordered_categories":773,"../../plots/cartesian/set_convert":777,"../../plots/cartesian/tick_label_defaults":778,"../../plots/cartesian/tick_value_defaults":780,"../../registry":838,"./attributes":876}],880:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158421,7 +160134,7 @@ module.exports = function calc(gd, trace) { return [t]; }; -},{"../../plots/cartesian/axes":748,"../heatmap/clean_2d_array":929,"./array_minmax":863,"./calc_clippath":869,"./calc_gridlines":870,"./calc_labels":871,"./cheater_basis":873,"./map_2d_array":885,"./smooth_fill_2d_array":889}],869:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../heatmap/clean_2d_array":941,"./array_minmax":875,"./calc_clippath":881,"./calc_gridlines":882,"./calc_labels":883,"./cheater_basis":885,"./map_2d_array":897,"./smooth_fill_2d_array":901}],881:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158473,7 +160186,7 @@ module.exports = function makeClipPath(xctrl, yctrl, aax, bax) { return segments; }; -},{}],870:[function(require,module,exports){ +},{}],882:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158816,7 +160529,7 @@ module.exports = function calcGridlines(trace, cd, axisLetter, crossAxisLetter) } }; -},{"../../lib/extend":701,"../../plots/cartesian/axes":748}],871:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/axes":760}],883:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158877,7 +160590,7 @@ module.exports = function calcLabels(trace, axis) { } }; -},{"../../lib/extend":701,"../../plots/cartesian/axes":748}],872:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/axes":760}],884:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158919,7 +160632,7 @@ module.exports = function makeControlPoints(p0, p1, p2, smoothness) { ]]; }; -},{}],873:[function(require,module,exports){ +},{}],885:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158987,7 +160700,7 @@ module.exports = function(a, b, cheaterslope) { return data; }; -},{"../../lib":709}],874:[function(require,module,exports){ +},{"../../lib":721}],886:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159339,7 +161052,7 @@ module.exports = function computeControlPoints(xe, ye, x, y, asmoothing, bsmooth return [xe, ye]; }; -},{"../../lib":709,"./catmull_rom":872}],875:[function(require,module,exports){ +},{"../../lib":721,"./catmull_rom":884}],887:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159355,7 +161068,7 @@ module.exports = { RELATIVE_CULL_TOLERANCE: 1e-6 }; -},{}],876:[function(require,module,exports){ +},{}],888:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159507,7 +161220,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { } }; -},{}],877:[function(require,module,exports){ +},{}],889:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159635,7 +161348,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { }; -},{}],878:[function(require,module,exports){ +},{}],890:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159786,7 +161499,7 @@ module.exports = function(arrays, na, nb, asmoothing, bsmoothing) { }; -},{}],879:[function(require,module,exports){ +},{}],891:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159848,7 +161561,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, dfltColor, fullLayou } }; -},{"../../components/color/attributes":589,"../../lib":709,"./ab_defaults":862,"./attributes":864,"./set_convert":888,"./xy_defaults":890}],880:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib":721,"./ab_defaults":874,"./attributes":876,"./set_convert":900,"./xy_defaults":902}],892:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159864,7 +161577,7 @@ module.exports = function(data) { return Array.isArray(data[0]); }; -},{}],881:[function(require,module,exports){ +},{}],893:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159902,7 +161615,7 @@ Carpet.meta = { module.exports = Carpet; -},{"../../plots/cartesian":758,"./attributes":864,"./calc":868,"./defaults":879,"./plot":887}],882:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":876,"./calc":880,"./defaults":891,"./plot":899}],894:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159938,7 +161651,7 @@ module.exports = function(gd, trace) { return firstAxis; }; -},{}],883:[function(require,module,exports){ +},{}],895:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159969,7 +161682,7 @@ module.exports = function makePath(xp, yp, isBicubic) { return path.join(isBicubic ? '' : 'L'); }; -},{}],884:[function(require,module,exports){ +},{}],896:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160004,7 +161717,7 @@ module.exports = function mapArray(out, data, func) { return out; }; -},{}],885:[function(require,module,exports){ +},{}],897:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160049,7 +161762,7 @@ module.exports = function mapArray(out, data, func) { return out; }; -},{}],886:[function(require,module,exports){ +},{}],898:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160091,7 +161804,7 @@ module.exports = function orientText(trace, xaxis, yaxis, xy, dxy, refDxy) { }; }; -},{}],887:[function(require,module,exports){ +},{}],899:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160108,6 +161821,7 @@ var Drawing = require('../../components/drawing'); var map1dArray = require('./map_1d_array'); var makepath = require('./makepath'); var orientText = require('./orient_text'); +var svgTextUtils = require('../../lib/svg_text_utils'); module.exports = function plot(gd, plotinfo, cdcarpet) { for(var i = 0; i < cdcarpet.length; i++) { @@ -160153,10 +161867,10 @@ function plotOne(gd, plotinfo, cd) { drawGridLines(xa, ya, boundaryLayer, aax, 'a-boundary', aax._boundarylines); drawGridLines(xa, ya, boundaryLayer, bax, 'b-boundary', bax._boundarylines); - var maxAExtent = drawAxisLabels(Drawing.tester, xa, ya, trace, t, labelLayer, aax._labels, 'a-label'); - var maxBExtent = drawAxisLabels(Drawing.tester, xa, ya, trace, t, labelLayer, bax._labels, 'b-label'); + var maxAExtent = drawAxisLabels(gd, xa, ya, trace, t, labelLayer, aax._labels, 'a-label'); + var maxBExtent = drawAxisLabels(gd, xa, ya, trace, t, labelLayer, bax._labels, 'b-label'); - drawAxisTitles(labelLayer, trace, t, xa, ya, maxAExtent, maxBExtent); + drawAxisTitles(gd, labelLayer, trace, t, xa, ya, maxAExtent, maxBExtent); // Swap for debugging in order to draw directly: // drawClipPath(trace, axisLayer, xa, ya); @@ -160227,7 +161941,7 @@ function drawGridLines(xaxis, yaxis, layer, axis, axisLetter, gridlines) { gridJoin.exit().remove(); } -function drawAxisLabels(tester, xaxis, yaxis, trace, t, layer, labels, labelClass) { +function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) { var labelJoin = layer.selectAll('text.' + labelClass).data(labels); labelJoin.enter().append('text') @@ -160246,20 +161960,26 @@ function drawAxisLabels(tester, xaxis, yaxis, trace, t, layer, labels, labelClas orientation = orientText(trace, xaxis, yaxis, label.xy, [Math.cos(angle), Math.sin(angle)]); } var direction = (label.endAnchor ? -1 : 1) * orientation.flip; - var bbox = Drawing.measureText(tester, label.text, label.font); - d3.select(this) - .attr('text-anchor', direction > 0 ? 'start' : 'end') + var labelEl = d3.select(this) + .attr({ + 'text-anchor': direction > 0 ? 'start' : 'end', + 'data-notex': 1 + }) + .call(Drawing.font, label.font) .text(label.text) - .attr('transform', + .call(svgTextUtils.convertToTspans, gd); + + var bbox = Drawing.bBox(this); + + labelEl.attr('transform', // Translate to the correct point: 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + // Rotate to line up with grid line tangent: 'rotate(' + orientation.angle + ')' + // Adjust the baseline and indentation: 'translate(' + label.axis.labelpadding * direction + ',' + bbox.height * 0.3 + ')' - ) - .call(Drawing.font, label.font.family, label.font.size, label.font.color); + ); maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding); }); @@ -160269,23 +161989,23 @@ function drawAxisLabels(tester, xaxis, yaxis, trace, t, layer, labels, labelClas return maxExtent; } -function drawAxisTitles(layer, trace, t, xa, ya, maxAExtent, maxBExtent) { +function drawAxisTitles(gd, layer, trace, t, xa, ya, maxAExtent, maxBExtent) { var a, b, xy, dxy; a = 0.5 * (trace.a[0] + trace.a[trace.a.length - 1]); b = trace.b[0]; xy = trace.ab2xy(a, b, true); dxy = trace.dxyda_rough(a, b); - drawAxisTitle(layer, trace, t, xy, dxy, trace.aaxis, xa, ya, maxAExtent, 'a-title'); + drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.aaxis, xa, ya, maxAExtent, 'a-title'); a = trace.a[0]; b = 0.5 * (trace.b[0] + trace.b[trace.b.length - 1]); xy = trace.ab2xy(a, b, true); dxy = trace.dxydb_rough(a, b); - drawAxisTitle(layer, trace, t, xy, dxy, trace.baxis, xa, ya, maxBExtent, 'b-title'); + drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.baxis, xa, ya, maxBExtent, 'b-title'); } -function drawAxisTitle(layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClass) { +function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClass) { var data = []; if(axis.title) data.push(axis.title); var titleJoin = layer.selectAll('text.' + labelClass).data(data); @@ -160308,6 +162028,7 @@ function drawAxisTitle(layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClas var el = d3.select(this); el.text(axis.title || '') + .call(svgTextUtils.convertToTspans, gd) .attr('transform', 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + 'rotate(' + orientation.angle + ') ' + @@ -160321,7 +162042,7 @@ function drawAxisTitle(layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClas titleJoin.exit().remove(); } -},{"../../components/drawing":614,"./makepath":883,"./map_1d_array":884,"./orient_text":886,"d3":118}],888:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib/svg_text_utils":740,"./makepath":895,"./map_1d_array":896,"./orient_text":898,"d3":120}],900:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160608,7 +162329,7 @@ module.exports = function setConvert(trace) { }; }; -},{"../../lib/search":723,"./compute_control_points":874,"./constants":875,"./create_i_derivative_evaluator":876,"./create_j_derivative_evaluator":877,"./create_spline_evaluator":878}],889:[function(require,module,exports){ +},{"../../lib/search":735,"./compute_control_points":886,"./constants":887,"./create_i_derivative_evaluator":888,"./create_j_derivative_evaluator":889,"./create_spline_evaluator":890}],901:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160831,7 +162552,7 @@ module.exports = function smoothFill2dArray(data, a, b) { return data; }; -},{"../../lib":709}],890:[function(require,module,exports){ +},{"../../lib":721}],902:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160869,7 +162590,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return true; }; -},{"../heatmap/convert_column_xyz":931,"./has_columns":880}],891:[function(require,module,exports){ +},{"../heatmap/convert_column_xyz":943,"./has_columns":892}],903:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160920,7 +162641,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../../plots/attributes":746,"../scattergeo/attributes":1045}],892:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../../plots/attributes":758,"../scattergeo/attributes":1059}],904:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160939,7 +162660,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":596}],893:[function(require,module,exports){ +},{"../../components/colorscale/calc":606}],905:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160990,11 +162711,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults( traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} ); - - coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":891}],894:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":903}],906:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161013,7 +162732,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],895:[function(require,module,exports){ +},{}],907:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161083,7 +162802,7 @@ function makeHoverInfo(pointData, trace, pt, axis) { pointData.extraText = text.join('
'); } -},{"../../plots/cartesian/axes":748,"./attributes":891}],896:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"./attributes":903}],908:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161120,7 +162839,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":776,"../heatmap/colorbar":930,"./attributes":891,"./calc":892,"./defaults":893,"./event_data":894,"./hover":895,"./plot":897}],897:[function(require,module,exports){ +},{"../../plots/geo":788,"../heatmap/colorbar":942,"./attributes":903,"./calc":904,"./defaults":905,"./event_data":906,"./hover":907,"./plot":909}],909:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161254,7 +162973,7 @@ function style(geo) { }); } -},{"../../components/color":590,"../../components/colorscale":604,"../../components/drawing":614,"../../lib/array_to_calc_item":695,"../../lib/geo_location_utils":704,"../../lib/topojson_utils":730,"../../plots/geo/constants":774,"d3":118}],898:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorscale":614,"../../components/drawing":624,"../../lib/array_to_calc_item":707,"../../lib/geo_location_utils":716,"../../lib/topojson_utils":742,"../../plots/geo/constants":786,"d3":120}],910:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161393,7 +163112,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../components/drawing/attributes":613,"../../lib/extend":701,"../heatmap/attributes":927,"../scatter/attributes":1008}],899:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../components/drawing/attributes":623,"../../lib/extend":713,"../heatmap/attributes":939,"../scatter/attributes":1022}],911:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161497,7 +163216,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":709,"../../plots/cartesian/axes":748,"../heatmap/calc":928}],900:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../heatmap/calc":940}],912:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161559,7 +163278,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../plots/plots":811,"./end_plus":904,"./make_color_map":908}],901:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../plots/plots":823,"./end_plus":916,"./make_color_map":920}],913:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161599,7 +163318,7 @@ module.exports.CHOOSESADDLE = { // substitute to be used up later? module.exports.SADDLEREMAINDER = {1: 4, 2: 8, 4: 1, 7: 13, 8: 2, 11: 14, 13: 7, 14: 11}; -},{}],902:[function(require,module,exports){ +},{}],914:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161631,7 +163350,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce) { if(autoContour || !contourSize) coerce('ncontours'); }; -},{"../../lib":709,"./attributes":898}],903:[function(require,module,exports){ +},{"../../lib":721,"./attributes":910}],915:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161670,7 +163389,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":709,"../heatmap/has_columns":934,"../heatmap/xyz_defaults":942,"./attributes":898,"./contours_defaults":902,"./style_defaults":912}],904:[function(require,module,exports){ +},{"../../lib":721,"../heatmap/has_columns":946,"../heatmap/xyz_defaults":954,"./attributes":910,"./contours_defaults":914,"./style_defaults":924}],916:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161690,7 +163409,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],905:[function(require,module,exports){ +},{}],917:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161965,7 +163684,7 @@ function getInterpPx(pi, loc, step) { } } -},{"../../lib":709,"./constants":901}],906:[function(require,module,exports){ +},{"../../lib":721,"./constants":913}],918:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161984,7 +163703,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":935}],907:[function(require,module,exports){ +},{"../heatmap/hover":947}],919:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162025,7 +163744,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":758,"./attributes":898,"./calc":899,"./colorbar":900,"./defaults":903,"./hover":906,"./plot":910,"./style":911}],908:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":910,"./calc":911,"./colorbar":912,"./defaults":915,"./hover":918,"./plot":922,"./style":923}],920:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162109,7 +163828,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":604,"./end_plus":904,"d3":118}],909:[function(require,module,exports){ +},{"../../components/colorscale":614,"./end_plus":916,"d3":120}],921:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162201,7 +163920,7 @@ function getMarchingIndex(val, corners) { return (mi === 15) ? 0 : mi; } -},{"./constants":901}],910:[function(require,module,exports){ +},{"./constants":913}],922:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162565,7 +164284,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":614,"../../lib":709,"../heatmap/plot":940,"./end_plus":904,"./find_all_paths":905,"./make_crossings":909,"d3":118}],911:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"../heatmap/plot":952,"./end_plus":916,"./find_all_paths":917,"./make_crossings":921,"d3":120}],923:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162627,7 +164346,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":614,"../heatmap/style":941,"./make_color_map":908,"d3":118}],912:[function(require,module,exports){ +},{"../../components/drawing":624,"../heatmap/style":953,"./make_color_map":920,"d3":120}],924:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162663,7 +164382,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, } }; -},{"../../components/colorscale/defaults":599}],913:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609}],925:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162887,7 +164606,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../heatmap/attributes":927,"../scatter/attributes":1008,"./constants":916}],914:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../heatmap/attributes":939,"../scatter/attributes":1022,"./constants":928}],926:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163103,7 +164822,7 @@ function heatmappishCalc(gd, trace) { return [cd0]; } -},{"../../components/colorscale/calc":596,"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"../carpet/lookup_carpetid":882,"../heatmap/clean_2d_array":929,"../heatmap/convert_column_xyz":931,"../heatmap/find_empties":933,"../heatmap/has_columns":934,"../heatmap/interp2d":937,"../heatmap/make_bound_array":938,"../heatmap/max_row_length":939,"./defaults":920}],915:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"../carpet/lookup_carpetid":894,"../heatmap/clean_2d_array":941,"../heatmap/convert_column_xyz":943,"../heatmap/find_empties":945,"../heatmap/has_columns":946,"../heatmap/interp2d":949,"../heatmap/make_bound_array":950,"../heatmap/max_row_length":951,"./defaults":932}],927:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163173,7 +164892,7 @@ module.exports = function(pathinfo, operation, perimeter, trace) { } }; -},{}],916:[function(require,module,exports){ +},{}],928:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163190,7 +164909,7 @@ module.exports = { SET_OPS: ['{}', '}{'] }; -},{}],917:[function(require,module,exports){ +},{}],929:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163278,7 +164997,7 @@ function makeInequalitySettings(operation) { }; } -},{"./constants":916,"fast-isnumeric":127}],918:[function(require,module,exports){ +},{"./constants":928,"fast-isnumeric":129}],930:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163339,7 +165058,7 @@ module.exports = function(coerce, contours) { contours.size = map.size; }; -},{"./constraint_mapping":917,"fast-isnumeric":127}],919:[function(require,module,exports){ +},{"./constraint_mapping":929,"fast-isnumeric":129}],931:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163428,7 +165147,7 @@ module.exports = function(pathinfo, operation) { } }; -},{"../../lib":709}],920:[function(require,module,exports){ +},{"../../lib":721}],932:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163582,7 +165301,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../lib":709,"../../plots/attributes":746,"../contour/style_defaults":912,"../heatmap/xyz_defaults":942,"../scatter/fillcolor_defaults":1015,"./attributes":913,"./constraint_value_defaults":918}],921:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../plots/attributes":758,"../contour/style_defaults":924,"../heatmap/xyz_defaults":954,"../scatter/fillcolor_defaults":1029,"./attributes":925,"./constraint_value_defaults":930}],933:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163631,7 +165350,7 @@ module.exports = function emptyPathinfo(contours, plotinfo, cd0) { return pathinfo; }; -},{"../../lib":709}],922:[function(require,module,exports){ +},{"../../lib":721}],934:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163667,7 +165386,7 @@ ContourCarpet.meta = { module.exports = ContourCarpet; -},{"../../plots/cartesian":758,"../contour/colorbar":900,"./attributes":913,"./calc":914,"./defaults":920,"./plot":925,"./style":926}],923:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../contour/colorbar":912,"./attributes":925,"./calc":926,"./defaults":932,"./plot":937,"./style":938}],935:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163803,7 +165522,7 @@ module.exports = function joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpe return fullpath; }; -},{"../../components/drawing":614,"../../lib":709,"../carpet/axis_aligned_line":865}],924:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"../carpet/axis_aligned_line":877}],936:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163840,7 +165559,7 @@ module.exports = function mapPathinfo(pathinfo, map) { } }; -},{}],925:[function(require,module,exports){ +},{}],937:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164076,7 +165795,7 @@ function makeFills(trace, plotgroup, xa, ya, pathinfo, perimeter, ab2p, carpet, }); } -},{"../../components/drawing":614,"../carpet/lookup_carpetid":882,"../carpet/makepath":883,"../carpet/map_1d_array":884,"../contour/find_all_paths":905,"../contour/make_crossings":909,"./close_boundaries":915,"./convert_to_constraints":919,"./empty_pathinfo":921,"./join_all_paths":923,"./map_pathinfo":924,"d3":118}],926:[function(require,module,exports){ +},{"../../components/drawing":624,"../carpet/lookup_carpetid":894,"../carpet/makepath":895,"../carpet/map_1d_array":896,"../contour/find_all_paths":917,"../contour/make_crossings":921,"./close_boundaries":927,"./convert_to_constraints":931,"./empty_pathinfo":933,"./join_all_paths":935,"./map_pathinfo":936,"d3":120}],938:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164141,7 +165860,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":614,"../contour/make_color_map":908,"../heatmap/style":941,"d3":118}],927:[function(require,module,exports){ +},{"../../components/drawing":624,"../contour/make_color_map":920,"../heatmap/style":953,"d3":120}],939:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164241,7 +165960,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../scatter/attributes":1008}],928:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../scatter/attributes":1022}],940:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164301,10 +166020,15 @@ module.exports = function calc(gd, trace) { z = binned.z; } else { - if(hasColumns(trace)) convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + if(hasColumns(trace)) { + convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + x = trace.x; + y = trace.y; + } else { + x = trace.x ? xa.makeCalcdata(trace, 'x') : []; + y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + } - x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace.y ? ya.makeCalcdata(trace, 'y') : []; x0 = trace.x0 || 0; dx = trace.dx || 1; y0 = trace.y0 || 0; @@ -164383,7 +166107,7 @@ module.exports = function calc(gd, trace) { return [cd0]; }; -},{"../../components/colorscale/calc":596,"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"../histogram2d/calc":956,"./clean_2d_array":929,"./convert_column_xyz":931,"./find_empties":933,"./has_columns":934,"./interp2d":937,"./make_bound_array":938,"./max_row_length":939}],929:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"../histogram2d/calc":968,"./clean_2d_array":941,"./convert_column_xyz":943,"./find_empties":945,"./has_columns":946,"./interp2d":949,"./make_bound_array":950,"./max_row_length":951}],941:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164428,7 +166152,7 @@ module.exports = function clean2dArray(zOld, transpose) { return zNew; }; -},{"fast-isnumeric":127}],930:[function(require,module,exports){ +},{"fast-isnumeric":129}],942:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164479,7 +166203,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],931:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],943:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164560,7 +166284,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, if(hasColumnText) trace.text = text; }; -},{"../../constants/numerical":690,"../../lib":709}],932:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721}],944:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164605,7 +166329,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":927,"./has_columns":934,"./xyz_defaults":942}],933:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":939,"./has_columns":946,"./xyz_defaults":954}],945:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164711,7 +166435,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"./max_row_length":939}],934:[function(require,module,exports){ +},{"./max_row_length":951}],946:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164727,7 +166451,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],935:[function(require,module,exports){ +},{}],947:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164844,7 +166568,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../components/fx":631,"../../lib":709}],936:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib":721}],948:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164899,7 +166623,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":758,"./attributes":927,"./calc":928,"./colorbar":930,"./defaults":932,"./hover":935,"./plot":940,"./style":941}],937:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":939,"./calc":940,"./colorbar":942,"./defaults":944,"./hover":947,"./plot":952,"./style":953}],949:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165031,7 +166755,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":709}],938:[function(require,module,exports){ +},{"../../lib":721}],950:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165113,7 +166837,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../registry":826}],939:[function(require,module,exports){ +},{"../../registry":838}],951:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165135,7 +166859,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],940:[function(require,module,exports){ +},{}],952:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165604,7 +167328,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale":604,"../../constants/xmlns_namespaces":692,"../../lib":709,"../../registry":826,"./max_row_length":939,"tinycolor2":526}],941:[function(require,module,exports){ +},{"../../components/colorscale":614,"../../constants/xmlns_namespaces":704,"../../lib":721,"../../registry":838,"./max_row_length":951,"tinycolor2":530}],953:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165625,7 +167349,7 @@ module.exports = function style(gd) { }); }; -},{"d3":118}],942:[function(require,module,exports){ +},{"d3":120}],954:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165720,7 +167444,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../registry":826,"./has_columns":934,"fast-isnumeric":127}],943:[function(require,module,exports){ +},{"../../registry":838,"./has_columns":946,"fast-isnumeric":129}],955:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165762,7 +167486,7 @@ extendFlat( module.exports = attrs; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../heatmap/attributes":927}],944:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../heatmap/attributes":939}],956:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165902,7 +167626,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":727,"../../plots/cartesian/axes":748,"gl-heatmap2d":161}],945:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"../../plots/cartesian/axes":760,"gl-heatmap2d":164}],957:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165935,7 +167659,7 @@ HeatmapGl.meta = { module.exports = HeatmapGl; -},{"../../plots/gl2d":788,"../heatmap/calc":928,"../heatmap/colorbar":930,"../heatmap/defaults":932,"./attributes":943,"./convert":944}],946:[function(require,module,exports){ +},{"../../plots/gl2d":800,"../heatmap/calc":940,"../heatmap/colorbar":942,"../heatmap/defaults":944,"./attributes":955,"./convert":956}],958:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166147,7 +167871,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":836}],947:[function(require,module,exports){ +},{"../bar/attributes":848}],959:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166173,7 +167897,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],948:[function(require,module,exports){ +},{}],960:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166206,7 +167930,7 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect return traceOut; }; -},{}],949:[function(require,module,exports){ +},{}],961:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166282,7 +168006,7 @@ module.exports = { } }; -},{"fast-isnumeric":127}],950:[function(require,module,exports){ +},{"fast-isnumeric":129}],962:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166513,7 +168237,7 @@ function cdf(size, direction, currentbin) { } } -},{"../../lib":709,"../../plots/cartesian/axes":748,"../bar/arrays_to_calcdata":835,"./average":947,"./bin_functions":949,"./clean_bins":951,"./norm_functions":954,"fast-isnumeric":127}],951:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../bar/arrays_to_calcdata":847,"./average":959,"./bin_functions":961,"./clean_bins":963,"./norm_functions":966,"fast-isnumeric":129}],963:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166590,7 +168314,7 @@ module.exports = function cleanBins(trace, ax, binDirection) { if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; }; -},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],952:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],964:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166652,7 +168376,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":590,"../../components/errorbars/defaults":619,"../../lib":709,"../../registry":826,"../bar/style_defaults":847,"./attributes":946,"./bin_defaults":948}],953:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars/defaults":629,"../../lib":721,"../../registry":838,"../bar/style_defaults":859,"./attributes":958,"./bin_defaults":960}],965:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166707,7 +168431,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":758,"../bar/hover":839,"../bar/layout_attributes":841,"../bar/layout_defaults":842,"../bar/plot":843,"../bar/set_positions":844,"../bar/style":846,"../scatter/colorbar":1011,"./attributes":946,"./calc":950,"./defaults":952}],954:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../bar/hover":851,"../bar/layout_attributes":853,"../bar/layout_defaults":854,"../bar/plot":855,"../bar/set_positions":856,"../bar/style":858,"../scatter/colorbar":1025,"./attributes":958,"./calc":962,"./defaults":964}],966:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166742,7 +168466,7 @@ module.exports = { } }; -},{}],955:[function(require,module,exports){ +},{}],967:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166794,7 +168518,7 @@ module.exports = extendFlat({}, { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../heatmap/attributes":927,"../histogram/attributes":946}],956:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../heatmap/attributes":939,"../histogram/attributes":958}],968:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166997,7 +168721,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../histogram/average":947,"../histogram/bin_functions":949,"../histogram/clean_bins":951,"../histogram/norm_functions":954}],957:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../histogram/average":959,"../histogram/bin_functions":961,"../histogram/clean_bins":963,"../histogram/norm_functions":966}],969:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167035,7 +168759,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout ); }; -},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":955,"./sample_defaults":959}],958:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":967,"./sample_defaults":971}],970:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167075,7 +168799,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":758,"../heatmap/calc":928,"../heatmap/colorbar":930,"../heatmap/hover":935,"../heatmap/plot":940,"../heatmap/style":941,"./attributes":955,"./defaults":957}],959:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../heatmap/calc":940,"../heatmap/colorbar":942,"../heatmap/hover":947,"../heatmap/plot":952,"../heatmap/style":953,"./attributes":967,"./defaults":969}],971:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167115,7 +168839,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../../registry":826,"../histogram/bin_defaults":948}],960:[function(require,module,exports){ +},{"../../registry":838,"../histogram/bin_defaults":960}],972:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167160,7 +168884,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../contour/attributes":898,"../histogram2d/attributes":955}],961:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../contour/attributes":910,"../histogram2d/attributes":967}],973:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167190,7 +168914,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":709,"../contour/contours_defaults":902,"../contour/style_defaults":912,"../histogram2d/sample_defaults":959,"./attributes":960}],962:[function(require,module,exports){ +},{"../../lib":721,"../contour/contours_defaults":914,"../contour/style_defaults":924,"../histogram2d/sample_defaults":971,"./attributes":972}],974:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167230,7 +168954,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":758,"../contour/calc":899,"../contour/colorbar":900,"../contour/hover":906,"../contour/plot":910,"../contour/style":911,"./attributes":960,"./defaults":961}],963:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../contour/calc":911,"../contour/colorbar":912,"../contour/hover":918,"../contour/plot":922,"../contour/style":923,"./attributes":972,"./defaults":973}],975:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167398,8 +169122,12 @@ module.exports = { width: extendFlat({}, surfaceAtts.contours.x.width) }, + cauto: colorscaleAttrs.zauto, + cmin: colorscaleAttrs.zmin, + cmax: colorscaleAttrs.zmax, colorscale: colorscaleAttrs.colorscale, reversescale: colorscaleAttrs.reversescale, + autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}), showscale: colorscaleAttrs.showscale, colorbar: colorbarAttrs, @@ -167428,7 +169156,76 @@ module.exports = { }, surfaceAtts.lighting) }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../surface/attributes":1071}],964:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../surface/attributes":1087}],976:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 colorscaleCalc = require('../../components/colorscale/calc'); + +module.exports = function calc(gd, trace) { + if(trace.intensity) { + colorscaleCalc(trace, trace.intensity, '', 'c'); + } +}; + +},{"../../components/colorscale/calc":606}],977:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Plots = require('../../plots/plots'); +var Colorscale = require('../../components/colorscale'); +var drawColorbar = require('../../components/colorbar/draw'); + +module.exports = function colorbar(gd, cd) { + var trace = cd[0].trace, + cbId = 'cb' + trace.uid, + cmin = trace.cmin, + cmax = trace.cmax, + vals = trace.intensity || []; + + if(!isNumeric(cmin)) cmin = Lib.aggNums(Math.min, null, vals); + if(!isNumeric(cmax)) cmax = Lib.aggNums(Math.max, null, vals); + + gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); + + if(!trace.showscale) { + Plots.autoMargin(gd, cbId); + return; + } + + var cb = cd[0].t.cb = drawColorbar(gd, cbId); + var sclFunc = Colorscale.makeColorScaleFunc( + Colorscale.extractScale( + trace.colorscale, + cmin, + cmax + ), + { noNumericCheck: true } + ); + + cb.fillcolor(sclFunc) + .filllevels({start: cmin, end: cmax, size: (cmax - cmin) / 254}) + .options(trace.colorbar)(); +}; + +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],978:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167555,6 +169352,7 @@ proto.update = function(data) { if(data.intensity) { this.color = '#fff'; config.vertexIntensity = data.intensity; + config.vertexIntensityBounds = [data.cmin, data.cmax]; config.colormap = parseColorScale(data.colorscale); } else if(data.vertexcolor) { @@ -167591,7 +169389,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":727,"alpha-shape":41,"convex-hull":99,"delaunay-triangulate":119,"gl-mesh3d":200,"tinycolor2":526}],965:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"alpha-shape":41,"convex-hull":101,"delaunay-triangulate":121,"gl-mesh3d":203,"tinycolor2":530}],979:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167605,10 +169403,9 @@ module.exports = createMesh3DTrace; var Registry = require('../../registry'); var Lib = require('../../lib'); -var colorbarDefaults = require('../../components/colorbar/defaults'); +var colorscaleDefaults = require('../../components/colorscale/defaults'); var attributes = require('./attributes'); - module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); @@ -167671,28 +169468,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if('intensity' in traceIn) { coerce('intensity'); - coerce('showscale', true); - } - else { + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); + } else { traceOut.showscale = false; if('facecolor' in traceIn) coerce('facecolor'); else if('vertexcolor' in traceIn) coerce('vertexcolor'); else coerce('color', defaultColor); } - - if(traceOut.reversescale) { - traceOut.colorscale = traceOut.colorscale.map(function(si) { - return [1 - si[0], si[1]]; - }).reverse(); - } - - if(traceOut.showscale) { - colorbarDefaults(traceIn, traceOut, layout); - } }; -},{"../../components/colorbar/defaults":592,"../../lib":709,"../../registry":826,"./attributes":963}],966:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"../../registry":838,"./attributes":975}],980:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167708,7 +169494,8 @@ var Mesh3D = {}; Mesh3D.attributes = require('./attributes'); Mesh3D.supplyDefaults = require('./defaults'); -Mesh3D.colorbar = require('../heatmap/colorbar'); +Mesh3D.calc = require('./calc'); +Mesh3D.colorbar = require('./colorbar'); Mesh3D.plot = require('./convert'); Mesh3D.moduleType = 'trace'; @@ -167728,7 +169515,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":791,"../heatmap/colorbar":930,"./attributes":963,"./convert":964,"./defaults":965}],967:[function(require,module,exports){ +},{"../../plots/gl3d":803,"./attributes":975,"./calc":976,"./colorbar":977,"./convert":978,"./defaults":979}],981:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167864,7 +169651,7 @@ module.exports = { } }; -},{"../../components/drawing/attributes":613,"../../lib":709,"../scatter/attributes":1008}],968:[function(require,module,exports){ +},{"../../components/drawing/attributes":623,"../../lib":721,"../scatter/attributes":1022}],982:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167913,7 +169700,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":709,"./attributes":967,"./direction_defaults":969,"./helpers":970,"./ohlc_defaults":972}],969:[function(require,module,exports){ +},{"../../lib":721,"./attributes":981,"./direction_defaults":983,"./helpers":984,"./ohlc_defaults":986}],983:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167939,7 +169726,7 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir coerce(direction + '.name', nameDflt); }; -},{}],970:[function(require,module,exports){ +},{}],984:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167951,6 +169738,8 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); // This routine gets called during the trace supply-defaults step. @@ -168037,14 +169826,38 @@ exports.makeTransform = function(traceIn, state, direction) { }; exports.getFilterFn = function(direction) { - switch(direction) { - case 'increasing': - return function(o, c) { return o <= c; }; + return new _getFilterFn(direction); +}; - case 'decreasing': - return function(o, c) { return o > c; }; +function _getFilterFn(direction) { + // we're optimists - before we have any changing data, assume increasing + var isPrevIncreasing = true; + var cPrev = null; + + function _isIncreasing(o, c) { + if(o === c) { + if(c > cPrev) { + isPrevIncreasing = true; // increasing + } else if(c < cPrev) { + isPrevIncreasing = false; // decreasing + } + // else isPrevIncreasing is not changed + } + else isPrevIncreasing = (o < c); + cPrev = c; + return isPrevIncreasing; } -}; + + function isIncreasing(o, c) { + return isNumeric(o) && isNumeric(c) && _isIncreasing(+o, +c); + } + + function isDecreasing(o, c) { + return isNumeric(o) && isNumeric(c) && !_isIncreasing(+o, +c); + } + + return direction === 'increasing' ? isIncreasing : isDecreasing; +} exports.addRangeSlider = function(data, layout) { var hasOneVisibleTrace = false; @@ -168062,7 +169875,7 @@ exports.addRangeSlider = function(data, layout) { } }; -},{"../../lib":709}],971:[function(require,module,exports){ +},{"../../lib":721,"fast-isnumeric":129}],985:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168104,7 +169917,7 @@ module.exports = { register(require('../scatter')); register(require('./transform')); -},{"../../plot_api/register":738,"../../plots/cartesian":758,"../scatter":1018,"./attributes":967,"./defaults":968,"./transform":973}],972:[function(require,module,exports){ +},{"../../plot_api/register":750,"../../plots/cartesian":770,"../scatter":1032,"./attributes":981,"./defaults":982,"./transform":987}],986:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168146,7 +169959,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { return len; }; -},{"../../registry":826}],973:[function(require,module,exports){ +},{"../../registry":838}],987:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168158,6 +169971,8 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); var helpers = require('./helpers'); var Axes = require('../../plots/cartesian/axes'); @@ -168344,7 +170159,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { }; for(var i = 0; i < len; i++) { - if(filterFn(open[i], close[i])) { + if(filterFn(open[i], close[i]) && isNumeric(high[i]) && isNumeric(low[i])) { appendX(i); appendY(open[i], high[i], low[i], close[i]); appendText(i, open[i], high[i], low[i], close[i]); @@ -168405,7 +170220,7 @@ function convertTickWidth(gd, xa, trace) { return minDiff * tickWidth; } -},{"../../lib":709,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_ids":751,"./helpers":970}],974:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_ids":763,"./helpers":984,"fast-isnumeric":129}],988:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168576,7 +170391,7 @@ module.exports = { ) }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/colorscale/scales":608,"../../lib/extend":701,"../../plots/cartesian/layout_attributes":759,"../../plots/font_attributes":772}],975:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/colorscale/scales":618,"../../lib/extend":713,"../../plots/cartesian/layout_attributes":771,"../../plots/font_attributes":784}],989:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168652,7 +170467,7 @@ exports.toSVG = function(gd) { }, 60); }; -},{"../../constants/xmlns_namespaces":692,"../../plots/plots":811,"./constants":978,"./plot":983,"d3":118}],976:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../../plots/plots":823,"./constants":992,"./plot":997,"d3":120}],990:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168683,7 +170498,7 @@ module.exports = function calc(gd, trace) { }]; }; -},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"../../lib":709}],977:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"../../lib":721}],991:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168737,7 +170552,7 @@ module.exports = function colorbar(gd, cd) { .options(line.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],978:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],992:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168774,7 +170589,7 @@ module.exports = { } }; -},{}],979:[function(require,module,exports){ +},{}],993:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168887,7 +170702,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceFont(coerce, 'rangefont', fontDflt); }; -},{"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603,"../../lib":709,"./attributes":974,"./constants":978}],980:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613,"../../lib":721,"./attributes":988,"./constants":992}],994:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168920,7 +170735,7 @@ Parcoords.meta = { module.exports = Parcoords; -},{"./attributes":974,"./base_plot":975,"./calc":976,"./colorbar":977,"./defaults":979,"./plot":983}],981:[function(require,module,exports){ +},{"./attributes":988,"./base_plot":989,"./calc":990,"./colorbar":991,"./defaults":993,"./plot":997}],995:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -169345,7 +171160,7 @@ module.exports = function(canvasGL, lines, canvasWidth, canvasHeight, initialDim }; }; -},{"./constants":978,"regl":491}],982:[function(require,module,exports){ +},{"./constants":992,"regl":495}],996:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170121,7 +171936,7 @@ module.exports = function(root, svg, styledData, layout, callbacks) { return tweakables; }; -},{"../../components/drawing":614,"../../lib":709,"./constants":978,"./lines":981,"d3":118}],983:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"./constants":992,"./lines":995,"d3":120}],997:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170241,7 +172056,7 @@ module.exports = function plot(gd, cdparcoords) { }); }; -},{"./parcoords":982}],984:[function(require,module,exports){ +},{"./parcoords":996}],998:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170491,7 +172306,7 @@ module.exports = { } }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/font_attributes":772}],985:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/font_attributes":784}],999:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170538,7 +172353,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":826}],986:[function(require,module,exports){ +},{"../../registry":838}],1000:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170690,7 +172505,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":590,"./helpers":988,"fast-isnumeric":127,"tinycolor2":526}],987:[function(require,module,exports){ +},{"../../components/color":600,"./helpers":1002,"fast-isnumeric":129,"tinycolor2":530}],1001:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170740,8 +172555,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); coerce('hovertext'); - coerce('hoverinfo', (layout._dataLength === 1) ? 'label+text+value+percent' : undefined); - if(textInfo && textInfo !== 'none') { var textPosition = coerce('textposition'), hasBoth = Array.isArray(textPosition) || textPosition === 'auto', @@ -170775,7 +172588,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":709,"./attributes":984}],988:[function(require,module,exports){ +},{"../../lib":721,"./attributes":998}],1002:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170804,7 +172617,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":709}],989:[function(require,module,exports){ +},{"../../lib":721}],1003:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170840,7 +172653,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":984,"./base_plot":985,"./calc":986,"./defaults":987,"./layout_attributes":990,"./layout_defaults":991,"./plot":992,"./style":993,"./style_one":994}],990:[function(require,module,exports){ +},{"./attributes":998,"./base_plot":999,"./calc":1000,"./defaults":1001,"./layout_attributes":1004,"./layout_defaults":1005,"./plot":1006,"./style":1007,"./style_one":1008}],1004:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170860,7 +172673,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],991:[function(require,module,exports){ +},{}],1005:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170882,7 +172695,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":709,"./layout_attributes":990}],992:[function(require,module,exports){ +},{"../../lib":721,"./layout_attributes":1004}],1006:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170974,9 +172787,9 @@ module.exports = function plot(gd, cdpie) { evt.originalEvent = d3.event; // in case fullLayout or fullData has changed without a replot - var fullLayout2 = gd._fullLayout, - trace2 = gd._fullData[trace.index], - hoverinfo = trace2.hoverinfo; + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; + var hoverinfo = Fx.castHoverinfo(trace2, fullLayout2, pt.i); if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; @@ -171009,8 +172822,6 @@ module.exports = function plot(gd, cdpie) { if(hoverinfo.indexOf('value') !== -1) thisText.push(helpers.formatPieValue(pt.v, separators)); if(hoverinfo.indexOf('percent') !== -1) thisText.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators)); - var hoverLabelOpts = trace2.hoverlabel; - Fx.loneHover({ x0: hoverCenterX - rInscribed * cd0.r, x1: hoverCenterX + rInscribed * cd0.r, @@ -171018,14 +172829,15 @@ module.exports = function plot(gd, cdpie) { text: thisText.join('
'), name: hoverinfo.indexOf('name') !== -1 ? trace2.name : undefined, idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', - color: pt.hbg || hoverLabelOpts.bgcolor || pt.color, - borderColor: pt.hbc || hoverLabelOpts.bordercolor, - fontFamily: pt.htf || hoverLabelOpts.font.family, - fontSize: pt.hts || hoverLabelOpts.font.size, - fontColor: pt.htc || hoverLabelOpts.font.color + color: Fx.castHoverOption(trace, pt.i, 'bgcolor') || pt.color, + borderColor: Fx.castHoverOption(trace, pt.i, 'bordercolor'), + fontFamily: Fx.castHoverOption(trace, pt.i, 'font.family'), + fontSize: Fx.castHoverOption(trace, pt.i, 'font.size'), + fontColor: Fx.castHoverOption(trace, pt.i, 'font.color') }, { container: fullLayout2._hoverlayer.node(), - outerContainer: fullLayout2._paper.node() + outerContainer: fullLayout2._paper.node(), + gd: gd }); Fx.hover(gd, evt, 'pie'); @@ -171137,15 +172949,11 @@ module.exports = function plot(gd, cdpie) { .attr({ 'class': 'slicetext', transform: '', - 'data-bb': '', - 'text-anchor': 'middle', - x: 0, - y: 0 + 'text-anchor': 'middle' }) .call(Drawing.font, textPosition === 'outside' ? trace.outsidetextfont : trace.insidetextfont) - .call(svgTextUtils.convertToTspans); - sliceText.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(svgTextUtils.convertToTspans, gd); // position the text relative to the slice // TODO: so far this only accounts for flat @@ -171160,7 +172968,6 @@ module.exports = function plot(gd, cdpie) { sliceText.call(Drawing.font, trace.outsidetextfont); if(trace.outsidetextfont.family !== trace.insidetextfont.family || trace.outsidetextfont.size !== trace.insidetextfont.size) { - sliceText.attr({'data-bb': ''}); textBB = Drawing.bBox(sliceText.node()); } transform = transformOutsideText(textBB, pt); @@ -171596,7 +173403,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":590,"../../components/drawing":614,"../../components/fx":631,"../../lib/svg_text_utils":728,"./helpers":988,"d3":118}],993:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/fx":641,"../../lib/svg_text_utils":740,"./helpers":1002,"d3":120}],1007:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171625,7 +173432,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":994,"d3":118}],994:[function(require,module,exports){ +},{"./style_one":1008,"d3":120}],1008:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171650,7 +173457,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":590}],995:[function(require,module,exports){ +},{"../../components/color":600}],1009:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171784,7 +173591,7 @@ module.exports = { } }; -},{"../scattergl/attributes":1052}],996:[function(require,module,exports){ +},{"../scattergl/attributes":1066}],1010:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172015,7 +173822,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":727,"../scatter/get_trace_color":1016,"gl-pointcloud2d":225}],997:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"../scatter/get_trace_color":1030,"gl-pointcloud2d":228}],1011:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172060,7 +173867,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { coerce('marker.border.arearatio'); }; -},{"../../lib":709,"./attributes":995}],998:[function(require,module,exports){ +},{"../../lib":721,"./attributes":1009}],1012:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172093,7 +173900,7 @@ pointcloud.meta = { module.exports = pointcloud; -},{"../../plots/gl2d":788,"../scatter3d/calc":1032,"./attributes":995,"./convert":996,"./defaults":997}],999:[function(require,module,exports){ +},{"../../plots/gl2d":800,"../scatter3d/calc":1046,"./attributes":1009,"./convert":1010,"./defaults":1011}],1013:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172302,7 +174109,7 @@ module.exports = { } }; -},{"../../components/color/attributes":589,"../../components/shapes/attributes":666,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/font_attributes":772}],1000:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../components/shapes/attributes":676,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/font_attributes":784}],1014:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172334,7 +174141,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":811,"./plot":1005}],1001:[function(require,module,exports){ +},{"../../plots/plots":823,"./plot":1019}],1015:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172387,7 +174194,7 @@ module.exports = function calc(gd, trace) { }]; }; -},{"../../lib":709,"strongly-connected-components":520}],1002:[function(require,module,exports){ +},{"../../lib":721,"strongly-connected-components":524}],1016:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172406,10 +174213,10 @@ module.exports = { forceIterations: 5, forceTicksPerFrame: 10, duration: 500, - ease: 'linear' + ease: 'cubic-in-out' }; -},{}],1003:[function(require,module,exports){ +},{}],1017:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172427,7 +174234,6 @@ var Color = require('../../components/color'); var tinycolor = require('tinycolor2'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } @@ -172457,8 +174263,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'rgba(0, 0, 0, 0.2)'; })); - coerce('hoverinfo', layout._dataLength === 1 ? 'label+text+value+percent' : undefined); - coerce('domain.x'); coerce('domain.y'); coerce('orientation'); @@ -172478,7 +174282,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../components/color/attributes":589,"../../lib":709,"./attributes":999,"tinycolor2":526}],1004:[function(require,module,exports){ +},{"../../components/color":600,"../../components/color/attributes":599,"../../lib":721,"./attributes":1013,"tinycolor2":530}],1018:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172510,7 +174314,7 @@ Plot.meta = { module.exports = Plot; -},{"./attributes":999,"./base_plot":1000,"./calc":1001,"./defaults":1003,"./plot":1005}],1005:[function(require,module,exports){ +},{"./attributes":1013,"./base_plot":1014,"./calc":1015,"./defaults":1017,"./plot":1019}],1019:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172668,7 +174472,8 @@ module.exports = function plot(gd, calcData) { idealAlign: d3.event.x < hoverCenterX ? 'right' : 'left' }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); makeTranslucent(tooltip, 0.65); @@ -172723,7 +174528,8 @@ module.exports = function plot(gd, calcData) { idealAlign: 'left' }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); makeTranslucent(tooltip, 0.85); @@ -172770,7 +174576,7 @@ module.exports = function plot(gd, calcData) { ); }; -},{"../../components/color":590,"../../components/fx":631,"../../lib":709,"./render":1006,"d3":118}],1006:[function(require,module,exports){ +},{"../../components/color":600,"../../components/fx":641,"../../lib":721,"./render":1020,"d3":120}],1020:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172888,8 +174694,6 @@ function sankeyModel(layout, d, i) { node = sankeyNodes[n]; node.width = width; node.height = height; - if(node.parallel) node.x = (horizontal ? width : height) * node.parallel; - if(node.perpendicular) node.y = (horizontal ? height : width) * node.perpendicular; } switchToForceFormat(nodes); @@ -172953,9 +174757,7 @@ function nodeModel(uniqueKeys, d, n) { zoneThicknessPad = c.nodePadAcross, zoneLengthPad = d.nodePad / 2, visibleThickness = n.dx + 0.5, - visibleLength = n.dy - 0.5, - zoneThickness = visibleThickness + 2 * zoneThicknessPad, - zoneLength = visibleLength + 2 * zoneLengthPad; + visibleLength = n.dy - 0.5; var basicKey = n.label; var foundKey = uniqueKeys[basicKey]; @@ -172971,15 +174773,15 @@ function nodeModel(uniqueKeys, d, n) { nodeLineWidth: d.nodeLineWidth, textFont: d.textFont, size: d.horizontal ? d.height : d.width, - visibleWidth: Math.ceil(d.horizontal ? visibleThickness : visibleLength), - visibleHeight: Math.ceil(d.horizontal ? visibleLength : visibleThickness), - zoneX: d.horizontal ? -zoneThicknessPad : -zoneLengthPad, - zoneY: d.horizontal ? -zoneLengthPad : -zoneThicknessPad, - zoneWidth: d.horizontal ? zoneThickness : zoneLength, - zoneHeight: d.horizontal ? zoneLength : zoneThickness, + visibleWidth: Math.ceil(visibleThickness), + visibleHeight: Math.ceil(visibleLength), + zoneX: -zoneThicknessPad, + zoneY: -zoneLengthPad, + zoneWidth: visibleThickness + 2 * zoneThicknessPad, + zoneHeight: visibleLength + 2 * zoneLengthPad, labelY: d.horizontal ? n.dy / 2 + 1 : n.dx / 2 + 1, left: n.originalLayer === 1, - sizeAcross: d.horizontal ? d.width : d.height, + sizeAcross: d.width, forceLayouts: d.forceLayouts, horizontal: d.horizontal, darkBackground: tc.getBrightness() <= 128, @@ -172997,15 +174799,13 @@ function nodeModel(uniqueKeys, d, n) { // rendering snippets function crispLinesOnEnd(sankeyNode) { - d3.select(sankeyNode.node().parentElement).style('shape-rendering', 'crispEdges'); + d3.select(sankeyNode.node().parentNode).style('shape-rendering', 'crispEdges'); } function updateNodePositions(sankeyNode) { sankeyNode .attr('transform', function(d) { - return d.horizontal ? - 'translate(' + (d.node.x - 0.5) + ', ' + (d.node.y - d.node.dy / 2 + 0.5) + ')' : - 'translate(' + (d.node.y - d.node.dy / 2 - 0.5) + ', ' + (d.node.x + 0.5) + ')'; + return 'translate(' + (d.node.x - 0.5) + ', ' + (d.node.y - d.node.dy / 2 + 0.5) + ')'; }); } @@ -173018,7 +174818,7 @@ function linkPath(d) { } function updateNodeShapes(sankeyNode) { - d3.select(sankeyNode.node().parentElement).style('shape-rendering', 'optimizeSpeed'); + d3.select(sankeyNode.node().parentNode).style('shape-rendering', 'optimizeSpeed'); sankeyNode.call(updateNodePositions); } @@ -173032,20 +174832,28 @@ function sizeNode(rect) { .attr('height', function(d) {return d.visibleHeight;}); } -function salientEnough(d) { - return d.link.dy > 1 || d.linkLineWidth > 0; +function salientEnough(d) {return d.link.dy > 1 || d.linkLineWidth > 0;} + +function sankeyTransform(d) { + var offset = 'translate(' + d.translateX + ',' + d.translateY + ')'; + return offset + (d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)'); } -function linksTransform(d) { - return d.horizontal ? 'matrix(1,0,0,1,0,0)' : 'matrix(0,1,1,0,0,0)'; +function nodeCentering(d) { + return 'translate(' + (d.horizontal ? 0 : d.labelY) + ' ' + (d.horizontal ? d.labelY : 0) + ')'; } function textGuidePath(d) { return d3.svg.line()([ - [d.horizontal ? (d.left ? -d.sizeAcross : d.visibleWidth + c.nodeTextOffsetHorizontal) : c.nodeTextOffsetHorizontal, d.labelY], - [d.horizontal ? (d.left ? - c.nodeTextOffsetHorizontal : d.sizeAcross) : d.visibleWidth - c.nodeTextOffsetHorizontal, d.labelY] + [d.horizontal ? (d.left ? -d.sizeAcross : d.visibleWidth + c.nodeTextOffsetHorizontal) : c.nodeTextOffsetHorizontal, 0], + [d.horizontal ? (d.left ? - c.nodeTextOffsetHorizontal : d.sizeAcross) : d.visibleHeight - c.nodeTextOffsetHorizontal, 0] ]);} +function sankeyInverseTransform(d) {return d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)';} +function textFlip(d) {return d.horizontal ? 'scale(1 1)' : 'scale(-1 1)';} +function nodeTextColor(d) {return d.darkBackground && !d.horizontal ? 'rgb(255,255,255)' : 'rgb(0,0,0)';} +function nodeTextOffset(d) {return d.horizontal && d.left ? '100%' : '0%';} + // event handling function attachPointerEvents(selection, sankey, eventSet) { @@ -173084,7 +174892,7 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) { var dragBehavior = d3.behavior.drag() - .origin(function(d) {return d.horizontal ? d.node : {x: d.node.y, y: d.node.x};}) + .origin(function(d) {return d.node;}) .on('dragstart', function(d) { if(d.arrangement === 'fixed') return; @@ -173108,8 +174916,8 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) { .on('drag', function(d) { if(d.arrangement === 'fixed') return; - var x = d.horizontal ? d3.event.x : d3.event.y; - var y = d.horizontal ? d3.event.y : d3.event.x; + var x = d3.event.x; + var y = d3.event.y; if(d.arrangement === 'snap') { d.node.x = x; d.node.y = y; @@ -173205,10 +175013,12 @@ module.exports = function(svg, styledData, layout, callbacks) { .style('left', 0) .style('shape-rendering', 'geometricPrecision') .style('pointer-events', 'auto') - .style('box-sizing', 'content-box'); + .style('box-sizing', 'content-box') + .attr('transform', sankeyTransform); - sankey - .attr('transform', function(d) {return 'translate(' + d.translateX + ',' + d.translateY + ')';}); + sankey.transition() + .ease(c.ease).duration(c.duration) + .attr('transform', sankeyTransform); var sankeyLinks = sankey.selectAll('.sankeyLinks') .data(repeat, keyFun); @@ -173216,12 +175026,7 @@ module.exports = function(svg, styledData, layout, callbacks) { sankeyLinks.enter() .append('g') .classed('sankeyLinks', true) - .style('fill', 'none') - .style('transform', linksTransform); - - sankeyLinks.transition() - .ease(c.ease).duration(c.duration) - .style('transform', linksTransform); + .style('fill', 'none'); var sankeyLink = sankeyLinks.selectAll('.sankeyLink') .data(function(d) { @@ -173335,26 +175140,42 @@ module.exports = function(svg, styledData, layout, callbacks) { .attr('width', function(d) {return d.zoneWidth;}) .attr('height', function(d) {return d.zoneHeight;}); - var nodeLabelGuide = sankeyNode.selectAll('.nodeLabelGuide') + var nodeCentered = sankeyNode.selectAll('.nodeCentered') + .data(repeat); + + nodeCentered.enter() + .append('g') + .classed('nodeCentered', true) + .attr('transform', nodeCentering); + + nodeCentered + .transition() + .ease(c.ease).duration(c.duration) + .attr('transform', nodeCentering); + + var nodeLabelGuide = nodeCentered.selectAll('.nodeLabelGuide') .data(repeat); nodeLabelGuide.enter() .append('path') .classed('nodeLabelGuide', true) .attr('id', function(d) {return d.uniqueNodeLabelPathId;}) - .attr('d', textGuidePath); + .attr('d', textGuidePath) + .attr('transform', sankeyInverseTransform); nodeLabelGuide .transition() .ease(c.ease).duration(c.duration) - .attr('d', textGuidePath); + .attr('d', textGuidePath) + .attr('transform', sankeyInverseTransform); - var nodeLabel = sankeyNode.selectAll('.nodeLabel') + var nodeLabel = nodeCentered.selectAll('.nodeLabel') .data(repeat); nodeLabel.enter() .append('text') .classed('nodeLabel', true) + .attr('transform', textFlip) .style('user-select', 'none') .style('cursor', 'default') .style('fill', 'black'); @@ -173365,6 +175186,11 @@ module.exports = function(svg, styledData, layout, callbacks) { }) .each(function(d) {Drawing.font(nodeLabel, d.textFont);}); + nodeLabel + .transition() + .ease(c.ease).duration(c.duration) + .attr('transform', textFlip); + var nodeLabelTextPath = nodeLabel.selectAll('.nodeLabelTextPath') .data(repeat); @@ -173372,16 +175198,22 @@ module.exports = function(svg, styledData, layout, callbacks) { .append('textPath') .classed('nodeLabelTextPath', true) .attr('alignment-baseline', 'middle') - .attr('xlink:href', function(d) {return '#' + d.uniqueNodeLabelPathId;}); + .attr('xlink:href', function(d) {return '#' + d.uniqueNodeLabelPathId;}) + .attr('startOffset', nodeTextOffset) + .style('fill', nodeTextColor); nodeLabelTextPath .text(function(d) {return d.horizontal || d.node.dy > 5 ? d.node.label : '';}) - .attr('startOffset', function(d) {return d.horizontal && d.left ? '100%' : '0%';}) - .style('text-anchor', function(d) {return d.horizontal && d.left ? 'end' : 'start';}) - .style('fill', function(d) {return d.darkBackground && !d.horizontal ? 'white' : 'black';}); + .attr('text-anchor', function(d) {return d.horizontal && d.left ? 'end' : 'start';}); + + nodeLabelTextPath + .transition() + .ease(c.ease).duration(c.duration) + .attr('startOffset', nodeTextOffset) + .style('fill', nodeTextColor); }; -},{"../../components/color":590,"../../components/drawing":614,"../../lib":709,"./constants":1002,"@plotly/d3-sankey":36,"d3":118,"d3-force":114,"tinycolor2":526}],1007:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../lib":721,"./constants":1016,"@plotly/d3-sankey":36,"d3":120,"d3-force":116,"tinycolor2":530}],1021:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173433,7 +175265,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":709}],1008:[function(require,module,exports){ +},{"../../lib":721}],1022:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173493,10 +175325,6 @@ module.exports = { 'where `y0` is the starting coordinate and `dy` the step.' ].join(' ') }, - customdata: { - valType: 'data_array', - description: 'Assigns extra data to each scatter point DOM element' - }, dy: { valType: 'number', dflt: 1, @@ -173506,10 +175334,6 @@ module.exports = { 'See `y0` for more info.' ].join(' ') }, - ids: { - valType: 'data_array', - description: 'A list of keys for object constancy of data points during animation' - }, text: { valType: 'string', role: 'info', @@ -173829,7 +175653,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/drawing":614,"../../components/drawing/attributes":613,"../../components/errorbars/attributes":616,"../../lib/extend":701,"./constants":1013}],1009:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/drawing":624,"../../components/drawing/attributes":623,"../../components/errorbars/attributes":626,"../../lib/extend":713,"./constants":1027}],1023:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173960,7 +175784,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":690,"../../plots/cartesian/axes":748,"./arrays_to_calcdata":1007,"./colorscale_calc":1012,"./subtypes":1028,"fast-isnumeric":127}],1010:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../plots/cartesian/axes":760,"./arrays_to_calcdata":1021,"./colorscale_calc":1026,"./subtypes":1042,"fast-isnumeric":129}],1024:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173999,7 +175823,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],1011:[function(require,module,exports){ +},{}],1025:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174055,7 +175879,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],1012:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],1026:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174088,7 +175912,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"./subtypes":1028}],1013:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"./subtypes":1042}],1027:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174104,7 +175928,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],1014:[function(require,module,exports){ +},{}],1028:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174143,11 +175967,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -174186,7 +176008,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":619,"../../lib":709,"./attributes":1008,"./constants":1013,"./fillcolor_defaults":1015,"./line_defaults":1019,"./line_shape_defaults":1021,"./marker_defaults":1024,"./subtypes":1028,"./text_defaults":1029,"./xy_defaults":1030}],1015:[function(require,module,exports){ +},{"../../components/errorbars/defaults":629,"../../lib":721,"./attributes":1022,"./constants":1027,"./fillcolor_defaults":1029,"./line_defaults":1033,"./line_shape_defaults":1035,"./marker_defaults":1038,"./subtypes":1042,"./text_defaults":1043,"./xy_defaults":1044}],1029:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174224,7 +176046,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":590}],1016:[function(require,module,exports){ +},{"../../components/color":600}],1030:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174277,7 +176099,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":590,"./subtypes":1028}],1017:[function(require,module,exports){ +},{"../../components/color":600,"./subtypes":1042}],1031:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174304,11 +176126,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -174364,7 +176187,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -174448,7 +176271,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":590,"../../components/errorbars":620,"../../components/fx":631,"../../lib":709,"./get_trace_color":1016}],1018:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars":630,"../../components/fx":641,"../../lib":721,"./get_trace_color":1030}],1032:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174498,7 +176321,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":758,"./arrays_to_calcdata":1007,"./attributes":1008,"./calc":1009,"./clean_data":1010,"./colorbar":1011,"./defaults":1014,"./hover":1017,"./plot":1025,"./select":1026,"./style":1027,"./subtypes":1028}],1019:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./arrays_to_calcdata":1021,"./attributes":1022,"./calc":1023,"./clean_data":1024,"./colorbar":1025,"./defaults":1028,"./hover":1031,"./plot":1039,"./select":1040,"./style":1041,"./subtypes":1042}],1033:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174531,7 +176354,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603}],1020:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613}],1034:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174704,7 +176527,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":690}],1021:[function(require,module,exports){ +},{"../../constants/numerical":702}],1035:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174723,7 +176546,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],1022:[function(require,module,exports){ +},{}],1036:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174764,7 +176587,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],1023:[function(require,module,exports){ +},{}],1037:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174806,7 +176629,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":127}],1024:[function(require,module,exports){ +},{"fast-isnumeric":129}],1038:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174881,7 +176704,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603,"./subtypes":1028}],1025:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613,"./subtypes":1042}],1039:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175224,10 +177047,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -175238,7 +177063,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -175246,7 +177072,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -175303,17 +177130,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -175325,6 +177155,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -175344,6 +177176,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -175352,7 +177186,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -175429,7 +177263,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":614,"../../components/errorbars":620,"../../lib":709,"../../lib/polygon":719,"./line_points":1020,"./link_traces":1022,"./subtypes":1028,"d3":118}],1026:[function(require,module,exports){ +},{"../../components/drawing":624,"../../components/errorbars":630,"../../lib":721,"../../lib/polygon":731,"./line_points":1034,"./link_traces":1036,"./subtypes":1042,"d3":120}],1040:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175451,7 +177285,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -175475,11 +177308,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -175502,7 +177333,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":1028}],1027:[function(require,module,exports){ +},{"./subtypes":1042}],1041:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175533,10 +177364,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -175548,7 +177379,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":614,"../../components/errorbars":620,"d3":118}],1028:[function(require,module,exports){ +},{"../../components/drawing":624,"../../components/errorbars":630,"d3":120}],1042:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175584,7 +177415,7 @@ module.exports = { } }; -},{"../../lib":709}],1029:[function(require,module,exports){ +},{"../../lib":721}],1043:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175605,7 +177436,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":709}],1030:[function(require,module,exports){ +},{"../../lib":721}],1044:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175655,7 +177486,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":826}],1031:[function(require,module,exports){ +},{"../../registry":838}],1045:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175671,7 +177502,7 @@ var colorAttributes = require('../../components/colorscale/color_attributes'); var errorBarAttrs = require('../../components/errorbars/attributes'); var DASHES = require('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl3d_markers'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line, @@ -175835,7 +177666,7 @@ module.exports = { error_z: errorBarAttrs, }; -},{"../../components/colorscale/color_attributes":597,"../../components/errorbars/attributes":616,"../../constants/gl3d_dashes":687,"../../constants/gl_markers":688,"../../lib/extend":701,"../scatter/attributes":1008}],1032:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":607,"../../components/errorbars/attributes":626,"../../constants/gl3d_dashes":699,"../../constants/gl3d_markers":700,"../../lib/extend":713,"../scatter/attributes":1022}],1046:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175864,7 +177695,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012}],1033:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026}],1047:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175935,7 +177766,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":618}],1034:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":628}],1048:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175958,7 +177789,7 @@ var str2RgbaArray = require('../../lib/str2rgbarray'); var formatColor = require('../../lib/gl_format_color'); var makeBubbleSizeFn = require('../scatter/make_bubble_size_func'); var DASH_PATTERNS = require('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl3d_markers'); var calculateError = require('./calc_errors'); @@ -176406,7 +178237,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":687,"../../constants/gl_markers":688,"../../lib":709,"../../lib/gl_format_color":706,"../../lib/str2rgbarray":727,"../scatter/make_bubble_size_func":1023,"./calc_errors":1033,"delaunay-triangulate":119,"gl-error3d":157,"gl-line3d":167,"gl-mesh3d":200,"gl-scatter3d":246}],1035:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":699,"../../constants/gl3d_markers":700,"../../lib":721,"../../lib/gl_format_color":718,"../../lib/str2rgbarray":739,"../scatter/make_bubble_size_func":1037,"./calc_errors":1047,"delaunay-triangulate":121,"gl-error3d":159,"gl-line3d":170,"gl-mesh3d":203,"gl-scatter3d":249}],1049:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176496,7 +178327,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) { return len; } -},{"../../components/errorbars/defaults":619,"../../lib":709,"../../registry":826,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1031}],1036:[function(require,module,exports){ +},{"../../components/errorbars/defaults":629,"../../lib":721,"../../registry":838,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1045}],1050:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176511,7 +178342,7 @@ var Scatter3D = {}; Scatter3D.plot = require('./convert'); Scatter3D.attributes = require('./attributes'); -Scatter3D.markerSymbols = require('../../constants/gl_markers'); +Scatter3D.markerSymbols = require('../../constants/gl3d_markers'); Scatter3D.supplyDefaults = require('./defaults'); Scatter3D.colorbar = require('../scatter/colorbar'); Scatter3D.calc = require('./calc'); @@ -176534,7 +178365,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":688,"../../plots/gl3d":791,"../scatter/colorbar":1011,"./attributes":1031,"./calc":1032,"./convert":1034,"./defaults":1035}],1037:[function(require,module,exports){ +},{"../../constants/gl3d_markers":700,"../../plots/gl3d":803,"../scatter/colorbar":1025,"./attributes":1045,"./calc":1046,"./convert":1048,"./defaults":1049}],1051:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176654,12 +178485,12 @@ module.exports = { textfont: scatterAttrs.textfont, textposition: scatterAttrs.textposition, hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['a', 'b', 'c', 'text', 'name'] + flags: ['a', 'b', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1038:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1052:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176735,7 +178566,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":748,"../carpet/lookup_carpetid":882,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"../scatter/subtypes":1028,"fast-isnumeric":127}],1039:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../carpet/lookup_carpetid":894,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"../scatter/subtypes":1042,"fast-isnumeric":129}],1053:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176820,15 +178651,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } - coerce('hoverinfo', (layout._dataLength === 1) ? 'a+b+text' : undefined); - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { dfltHoverOn.push('fills'); } coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":709,"../scatter/constants":1013,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/line_shape_defaults":1021,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1037}],1040:[function(require,module,exports){ +},{"../../lib":721,"../scatter/constants":1027,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/line_shape_defaults":1035,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1051}],1054:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176905,7 +178734,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../scatter/hover":1017}],1041:[function(require,module,exports){ +},{"../scatter/hover":1031}],1055:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176941,7 +178770,7 @@ ScatterCarpet.meta = { module.exports = ScatterCarpet; -},{"../../plots/cartesian":758,"../scatter/colorbar":1011,"./attributes":1037,"./calc":1038,"./defaults":1039,"./hover":1040,"./plot":1042,"./select":1043,"./style":1044}],1042:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../scatter/colorbar":1025,"./attributes":1051,"./calc":1052,"./defaults":1053,"./hover":1054,"./plot":1056,"./select":1057,"./style":1058}],1056:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176985,7 +178814,7 @@ module.exports = function plot(gd, plotinfoproxy, data) { } }; -},{"../../plots/cartesian/axes":748,"../scatter/plot":1025}],1043:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../scatter/plot":1039}],1057:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177020,7 +178849,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":1026}],1044:[function(require,module,exports){ +},{"../scatter/select":1040}],1058:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177049,7 +178878,7 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":1027}],1045:[function(require,module,exports){ +},{"../scatter/style":1041}],1059:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177173,7 +179002,7 @@ module.exports = { }) }; -},{"../../components/colorscale/color_attributes":597,"../../components/drawing/attributes":613,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1046:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":607,"../../components/drawing/attributes":623,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1060:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177217,7 +179046,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":690,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"fast-isnumeric":127}],1047:[function(require,module,exports){ +},{"../../constants/numerical":702,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"fast-isnumeric":129}],1061:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177272,8 +179101,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } - - coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+location+text' : undefined); }; function handleLonLatLocDefaults(traceIn, traceOut, coerce) { @@ -177298,7 +179125,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":709,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1045}],1048:[function(require,module,exports){ +},{"../../lib":721,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1059}],1062:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177319,7 +179146,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1049:[function(require,module,exports){ +},{}],1063:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177436,7 +179263,7 @@ function getExtraText(trace, pt, axis) { return text.join('
'); } -},{"../../components/fx":631,"../../constants/numerical":690,"../../plots/cartesian/axes":748,"../scatter/get_trace_color":1016,"./attributes":1045}],1050:[function(require,module,exports){ +},{"../../components/fx":641,"../../constants/numerical":702,"../../plots/cartesian/axes":760,"../scatter/get_trace_color":1030,"./attributes":1059}],1064:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177473,7 +179300,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":776,"../scatter/colorbar":1011,"./attributes":1045,"./calc":1046,"./defaults":1047,"./event_data":1048,"./hover":1049,"./plot":1051}],1051:[function(require,module,exports){ +},{"../../plots/geo":788,"../scatter/colorbar":1025,"./attributes":1059,"./calc":1060,"./defaults":1061,"./event_data":1062,"./hover":1063,"./plot":1065}],1065:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177590,9 +179417,9 @@ function style(geo) { group = d3.select(this); group.selectAll('path.point') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, geo.graphDiv); group.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, geo.graphDiv); }); // this part is incompatible with Drawing.lineGroupStyle @@ -177612,7 +179439,7 @@ function style(geo) { }); } -},{"../../components/color":590,"../../components/drawing":614,"../../constants/numerical":690,"../../lib":709,"../../lib/geo_location_utils":704,"../../lib/geojson_utils":705,"../../lib/topojson_utils":730,"../scatter/subtypes":1028,"d3":118}],1052:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../constants/numerical":702,"../../lib":721,"../../lib/geo_location_utils":716,"../../lib/geojson_utils":717,"../../lib/topojson_utils":742,"../scatter/subtypes":1042,"d3":120}],1066:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177627,7 +179454,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); var DASHES = require('../../constants/gl2d_dashes'); -var MARKERS = require('../../constants/gl_markers'); +var MARKERS = require('../../constants/gl2d_markers'); var extendFlat = require('../../lib/extend').extendFlat; var extendDeep = require('../../lib/extend').extendDeep; @@ -177702,7 +179529,52 @@ module.exports = { error_x: scatterAttrs.error_x }; -},{"../../components/colorscale/color_attributes":597,"../../constants/gl2d_dashes":686,"../../constants/gl_markers":688,"../../lib/extend":701,"../scatter/attributes":1008}],1053:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":607,"../../constants/gl2d_dashes":697,"../../constants/gl2d_markers":698,"../../lib/extend":713,"../scatter/attributes":1022}],1067:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 Axes = require('../../plots/cartesian/axes'); +var arraysToCalcdata = require('../scatter/arrays_to_calcdata'); +var calcColorscales = require('../scatter/colorscale_calc'); + +module.exports = function calc(gd, trace) { + var dragmode = gd._fullLayout.dragmode; + var cd; + + if(dragmode === 'lasso' || dragmode === 'select') { + var xa = Axes.getFromId(gd, trace.xaxis || 'x'); + var ya = Axes.getFromId(gd, trace.yaxis || 'y'); + + var x = xa.makeCalcdata(trace, 'x'); + var y = ya.makeCalcdata(trace, 'y'); + + var serieslen = Math.min(x.length, y.length), i; + + // create the "calculated data" to plot + cd = new Array(serieslen); + + for(i = 0; i < serieslen; i++) { + cd[i] = {x: x[i], y: y[i]}; + } + } else { + cd = [{x: false, y: false, trace: trace, t: {}}]; + arraysToCalcdata(cd, trace); + } + + calcColorscales(trace); + + return cd; +}; + +},{"../../plots/cartesian/axes":760,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026}],1068:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177730,11 +179602,12 @@ var formatColor = require('../../lib/gl_format_color'); var subTypes = require('../scatter/subtypes'); var makeBubbleSizeFn = require('../scatter/make_bubble_size_func'); var getTraceColor = require('../scatter/get_trace_color'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl2d_markers'); var DASHES = require('../../constants/gl2d_dashes'); var AXES = ['xaxis', 'yaxis']; - +var DESELECTDIM = 0.2; +var TRANSPARENT = [0, 0, 0, 0]; function LineWithMarkers(scene, uid) { this.scene = scene; @@ -177800,11 +179673,14 @@ function LineWithMarkers(scene, uid) { size: 12, color: [0, 0, 0, 1], borderSize: 1, - borderColor: [0, 0, 0, 1] + borderColor: [0, 0, 0, 1], + snapPoints: true }; + var scatterOptions1 = Lib.extendFlat({}, scatterOptions0, {snapPoints: false}); this.scatter = this.initObject(createScatter, scatterOptions0, 3); this.fancyScatter = this.initObject(createFancyScatter, scatterOptions0, 4); + this.selectScatter = this.initObject(createScatter, scatterOptions1, 5); } var proto = LineWithMarkers.prototype; @@ -177919,7 +179795,7 @@ function _convertArray(convert, data, count) { var convertNumber = convertArray.bind(null, function(x) { return +x; }); var convertColorBase = convertArray.bind(null, str2RGBArray); var convertSymbol = convertArray.bind(null, function(x) { - return MARKER_SYMBOLS[x] || '●'; + return MARKER_SYMBOLS[x] ? x : 'circle'; }); function convertColor(color, opacity, count) { @@ -177956,8 +179832,21 @@ function _convertColor(colors, opacities, count) { return result; } -proto.update = function(options) { +function isSymbolOpen(symbol) { + return symbol.split('-open')[1] === ''; +} + +function fillColor(colorIn, colorOut, offsetIn, offsetOut, isDimmed) { + var dim = isDimmed ? DESELECTDIM : 1; + var j; + + for(j = 0; j < 3; j++) { + colorIn[4 * offsetIn + j] = colorOut[4 * offsetOut + j]; + } + colorIn[4 * offsetIn + j] = dim * colorOut[4 * offsetOut + j]; +} +proto.update = function(options, cdscatter) { if(options.visible !== true) { this.isVisible = false; this.hasLines = false; @@ -178008,6 +179897,11 @@ proto.update = function(options) { // not quite on-par with 'scatter', but close enough for now // does not handle the colorscale case this.color = getTraceColor(options, {}); + + // provide reference for selecting points + if(cdscatter && cdscatter[0] && !cdscatter[0].glTrace) { + cdscatter[0].glTrace = this; + } }; // We'd ideally know that all values are of fast types; sampling gives no certainty but faster @@ -178042,7 +179936,9 @@ proto.updateFast = function(options) { positions = new Float64Array(2 * len), bounds = this.bounds, pId = 0, - ptr = 0; + ptr = 0, + selection = options.selection, + i, selPositions, l; var xx, yy; @@ -178055,7 +179951,7 @@ proto.updateFast = function(options) { // TODO bypass this on modebar +/- zoom if(fastType || isDateTime) { - for(var i = 0; i < len; ++i) { + for(i = 0; i < len; ++i) { xx = x[i]; yy = y[i]; @@ -178065,11 +179961,11 @@ proto.updateFast = function(options) { xx = Lib.dateTime2ms(xx, xcalendar); } - idToIndex[pId++] = i; - positions[ptr++] = xx; positions[ptr++] = yy; + idToIndex[pId++] = i; + bounds[0] = Math.min(bounds[0], xx); bounds[1] = Math.min(bounds[1], yy); bounds[2] = Math.max(bounds[2], xx); @@ -178081,6 +179977,16 @@ proto.updateFast = function(options) { positions = truncate(positions, ptr); this.idToIndex = idToIndex; + // form selected set + if(selection) { + selPositions = new Float64Array(2 * selection.length); + + for(i = 0, l = selection.length; i < l; i++) { + selPositions[i * 2 + 0] = selection[i].x; + selPositions[i * 2 + 1] = selection[i].y; + } + } + this.updateLines(options, positions); this.updateError('X', options); this.updateError('Y', options); @@ -178088,23 +179994,68 @@ proto.updateFast = function(options) { var markerSize; if(this.hasMarkers) { - this.scatter.options.positions = positions; + var markerColor, borderColor, opacity; + + // if we have selPositions array - means we have to render all points transparent, and selected points opaque + if(selPositions) { + this.scatter.options.positions = null; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); + opacity = (options.opacity) * (options.marker.opacity) * DESELECTDIM; + + markerColor[3] *= opacity; + this.scatter.options.color = markerColor; + + borderColor[3] *= opacity; + this.scatter.options.borderColor = borderColor; + + markerSize = options.marker.size; + this.scatter.options.size = markerSize; + this.scatter.options.borderSize = options.marker.line.width; + + this.scatter.update(); + this.scatter.options.positions = positions; - var markerColor = str2RGBArray(options.marker.color), - borderColor = str2RGBArray(options.marker.line.color), + + this.selectScatter.options.positions = selPositions; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); opacity = (options.opacity) * (options.marker.opacity); - markerColor[3] *= opacity; - this.scatter.options.color = markerColor; + markerColor[3] *= opacity; + this.selectScatter.options.color = markerColor; + + borderColor[3] *= opacity; + this.selectScatter.options.borderColor = borderColor; + + markerSize = options.marker.size; + this.selectScatter.options.size = markerSize; + this.selectScatter.options.borderSize = options.marker.line.width; + + this.selectScatter.update(); + } + + else { + this.scatter.options.positions = positions; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); + opacity = (options.opacity) * (options.marker.opacity); + markerColor[3] *= opacity; + this.scatter.options.color = markerColor; - borderColor[3] *= opacity; - this.scatter.options.borderColor = borderColor; + borderColor[3] *= opacity; + this.scatter.options.borderColor = borderColor; - markerSize = options.marker.size; - this.scatter.options.size = markerSize; - this.scatter.options.borderSize = options.marker.line.width; + markerSize = options.marker.size; + this.scatter.options.size = markerSize; + this.scatter.options.borderSize = options.marker.line.width; + + this.scatter.update(); + } - this.scatter.update(); } else { this.scatter.clear(); @@ -178121,7 +180072,8 @@ proto.updateFancy = function(options) { var scene = this.scene, xaxis = scene.xaxis, yaxis = scene.yaxis, - bounds = this.bounds; + bounds = this.bounds, + selection = options.selection; // makeCalcdata runs d2c (data-to-coordinate) on every point var x = this.pickXData = xaxis.makeCalcdata(options, 'x').slice(); @@ -178146,7 +180098,7 @@ proto.updateFancy = function(options) { var getX = (xaxis.type === 'log') ? xaxis.d2l : function(x) { return x; }; var getY = (yaxis.type === 'log') ? yaxis.d2l : function(y) { return y; }; - var i, j, xx, yy, ex0, ex1, ey0, ey1; + var i, xx, yy, ex0, ex1, ey0, ey1; for(i = 0; i < len; ++i) { this.xData[i] = xx = getX(x[i]); @@ -178182,7 +180134,14 @@ proto.updateFancy = function(options) { this.updateError('X', options, positions, errorsX); this.updateError('Y', options, positions, errorsY); - var sizes; + var sizes, selIds; + + if(selection) { + selIds = {}; + for(i = 0; i < selection.length; i++) { + selIds[selection[i].pointNumber] = true; + } + } if(this.hasMarkers) { this.scatter.options.positions = positions; @@ -178196,32 +180155,65 @@ proto.updateFancy = function(options) { this.scatter.options.colors = new Array(pId * 4); this.scatter.options.borderColors = new Array(pId * 4); - var markerSizeFunc = makeBubbleSizeFn(options), - markerOpts = options.marker, - markerOpacity = markerOpts.opacity, - traceOpacity = options.opacity, - colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len), - glyphs = convertSymbol(markerOpts.symbol, len), - borderWidths = convertNumber(markerOpts.line.width, len), - borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len), - index; + var markerSizeFunc = makeBubbleSizeFn(options); + var markerOpts = options.marker; + var markerOpacity = markerOpts.opacity; + var traceOpacity = options.opacity; + var symbols = convertSymbol(markerOpts.symbol, len); + var colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len); + var borderWidths = convertNumber(markerOpts.line.width, len); + var borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len); + var index, size, symbol, symbolSpec, isOpen, isDimmed, _colors, _borderColors, bw, minBorderWidth; sizes = convertArray(markerSizeFunc, markerOpts.size, len); for(i = 0; i < pId; ++i) { index = idToIndex[i]; - this.scatter.options.sizes[i] = 4.0 * sizes[index]; - this.scatter.options.glyphs[i] = glyphs[index]; - this.scatter.options.borderWidths[i] = 0.5 * borderWidths[index]; + symbol = symbols[index]; + symbolSpec = MARKER_SYMBOLS[symbol]; + isOpen = isSymbolOpen(symbol); + isDimmed = selIds && !selIds[index]; - for(j = 0; j < 4; ++j) { - this.scatter.options.colors[4 * i + j] = colors[4 * index + j]; - this.scatter.options.borderColors[4 * i + j] = borderColors[4 * index + j]; + if(symbolSpec.noBorder && !isOpen) { + _colors = borderColors; + } else { + _colors = colors; } + + if(isOpen) { + _borderColors = colors; + } else { + _borderColors = borderColors; + } + + // See https://github.com/plotly/plotly.js/pull/1781#discussion_r121820798 + // for more info on this logic + size = sizes[index]; + bw = borderWidths[index]; + minBorderWidth = (symbolSpec.noBorder || symbolSpec.noFill) ? 0.1 * size : 0; + + this.scatter.options.sizes[i] = 4.0 * size; + this.scatter.options.glyphs[i] = symbolSpec.unicode; + this.scatter.options.borderWidths[i] = 0.5 * ((bw > minBorderWidth) ? bw - minBorderWidth : 0); + + if(isOpen && !symbolSpec.noBorder && !symbolSpec.noFill) { + fillColor(this.scatter.options.colors, TRANSPARENT, i, 0); + } else { + fillColor(this.scatter.options.colors, _colors, i, index, isDimmed); + } + fillColor(this.scatter.options.borderColors, _borderColors, i, index, isDimmed); } - this.fancyScatter.update(); + // prevent scatter from resnapping points + if(selIds) { + this.scatter.options.positions = null; + this.fancyScatter.update(); + this.scatter.options.positions = positions; + } + else { + this.fancyScatter.update(); + } } else { this.fancyScatter.clear(); @@ -178343,15 +180335,16 @@ proto.dispose = function() { this.fancyScatter.dispose(); }; -function createLineWithMarkers(scene, data) { +function createLineWithMarkers(scene, data, cdscatter) { var plot = new LineWithMarkers(scene, data.uid); - plot.update(data); + plot.update(data, cdscatter); + return plot; } module.exports = createLineWithMarkers; -},{"../../components/errorbars":620,"../../constants/gl2d_dashes":686,"../../constants/gl_markers":688,"../../lib":709,"../../lib/gl_format_color":706,"../../lib/str2rgbarray":727,"../../lib/typed_array_truncate":731,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_autotype":749,"../scatter/get_trace_color":1016,"../scatter/make_bubble_size_func":1023,"../scatter/subtypes":1028,"fast-isnumeric":127,"gl-error2d":155,"gl-line2d":165,"gl-scatter2d":243,"gl-scatter2d-sdf":238}],1054:[function(require,module,exports){ +},{"../../components/errorbars":630,"../../constants/gl2d_dashes":697,"../../constants/gl2d_markers":698,"../../lib":721,"../../lib/gl_format_color":718,"../../lib/str2rgbarray":739,"../../lib/typed_array_truncate":743,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_autotype":761,"../scatter/get_trace_color":1030,"../scatter/make_bubble_size_func":1037,"../scatter/subtypes":1042,"fast-isnumeric":129,"gl-error2d":157,"gl-line2d":168,"gl-scatter2d":246,"gl-scatter2d-sdf":241}],1069:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178408,7 +180401,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":619,"../../lib":709,"../scatter/constants":1013,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/xy_defaults":1030,"./attributes":1052}],1055:[function(require,module,exports){ +},{"../../components/errorbars/defaults":629,"../../lib":721,"../scatter/constants":1027,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/xy_defaults":1044,"./attributes":1066}],1070:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178424,10 +180417,12 @@ var ScatterGl = {}; ScatterGl.attributes = require('./attributes'); ScatterGl.supplyDefaults = require('./defaults'); ScatterGl.colorbar = require('../scatter/colorbar'); +ScatterGl.hoverPoints = require('../scatter/hover'); // reuse the Scatter3D 'dummy' calc step so that legends know what to do -ScatterGl.calc = require('../scatter3d/calc'); +ScatterGl.calc = require('./calc'); ScatterGl.plot = require('./convert'); +ScatterGl.selectPoints = require('./select'); ScatterGl.moduleType = 'trace'; ScatterGl.name = 'scattergl'; @@ -178444,7 +180439,69 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":788,"../scatter/colorbar":1011,"../scatter3d/calc":1032,"./attributes":1052,"./convert":1053,"./defaults":1054}],1056:[function(require,module,exports){ +},{"../../plots/gl2d":800,"../scatter/colorbar":1025,"../scatter/hover":1031,"./attributes":1066,"./calc":1067,"./convert":1068,"./defaults":1069,"./select":1071}],1071:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 subtypes = require('../scatter/subtypes'); + +module.exports = function selectPoints(searchInfo, polygon) { + var cd = searchInfo.cd, + xa = searchInfo.xaxis, + ya = searchInfo.yaxis, + selection = [], + trace = cd[0].trace, + i, + di, + x, + y; + + var scattergl = cd[0].glTrace; + var scene = cd[0].glTrace.scene; + + var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); + if(trace.visible !== true || hasOnlyLines) return; + + // filter out points by visible scatter ones + if(polygon === false) { + // clear selection + for(i = 0; i < cd.length; i++) cd[i].dim = 0; + } + else { + for(i = 0; i < cd.length; i++) { + di = cd[i]; + x = xa.c2p(di.x); + y = ya.c2p(di.y); + if(polygon.contains([x, y])) { + selection.push({ + pointNumber: i, + x: di.x, + y: di.y + }); + di.dim = 0; + } + else di.dim = 1; + } + } + + // highlight selected points here + trace.selection = selection; + + scattergl.update(trace, cd); + scene.glplot.setDirty(); + + return selection; +}; + +},{"../scatter/subtypes":1042}],1072:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178560,7 +180617,7 @@ module.exports = { }), }; -},{"../../components/colorbar/attributes":591,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/mapbox/layout_attributes":807,"../scatter/attributes":1008,"../scattergeo/attributes":1045}],1057:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/mapbox/layout_attributes":819,"../scatter/attributes":1022,"../scattergeo/attributes":1059}],1073:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178903,7 +180960,7 @@ function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } -},{"../../components/colorscale":604,"../../constants/numerical":690,"../../lib":709,"../../lib/geojson_utils":705,"../../plots/mapbox/convert_text_opts":804,"../scatter/make_bubble_size_func":1023,"../scatter/subtypes":1028}],1058:[function(require,module,exports){ +},{"../../components/colorscale":614,"../../constants/numerical":702,"../../lib":721,"../../lib/geojson_utils":717,"../../plots/mapbox/convert_text_opts":816,"../scatter/make_bubble_size_func":1037,"../scatter/subtypes":1042}],1074:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178969,8 +181026,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } - - coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+text' : undefined); }; function handleLonLatDefaults(traceIn, traceOut, coerce) { @@ -178984,7 +181039,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":709,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1056}],1059:[function(require,module,exports){ +},{"../../lib":721,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1072}],1075:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179004,7 +181059,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1060:[function(require,module,exports){ +},{}],1076:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179107,7 +181162,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../components/fx":631,"../../constants/numerical":690,"../scatter/get_trace_color":1016}],1061:[function(require,module,exports){ +},{"../../components/fx":641,"../../constants/numerical":702,"../scatter/get_trace_color":1030}],1077:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179144,7 +181199,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":805,"../scatter/colorbar":1011,"../scattergeo/calc":1046,"./attributes":1056,"./defaults":1058,"./event_data":1059,"./hover":1060,"./plot":1062}],1062:[function(require,module,exports){ +},{"../../plots/mapbox":817,"../scatter/colorbar":1025,"../scattergeo/calc":1060,"./attributes":1072,"./defaults":1074,"./event_data":1075,"./hover":1076,"./plot":1078}],1078:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179268,7 +181323,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":1057}],1063:[function(require,module,exports){ +},{"./convert":1073}],1079:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179407,7 +181462,7 @@ module.exports = { hoveron: scatterAttrs.hoveron, }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/drawing/attributes":613,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1064:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/drawing/attributes":623,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1080:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179504,7 +181559,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":748,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"../scatter/subtypes":1028,"fast-isnumeric":127}],1065:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"../scatter/subtypes":1042,"fast-isnumeric":129}],1081:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179602,15 +181657,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } - coerce('hoverinfo', (layout._dataLength === 1) ? 'a+b+c+text' : undefined); - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { dfltHoverOn.push('fills'); } coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":709,"../scatter/constants":1013,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/line_shape_defaults":1021,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1063}],1066:[function(require,module,exports){ +},{"../../lib":721,"../scatter/constants":1027,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/line_shape_defaults":1035,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1079}],1082:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179681,7 +181734,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":748,"../scatter/hover":1017}],1067:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../scatter/hover":1031}],1083:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179717,7 +181770,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":819,"../scatter/colorbar":1011,"./attributes":1063,"./calc":1064,"./defaults":1065,"./hover":1066,"./plot":1068,"./select":1069,"./style":1070}],1068:[function(require,module,exports){ +},{"../../plots/ternary":831,"../scatter/colorbar":1025,"./attributes":1079,"./calc":1080,"./defaults":1081,"./hover":1082,"./plot":1084,"./select":1085,"./style":1086}],1084:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179753,11 +181806,11 @@ module.exports = function plot(ternary, moduleCalcData) { scatterPlot(ternary.graphDiv, plotinfo, moduleCalcData); }; -},{"../scatter/plot":1025}],1069:[function(require,module,exports){ -arguments[4][1043][0].apply(exports,arguments) -},{"../scatter/select":1026,"dup":1043}],1070:[function(require,module,exports){ -arguments[4][1044][0].apply(exports,arguments) -},{"../scatter/style":1027,"dup":1044}],1071:[function(require,module,exports){ +},{"../scatter/plot":1039}],1085:[function(require,module,exports){ +arguments[4][1057][0].apply(exports,arguments) +},{"../scatter/select":1040,"dup":1057}],1086:[function(require,module,exports){ +arguments[4][1058][0].apply(exports,arguments) +},{"../scatter/style":1041,"dup":1058}],1087:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -179882,7 +181935,6 @@ module.exports = { ].join(' ') }, - // Todo this block has a structure of colorscale/attributes.js but with colorscale/color_attributes.js names cauto: colorscaleAttrs.zauto, cmin: colorscaleAttrs.zmin, cmax: colorscaleAttrs.zmax, @@ -180005,7 +182057,7 @@ module.exports = { } }; -},{"../../components/color":590,"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701}],1072:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713}],1088:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180029,7 +182081,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":596}],1073:[function(require,module,exports){ +},{"../../components/colorscale/calc":606}],1089:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180081,7 +182133,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],1074:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],1090:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180460,7 +182512,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":727,"gl-surface3d":261,"ndarray":460,"ndarray-fill":450,"ndarray-homography":452,"ndarray-ops":454,"tinycolor2":526}],1075:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"gl-surface3d":264,"ndarray":463,"ndarray-fill":453,"ndarray-homography":455,"ndarray-ops":457,"tinycolor2":530}],1091:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180581,7 +182633,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":599,"../../lib":709,"../../registry":826,"./attributes":1071}],1076:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"../../registry":838,"./attributes":1087}],1092:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180624,7 +182676,7 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":791,"./attributes":1071,"./calc":1072,"./colorbar":1073,"./convert":1074,"./defaults":1075}],1077:[function(require,module,exports){ +},{"../../plots/gl3d":803,"./attributes":1087,"./calc":1088,"./colorbar":1089,"./convert":1090,"./defaults":1091}],1093:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180637,7 +182689,6 @@ module.exports = Surface; var Lib = require('../lib'); var Registry = require('../registry'); -var PlotSchema = require('../plot_api/plot_schema'); var Axes = require('../plots/cartesian/axes'); var COMPARISON_OPS = ['=', '!=', '<', '>=', '>', '<=']; @@ -180775,6 +182826,7 @@ exports.calcTransform = function(gd, trace, opts) { var target = opts.target; var len = targetArray.length; var targetCalendar = opts.targetcalendar; + var arrayAttrs = trace._arrayAttrs; // even if you provide targetcalendar, if target is a string and there // is a calendar attribute matching target it will get used instead. @@ -180785,7 +182837,6 @@ exports.calcTransform = function(gd, trace, opts) { var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray); var filterFunc = getFilterFunc(opts, d2c, targetCalendar); - var arrayAttrs = PlotSchema.findArrayAttributes(trace); var originalArrays = {}; function forAllAttrs(fn, index) { @@ -180933,7 +182984,7 @@ function getFilterFunc(opts, d2c, targetCalendar) { } } -},{"../lib":709,"../plot_api/plot_schema":737,"../plots/cartesian/axes":748,"../registry":826}],1078:[function(require,module,exports){ +},{"../lib":721,"../plots/cartesian/axes":760,"../registry":838}],1094:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -180970,15 +183021,26 @@ exports.attributes = { 'with `x` [1, 3] and one trace with `x` [2, 4].' ].join(' ') }, - style: { - valType: 'any', - dflt: {}, - description: [ - 'Sets each group style.', - 'For example, with `groups` set to *[\'a\', \'b\', \'a\', \'b\']*', - 'and `style` set to *{ a: { marker: { color: \'red\' } }}', - 'marker points in group *\'a\'* will be drawn in red.' - ].join(' ') + styles: { + _isLinkedToArray: 'style', + target: { + valType: 'string', + role: 'info', + description: [ + 'The group value which receives these styles.' + ].join(' ') + }, + value: { + valType: 'any', + role: 'info', + dflt: {}, + description: [ + 'Sets each group styles.', + 'For example, with `groups` set to *[\'a\', \'b\', \'a\', \'b\']*', + 'and `styles` set to *[{target: \'a\', value: { marker: { color: \'red\' } }}]', + 'marker points in group *\'a\'* will be drawn in red.' + ].join(' ') + }, } }; @@ -181007,11 +183069,22 @@ exports.supplyDefaults = function(transformIn) { if(!enabled) return transformOut; coerce('groups'); - coerce('style'); + + var styleIn = transformIn.styles; + var styleOut = transformOut.styles = []; + + if(styleIn) { + for(var i = 0; i < styleIn.length; i++) { + styleOut[i] = {}; + Lib.coerce(styleIn[i], styleOut[i], exports.attributes.styles, 'target'); + Lib.coerce(styleIn[i], styleOut[i], exports.attributes.styles, 'value'); + } + } return transformOut; }; + /** * Apply transform !!! * @@ -181051,6 +183124,7 @@ function pasteArray(newTrace, trace, j, a) { } function transformOne(trace, state) { + var i; var opts = state.transform; var groups = trace.transforms[state.transformIndex].groups; @@ -181064,9 +183138,13 @@ function transformOne(trace, state) { var arrayAttrs = PlotSchema.findArrayAttributes(trace); - var style = opts.style || {}; + var styles = opts.styles || []; + var styleLookup = {}; + for(i = 0; i < styles.length; i++) { + styleLookup[styles[i].target] = styles[i].value; + } - for(var i = 0; i < groupNames.length; i++) { + for(i = 0; i < groupNames.length; i++) { var groupName = groupNames[i]; var newTrace = newData[i] = Lib.extendDeepNoArrays({}, trace); @@ -181081,15 +183159,15 @@ function transformOne(trace, state) { newTrace.name = groupName; - // there's no need to coerce style[groupName] here + // there's no need to coerce styleLookup[groupName] here // as another round of supplyDefaults is done on the transformed traces - newTrace = Lib.extendDeepNoArrays(newTrace, style[groupName] || {}); + newTrace = Lib.extendDeepNoArrays(newTrace, styleLookup[groupName] || {}); } return newData; } -},{"../lib":709,"../plot_api/plot_schema":737}],1079:[function(require,module,exports){ +},{"../lib":721,"../plot_api/plot_schema":749}],1095:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -181101,7 +183179,6 @@ function transformOne(trace, state) { 'use strict'; var Lib = require('../lib'); -var PlotSchema = require('../plot_api/plot_schema'); var Axes = require('../plots/cartesian/axes'); exports.moduleType = 'transform'; @@ -181170,7 +183247,7 @@ exports.calcTransform = function(gd, trace, opts) { var target = opts.target; var len = targetArray.length; - var arrayAttrs = PlotSchema.findArrayAttributes(trace); + var arrayAttrs = trace._arrayAttrs; var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray); var indices = getIndices(opts, targetArray, d2c); @@ -181224,5 +183301,5 @@ function getSortFunc(opts, d2c) { } } -},{"../lib":709,"../plot_api/plot_schema":737,"../plots/cartesian/axes":748}]},{},[19])(19) +},{"../lib":721,"../plots/cartesian/axes":760}]},{},[19])(19) }); \ No newline at end of file diff --git a/dist/plotly.js b/dist/plotly.js index 2928efda930..728bfa0b56a 100644 --- a/dist/plotly.js +++ b/dist/plotly.js @@ -1,5 +1,5 @@ /** -* plotly.js v1.27.1 +* plotly.js v1.28.0 * Copyright 2012-2017, Plotly, Inc. * All rights reserved. * Licensed under the MIT license @@ -69,7 +69,7 @@ for(var selector in rules) { Lib.addStyleRule(fullSelector, rules[selector]); } -},{"../src/lib":709}],2:[function(require,module,exports){ +},{"../src/lib":721}],2:[function(require,module,exports){ 'use strict'; module.exports = { @@ -208,7 +208,7 @@ module.exports = { module.exports = require('../src/traces/bar'); -},{"../src/traces/bar":840}],4:[function(require,module,exports){ +},{"../src/traces/bar":852}],4:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -221,7 +221,7 @@ module.exports = require('../src/traces/bar'); module.exports = require('../src/traces/box'); -},{"../src/traces/box":852}],5:[function(require,module,exports){ +},{"../src/traces/box":864}],5:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -234,7 +234,7 @@ module.exports = require('../src/traces/box'); module.exports = require('../src/components/calendars'); -},{"../src/components/calendars":588}],6:[function(require,module,exports){ +},{"../src/components/calendars":598}],6:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -247,7 +247,7 @@ module.exports = require('../src/components/calendars'); module.exports = require('../src/traces/candlestick'); -},{"../src/traces/candlestick":860}],7:[function(require,module,exports){ +},{"../src/traces/candlestick":872}],7:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -260,7 +260,7 @@ module.exports = require('../src/traces/candlestick'); module.exports = require('../src/traces/carpet'); -},{"../src/traces/carpet":881}],8:[function(require,module,exports){ +},{"../src/traces/carpet":893}],8:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -273,7 +273,7 @@ module.exports = require('../src/traces/carpet'); module.exports = require('../src/traces/choropleth'); -},{"../src/traces/choropleth":896}],9:[function(require,module,exports){ +},{"../src/traces/choropleth":908}],9:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -286,7 +286,7 @@ module.exports = require('../src/traces/choropleth'); module.exports = require('../src/traces/contour'); -},{"../src/traces/contour":907}],10:[function(require,module,exports){ +},{"../src/traces/contour":919}],10:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -299,7 +299,7 @@ module.exports = require('../src/traces/contour'); module.exports = require('../src/traces/contourcarpet'); -},{"../src/traces/contourcarpet":922}],11:[function(require,module,exports){ +},{"../src/traces/contourcarpet":934}],11:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -312,7 +312,7 @@ module.exports = require('../src/traces/contourcarpet'); module.exports = require('../src/core'); -},{"../src/core":693}],12:[function(require,module,exports){ +},{"../src/core":705}],12:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -325,7 +325,7 @@ module.exports = require('../src/core'); module.exports = require('../src/transforms/filter'); -},{"../src/transforms/filter":1077}],13:[function(require,module,exports){ +},{"../src/transforms/filter":1093}],13:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -338,7 +338,7 @@ module.exports = require('../src/transforms/filter'); module.exports = require('../src/transforms/groupby'); -},{"../src/transforms/groupby":1078}],14:[function(require,module,exports){ +},{"../src/transforms/groupby":1094}],14:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -351,7 +351,7 @@ module.exports = require('../src/transforms/groupby'); module.exports = require('../src/traces/heatmap'); -},{"../src/traces/heatmap":936}],15:[function(require,module,exports){ +},{"../src/traces/heatmap":948}],15:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -364,7 +364,7 @@ module.exports = require('../src/traces/heatmap'); module.exports = require('../src/traces/heatmapgl'); -},{"../src/traces/heatmapgl":945}],16:[function(require,module,exports){ +},{"../src/traces/heatmapgl":957}],16:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -377,7 +377,7 @@ module.exports = require('../src/traces/heatmapgl'); module.exports = require('../src/traces/histogram'); -},{"../src/traces/histogram":953}],17:[function(require,module,exports){ +},{"../src/traces/histogram":965}],17:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -390,7 +390,7 @@ module.exports = require('../src/traces/histogram'); module.exports = require('../src/traces/histogram2d'); -},{"../src/traces/histogram2d":958}],18:[function(require,module,exports){ +},{"../src/traces/histogram2d":970}],18:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -403,7 +403,7 @@ module.exports = require('../src/traces/histogram2d'); module.exports = require('../src/traces/histogram2dcontour'); -},{"../src/traces/histogram2dcontour":962}],19:[function(require,module,exports){ +},{"../src/traces/histogram2dcontour":974}],19:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -487,7 +487,7 @@ module.exports = Plotly; module.exports = require('../src/traces/mesh3d'); -},{"../src/traces/mesh3d":966}],21:[function(require,module,exports){ +},{"../src/traces/mesh3d":980}],21:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -500,7 +500,7 @@ module.exports = require('../src/traces/mesh3d'); module.exports = require('../src/traces/ohlc'); -},{"../src/traces/ohlc":971}],22:[function(require,module,exports){ +},{"../src/traces/ohlc":985}],22:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -513,7 +513,7 @@ module.exports = require('../src/traces/ohlc'); module.exports = require('../src/traces/parcoords'); -},{"../src/traces/parcoords":980}],23:[function(require,module,exports){ +},{"../src/traces/parcoords":994}],23:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -526,7 +526,7 @@ module.exports = require('../src/traces/parcoords'); module.exports = require('../src/traces/pie'); -},{"../src/traces/pie":989}],24:[function(require,module,exports){ +},{"../src/traces/pie":1003}],24:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -539,7 +539,7 @@ module.exports = require('../src/traces/pie'); module.exports = require('../src/traces/pointcloud'); -},{"../src/traces/pointcloud":998}],25:[function(require,module,exports){ +},{"../src/traces/pointcloud":1012}],25:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -552,7 +552,7 @@ module.exports = require('../src/traces/pointcloud'); module.exports = require('../src/traces/sankey'); -},{"../src/traces/sankey":1004}],26:[function(require,module,exports){ +},{"../src/traces/sankey":1018}],26:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -565,7 +565,7 @@ module.exports = require('../src/traces/sankey'); module.exports = require('../src/traces/scatter3d'); -},{"../src/traces/scatter3d":1036}],27:[function(require,module,exports){ +},{"../src/traces/scatter3d":1050}],27:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -578,7 +578,7 @@ module.exports = require('../src/traces/scatter3d'); module.exports = require('../src/traces/scattercarpet'); -},{"../src/traces/scattercarpet":1041}],28:[function(require,module,exports){ +},{"../src/traces/scattercarpet":1055}],28:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -591,7 +591,7 @@ module.exports = require('../src/traces/scattercarpet'); module.exports = require('../src/traces/scattergeo'); -},{"../src/traces/scattergeo":1050}],29:[function(require,module,exports){ +},{"../src/traces/scattergeo":1064}],29:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -604,7 +604,7 @@ module.exports = require('../src/traces/scattergeo'); module.exports = require('../src/traces/scattergl'); -},{"../src/traces/scattergl":1055}],30:[function(require,module,exports){ +},{"../src/traces/scattergl":1070}],30:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -617,7 +617,7 @@ module.exports = require('../src/traces/scattergl'); module.exports = require('../src/traces/scattermapbox'); -},{"../src/traces/scattermapbox":1061}],31:[function(require,module,exports){ +},{"../src/traces/scattermapbox":1077}],31:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -630,7 +630,7 @@ module.exports = require('../src/traces/scattermapbox'); module.exports = require('../src/traces/scatterternary'); -},{"../src/traces/scatterternary":1067}],32:[function(require,module,exports){ +},{"../src/traces/scatterternary":1083}],32:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -643,7 +643,7 @@ module.exports = require('../src/traces/scatterternary'); module.exports = require('../src/transforms/sort'); -},{"../src/transforms/sort":1079}],33:[function(require,module,exports){ +},{"../src/transforms/sort":1095}],33:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -656,7 +656,7 @@ module.exports = require('../src/transforms/sort'); module.exports = require('../src/traces/surface'); -},{"../src/traces/surface":1076}],34:[function(require,module,exports){ +},{"../src/traces/surface":1092}],34:[function(require,module,exports){ 'use strict' module.exports = createCamera @@ -885,7 +885,7 @@ function createCamera(element, options) { return camera } -},{"3d-view":35,"mouse-change":445,"mouse-event-offset":446,"mouse-wheel":448,"right-now":494}],35:[function(require,module,exports){ +},{"3d-view":35,"mouse-change":448,"mouse-event-offset":449,"mouse-wheel":451,"right-now":498}],35:[function(require,module,exports){ 'use strict' module.exports = createViewController @@ -1008,7 +1008,7 @@ function createViewController(options) { matrix: matrix }, mode) } -},{"matrix-camera-controller":443,"orbit-camera-controller":465,"turntable-camera-controller":530}],36:[function(require,module,exports){ +},{"matrix-camera-controller":446,"orbit-camera-controller":469,"turntable-camera-controller":534}],36:[function(require,module,exports){ // https://github.com/d3/d3-sankey Version 0.5.0. Copyright 2017 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-interpolate')) : @@ -1325,7 +1325,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); }))); -},{"d3-array":110,"d3-collection":111,"d3-interpolate":115}],37:[function(require,module,exports){ +},{"d3-array":112,"d3-collection":113,"d3-interpolate":117}],37:[function(require,module,exports){ 'use strict' var weakMap = typeof WeakMap === 'undefined' ? require('weak-map') : WeakMap @@ -1356,7 +1356,7 @@ function createABigTriangle(gl) { module.exports = createABigTriangle -},{"gl-buffer":152,"gl-vao":266,"weak-map":551}],38:[function(require,module,exports){ +},{"gl-buffer":154,"gl-vao":269,"weak-map":555}],38:[function(require,module,exports){ var padLeft = require('pad-left') module.exports = addLineNumbers @@ -1374,7 +1374,7 @@ function addLineNumbers (string, start, delim) { }).join('\n') } -},{"pad-left":466}],39:[function(require,module,exports){ +},{"pad-left":470}],39:[function(require,module,exports){ 'use strict' module.exports = affineHull @@ -1426,7 +1426,7 @@ function affineHull(points) { } return index } -},{"robust-orientation":500}],40:[function(require,module,exports){ +},{"robust-orientation":504}],40:[function(require,module,exports){ 'use strict' module.exports = alphaComplex @@ -1443,7 +1443,7 @@ function alphaComplex(alpha, points) { return circumradius(simplex) * alpha < 1 }) } -},{"circumradius":83,"delaunay-triangulate":119}],41:[function(require,module,exports){ +},{"circumradius":85,"delaunay-triangulate":121}],41:[function(require,module,exports){ module.exports = alphaShape var ac = require('alpha-complex') @@ -1452,7 +1452,77 @@ var bnd = require('simplicial-complex-boundary') function alphaShape(alpha, points) { return bnd(ac(alpha, points)) } -},{"alpha-complex":40,"simplicial-complex-boundary":508}],42:[function(require,module,exports){ +},{"alpha-complex":40,"simplicial-complex-boundary":512}],42:[function(require,module,exports){ +'use strict' + +module.exports = normalize; + +function normalize (arr, dim) { + if (!arr || arr.length == null) throw Error('Argument should be an array') + + if (dim == null) dim = 1 + else dim = Math.floor(dim) + + var bounds = Array(dim * 2) + + for (var offset = 0; offset < dim; offset++) { + var max = -Infinity, min = Infinity, i = offset, l = arr.length; + + for (; i < l; i+=dim) { + if (arr[i] > max) max = arr[i]; + if (arr[i] < min) min = arr[i]; + } + + bounds[offset] = min + bounds[dim + offset] = max + } + + return bounds; +} + +},{}],43:[function(require,module,exports){ +'use strict' + +var getBounds = require('array-bounds') + +module.exports = normalize; + +function normalize (arr, dim, bounds) { + if (!arr || arr.length == null) throw Error('Argument should be an array') + + if (dim == null) dim = 1 + if (bounds == null) bounds = getBounds(arr, dim) + + for (var offset = 0; offset < dim; offset++) { + var max = bounds[dim + offset], min = bounds[offset], i = offset, l = arr.length; + + if (max === Infinity && min === -Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === max ? 1 : arr[i] === min ? 0 : .5 + } + } + else if (max === Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === max ? 1 : 0 + } + } + else if (min === -Infinity) { + for (i = offset; i < l; i+=dim) { + arr[i] = arr[i] === min ? 0 : 1 + } + } + else { + var range = max - min + for (i = offset; i < l; i+=dim) { + arr[i] = (arr[i] - min) / range + } + } + } + + return arr; +} + +},{"array-bounds":42}],44:[function(require,module,exports){ 'use strict'; var arraytools = function () { @@ -1641,7 +1711,7 @@ var arraytools = function () { module.exports = arraytools(); -},{}],43:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2135,12 +2205,12 @@ var objectKeys = Object.keys || function (obj) { }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"util/":541}],44:[function(require,module,exports){ +},{"util/":545}],46:[function(require,module,exports){ module.exports = function _atob(str) { return atob(str) } -},{}],45:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ 'use strict' module.exports = barycentric @@ -2188,7 +2258,7 @@ function barycentric(simplex, point) { } return y } -},{"robust-linear-solve":499}],46:[function(require,module,exports){ +},{"robust-linear-solve":503}],48:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2201,7 +2271,7 @@ function add(a, b) { a[1].mul(b[1])) } -},{"./lib/rationalize":56}],47:[function(require,module,exports){ +},{"./lib/rationalize":58}],49:[function(require,module,exports){ 'use strict' module.exports = cmp @@ -2210,7 +2280,7 @@ function cmp(a, b) { return a[0].mul(b[1]).cmp(b[0].mul(a[1])) } -},{}],48:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2221,7 +2291,7 @@ function div(a, b) { return rationalize(a[0].mul(b[1]), a[1].mul(b[0])) } -},{"./lib/rationalize":56}],49:[function(require,module,exports){ +},{"./lib/rationalize":58}],51:[function(require,module,exports){ 'use strict' var isRat = require('./is-rat') @@ -2283,7 +2353,7 @@ function makeRational(numer, denom) { return rationalize(a, b) } -},{"./div":48,"./is-rat":50,"./lib/is-bn":54,"./lib/num-to-bn":55,"./lib/rationalize":56,"./lib/str-to-bn":57}],50:[function(require,module,exports){ +},{"./div":50,"./is-rat":52,"./lib/is-bn":56,"./lib/num-to-bn":57,"./lib/rationalize":58,"./lib/str-to-bn":59}],52:[function(require,module,exports){ 'use strict' var isBN = require('./lib/is-bn') @@ -2294,7 +2364,7 @@ function isRat(x) { return Array.isArray(x) && x.length === 2 && isBN(x[0]) && isBN(x[1]) } -},{"./lib/is-bn":54}],51:[function(require,module,exports){ +},{"./lib/is-bn":56}],53:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2305,7 +2375,7 @@ function sign (x) { return x.cmp(new BN(0)) } -},{"bn.js":64}],52:[function(require,module,exports){ +},{"bn.js":66}],54:[function(require,module,exports){ 'use strict' var sign = require('./bn-sign') @@ -2330,7 +2400,7 @@ function bn2num(b) { return sign(b) * out } -},{"./bn-sign":51}],53:[function(require,module,exports){ +},{"./bn-sign":53}],55:[function(require,module,exports){ 'use strict' var db = require('double-bits') @@ -2351,7 +2421,7 @@ function ctzNumber(x) { return h + 32 } -},{"bit-twiddle":63,"double-bits":120}],54:[function(require,module,exports){ +},{"bit-twiddle":65,"double-bits":122}],56:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2364,7 +2434,7 @@ function isBN(x) { return x && typeof x === 'object' && Boolean(x.words) } -},{"bn.js":64}],55:[function(require,module,exports){ +},{"bn.js":66}],57:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2381,7 +2451,7 @@ function num2bn(x) { } } -},{"bn.js":64,"double-bits":120}],56:[function(require,module,exports){ +},{"bn.js":66,"double-bits":122}],58:[function(require,module,exports){ 'use strict' var num2bn = require('./num-to-bn') @@ -2409,7 +2479,7 @@ function rationalize(numer, denom) { return [ numer, denom ] } -},{"./bn-sign":51,"./num-to-bn":55}],57:[function(require,module,exports){ +},{"./bn-sign":53,"./num-to-bn":57}],59:[function(require,module,exports){ 'use strict' var BN = require('bn.js') @@ -2420,7 +2490,7 @@ function str2BN(x) { return new BN(x) } -},{"bn.js":64}],58:[function(require,module,exports){ +},{"bn.js":66}],60:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2431,7 +2501,7 @@ function mul(a, b) { return rationalize(a[0].mul(b[0]), a[1].mul(b[1])) } -},{"./lib/rationalize":56}],59:[function(require,module,exports){ +},{"./lib/rationalize":58}],61:[function(require,module,exports){ 'use strict' var bnsign = require('./lib/bn-sign') @@ -2442,7 +2512,7 @@ function sign(x) { return bnsign(x[0]) * bnsign(x[1]) } -},{"./lib/bn-sign":51}],60:[function(require,module,exports){ +},{"./lib/bn-sign":53}],62:[function(require,module,exports){ 'use strict' var rationalize = require('./lib/rationalize') @@ -2453,7 +2523,7 @@ function sub(a, b) { return rationalize(a[0].mul(b[1]).sub(a[1].mul(b[0])), a[1].mul(b[1])) } -},{"./lib/rationalize":56}],61:[function(require,module,exports){ +},{"./lib/rationalize":58}],63:[function(require,module,exports){ 'use strict' var bn2num = require('./lib/bn-to-num') @@ -2491,7 +2561,7 @@ function roundRat (f) { } } -},{"./lib/bn-to-num":52,"./lib/ctz":53}],62:[function(require,module,exports){ +},{"./lib/bn-to-num":54,"./lib/ctz":55}],64:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, useNdarray, earlyOut) { @@ -2553,7 +2623,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],63:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ /** * Bit twiddling hacks for JavaScript. * @@ -2759,7 +2829,7 @@ exports.nextCombination = function(v) { } -},{}],64:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ (function (module, exports) { 'use strict'; @@ -6188,7 +6258,7 @@ exports.nextCombination = function(v) { }; })(typeof module === 'undefined' || module, this); -},{}],65:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -6224,7 +6294,7 @@ function boundary (cells) { return result } -},{}],66:[function(require,module,exports){ +},{}],68:[function(require,module,exports){ 'use strict' module.exports = boxIntersectWrapper @@ -6363,7 +6433,7 @@ function boxIntersectWrapper(arg0, arg1, arg2) { throw new Error('box-intersect: Invalid arguments') } } -},{"./lib/intersect":68,"./lib/sweep":72,"typedarray-pool":533}],67:[function(require,module,exports){ +},{"./lib/intersect":70,"./lib/sweep":74,"typedarray-pool":537}],69:[function(require,module,exports){ 'use strict' var DIMENSION = 'd' @@ -6508,7 +6578,7 @@ function bruteForcePlanner(full) { exports.partial = bruteForcePlanner(false) exports.full = bruteForcePlanner(true) -},{}],68:[function(require,module,exports){ +},{}],70:[function(require,module,exports){ 'use strict' module.exports = boxIntersectIter @@ -7003,7 +7073,7 @@ function boxIntersectIter( } } } -},{"./brute":67,"./median":69,"./partition":70,"./sweep":72,"bit-twiddle":63,"typedarray-pool":533}],69:[function(require,module,exports){ +},{"./brute":69,"./median":71,"./partition":72,"./sweep":74,"bit-twiddle":65,"typedarray-pool":537}],71:[function(require,module,exports){ 'use strict' module.exports = findMedian @@ -7146,7 +7216,7 @@ function findMedian(d, axis, start, end, boxes, ids) { start, mid, boxes, ids, boxes[elemSize*mid+axis]) } -},{"./partition":70}],70:[function(require,module,exports){ +},{"./partition":72}],72:[function(require,module,exports){ 'use strict' module.exports = genPartition @@ -7167,7 +7237,7 @@ function genPartition(predicate, args) { .replace('$', predicate)) return Function.apply(void 0, fargs) } -},{}],71:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ 'use strict'; //This code is extracted from ndarray-sort @@ -7404,7 +7474,7 @@ function quickSort(left, right, data) { quickSort(less, great, data); } } -},{}],72:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ 'use strict' module.exports = { @@ -7839,7 +7909,7 @@ red_loop: } } } -},{"./sort":71,"bit-twiddle":63,"typedarray-pool":533}],73:[function(require,module,exports){ +},{"./sort":73,"bit-twiddle":65,"typedarray-pool":537}],75:[function(require,module,exports){ /*! * The buffer module from node.js, for the browser. * @@ -9547,7 +9617,7 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -},{"base64-js":74,"ieee754":283}],74:[function(require,module,exports){ +},{"base64-js":76,"ieee754":286}],76:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -9663,7 +9733,7 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],75:[function(require,module,exports){ +},{}],77:[function(require,module,exports){ 'use strict' var monotoneTriangulate = require('./lib/monotone') @@ -9747,7 +9817,7 @@ function cdt2d(points, edges, options) { } } -},{"./lib/delaunay":76,"./lib/filter":77,"./lib/monotone":78,"./lib/triangulation":79}],76:[function(require,module,exports){ +},{"./lib/delaunay":78,"./lib/filter":79,"./lib/monotone":80,"./lib/triangulation":81}],78:[function(require,module,exports){ 'use strict' var inCircle = require('robust-in-sphere')[4] @@ -9864,7 +9934,7 @@ function delaunayRefine(points, triangulation) { } } -},{"binary-search-bounds":80,"robust-in-sphere":498}],77:[function(require,module,exports){ +},{"binary-search-bounds":82,"robust-in-sphere":502}],79:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -10046,7 +10116,7 @@ function classifyFaces(triangulation, target, infinity) { return result } -},{"binary-search-bounds":80}],78:[function(require,module,exports){ +},{"binary-search-bounds":82}],80:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -10235,7 +10305,7 @@ function monotoneTriangulate(points, edges) { return cells } -},{"binary-search-bounds":80,"robust-orientation":500}],79:[function(require,module,exports){ +},{"binary-search-bounds":82,"robust-orientation":504}],81:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -10341,7 +10411,7 @@ function createTriangulation(numVerts, edges) { return new Triangulation(stars, edges) } -},{"binary-search-bounds":80}],80:[function(require,module,exports){ +},{"binary-search-bounds":82}],82:[function(require,module,exports){ "use strict" function compileSearch(funcName, predicate, reversed, extraArgs, earlyOut) { @@ -10395,7 +10465,7 @@ module.exports = { eq: compileBoundsSearch("-", true, "EQ", true) } -},{}],81:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ 'use strict' module.exports = orientation @@ -10414,7 +10484,7 @@ function orientation(s) { return p } -},{}],82:[function(require,module,exports){ +},{}],84:[function(require,module,exports){ "use strict" var dup = require("dup") @@ -10483,7 +10553,7 @@ function circumcenter(points) { circumcenter.barycenetric = barycentricCircumcenter module.exports = circumcenter -},{"dup":121,"robust-linear-solve":499}],83:[function(require,module,exports){ +},{"dup":123,"robust-linear-solve":503}],85:[function(require,module,exports){ module.exports = circumradius var circumcenter = require('circumcenter') @@ -10499,7 +10569,7 @@ function circumradius(points) { } return Math.sqrt(avgDist / points.length) } -},{"circumcenter":82}],84:[function(require,module,exports){ +},{"circumcenter":84}],86:[function(require,module,exports){ module.exports = clamp function clamp(value, min, max) { @@ -10508,7 +10578,7 @@ function clamp(value, min, max) { : (value < max ? max : value > min ? min : value) } -},{}],85:[function(require,module,exports){ +},{}],87:[function(require,module,exports){ 'use strict' module.exports = cleanPSLG @@ -10891,7 +10961,7 @@ function cleanPSLG (points, edges, colors) { return modified } -},{"./lib/rat-seg-intersect":86,"big-rat":49,"big-rat/cmp":47,"big-rat/to-float":61,"box-intersect":66,"nextafter":461,"rat-vec":487,"robust-segment-intersect":503,"union-find":534}],86:[function(require,module,exports){ +},{"./lib/rat-seg-intersect":88,"big-rat":51,"big-rat/cmp":49,"big-rat/to-float":63,"box-intersect":68,"nextafter":464,"rat-vec":491,"robust-segment-intersect":507,"union-find":538}],88:[function(require,module,exports){ 'use strict' module.exports = solveIntersection @@ -10935,7 +11005,7 @@ function solveIntersection (a, b, c, d) { return r } -},{"big-rat/div":48,"big-rat/mul":58,"big-rat/sign":59,"big-rat/sub":60,"rat-vec/add":486,"rat-vec/muls":488,"rat-vec/sub":489}],87:[function(require,module,exports){ +},{"big-rat/div":50,"big-rat/mul":60,"big-rat/sign":61,"big-rat/sub":62,"rat-vec/add":490,"rat-vec/muls":492,"rat-vec/sub":493}],89:[function(require,module,exports){ (function (Buffer){ var clone = (function() { 'use strict'; @@ -11099,14 +11169,16 @@ if (typeof module === 'object' && module.exports) { } }).call(this,require("buffer").Buffer) -},{"buffer":73}],88:[function(require,module,exports){ -/** @module color-number */ +},{"buffer":75}],90:[function(require,module,exports){ +/** @module color-id */ 'use strict' var clamp = require('clamp') module.exports = toNumber +module.exports.to = toNumber +module.exports.from = fromNumber function toNumber (rgba, normalized) { if(normalized == null) normalized = true @@ -11132,8 +11204,21 @@ function toNumber (rgba, normalized) { return n } + +function fromNumber (n, normalized) { + n = +n + + var r = n >>> 24 + var g = (n & 0x00ff0000) >>> 16 + var b = (n & 0x0000ff00) >>> 8 + var a = n & 0x000000ff + + if (normalized === false) return [r, g, b, a] + + return [r/255, g/255, b/255, a/255] +} -},{"clamp":84}],89:[function(require,module,exports){ +},{"clamp":86}],91:[function(require,module,exports){ module.exports = { "aliceblue": [240, 248, 255], "antiquewhite": [250, 235, 215], @@ -11284,7 +11369,7 @@ module.exports = { "yellow": [255, 255, 0], "yellowgreen": [154, 205, 50] }; -},{}],90:[function(require,module,exports){ +},{}],92:[function(require,module,exports){ /** * @module color-parse */ @@ -11461,7 +11546,7 @@ function parse (cstr) { }; } -},{"color-name":89,"is-plain-obj":290}],91:[function(require,module,exports){ +},{"color-name":91,"is-plain-obj":293}],93:[function(require,module,exports){ /** @module color-rgba */ 'use strict' @@ -11500,7 +11585,7 @@ module.exports = function rgba (color, normalize) { } -},{"clamp":84,"color-parse":90,"color-space/hsl":92}],92:[function(require,module,exports){ +},{"clamp":86,"color-parse":92,"color-space/hsl":94}],94:[function(require,module,exports){ /** * @module color-space/hsl */ @@ -11609,7 +11694,7 @@ rgb.hsl = function(rgb) { return [h, s * 100, l * 100]; }; -},{"./rgb":93}],93:[function(require,module,exports){ +},{"./rgb":95}],95:[function(require,module,exports){ /** * RGB space. * @@ -11625,7 +11710,7 @@ module.exports = { alias: ['RGB'] }; -},{}],94:[function(require,module,exports){ +},{}],96:[function(require,module,exports){ module.exports={ "jet":[{"index":0,"rgb":[0,0,131]},{"index":0.125,"rgb":[0,60,170]},{"index":0.375,"rgb":[5,255,255]},{"index":0.625,"rgb":[255,255,0]},{"index":0.875,"rgb":[250,0,0]},{"index":1,"rgb":[128,0,0]}], @@ -11718,7 +11803,7 @@ module.exports={ "cubehelix": [{"index":0,"rgb":[0,0,0]},{"index":0.07,"rgb":[22,5,59]},{"index":0.13,"rgb":[60,4,105]},{"index":0.2,"rgb":[109,1,135]},{"index":0.27,"rgb":[161,0,147]},{"index":0.33,"rgb":[210,2,142]},{"index":0.4,"rgb":[251,11,123]},{"index":0.47,"rgb":[255,29,97]},{"index":0.53,"rgb":[255,54,69]},{"index":0.6,"rgb":[255,85,46]},{"index":0.67,"rgb":[255,120,34]},{"index":0.73,"rgb":[255,157,37]},{"index":0.8,"rgb":[241,191,57]},{"index":0.87,"rgb":[224,220,93]},{"index":0.93,"rgb":[218,241,142]},{"index":1,"rgb":[227,253,198]}] }; -},{}],95:[function(require,module,exports){ +},{}],97:[function(require,module,exports){ /* * Ben Postlethwaite * January 2013 @@ -11855,7 +11940,7 @@ function rgbaStr (rgba) { return 'rgba(' + rgba.join(',') + ')'; } -},{"./colorScales":94,"arraytools":42,"clone":87}],96:[function(require,module,exports){ +},{"./colorScales":96,"arraytools":44,"clone":89}],98:[function(require,module,exports){ "use strict" module.exports = compareAngle @@ -11941,7 +12026,7 @@ function compareAngle(a, b, c, d) { } } } -},{"robust-orientation":500,"robust-product":501,"robust-sum":505,"signum":507,"two-sum":532}],97:[function(require,module,exports){ +},{"robust-orientation":504,"robust-product":505,"robust-sum":509,"signum":511,"two-sum":536}],99:[function(require,module,exports){ module.exports = compareCells var min = Math.min @@ -11997,7 +12082,7 @@ function compareCells(a, b) { } } -},{}],98:[function(require,module,exports){ +},{}],100:[function(require,module,exports){ 'use strict' var compareCells = require('compare-cell') @@ -12009,7 +12094,7 @@ function compareOrientedCells(a, b) { return compareCells(a, b) || parity(a) - parity(b) } -},{"cell-orientation":81,"compare-cell":97}],99:[function(require,module,exports){ +},{"cell-orientation":83,"compare-cell":99}],101:[function(require,module,exports){ "use strict" var convexHull1d = require('./lib/ch1d') @@ -12035,7 +12120,7 @@ function convexHull(points) { } return convexHullnd(points, d) } -},{"./lib/ch1d":100,"./lib/ch2d":101,"./lib/chnd":102}],100:[function(require,module,exports){ +},{"./lib/ch1d":102,"./lib/ch2d":103,"./lib/chnd":104}],102:[function(require,module,exports){ "use strict" module.exports = convexHull1d @@ -12059,7 +12144,7 @@ function convexHull1d(points) { return [[lo]] } } -},{}],101:[function(require,module,exports){ +},{}],103:[function(require,module,exports){ 'use strict' module.exports = convexHull2D @@ -12082,7 +12167,7 @@ function convexHull2D(points) { return edges } -},{"monotone-convex-hull-2d":444}],102:[function(require,module,exports){ +},{"monotone-convex-hull-2d":447}],104:[function(require,module,exports){ 'use strict' module.exports = convexHullnD @@ -12143,7 +12228,7 @@ function convexHullnD(points, d) { return invPermute(nhull, ah) } } -},{"affine-hull":39,"incremental-convex-hull":284}],103:[function(require,module,exports){ +},{"affine-hull":39,"incremental-convex-hull":287}],105:[function(require,module,exports){ module.exports = { AFG: 'afghan', ALA: '\\b\\wland', @@ -12402,7 +12487,7 @@ module.exports = { ZWE: 'zimbabwe|^(?!.*northern).*rhodesia' } -},{}],104:[function(require,module,exports){ +},{}],106:[function(require,module,exports){ // (c) Dean McNamee , 2012. // // https://github.com/deanm/css-color-parser-js @@ -12605,7 +12690,7 @@ function parseCSSColor(css_str) { try { exports.parseCSSColor = parseCSSColor } catch(e) { } -},{}],105:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ "use strict" function dcubicHermite(p0, v0, p1, v1, t, f) { @@ -12645,564 +12730,568 @@ function cubicHermite(p0, v0, p1, v1, t, f) { module.exports = cubicHermite module.exports.derivative = dcubicHermite -},{}],106:[function(require,module,exports){ -"use strict" - -var createThunk = require("./lib/thunk.js") - -function Procedure() { - this.argTypes = [] - this.shimArgs = [] - this.arrayArgs = [] - this.arrayBlockIndices = [] - this.scalarArgs = [] - this.offsetArgs = [] - this.offsetArgIndex = [] - this.indexArgs = [] - this.shapeArgs = [] - this.funcName = "" - this.pre = null - this.body = null - this.post = null - this.debug = false -} - -function compileCwise(user_args) { - //Create procedure - var proc = new Procedure() - - //Parse blocks - proc.pre = user_args.pre - proc.body = user_args.body - proc.post = user_args.post - - //Parse arguments - var proc_args = user_args.args.slice(0) - proc.argTypes = proc_args - for(var i=0; i0) { - throw new Error("cwise: pre() block may not reference array args") - } - if(i < proc.post.args.length && proc.post.args[i].count>0) { - throw new Error("cwise: post() block may not reference array args") - } - } else if(arg_type === "scalar") { - proc.scalarArgs.push(i) - proc.shimArgs.push("scalar" + i) - } else if(arg_type === "index") { - proc.indexArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { - throw new Error("cwise: pre() block may not reference array index") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array index") - } - if(i < proc.post.args.length && proc.post.args[i].count > 0) { - throw new Error("cwise: post() block may not reference array index") - } - } else if(arg_type === "shape") { - proc.shapeArgs.push(i) - if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { - throw new Error("cwise: pre() block may not write to array shape") - } - if(i < proc.body.args.length && proc.body.args[i].lvalue) { - throw new Error("cwise: body() block may not write to array shape") - } - if(i < proc.post.args.length && proc.post.args[i].lvalue) { - throw new Error("cwise: post() block may not write to array shape") - } - } else if(typeof arg_type === "object" && arg_type.offset) { - proc.argTypes[i] = "offset" - proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) - proc.offsetArgIndex.push(i) - } else { - throw new Error("cwise: Unknown argument type " + proc_args[i]) - } - } - - //Make sure at least one array argument was specified - if(proc.arrayArgs.length <= 0) { - throw new Error("cwise: No array arguments specified") - } - - //Make sure arguments are correct - if(proc.pre.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in pre() block") - } - if(proc.body.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in body() block") - } - if(proc.post.args.length > proc_args.length) { - throw new Error("cwise: Too many arguments in post() block") - } - - //Check debug flag - proc.debug = !!user_args.printCode || !!user_args.debug - - //Retrieve name - proc.funcName = user_args.funcName || "cwise" - - //Read in block size - proc.blockSize = user_args.blockSize || 64 - - return createThunk(proc) -} - -module.exports = compileCwise +},{}],108:[function(require,module,exports){ +"use strict" -},{"./lib/thunk.js":108}],107:[function(require,module,exports){ -"use strict" - -var uniq = require("uniq") - -// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) -// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. -function innerFill(order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , has_index = proc.indexArgs.length>0 - , code = [] - , vars = [] - , idx=0, pidx=0, i, j - for(i=0; i=0; --i) { // Start at largest stride and work your way inwards - idx = order[i] - code.push(["for(i",i,"=0;i",i," 0) { - code.push(["index[",pidx,"]-=s",pidx].join("")) - } - code.push(["++index[",idx,"]"].join("")) - } - code.push("}") - } - return code.join("\n") -} - -// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. -// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. -// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. -function outerFill(matched, order, proc, body) { - var dimension = order.length - , nargs = proc.arrayArgs.length - , blockSize = proc.blockSize - , has_index = proc.indexArgs.length > 0 - , code = [] - for(var i=0; i0;){"].join("")) // Iterate back to front - code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). - code.push(["s",order[i],"=j",i].join("")) - code.push(["j",i,"=0"].join("")) - code.push(["}else{s",order[i],"=",blockSize].join("")) - code.push(["j",i,"-=",blockSize,"}"].join("")) - if(has_index) { - code.push(["index[",order[i],"]=j",i].join("")) - } - } - for(var i=0; i 0) { - allEqual = allEqual && summary[i] === summary[i-1] - } - } - if(allEqual) { - return summary[0] - } - return summary.join("") -} - -//Generates a cwise operator -function generateCWiseOp(proc, typesig) { - - //Compute dimension - // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. - var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 - var orders = new Array(proc.arrayArgs.length) - var dtypes = new Array(proc.arrayArgs.length) - for(var i=0; i 0) { - vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) - } - if(proc.indexArgs.length > 0) { - // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. - var zeros = new Array(dimension) - for(var i=0; i 3) { - code.push(processBlock(proc.pre, proc, dtypes)) - } - - //Process body - var body = processBlock(proc.body, proc, dtypes) - var matched = countMatches(loopOrders) - if(matched < dimension) { - code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. - } else { - code.push(innerFill(loopOrders[0], proc, body)) - } - - //Inline epilog - if(proc.post.body.length > 3) { - code.push(processBlock(proc.post, proc, dtypes)) - } - - if(proc.debug) { - console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") - } - - var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") - var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) - return f() -} -module.exports = generateCWiseOp - -},{"uniq":535}],108:[function(require,module,exports){ -"use strict" - -// The function below is called when constructing a cwise function object, and does the following: -// A function object is constructed which accepts as argument a compilation function and returns another function. -// It is this other function that is eventually returned by createThunk, and this function is the one that actually -// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. -// The compilation passed to the first function object is used for compiling new functions. -// Once this function object is created, it is called with compile as argument, where the first argument of compile -// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). -// So createThunk roughly works like this: -// function createThunk(proc) { -// var thunk = function(compileBound) { -// var CACHED = {} -// return function(arrays and scalars) { -// if (dtype and order of arrays in CACHED) { -// var func = CACHED[dtype and order of arrays] -// } else { -// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) -// } -// return func(arrays and scalars) -// } -// } -// return thunk(compile.bind1(proc)) -// } - -var compile = require("./compile.js") - -function createThunk(proc) { - var code = ["'use strict'", "var CACHED={}"] - var vars = [] - var thunkName = proc.funcName + "_cwise_thunk" - - //Build thunk - code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) - var typesig = [] - var string_typesig = [] - var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). - Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] - var shapeLengthConditions = [], shapeConditions = [] - // Process array arguments - for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) - shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) - shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") - } - } - // Check for shape equality - if (proc.arrayArgs.length > 1) { - code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") - code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") - code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") - code.push("}") - } - // Process scalar arguments - for(var i=0; i0) { + throw new Error("cwise: pre() block may not reference array args") + } + if(i < proc.post.args.length && proc.post.args[i].count>0) { + throw new Error("cwise: post() block may not reference array args") + } + } else if(arg_type === "scalar") { + proc.scalarArgs.push(i) + proc.shimArgs.push("scalar" + i) + } else if(arg_type === "index") { + proc.indexArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].count > 0) { + throw new Error("cwise: pre() block may not reference array index") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array index") + } + if(i < proc.post.args.length && proc.post.args[i].count > 0) { + throw new Error("cwise: post() block may not reference array index") + } + } else if(arg_type === "shape") { + proc.shapeArgs.push(i) + if(i < proc.pre.args.length && proc.pre.args[i].lvalue) { + throw new Error("cwise: pre() block may not write to array shape") + } + if(i < proc.body.args.length && proc.body.args[i].lvalue) { + throw new Error("cwise: body() block may not write to array shape") + } + if(i < proc.post.args.length && proc.post.args[i].lvalue) { + throw new Error("cwise: post() block may not write to array shape") + } + } else if(typeof arg_type === "object" && arg_type.offset) { + proc.argTypes[i] = "offset" + proc.offsetArgs.push({ array: arg_type.array, offset:arg_type.offset }) + proc.offsetArgIndex.push(i) + } else { + throw new Error("cwise: Unknown argument type " + proc_args[i]) + } + } + + //Make sure at least one array argument was specified + if(proc.arrayArgs.length <= 0) { + throw new Error("cwise: No array arguments specified") + } + + //Make sure arguments are correct + if(proc.pre.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in pre() block") + } + if(proc.body.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in body() block") + } + if(proc.post.args.length > proc_args.length) { + throw new Error("cwise: Too many arguments in post() block") + } + + //Check debug flag + proc.debug = !!user_args.printCode || !!user_args.debug + + //Retrieve name + proc.funcName = user_args.funcName || "cwise" + + //Read in block size + proc.blockSize = user_args.blockSize || 64 + + return createThunk(proc) +} + +module.exports = compileCwise + +},{"./lib/thunk.js":110}],109:[function(require,module,exports){ +"use strict" + +var uniq = require("uniq") + +// This function generates very simple loops analogous to how you typically traverse arrays (the outermost loop corresponds to the slowest changing index, the innermost loop to the fastest changing index) +// TODO: If two arrays have the same strides (and offsets) there is potential for decreasing the number of "pointers" and related variables. The drawback is that the type signature would become more specific and that there would thus be less potential for caching, but it might still be worth it, especially when dealing with large numbers of arguments. +function innerFill(order, proc, body) { + var dimension = order.length + , nargs = proc.arrayArgs.length + , has_index = proc.indexArgs.length>0 + , code = [] + , vars = [] + , idx=0, pidx=0, i, j + for(i=0; i 0) { + code.push("var " + vars.join(",")) + } + //Scan loop + for(i=dimension-1; i>=0; --i) { // Start at largest stride and work your way inwards + idx = order[i] + code.push(["for(i",i,"=0;i",i," 0) { + code.push(["index[",pidx,"]-=s",pidx].join("")) + } + code.push(["++index[",idx,"]"].join("")) + } + code.push("}") + } + return code.join("\n") +} + +// Generate "outer" loops that loop over blocks of data, applying "inner" loops to the blocks by manipulating the local variables in such a way that the inner loop only "sees" the current block. +// TODO: If this is used, then the previous declaration (done by generateCwiseOp) of s* is essentially unnecessary. +// I believe the s* are not used elsewhere (in particular, I don't think they're used in the pre/post parts and "shape" is defined independently), so it would be possible to make defining the s* dependent on what loop method is being used. +function outerFill(matched, order, proc, body) { + var dimension = order.length + , nargs = proc.arrayArgs.length + , blockSize = proc.blockSize + , has_index = proc.indexArgs.length > 0 + , code = [] + for(var i=0; i0;){"].join("")) // Iterate back to front + code.push(["if(j",i,"<",blockSize,"){"].join("")) // Either decrease j by blockSize (s = blockSize), or set it to zero (after setting s = j). + code.push(["s",order[i],"=j",i].join("")) + code.push(["j",i,"=0"].join("")) + code.push(["}else{s",order[i],"=",blockSize].join("")) + code.push(["j",i,"-=",blockSize,"}"].join("")) + if(has_index) { + code.push(["index[",order[i],"]=j",i].join("")) + } + } + for(var i=0; i 0) { + allEqual = allEqual && summary[i] === summary[i-1] + } + } + if(allEqual) { + return summary[0] + } + return summary.join("") +} + +//Generates a cwise operator +function generateCWiseOp(proc, typesig) { + + //Compute dimension + // Arrays get put first in typesig, and there are two entries per array (dtype and order), so this gets the number of dimensions in the first array arg. + var dimension = (typesig[1].length - Math.abs(proc.arrayBlockIndices[0]))|0 + var orders = new Array(proc.arrayArgs.length) + var dtypes = new Array(proc.arrayArgs.length) + for(var i=0; i 0) { + vars.push("shape=SS.slice(0)") // Makes the shape over which we iterate available to the user defined functions (so you can use width/height for example) + } + if(proc.indexArgs.length > 0) { + // Prepare an array to keep track of the (logical) indices, initialized to dimension zeroes. + var zeros = new Array(dimension) + for(var i=0; i 0) { + code.push("var " + vars.join(",")) + } + for(var i=0; i 3) { + code.push(processBlock(proc.pre, proc, dtypes)) + } + + //Process body + var body = processBlock(proc.body, proc, dtypes) + var matched = countMatches(loopOrders) + if(matched < dimension) { + code.push(outerFill(matched, loopOrders[0], proc, body)) // TODO: Rather than passing loopOrders[0], it might be interesting to look at passing an order that represents the majority of the arguments for example. + } else { + code.push(innerFill(loopOrders[0], proc, body)) + } + + //Inline epilog + if(proc.post.body.length > 3) { + code.push(processBlock(proc.post, proc, dtypes)) + } + + if(proc.debug) { + console.log("-----Generated cwise routine for ", typesig, ":\n" + code.join("\n") + "\n----------") + } + + var loopName = [(proc.funcName||"unnamed"), "_cwise_loop_", orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("") + var f = new Function(["function ",loopName,"(", arglist.join(","),"){", code.join("\n"),"} return ", loopName].join("")) + return f() +} +module.exports = generateCWiseOp + +},{"uniq":539}],110:[function(require,module,exports){ +"use strict" + +// The function below is called when constructing a cwise function object, and does the following: +// A function object is constructed which accepts as argument a compilation function and returns another function. +// It is this other function that is eventually returned by createThunk, and this function is the one that actually +// checks whether a certain pattern of arguments has already been used before and compiles new loops as needed. +// The compilation passed to the first function object is used for compiling new functions. +// Once this function object is created, it is called with compile as argument, where the first argument of compile +// is bound to "proc" (essentially containing a preprocessed version of the user arguments to cwise). +// So createThunk roughly works like this: +// function createThunk(proc) { +// var thunk = function(compileBound) { +// var CACHED = {} +// return function(arrays and scalars) { +// if (dtype and order of arrays in CACHED) { +// var func = CACHED[dtype and order of arrays] +// } else { +// var func = CACHED[dtype and order of arrays] = compileBound(dtype and order of arrays) +// } +// return func(arrays and scalars) +// } +// } +// return thunk(compile.bind1(proc)) +// } + +var compile = require("./compile.js") + +function createThunk(proc) { + var code = ["'use strict'", "var CACHED={}"] + var vars = [] + var thunkName = proc.funcName + "_cwise_thunk" + + //Build thunk + code.push(["return function ", thunkName, "(", proc.shimArgs.join(","), "){"].join("")) + var typesig = [] + var string_typesig = [] + var proc_args = [["array",proc.arrayArgs[0],".shape.slice(", // Slice shape so that we only retain the shape over which we iterate (which gets passed to the cwise operator as SS). + Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?(","+proc.arrayBlockIndices[0]+")"):")"].join("")] + var shapeLengthConditions = [], shapeConditions = [] + // Process array arguments + for(var i=0; i0) { // Gather conditions to check for shape equality (ignoring block indices) + shapeLengthConditions.push("array" + proc.arrayArgs[0] + ".shape.length===array" + j + ".shape.length+" + (Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))) + shapeConditions.push("array" + proc.arrayArgs[0] + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[0]) + "]===array" + j + ".shape[shapeIndex+" + Math.max(0,proc.arrayBlockIndices[i]) + "]") + } + } + // Check for shape equality + if (proc.arrayArgs.length > 1) { + code.push("if (!(" + shapeLengthConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same dimensionality!')") + code.push("for(var shapeIndex=array" + proc.arrayArgs[0] + ".shape.length-" + Math.abs(proc.arrayBlockIndices[0]) + "; shapeIndex-->0;) {") + code.push("if (!(" + shapeConditions.join(" && ") + ")) throw new Error('cwise: Arrays do not all have the same shape!')") + code.push("}") + } + // Process scalar arguments + for(var i=0; i * but significantly simplified and sped up by ignoring number and string constructors @@ -28458,7 +28547,7 @@ module.exports = function(n) { return n - n < 1; }; -},{}],128:[function(require,module,exports){ +},{}],130:[function(require,module,exports){ 'use strict'; module.exports = createFilter; @@ -28542,7 +28631,7 @@ function compare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],129:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ 'use strict' module.exports = createFilteredVector @@ -28835,32 +28924,35 @@ function createFilteredVector(initState, initVelocity, initTime) { } } -},{"binary-search-bounds":62,"cubic-hermite":105}],130:[function(require,module,exports){ +},{"binary-search-bounds":64,"cubic-hermite":107}],132:[function(require,module,exports){ +/** + * @module font-atlas-sdf + */ + 'use strict' var SDF = require('tiny-sdf') +var optical = require('optical-properties') module.exports = atlas + function atlas(options) { options = options || {} var canvas = options.canvas || document.createElement('canvas') - var family = options.family || 'monospace' + var family = options.family || 'sans-serif' var shape = options.shape || [512, 512] var step = options.step || [32, 32] - var size = options.size || 16 + var size = parseFloat(options.size) || 16 var chars = options.chars || [32, 126] var bufferSize = Math.floor((step[0] - size)/2) var radius = options.radius || bufferSize*1.5 var sdf = new SDF(size, bufferSize, radius, 0, family) - var vAlign = options.align || true + var vAlign = options.align == null ? 'optical' : options.align + var fit = options.fit == null || options.fit == true ? .5 : options.fit var i, j - if (typeof size === 'number') { - size = size + 'px' - } - if (!Array.isArray(chars)) { chars = String(chars).split('') } @@ -28886,28 +28978,69 @@ function atlas(options) { ctx.fillStyle = '#000' ctx.fillRect(0, 0, canvas.width, canvas.height) - ctx.font = size + ' ' + family ctx.textBaseline = 'middle' + var w = step[0], h = step[1] var x = 0 var y = 0 - var len = Math.min(chars.length, Math.floor(shape[0]/step[0]) * Math.ceil(shape[1]/step[1])) + var ratio = size/h + var len = Math.min(chars.length, Math.floor(shape[0]/w) * Math.ceil(shape[1]/h)) // hack tiny-sdf to render centered //FIXME: get rif of it by [possibly] PR to tiny-sdf var align = sdf.ctx.textAlign var buffer = sdf.buffer + var middle = sdf.middle sdf.ctx.textAlign = 'center' sdf.buffer = sdf.size/2 for (i = 0; i < len; i++) { - var data = sdf.draw(chars[i]) + if (!chars[i]) continue; + + var props = getProps(chars[i], family, ratio) + var scale = 1, diff = [0, 0] + + //hack tinysdf char-draw method + if (fit) { + var fitRatio = fit + if (Array.isArray(fit)) { + fitRatio = fit[i] + } + var vert = (props.bounds[3]-props.bounds[1])*.5 + var horiz = (props.bounds[2]-props.bounds[0])*.5 + var maxSide = Math.max( vert , horiz ) + var diag = Math.sqrt(vert*vert + horiz*horiz) + var maxDist = props.radius*.333 + maxSide*.333 + diag*.333 + + scale = h*fitRatio / (maxDist*h*2) + sdf.ctx.font = size*scale + 'px ' + family; + } + else { + sdf.ctx.font = size + 'px ' + family; + } + + if (vAlign) { + if (vAlign === 'optical' || vAlign === true) { + diff = [ + w*.5 - w*props.center[0], + h*.5 - h*props.center[1] + ] + } + else { + diff = [ + w*.5 - w*(props.bounds[2] + props.bounds[0])*.5, + h*.5 - h*(props.bounds[3] + props.bounds[1])*.5 + ] + } + sdf.middle = middle + diff[1]*scale + } - var offY = 0 - if (vAlign) offY = getAlignOffset(data) + //calc sdf + var data = sdf.draw(chars[i]) - ctx.putImageData(data, x, y - offY) + // ctx.putImageData(data, x + diff[0]*scale, y + diff[1]*scale, 0, -diff[1]*scale, data.width, data.height) + ctx.putImageData(data, x + diff[0]*scale, y) x += step[0] if (x > shape[0] - step[0]) { @@ -28919,49 +29052,38 @@ function atlas(options) { // unhack tiny-sdf sdf.ctx.textAlign = align sdf.buffer = buffer + sdf.middle = middle return canvas +} +var cache = {} +function getProps(char, family, ratio) { + if (cache[family] && cache[family][char]) return cache[family][char] + + var propsSize = 200 + var propsFs = propsSize * ratio + var props = optical(char, {size: propsSize, fontSize: propsFs, fontFamily: family}) + + if (!cache[family]) cache[family] = {} + + var relProps = { + center: [ + props.center[0]/propsSize, + props.center[1]/propsSize + ], + bounds: props.bounds.map(function (v) { + return v/propsSize + }), + radius: props.radius/propsSize + } - function getAlignOffset (data) { - var buf = data.data, w = data.width, h = data.height - - var top = 0, bottom = 0, x, y, r, line - - //find top boundary - for (y = 0; y < h; y++) { - line = y * w * 4 - for (x = 0; x < w; x++) { - r = buf[line + x * 4] - - if (r > 0) { - top = y - break - } - } - if (top) break - } - - //find bottom boundary - for (y = h; y--;) { - line = y * w * 4 - for (x = 0; x < w; x++) { - r = buf[line + x * 4] - - if (r > 0) { - bottom = y - break - } - } - if (bottom) break - } + cache[family][char] = relProps - return top - .5 * (top + (h - bottom)) - } + return relProps } - -},{"tiny-sdf":525}],131:[function(require,module,exports){ +},{"optical-properties":467,"tiny-sdf":529}],133:[function(require,module,exports){ "use strict" module.exports = createRBTree @@ -29958,7 +30080,7 @@ function defaultCompare(a, b) { function createRBTree(compare) { return new RedBlackTree(compare || defaultCompare, null) } -},{}],132:[function(require,module,exports){ +},{}],134:[function(require,module,exports){ // transliterated from the python snippet here: // http://en.wikipedia.org/wiki/Lanczos_approximation @@ -30027,7 +30149,7 @@ module.exports = function gamma (z) { module.exports.log = lngamma; -},{}],133:[function(require,module,exports){ +},{}],135:[function(require,module,exports){ var wgs84 = require('wgs84'); module.exports.geometry = geometry; @@ -30093,7 +30215,7 @@ function rad(_) { return _ * Math.PI / 180; } -},{"wgs84":557}],134:[function(require,module,exports){ +},{"wgs84":561}],136:[function(require,module,exports){ var geojsonArea = require('geojson-area'); module.exports = rewind; @@ -30144,7 +30266,7 @@ function cw(_) { return geojsonArea.ring(_) >= 0; } -},{"geojson-area":133}],135:[function(require,module,exports){ +},{"geojson-area":135}],137:[function(require,module,exports){ 'use strict'; module.exports = clip; @@ -30295,7 +30417,7 @@ function newSlice(slices, slice, area, dist, outer) { return []; } -},{"./feature":137}],136:[function(require,module,exports){ +},{"./feature":139}],138:[function(require,module,exports){ 'use strict'; module.exports = convert; @@ -30418,7 +30540,7 @@ function calcSize(points) { points.dist = dist; } -},{"./feature":137,"./simplify":139}],137:[function(require,module,exports){ +},{"./feature":139,"./simplify":141}],139:[function(require,module,exports){ 'use strict'; module.exports = createFeature; @@ -30463,7 +30585,7 @@ function calcRingBBox(min, max, points) { } } -},{}],138:[function(require,module,exports){ +},{}],140:[function(require,module,exports){ 'use strict'; module.exports = geojsonvt; @@ -30707,7 +30829,7 @@ function isClippedSquare(tile, extent, buffer) { return true; } -},{"./clip":135,"./convert":136,"./tile":140,"./transform":141,"./wrap":142}],139:[function(require,module,exports){ +},{"./clip":137,"./convert":138,"./tile":142,"./transform":143,"./wrap":144}],141:[function(require,module,exports){ 'use strict'; module.exports = simplify; @@ -30783,7 +30905,7 @@ function getSqSegDist(p, a, b) { return dx * dx + dy * dy; } -},{}],140:[function(require,module,exports){ +},{}],142:[function(require,module,exports){ 'use strict'; module.exports = createTile; @@ -30891,7 +31013,7 @@ function signedArea(ring) { return sum; } -},{}],141:[function(require,module,exports){ +},{}],143:[function(require,module,exports){ 'use strict'; exports.tile = transformTile; @@ -30934,7 +31056,7 @@ function transformPoint(p, extent, z2, tx, ty) { return [x, y]; } -},{}],142:[function(require,module,exports){ +},{}],144:[function(require,module,exports){ 'use strict'; var clip = require('./clip'); @@ -30992,7 +31114,7 @@ function shiftCoords(points, offset) { return newPoints; } -},{"./clip":135,"./feature":137}],143:[function(require,module,exports){ +},{"./clip":137,"./feature":139}],145:[function(require,module,exports){ module.exports = getCanvasContext function getCanvasContext (type, opts) { if (typeof type !== 'string') { @@ -31032,7 +31154,7 @@ function getCanvasContext (type, opts) { return (gl || null) // ensure null on fail } -},{}],144:[function(require,module,exports){ +},{}],146:[function(require,module,exports){ 'use strict' module.exports = createAxes @@ -31555,7 +31677,7 @@ function createAxes(gl, options) { return axes } -},{"./lib/background.js":145,"./lib/cube.js":146,"./lib/lines.js":147,"./lib/text.js":149,"./lib/ticks.js":150}],145:[function(require,module,exports){ +},{"./lib/background.js":147,"./lib/cube.js":148,"./lib/lines.js":149,"./lib/text.js":151,"./lib/ticks.js":152}],147:[function(require,module,exports){ 'use strict' module.exports = createBackgroundCube @@ -31667,7 +31789,7 @@ function createBackgroundCube(gl) { return new BackgroundCube(gl, buffer, vao, shader) } -},{"./shaders":148,"gl-buffer":152,"gl-vao":266}],146:[function(require,module,exports){ +},{"./shaders":150,"gl-buffer":154,"gl-vao":269}],148:[function(require,module,exports){ "use strict" module.exports = getCubeEdges @@ -31908,7 +32030,7 @@ function getCubeEdges(model, view, projection, bounds) { //Return result return CUBE_RESULT } -},{"bit-twiddle":63,"gl-mat4/invert":176,"gl-mat4/multiply":178,"robust-orientation":500,"split-polygon":518}],147:[function(require,module,exports){ +},{"bit-twiddle":65,"gl-mat4/invert":179,"gl-mat4/multiply":181,"robust-orientation":504,"split-polygon":522}],149:[function(require,module,exports){ 'use strict' module.exports = createLines @@ -32114,7 +32236,7 @@ function createLines(gl, bounds, ticks) { return new Lines(gl, vertBuf, vao, shader, tickCount, tickOffset, gridCount, gridOffset) } -},{"./shaders":148,"gl-buffer":152,"gl-vao":266}],148:[function(require,module,exports){ +},{"./shaders":150,"gl-buffer":154,"gl-vao":269}],150:[function(require,module,exports){ 'use strict' @@ -32145,7 +32267,7 @@ exports.bg = function(gl) { ]) } -},{"gl-shader":250}],149:[function(require,module,exports){ +},{"gl-shader":253}],151:[function(require,module,exports){ (function (process){ "use strict" @@ -32347,7 +32469,7 @@ function createTextSprites( } }).call(this,require('_process')) -},{"./shaders":148,"_process":479,"gl-buffer":152,"gl-vao":266,"vectorize-text":546}],150:[function(require,module,exports){ +},{"./shaders":150,"_process":483,"gl-buffer":154,"gl-vao":269,"vectorize-text":550}],152:[function(require,module,exports){ 'use strict' exports.create = defaultTicks @@ -32428,7 +32550,7 @@ function ticksEqual(ticksA, ticksB) { } return true } -},{}],151:[function(require,module,exports){ +},{}],153:[function(require,module,exports){ "use strict" module.exports = axesProperties @@ -32570,7 +32692,7 @@ i_loop: return ranges } -},{"./lib/cube.js":146,"extract-frustum-planes":126,"gl-mat4/multiply":178,"gl-mat4/transpose":186,"gl-vec4/transformMat4":272,"split-polygon":518}],152:[function(require,module,exports){ +},{"./lib/cube.js":148,"extract-frustum-planes":128,"gl-mat4/multiply":181,"gl-mat4/transpose":189,"gl-vec4/transformMat4":275,"split-polygon":522}],154:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -32724,7 +32846,7 @@ function createBuffer(gl, data, type, usage) { module.exports = createBuffer -},{"ndarray":460,"ndarray-ops":454,"typedarray-pool":533}],153:[function(require,module,exports){ +},{"ndarray":463,"ndarray-ops":457,"typedarray-pool":537}],155:[function(require,module,exports){ module.exports = { 0: 'NONE', 1: 'ONE', @@ -33024,14 +33146,14 @@ module.exports = { 37444: 'BROWSER_DEFAULT_WEBGL' } -},{}],154:[function(require,module,exports){ +},{}],156:[function(require,module,exports){ var gl10 = require('./1.0/numbers') module.exports = function lookupConstant (number) { return gl10[number] } -},{"./1.0/numbers":153}],155:[function(require,module,exports){ +},{"./1.0/numbers":155}],157:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -33296,7 +33418,7 @@ function createError2D (plot, options) { return errorBars } -},{"./lib/shaders":156,"gl-buffer":152,"gl-shader":250,"typedarray-pool":533}],156:[function(require,module,exports){ +},{"./lib/shaders":158,"gl-buffer":154,"gl-shader":253,"typedarray-pool":537}],158:[function(require,module,exports){ module.exports = { @@ -33304,7 +33426,7 @@ module.exports = { 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" } -},{}],157:[function(require,module,exports){ +},{}],159:[function(require,module,exports){ 'use strict' module.exports = createErrorBars @@ -33361,12 +33483,13 @@ proto.drawTransparent = proto.draw = function(cameraParams) { var cw = view[15] var pixelScaleF = this.pixelRatio * (projection[3]*cx + projection[7]*cy + projection[11]*cz + projection[15]*cw) / gl.drawingBufferHeight - this.vao.bind() for(var i=0; i<3; ++i) { gl.lineWidth(this.lineWidth[i]) uniforms.capSize = this.capSize[i] * pixelScaleF - gl.drawArrays(gl.LINES, this.lineOffset[i], this.lineCount[i]) + if (this.lineCount[i]) { + gl.drawArrays(gl.LINES, this.lineOffset[i], this.lineCount[i]) + } } this.vao.unbind() } @@ -33541,24 +33664,36 @@ function createErrorBars(options) { return result } -},{"./shaders/index":158,"gl-buffer":152,"gl-vao":266}],158:[function(require,module,exports){ -'use strict' +},{"./shaders/index":161,"gl-buffer":154,"gl-vao":269}],160:[function(require,module,exports){ +module.exports = function(strings) { + if (typeof strings === 'string') strings = [strings] + var exprs = [].slice.call(arguments,1) + var parts = [] + for (var i = 0; i < strings.length-1; i++) { + parts.push(strings[i], exprs[i] || '') + } + parts.push(strings[i]) + return parts.join('') +} +},{}],161:[function(require,module,exports){ +'use strict' +var glslify = require('glslify') var createShader = require('gl-shader') -var vertSrc = "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}" -var fragSrc = "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}" +var vertSrc = glslify(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]) +var fragSrc = glslify(["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}"]) module.exports = function(gl) { return createShader(gl, vertSrc, fragSrc, null, [ {name: 'position', type: 'vec3'}, - {name: 'offset', type: 'vec3'}, - {name: 'color', type: 'vec4'} + {name: 'color', type: 'vec4'}, + {name: 'offset', type: 'vec3'} ]) } -},{"gl-shader":250}],159:[function(require,module,exports){ +},{"gl-shader":253,"glslify":160}],162:[function(require,module,exports){ 'use strict' var createTexture = require('gl-texture2d') @@ -34025,7 +34160,7 @@ function createFBO(gl, width, height, options) { WEBGL_draw_buffers) } -},{"gl-texture2d":262}],160:[function(require,module,exports){ +},{"gl-texture2d":265}],163:[function(require,module,exports){ var sprintf = require('sprintf-js').sprintf; var glConstants = require('gl-constants/lookup'); @@ -34080,7 +34215,7 @@ function formatCompilerError(errLog, src, type) { } -},{"add-line-numbers":38,"gl-constants/lookup":154,"glsl-shader-name":274,"sprintf-js":519}],161:[function(require,module,exports){ +},{"add-line-numbers":38,"gl-constants/lookup":156,"glsl-shader-name":277,"sprintf-js":523}],164:[function(require,module,exports){ 'use strict' module.exports = createHeatmap2D @@ -34398,7 +34533,7 @@ function createHeatmap2D (plot, options) { return heatmap } -},{"./lib/shaders":162,"binary-search-bounds":163,"gl-buffer":152,"gl-shader":250,"iota-array":287,"typedarray-pool":533}],162:[function(require,module,exports){ +},{"./lib/shaders":165,"binary-search-bounds":166,"gl-buffer":154,"gl-shader":253,"iota-array":290,"typedarray-pool":537}],165:[function(require,module,exports){ 'use strict' @@ -34410,9 +34545,9 @@ module.exports = { pickVertex: "precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 pickId;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nvoid main() {\n vWeight = weight;\n\n fragId = pickId;\n\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n" } -},{}],163:[function(require,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"dup":80}],164:[function(require,module,exports){ +},{}],166:[function(require,module,exports){ +arguments[4][82][0].apply(exports,arguments) +},{"dup":82}],167:[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 (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}" @@ -34423,7 +34558,7 @@ exports.pickVertex = "precision highp float;\n#define GLSLIFY 1\n\nattribute 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 (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}" -},{}],165:[function(require,module,exports){ +},{}],168:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -34936,7 +35071,7 @@ function createLinePlot(plot, options) { linePlot.update(options) return linePlot } -},{"./lib/shaders":164,"gl-buffer":152,"gl-shader":250,"gl-texture2d":262,"ndarray":460,"typedarray-pool":533}],166:[function(require,module,exports){ +},{"./lib/shaders":167,"gl-buffer":154,"gl-shader":253,"gl-texture2d":265,"ndarray":463,"typedarray-pool":537}],169:[function(require,module,exports){ var createShader = require('gl-shader') @@ -34960,7 +35095,7 @@ exports.createPickShader = function(gl) { return createShader(gl, vertSrc, pickFrag, null, ATTRIBUTES) } -},{"gl-shader":250}],167:[function(require,module,exports){ +},{"gl-shader":253}],170:[function(require,module,exports){ 'use strict' module.exports = createLinePlot @@ -35330,7 +35465,7 @@ function createLinePlot (options) { return linePlot } -},{"./lib/shaders":166,"binary-search-bounds":62,"gl-buffer":152,"gl-texture2d":262,"gl-vao":266,"glsl-read-float":273,"ndarray":460}],168:[function(require,module,exports){ +},{"./lib/shaders":169,"binary-search-bounds":64,"gl-buffer":154,"gl-texture2d":265,"gl-vao":269,"glsl-read-float":276,"ndarray":463}],171:[function(require,module,exports){ module.exports = invert /** @@ -35359,7 +35494,7 @@ function invert(out, a) { return out } -},{}],169:[function(require,module,exports){ +},{}],172:[function(require,module,exports){ module.exports = invert /** @@ -35398,7 +35533,7 @@ function invert(out, a) { return out } -},{}],170:[function(require,module,exports){ +},{}],173:[function(require,module,exports){ module.exports = clone; /** @@ -35427,7 +35562,7 @@ function clone(a) { out[15] = a[15]; return out; }; -},{}],171:[function(require,module,exports){ +},{}],174:[function(require,module,exports){ module.exports = create; /** @@ -35455,7 +35590,7 @@ function create() { out[15] = 1; return out; }; -},{}],172:[function(require,module,exports){ +},{}],175:[function(require,module,exports){ module.exports = determinant; /** @@ -35486,7 +35621,7 @@ function determinant(a) { // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; -},{}],173:[function(require,module,exports){ +},{}],176:[function(require,module,exports){ module.exports = fromQuat; /** @@ -35534,7 +35669,7 @@ function fromQuat(out, q) { return out; }; -},{}],174:[function(require,module,exports){ +},{}],177:[function(require,module,exports){ module.exports = fromRotationTranslation; /** @@ -35588,7 +35723,7 @@ function fromRotationTranslation(out, q, v) { return out; }; -},{}],175:[function(require,module,exports){ +},{}],178:[function(require,module,exports){ module.exports = identity; /** @@ -35616,7 +35751,7 @@ function identity(out) { out[15] = 1; return out; }; -},{}],176:[function(require,module,exports){ +},{}],179:[function(require,module,exports){ module.exports = invert; /** @@ -35672,7 +35807,7 @@ function invert(out, a) { return out; }; -},{}],177:[function(require,module,exports){ +},{}],180:[function(require,module,exports){ var identity = require('./identity'); module.exports = lookAt; @@ -35763,7 +35898,7 @@ function lookAt(out, eye, center, up) { return out; }; -},{"./identity":175}],178:[function(require,module,exports){ +},{"./identity":178}],181:[function(require,module,exports){ module.exports = multiply; /** @@ -35806,7 +35941,7 @@ function multiply(out, a, b) { out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; -},{}],179:[function(require,module,exports){ +},{}],182:[function(require,module,exports){ module.exports = perspective; /** @@ -35840,7 +35975,7 @@ function perspective(out, fovy, aspect, near, far) { out[15] = 0; return out; }; -},{}],180:[function(require,module,exports){ +},{}],183:[function(require,module,exports){ module.exports = rotate; /** @@ -35905,7 +36040,7 @@ function rotate(out, a, rad, axis) { } return out; }; -},{}],181:[function(require,module,exports){ +},{}],184:[function(require,module,exports){ module.exports = rotateX; /** @@ -35950,7 +36085,7 @@ function rotateX(out, a, rad) { out[11] = a23 * c - a13 * s; return out; }; -},{}],182:[function(require,module,exports){ +},{}],185:[function(require,module,exports){ module.exports = rotateY; /** @@ -35995,7 +36130,7 @@ function rotateY(out, a, rad) { out[11] = a03 * s + a23 * c; return out; }; -},{}],183:[function(require,module,exports){ +},{}],186:[function(require,module,exports){ module.exports = rotateZ; /** @@ -36040,7 +36175,7 @@ function rotateZ(out, a, rad) { out[7] = a13 * c - a03 * s; return out; }; -},{}],184:[function(require,module,exports){ +},{}],187:[function(require,module,exports){ module.exports = scale; /** @@ -36072,7 +36207,7 @@ function scale(out, a, v) { out[15] = a[15]; return out; }; -},{}],185:[function(require,module,exports){ +},{}],188:[function(require,module,exports){ module.exports = translate; /** @@ -36111,7 +36246,7 @@ function translate(out, a, v) { return out; }; -},{}],186:[function(require,module,exports){ +},{}],189:[function(require,module,exports){ module.exports = transpose; /** @@ -36161,7 +36296,7 @@ function transpose(out, a) { return out; }; -},{}],187:[function(require,module,exports){ +},{}],190:[function(require,module,exports){ 'use strict' module.exports = invert @@ -36192,7 +36327,7 @@ function invert(out, M) { } return out } -},{"gl-mat2/invert":168,"gl-mat3/invert":169,"gl-mat4/invert":176}],188:[function(require,module,exports){ +},{"gl-mat2/invert":171,"gl-mat3/invert":172,"gl-mat4/invert":179}],191:[function(require,module,exports){ /** * @fileoverview gl-matrix - High performance matrix and vector operations * @author Brandon Jones @@ -36230,7 +36365,7 @@ exports.quat = require("./gl-matrix/quat.js"); exports.vec2 = require("./gl-matrix/vec2.js"); exports.vec3 = require("./gl-matrix/vec3.js"); exports.vec4 = require("./gl-matrix/vec4.js"); -},{"./gl-matrix/common.js":189,"./gl-matrix/mat2.js":190,"./gl-matrix/mat2d.js":191,"./gl-matrix/mat3.js":192,"./gl-matrix/mat4.js":193,"./gl-matrix/quat.js":194,"./gl-matrix/vec2.js":195,"./gl-matrix/vec3.js":196,"./gl-matrix/vec4.js":197}],189:[function(require,module,exports){ +},{"./gl-matrix/common.js":192,"./gl-matrix/mat2.js":193,"./gl-matrix/mat2d.js":194,"./gl-matrix/mat3.js":195,"./gl-matrix/mat4.js":196,"./gl-matrix/quat.js":197,"./gl-matrix/vec2.js":198,"./gl-matrix/vec3.js":199,"./gl-matrix/vec4.js":200}],192:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36302,7 +36437,7 @@ glMatrix.equals = function(a, b) { module.exports = glMatrix; -},{}],190:[function(require,module,exports){ +},{}],193:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36740,7 +36875,7 @@ mat2.multiplyScalarAndAdd = function(out, a, b, scale) { module.exports = mat2; -},{"./common.js":189}],191:[function(require,module,exports){ +},{"./common.js":192}],194:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -37211,7 +37346,7 @@ mat2d.equals = function (a, b) { module.exports = mat2d; -},{"./common.js":189}],192:[function(require,module,exports){ +},{"./common.js":192}],195:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -37959,7 +38094,7 @@ mat3.equals = function (a, b) { module.exports = mat3; -},{"./common.js":189}],193:[function(require,module,exports){ +},{"./common.js":192}],196:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -40097,7 +40232,7 @@ mat4.equals = function (a, b) { module.exports = mat4; -},{"./common.js":189}],194:[function(require,module,exports){ +},{"./common.js":192}],197:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -40699,7 +40834,7 @@ quat.equals = vec4.equals; module.exports = quat; -},{"./common.js":189,"./mat3.js":192,"./vec3.js":196,"./vec4.js":197}],195:[function(require,module,exports){ +},{"./common.js":192,"./mat3.js":195,"./vec3.js":199,"./vec4.js":200}],198:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -41288,7 +41423,7 @@ vec2.equals = function (a, b) { module.exports = vec2; -},{"./common.js":189}],196:[function(require,module,exports){ +},{"./common.js":192}],199:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -42067,7 +42202,7 @@ vec3.equals = function (a, b) { module.exports = vec3; -},{"./common.js":189}],197:[function(require,module,exports){ +},{"./common.js":192}],200:[function(require,module,exports){ /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -42678,7 +42813,7 @@ vec4.equals = function (a, b) { module.exports = vec4; -},{"./common.js":189}],198:[function(require,module,exports){ +},{"./common.js":192}],201:[function(require,module,exports){ 'use strict' var barycentric = require('barycentric') @@ -42776,7 +42911,7 @@ function closestPointToPickLocation(simplex, pixelCoord, model, view, projection } return [closestIndex, interpolate(simplex, weights), weights] } -},{"barycentric":45,"polytope-closest-point/lib/closest_point_2d.js":478}],199:[function(require,module,exports){ +},{"barycentric":47,"polytope-closest-point/lib/closest_point_2d.js":482}],202:[function(require,module,exports){ var triVertSrc = "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}" @@ -42845,7 +42980,7 @@ exports.contourShader = { ] } -},{}],200:[function(require,module,exports){ +},{}],203:[function(require,module,exports){ 'use strict' var DEFAULT_VERTEX_NORMALS_EPSILON = 1e-6; // may be too large if triangles are very small @@ -43171,10 +43306,15 @@ proto.update = function(params) { var intensityHi = -Infinity if(!vertexUVs && !cellUVs) { if(vertexIntensity) { - for(var i=0; i this.snapThreshold +proto.drawPick = function(offset) { + var pick = offset !== undefined + var plot = this.plot + var pointCount = this.pointCount + var snap = pointCount > this.snapThreshold - if(!pointCount) { - return offset - } + if(!pointCount) { + return offset + } - calcScales.call(this) + calcScales.call(this) - var gl = plot.gl - var shader = pick ? this.pickShader : this.shader - var blend = gl.isEnabled(gl.BLEND) + var gl = plot.gl + var shader = pick ? this.pickShader : this.shader + var blend = gl.isEnabled(gl.BLEND) - shader.bind() + shader.bind() - if(pick) { - this.pickOffset = offset + if(pick) { + this.pickOffset = offset - for (var i = 0; i < 4; ++i) { - PICK_OFFSET[i] = (offset >> (i * 8)) & 0xff - } + for (var i = 0; i < 4; ++i) { + PICK_OFFSET[i] = (offset >> (i * 8)) & 0xff + } - shader.uniforms.pickOffset = PICK_OFFSET + shader.uniforms.pickOffset = PICK_OFFSET - this.idBuffer.bind() - shader.attributes.id.pointer(gl.UNSIGNED_BYTE, false) + this.idBuffer.bind() + shader.attributes.id.pointer(gl.UNSIGNED_BYTE, false) - } else { - gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); - gl.blendColor(0,0,0,1); - if (!blend) gl.enable(gl.BLEND) + } else { + gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); + gl.blendColor(0,0,0,1); + if (!blend) gl.enable(gl.BLEND) - this.colorBuffer.bind() - shader.attributes.color.pointer(gl.UNSIGNED_BYTE, false) + this.colorBuffer.bind() + shader.attributes.color.pointer(gl.UNSIGNED_BYTE, false) - this.charBuffer.bind() - shader.attributes.char.pointer(gl.UNSIGNED_BYTE, false) + this.charBuffer.bind() + shader.attributes.char.pointer(gl.UNSIGNED_BYTE, false) - shader.uniforms.chars = this.charTexture.bind(0) - shader.uniforms.charsShape = [this.charCanvas.width, this.charCanvas.height] - shader.uniforms.charsStep = this.charStep - shader.uniforms.palette = this.paletteTexture.bind(1) - } + shader.uniforms.chars = this.charTexture.bind(0) + shader.uniforms.charsShape = [this.charCanvas.width, this.charCanvas.height] + shader.uniforms.charsStep = this.charStep + shader.uniforms.palette = this.paletteTexture.bind(1) + } - this.sizeBuffer.bind() - shader.attributes.size.pointer(gl.FLOAT, false, 8, 0) - if (!pick) shader.attributes.border.pointer(gl.FLOAT, false, 8, 4) + this.sizeBuffer.bind() + shader.attributes.size.pointer(gl.FLOAT, false, 8, 0) + if (!pick) shader.attributes.border.pointer(gl.FLOAT, false, 8, 4) - this.positionBuffer.bind() - shader.attributes.positionHi.pointer(gl.FLOAT, false, 16, 0) - shader.attributes.positionLo.pointer(gl.FLOAT, false, 16, 8) + this.positionBuffer.bind() + shader.attributes.positionHi.pointer(gl.FLOAT, false, 16, 0) + shader.attributes.positionLo.pointer(gl.FLOAT, false, 16, 8) - shader.uniforms.pixelRatio = plot.pixelRatio - shader.uniforms.scaleHi = SCALE_HI - shader.uniforms.scaleLo = SCALE_LO - shader.uniforms.translateHi = TRANSLATE_HI - shader.uniforms.translateLo = TRANSLATE_LO - shader.uniforms.viewBox = plot.viewBox + shader.uniforms.pixelRatio = plot.pixelRatio + shader.uniforms.scaleHi = SCALE_HI + shader.uniforms.scaleLo = SCALE_LO + shader.uniforms.translateHi = TRANSLATE_HI + shader.uniforms.translateLo = TRANSLATE_LO + shader.uniforms.viewBox = plot.viewBox - var scales = this.scales + var scales = this.scales - if (snap) { - for (var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { - var lod = scales[scaleNum] - if(lod.pixelSize && (lod.pixelSize < pixelSize * 1.25) && scaleNum > 1) { - continue - } + if (snap) { + for (var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { + var lod = scales[scaleNum] + if(lod.pixelSize && (lod.pixelSize < pixelSize * 1.25) && scaleNum > 1) { + continue + } - var intervalStart = lod.offset - var intervalEnd = lod.count + intervalStart + var intervalStart = lod.offset + var intervalEnd = lod.count + intervalStart - var startOffset = search.ge(this.xCoords, xStart, intervalStart, intervalEnd - 1) - var endOffset = search.lt(this.xCoords, xEnd, startOffset, intervalEnd - 1) + 1 + var startOffset = search.ge(this.xCoords, xStart, intervalStart, intervalEnd - 1) + var endOffset = search.lt(this.xCoords, xEnd, startOffset, intervalEnd - 1) + 1 - if (endOffset > startOffset) { - gl.drawArrays(gl.POINTS, startOffset, (endOffset - startOffset)) - } - } - } - else { - gl.drawArrays(gl.POINTS, 0, pointCount) + if (endOffset > startOffset) { + gl.drawArrays(gl.POINTS, startOffset, (endOffset - startOffset)) + } } + } + else { + gl.drawArrays(gl.POINTS, 0, pointCount) + } - if (pick) return offset + pointCount + if (pick) return offset + pointCount + else { + if (!blend) gl.disable(gl.BLEND) else { - if (!blend) gl.disable(gl.BLEND) - else { - gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) - } + gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA) } } -})() + +} proto.draw = proto.drawPick @@ -47894,36 +48037,69 @@ proto.pick = function(x, y, value) { proto.update = function(options) { options = options || {} - var positions = options.positions || [] + var positions = options.positions || [] var colors = options.colors || [] var glyphs = options.glyphs || [] var sizes = options.sizes || [] var borderWidths = options.borderWidths || [] var borderColors = options.borderColors || [] var gl = this.plot.gl + var pointCount = this.pointCount + var snap = pointCount > this.snapThreshold - this.points = positions + //update positions + if (options.positions != null) { + this.points = positions - //create packed positions here - var pointCount = this.points.length / 2 - var packedId = pool.mallocInt32(pointCount) - var packedW = pool.mallocFloat32(2 * pointCount) - var packed = pool.mallocFloat64(2 * pointCount) - packed.set(this.points) + pointCount = this.points.length / 2 - this.pointCount = pointCount + snap = pointCount > this.snapThreshold - var snap = pointCount > this.snapThreshold + //create packed positions here + var packedW = pool.mallocFloat32(2 * pointCount) + var packed = pool.mallocFloat64(2 * pointCount) + var v_ids = pool.mallocUint32(pointCount) + var v_position = pool.mallocFloat32(4 * pointCount) - if (snap) { - this.scales = snapPoints(packed, packedId, packedW) + packed.set(this.points) + + if (snap) { + if (this.i2idx) pool.free(this.i2idx) + this.i2idx = pool.mallocInt32(pointCount) + this.scales = snapPoints(packed, this.i2idx, packedW) + } + + this.pointCount = pointCount + + + for(var i = 0; i < pointCount; ++i) { + var id = snap ? this.i2idx[i] : i + + v_ids[i] = id + + //collect buffers data + var x = positions[2 * id] + var y = positions[2 * id + 1] + + //write hi- and lo- position parts + v_position[4 * i] = x + v_position[4 * i + 1] = y + v_position[4 * i + 2] = x - v_position[4 * i] + v_position[4 * i + 3] = y - v_position[4 * i + 1] + + this.xCoords[i] = x + } + + this.idBuffer.update(v_ids) + this.positionBuffer.update(v_position) + pool.free(v_position) + pool.free(v_ids) + pool.free(packed) + pool.free(packedW) } - //v_position contains normalized positions to the available range of positions - var v_position = pool.mallocFloat32(4 * pointCount) var v_sizeWidth = pool.mallocFloat32(2 * pointCount) var v_color = pool.mallocUint8(2 * pointCount) - var v_ids = pool.mallocUint32(pointCount) var v_chars = pool.mallocUint8(2 * pointCount) //aggregate colors @@ -47992,31 +48168,21 @@ proto.update = function(options) { shape: [atlasW, atlasH], step: [step, step], chars: chars, - align: true + align: true, + fit: this.charFit }) this.chars = chars } - //collect buffers data for(var i = 0; i < pointCount; ++i) { - var id = snap ? packedId[i] : i - var x = positions[2 * id] - var y = positions[2 * id + 1] + var id = snap ? this.i2idx[i] : i + var s = sizes[id] var w = borderWidths[id] - //write hi- and lo- position parts - v_position[4 * i] = x - v_position[4 * i + 1] = y - v_position[4 * i + 2] = x - v_position[4 * i] - v_position[4 * i + 3] = y - v_position[4 * i + 1] - - this.xCoords[i] = x - //size is doubled bc character SDF is twice less than character step v_sizeWidth[2 * i] = s*2 v_sizeWidth[2 * i + 1] = w - v_ids[i] = id //color/bufferColor indexes var cId = colorIds[id] @@ -48033,13 +48199,9 @@ proto.update = function(options) { v_chars[2 * i] = charId % cols } - // if (!v_color.length) return - //fill buffes - this.positionBuffer.update(v_position) this.sizeBuffer.update(v_sizeWidth) this.colorBuffer.update(v_color) - this.idBuffer.update(v_ids) this.charBuffer.update(v_chars) //update char/color textures @@ -48049,14 +48211,9 @@ proto.update = function(options) { } this.paletteTexture.setPixels(ndarray(paletteColors.slice(0, 256*4), [256, 1, 4])) - pool.free(v_position) pool.free(v_sizeWidth) pool.free(v_color) - pool.free(v_ids) pool.free(v_chars) - pool.free(packed) - pool.free(packedId) - pool.free(packedW) } proto.dispose = function() { @@ -48099,257 +48256,308 @@ function createFancyScatter2D(plot, options) { return scatter } -},{"./lib/shaders":227,"binary-search-bounds":228,"clamp":84,"color-id":88,"font-atlas-sdf":130,"gl-buffer":152,"gl-shader":229,"gl-texture2d":262,"ndarray":460,"snap-points-2d":237,"typedarray-pool":533}],239:[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((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((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}" +},{"./lib/shaders":230,"binary-search-bounds":231,"clamp":86,"color-id":90,"font-atlas-sdf":132,"gl-buffer":154,"gl-shader":232,"gl-texture2d":265,"ndarray":463,"snap-points-2d":240,"typedarray-pool":537}],242:[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((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((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}" -},{}],240:[function(require,module,exports){ -arguments[4][80][0].apply(exports,arguments) -},{"dup":80}],241:[function(require,module,exports){ -arguments[4][236][0].apply(exports,arguments) -},{"dup":236}],242:[function(require,module,exports){ -arguments[4][237][0].apply(exports,arguments) -},{"./lib/sort":241,"dup":237,"typedarray-pool":533}],243:[function(require,module,exports){ -'use strict' - -var createShader = require('gl-shader') -var createBuffer = require('gl-buffer') -var search = require('binary-search-bounds') -var snapPoints = require('snap-points-2d') -var pool = require('typedarray-pool') -var SHADERS = require('./lib/shader') - -module.exports = createScatter2D - -function Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) { - this.plot = plot - this.positionBufferHi = positionBufferHi - this.positionBufferLo = positionBufferLo - this.pickBuffer = pickBuffer - this.weightBuffer = weightBuffer - this.shader = shader - this.pickShader = pickShader - this.scales = [] - this.size = 12.0 - this.borderSize = 1.0 - this.pointCount = 0 - this.color = [1, 0, 0, 1] - this.borderColor = [0, 0, 0, 1] - this.bounds = [Infinity, Infinity, -Infinity, -Infinity] - this.pickOffset = 0 - this.points = null - this.xCoords = null -} - -var proto = Scatter2D.prototype -var scaleHi = new Float32Array(2) -var scaleLo = new Float32Array(2) -var translateHi = new Float32Array(2) -var translateLo = new Float32Array(2) -var PICK_VEC4 = [0, 0, 0, 0] - -proto.dispose = function() { - this.shader.dispose() - this.pickShader.dispose() - this.positionBufferHi.dispose() - this.positionBufferLo.dispose() - this.pickBuffer.dispose() - if(this.xCoords) pool.free(this.xCoords) - this.plot.removeObject(this) -} - -proto.update = function(options) { - options = options || {} - - function dflt(opt, value) { - return opt in options ? options[opt] : value - } - - this.size = dflt('size', 12) - this.color = dflt('color', [1, 0, 0, 1]).slice() - this.borderSize = dflt('borderSize', 1) - this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() - - if(this.xCoords) pool.free(this.xCoords) - - this.points = options.positions - var pointCount = this.points.length >>> 1 - var packedId = pool.mallocInt32(pointCount) - var packedW = pool.mallocFloat32(2 * pointCount) - var packed = pool.mallocFloat64(2 * pointCount) - packed.set(this.points) - this.scales = snapPoints(packed, packedId, packedW, this.bounds) - - var xCoords = pool.mallocFloat64(pointCount) - var packedHi = pool.mallocFloat32(2 * pointCount) - var packedLo = pool.mallocFloat32(2 * pointCount) - packedHi.set(packed) - for(var i = 0, j = 0; i < pointCount; i++, j += 2) { - packedLo[j] = packed[j] - packedHi[j] - packedLo[j + 1] = packed[j + 1] - packedHi[j + 1] - xCoords[i] = packed[j] - } - this.positionBufferHi.update(packedHi) - this.positionBufferLo.update(packedLo) - this.pickBuffer.update(packedId) - this.weightBuffer.update(packedW) - - pool.free(packedId) - pool.free(packed) - pool.free(packedHi) - pool.free(packedLo) - pool.free(packedW) - - this.xCoords = xCoords - this.pointCount = pointCount - this.pickOffset = 0 -} - -proto.draw = function(pickOffset) { - - var pick = pickOffset !== void(0) - - var plot = this.plot - var shader = pick ? this.pickShader : this.shader - var scales = this.scales - var positionBufferHi = this.positionBufferHi - var positionBufferLo = this.positionBufferLo - var pickBuffer = this.pickBuffer - var bounds = this.bounds - var size = this.size - var borderSize = this.borderSize - var gl = plot.gl - var pixelRatio = pick ? plot.pickPixelRatio : plot.pixelRatio - var viewBox = plot.viewBox - var dataBox = plot.dataBox - - if(this.pointCount === 0) - return pickOffset - - var boundX = bounds[2] - bounds[0] - var boundY = bounds[3] - bounds[1] - var dataX = dataBox[2] - dataBox[0] - var dataY = dataBox[3] - dataBox[1] - var screenX = (viewBox[2] - viewBox[0]) * pixelRatio / plot.pixelRatio - var screenY = (viewBox[3] - viewBox[1]) * pixelRatio / plot.pixelRatio - - var pixelSize = Math.min(dataX / screenX, dataY / screenY) - - var scaleX = 2 * boundX / dataX - var scaleY = 2 * boundY / dataY - - scaleHi[0] = scaleX - scaleHi[1] = scaleY - - scaleLo[0] = scaleX - scaleHi[0] - scaleLo[1] = scaleY - scaleHi[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 - - translateLo[0] = translateX - translateHi[0] - translateLo[1] = translateY - translateHi[1] - - shader.bind() - shader.uniforms.scaleHi = scaleHi - shader.uniforms.scaleLo = scaleLo - shader.uniforms.translateHi = translateHi - shader.uniforms.translateLo = translateLo - shader.uniforms.color = this.color - shader.uniforms.borderColor = this.borderColor - shader.uniforms.pointSize = pixelRatio * (size + borderSize) - shader.uniforms.centerFraction = this.borderSize === 0 ? 2 : size / (size + borderSize + 1.25) - - positionBufferHi.bind() - shader.attributes.positionHi.pointer() - - positionBufferLo.bind() - shader.attributes.positionLo.pointer() - - if(pick) { - - this.pickOffset = pickOffset - PICK_VEC4[0] = ( pickOffset & 0xff) - PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) - PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) - PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) - shader.uniforms.pickOffset = PICK_VEC4 - - pickBuffer.bind() - shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) - - } else { - - shader.uniforms.useWeight = 1 - this.weightBuffer.bind() - shader.attributes.weight.pointer() - - } - - var xCoords = this.xCoords - var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX - var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX - - var firstLevel = true - - for(var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { - var lod = scales[scaleNum] - if(lod.pixelSize < pixelSize && scaleNum > 1) - continue - - var intervalStart = lod.offset - var intervalEnd = lod.count + intervalStart - - var startOffset = search.ge(xCoords, xStart, intervalStart, intervalEnd - 1) - var endOffset = search.lt(xCoords, xEnd, startOffset, intervalEnd - 1) + 1 - - if(endOffset > startOffset) - gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset) - - if(!pick && firstLevel) { - firstLevel = false - shader.uniforms.useWeight = 0 - } - } - - return pickOffset + this.pointCount -} - -proto.drawPick = proto.draw - -proto.pick = function(x, y, value) { - var pointId = value - this.pickOffset - return pointId < 0 || pointId >= this.pointCount - ? null : { - object: this, - pointId: pointId, - dataCoord: [ this.points[2 * pointId], this.points[2 * pointId + 1] ] - } -} - -function createScatter2D(plot, options) { - var gl = plot.gl - var positionBufferHi = createBuffer(gl) - var positionBufferLo = createBuffer(gl) - var pickBuffer = createBuffer(gl) - var weightBuffer = createBuffer(gl) - var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) - var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) - - var result = new Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) - result.update(options) - - plot.addObject(result) // register with plot +},{}],243:[function(require,module,exports){ +arguments[4][82][0].apply(exports,arguments) +},{"dup":82}],244:[function(require,module,exports){ +arguments[4][239][0].apply(exports,arguments) +},{"dup":239}],245:[function(require,module,exports){ +arguments[4][240][0].apply(exports,arguments) +},{"./lib/sort":244,"dup":240,"typedarray-pool":537}],246:[function(require,module,exports){ +'use strict' + +var createShader = require('gl-shader') +var createBuffer = require('gl-buffer') +var search = require('binary-search-bounds') +var snapPoints = require('snap-points-2d') +var pool = require('typedarray-pool') +var SHADERS = require('./lib/shader') +var normalize = require('array-normalize') +var getBounds = require('array-bounds') + +module.exports = createScatter2D + +function Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) { + this.plot = plot + this.positionBufferHi = positionBufferHi + this.positionBufferLo = positionBufferLo + this.pickBuffer = pickBuffer + this.weightBuffer = weightBuffer + this.shader = shader + this.pickShader = pickShader + this.scales = [] + this.size = 12.0 + this.borderSize = 1.0 + this.pointCount = 0 + this.color = [1, 0, 0, 1] + this.borderColor = [0, 0, 0, 1] + this.bounds = [Infinity, Infinity, -Infinity, -Infinity] + this.pickOffset = 0 + this.points = null + this.xCoords = null + this.snapPoints = true +} + +var proto = Scatter2D.prototype +var scaleHi = new Float32Array(2) +var scaleLo = new Float32Array(2) +var translateHi = new Float32Array(2) +var translateLo = new Float32Array(2) +var PICK_VEC4 = [0, 0, 0, 0] + +proto.dispose = function() { + this.shader.dispose() + this.pickShader.dispose() + this.positionBufferHi.dispose() + this.positionBufferLo.dispose() + this.pickBuffer.dispose() + if(this.xCoords) pool.free(this.xCoords) + this.plot.removeObject(this) +} + +proto.update = function(options) { + options = options || {} + + function dflt(opt, value) { + return opt in options ? options[opt] : value + } + + this.size = dflt('size', 12) + this.color = dflt('color', [1, 0, 0, 1]).slice() + this.borderSize = dflt('borderSize', 1) + this.borderColor = dflt('borderColor', [0, 0, 0, 1]).slice() + this.snapPoints = dflt('snapPoints', true) + + if(this.xCoords) pool.free(this.xCoords) + + //do not recalc points if there is no positions + if (options.positions != null) { + this.points = options.positions + var pointCount = this.points.length >>> 1 + + var packedId = pool.mallocInt32(pointCount) + var packedW = pool.mallocFloat32(pointCount) + var packed = pool.mallocFloat64(2 * pointCount) + packed.set(this.points) + + if (this.snapPoints) { + this.scales = snapPoints(packed, packedId, packedW, this.bounds) + } + else { + //get bounds + this.bounds = getBounds(packed, 2) + + // rescale packed to unit box + normalize(packed, 2, this.bounds) + + // generate fake ids + for (var i = 0; i < pointCount; i++) { + packedId[i] = i + packedW[i] = 1 + } + } + + var xCoords = pool.mallocFloat64(pointCount) + var packedHi = pool.mallocFloat32(2 * pointCount) + var packedLo = pool.mallocFloat32(2 * pointCount) + packedHi.set(packed) + for(var i = 0, j = 0; i < pointCount; i++, j += 2) { + packedLo[j] = packed[j] - packedHi[j] + packedLo[j + 1] = packed[j + 1] - packedHi[j + 1] + xCoords[i] = packed[j] + } + this.positionBufferHi.update(packedHi) + this.positionBufferLo.update(packedLo) + this.pickBuffer.update(packedId) + this.weightBuffer.update(packedW) + + pool.free(packedHi) + pool.free(packedLo) + pool.free(packedW) + pool.free(packed) + pool.free(packedId) + + this.xCoords = xCoords + this.pointCount = pointCount + this.pickOffset = 0 + } +} + +proto.draw = function(pickOffset) { + var pick = pickOffset !== void(0) + + var plot = this.plot + var shader = pick ? this.pickShader : this.shader + var scales = this.scales + var positionBufferHi = this.positionBufferHi + var positionBufferLo = this.positionBufferLo + var pickBuffer = this.pickBuffer + var bounds = this.bounds + var size = this.size + var borderSize = this.borderSize + var gl = plot.gl + var pixelRatio = pick ? plot.pickPixelRatio : plot.pixelRatio + var viewBox = plot.viewBox + var dataBox = plot.dataBox + + if(this.pointCount === 0) + return pickOffset + + var boundX = bounds[2] - bounds[0] + var boundY = bounds[3] - bounds[1] + var dataX = dataBox[2] - dataBox[0] + var dataY = dataBox[3] - dataBox[1] + var screenX = (viewBox[2] - viewBox[0]) * pixelRatio / plot.pixelRatio + var screenY = (viewBox[3] - viewBox[1]) * pixelRatio / plot.pixelRatio + + var pixelSize = this.pixelSize = Math.min(dataX / screenX, dataY / screenY) + + var scaleX = 2 * boundX / dataX + var scaleY = 2 * boundY / dataY + + scaleHi[0] = scaleX + scaleHi[1] = scaleY + + scaleLo[0] = scaleX - scaleHi[0] + scaleLo[1] = scaleY - scaleHi[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 + + translateLo[0] = translateX - translateHi[0] + translateLo[1] = translateY - translateHi[1] + + shader.bind() + shader.uniforms.scaleHi = scaleHi + shader.uniforms.scaleLo = scaleLo + shader.uniforms.translateHi = translateHi + shader.uniforms.translateLo = translateLo + shader.uniforms.color = this.color + shader.uniforms.borderColor = this.borderColor + shader.uniforms.pointSize = pixelRatio * (size + borderSize) + shader.uniforms.centerFraction = this.borderSize === 0 ? 2 : size / (size + borderSize + 1.25) + + positionBufferHi.bind() + shader.attributes.positionHi.pointer() + + positionBufferLo.bind() + shader.attributes.positionLo.pointer() + + if(pick) { + this.pickOffset = pickOffset + PICK_VEC4[0] = ( pickOffset & 0xff) + PICK_VEC4[1] = ((pickOffset >> 8) & 0xff) + PICK_VEC4[2] = ((pickOffset >> 16) & 0xff) + PICK_VEC4[3] = ((pickOffset >> 24) & 0xff) + shader.uniforms.pickOffset = PICK_VEC4 + + pickBuffer.bind() + shader.attributes.pickId.pointer(gl.UNSIGNED_BYTE) + + } else { + + shader.uniforms.useWeight = 1 + this.weightBuffer.bind() + shader.attributes.weight.pointer() + + } + + + var firstLevel = true + + if (this.snapPoints) { + for(var scaleNum = scales.length - 1; scaleNum >= 0; scaleNum--) { + var lod = scales[scaleNum] + if(lod.pixelSize < pixelSize && scaleNum > 1) + continue + + var range = this.getVisibleRange(lod) + var startOffset = range[0], endOffset = range[1] + + if(endOffset > startOffset) + gl.drawArrays(gl.POINTS, startOffset, endOffset - startOffset) + + if(!pick && firstLevel) { + firstLevel = false + shader.uniforms.useWeight = 0 + } + } + } + else { + gl.drawArrays(gl.POINTS, 0, this.pointCount) + } + + return pickOffset + this.pointCount +} + +proto.getVisibleRange = function (lod) { + var dataBox = this.plot.dataBox, + bounds = this.bounds, + pixelSize = this.pixelSize, + size = this.size, + pixelRatio = this.plot.pixelRatio, + boundX = bounds[2] - bounds[0], + boundY = bounds[3] - bounds[1] + + if (!lod) { + for(var scaleNum = this.scales.length - 1, lod; scaleNum >= 0; scaleNum--) { + lod = this.scales[scaleNum]; + if(!(lod.pixelSize < pixelSize && scaleNum > 1)) break; + } + } + + var xCoords = this.xCoords + var xStart = (dataBox[0] - bounds[0] - pixelSize * size * pixelRatio) / boundX + var xEnd = (dataBox[2] - bounds[0] + pixelSize * size * pixelRatio) / boundX + + var intervalStart = lod.offset + var intervalEnd = lod.count + intervalStart + + var startOffset = search.ge(xCoords, xStart, intervalStart, intervalEnd - 1) + var endOffset = search.lt(xCoords, xEnd, startOffset, intervalEnd - 1) + 1 + + return [startOffset, endOffset] +} + +proto.drawPick = proto.draw + +proto.pick = function(x, y, value) { + var pointId = value - this.pickOffset + return pointId < 0 || pointId >= this.pointCount + ? null : { + object: this, + pointId: pointId, + dataCoord: [ this.points[2 * pointId], this.points[2 * pointId + 1] ] + } +} + +function createScatter2D(plot, options) { + var gl = plot.gl + var positionBufferHi = createBuffer(gl) + var positionBufferLo = createBuffer(gl) + var pickBuffer = createBuffer(gl) + var weightBuffer = createBuffer(gl) + var shader = createShader(gl, SHADERS.pointVertex, SHADERS.pointFragment) + var pickShader = createShader(gl, SHADERS.pickVertex, SHADERS.pickFragment) + + var result = new Scatter2D(plot, positionBufferHi, positionBufferLo, pickBuffer, weightBuffer, shader, pickShader) + result.update(options) + + plot.addObject(result) // register with plot + + return result +} - return result -} -},{"./lib/shader":239,"binary-search-bounds":240,"gl-buffer":152,"gl-shader":250,"snap-points-2d":242,"typedarray-pool":533}],244:[function(require,module,exports){ +},{"./lib/shader":242,"array-bounds":42,"array-normalize":43,"binary-search-bounds":243,"gl-buffer":154,"gl-shader":253,"snap-points-2d":245,"typedarray-pool":537}],247:[function(require,module,exports){ "use strict" var vectorizeText = require("vectorize-text") @@ -48395,7 +48603,7 @@ function getGlyph(symbol, font) { //Save cached symbol return fontCache[symbol] = [triSymbol, lineSymbol, bounds] } -},{"vectorize-text":546}],245:[function(require,module,exports){ +},{"vectorize-text":550}],248:[function(require,module,exports){ var createShaderWrapper = require('gl-shader') @@ -48472,7 +48680,7 @@ exports.createPickProject = function(gl) { return createShader(gl, pickProject) } -},{"gl-shader":250}],246:[function(require,module,exports){ +},{"gl-shader":253}],249:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -49232,7 +49440,7 @@ function createPointCloud(options) { return pointCloud } -},{"./lib/glyphs":244,"./lib/shaders":245,"gl-buffer":152,"gl-mat4/multiply":178,"gl-vao":266,"typedarray-pool":533}],247:[function(require,module,exports){ +},{"./lib/glyphs":247,"./lib/shaders":248,"gl-buffer":154,"gl-mat4/multiply":181,"gl-vao":269,"typedarray-pool":537}],250:[function(require,module,exports){ 'use strict' @@ -49240,7 +49448,7 @@ function createPointCloud(options) { exports.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" exports.boxFragment = "precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n" -},{}],248:[function(require,module,exports){ +},{}],251:[function(require,module,exports){ 'use strict' var createShader = require('gl-shader') @@ -49366,7 +49574,7 @@ function createSelectBox(plot, options) { return selectBox } -},{"./lib/shaders":247,"gl-buffer":152,"gl-shader":250}],249:[function(require,module,exports){ +},{"./lib/shaders":250,"gl-buffer":154,"gl-shader":253}],252:[function(require,module,exports){ 'use strict' module.exports = createSelectBuffer @@ -49521,7 +49729,7 @@ function createSelectBuffer(gl, shape) { return new SelectBuffer(gl, fbo, buffer) } -},{"bit-twiddle":63,"cwise/lib/wrapper":109,"gl-fbo":159,"ndarray":460,"typedarray-pool":533}],250:[function(require,module,exports){ +},{"bit-twiddle":65,"cwise/lib/wrapper":111,"gl-fbo":162,"ndarray":463,"typedarray-pool":537}],253:[function(require,module,exports){ 'use strict' var createUniformWrapper = require('./lib/create-uniforms') @@ -49757,19 +49965,19 @@ function createShader( module.exports = createShader -},{"./lib/GLError":251,"./lib/create-attributes":252,"./lib/create-uniforms":253,"./lib/reflect":254,"./lib/runtime-reflect":255,"./lib/shader-cache":256}],251:[function(require,module,exports){ -arguments[4][208][0].apply(exports,arguments) -},{"dup":208}],252:[function(require,module,exports){ -arguments[4][209][0].apply(exports,arguments) -},{"./GLError":251,"dup":209}],253:[function(require,module,exports){ -arguments[4][210][0].apply(exports,arguments) -},{"./GLError":251,"./reflect":254,"dup":210}],254:[function(require,module,exports){ +},{"./lib/GLError":254,"./lib/create-attributes":255,"./lib/create-uniforms":256,"./lib/reflect":257,"./lib/runtime-reflect":258,"./lib/shader-cache":259}],254:[function(require,module,exports){ arguments[4][211][0].apply(exports,arguments) },{"dup":211}],255:[function(require,module,exports){ arguments[4][212][0].apply(exports,arguments) -},{"dup":212}],256:[function(require,module,exports){ +},{"./GLError":254,"dup":212}],256:[function(require,module,exports){ arguments[4][213][0].apply(exports,arguments) -},{"./GLError":251,"dup":213,"gl-format-compiler-error":160,"weakmap-shim":554}],257:[function(require,module,exports){ +},{"./GLError":254,"./reflect":257,"dup":213}],257:[function(require,module,exports){ +arguments[4][214][0].apply(exports,arguments) +},{"dup":214}],258:[function(require,module,exports){ +arguments[4][215][0].apply(exports,arguments) +},{"dup":215}],259:[function(require,module,exports){ +arguments[4][216][0].apply(exports,arguments) +},{"./GLError":254,"dup":216,"gl-format-compiler-error":163,"weakmap-shim":558}],260:[function(require,module,exports){ 'use strict' module.exports = createSpikes2D @@ -49857,7 +50065,7 @@ function createSpikes2D(plot, options) { return spikes } -},{}],258:[function(require,module,exports){ +},{}],261:[function(require,module,exports){ 'use strict' @@ -49874,7 +50082,7 @@ module.exports = function(gl) { ]) } -},{"gl-shader":250}],259:[function(require,module,exports){ +},{"gl-shader":253}],262:[function(require,module,exports){ 'use strict' var createBuffer = require('gl-buffer') @@ -50070,7 +50278,7 @@ function createSpikes(gl, options) { return spikes } -},{"./shaders/index":258,"gl-buffer":152,"gl-vao":266}],260:[function(require,module,exports){ +},{"./shaders/index":261,"gl-buffer":154,"gl-vao":269}],263:[function(require,module,exports){ var createShader = require('gl-shader') @@ -50120,7 +50328,7 @@ exports.createPickContourShader = function (gl) { return shader } -},{"gl-shader":250}],261:[function(require,module,exports){ +},{"gl-shader":253}],264:[function(require,module,exports){ 'use strict' module.exports = createSurfacePlot @@ -51445,7 +51653,7 @@ function createSurfacePlot (params) { return surface } -},{"./lib/shaders":260,"binary-search-bounds":62,"bit-twiddle":63,"colormap":95,"gl-buffer":152,"gl-mat4/invert":176,"gl-mat4/multiply":178,"gl-texture2d":262,"gl-vao":266,"ndarray":460,"ndarray-gradient":451,"ndarray-ops":454,"ndarray-pack":455,"surface-nets":523,"typedarray-pool":533}],262:[function(require,module,exports){ +},{"./lib/shaders":263,"binary-search-bounds":64,"bit-twiddle":65,"colormap":97,"gl-buffer":154,"gl-mat4/invert":179,"gl-mat4/multiply":181,"gl-texture2d":265,"gl-vao":269,"ndarray":463,"ndarray-gradient":454,"ndarray-ops":457,"ndarray-pack":458,"surface-nets":527,"typedarray-pool":537}],265:[function(require,module,exports){ 'use strict' var ndarray = require('ndarray') @@ -52008,7 +52216,7 @@ function createTexture2D(gl) { throw new Error('gl-texture2d: Invalid arguments for texture2d constructor') } -},{"ndarray":460,"ndarray-ops":454,"typedarray-pool":533}],263:[function(require,module,exports){ +},{"ndarray":463,"ndarray-ops":457,"typedarray-pool":537}],266:[function(require,module,exports){ "use strict" function doBind(gl, elements, attributes) { @@ -52063,7 +52271,7 @@ function doBind(gl, elements, attributes) { } module.exports = doBind -},{}],264:[function(require,module,exports){ +},{}],267:[function(require,module,exports){ "use strict" var bindAttribs = require("./do-bind.js") @@ -52103,7 +52311,7 @@ function createVAOEmulated(gl) { } module.exports = createVAOEmulated -},{"./do-bind.js":263}],265:[function(require,module,exports){ +},{"./do-bind.js":266}],268:[function(require,module,exports){ "use strict" var bindAttribs = require("./do-bind.js") @@ -52191,7 +52399,7 @@ function createVAONative(gl, ext) { } module.exports = createVAONative -},{"./do-bind.js":263}],266:[function(require,module,exports){ +},{"./do-bind.js":266}],269:[function(require,module,exports){ "use strict" var createVAONative = require("./lib/vao-native.js") @@ -52220,7 +52428,7 @@ function createVAO(gl, attributes, elements, elementsType) { module.exports = createVAO -},{"./lib/vao-emulated.js":264,"./lib/vao-native.js":265}],267:[function(require,module,exports){ +},{"./lib/vao-emulated.js":267,"./lib/vao-native.js":268}],270:[function(require,module,exports){ module.exports = cross; /** @@ -52240,7 +52448,7 @@ function cross(out, a, b) { out[2] = ax * by - ay * bx return out } -},{}],268:[function(require,module,exports){ +},{}],271:[function(require,module,exports){ module.exports = dot; /** @@ -52253,7 +52461,7 @@ module.exports = dot; function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } -},{}],269:[function(require,module,exports){ +},{}],272:[function(require,module,exports){ module.exports = length; /** @@ -52268,7 +52476,7 @@ function length(a) { z = a[2] return Math.sqrt(x*x + y*y + z*z) } -},{}],270:[function(require,module,exports){ +},{}],273:[function(require,module,exports){ module.exports = lerp; /** @@ -52289,7 +52497,7 @@ function lerp(out, a, b, t) { out[2] = az + t * (b[2] - az) return out } -},{}],271:[function(require,module,exports){ +},{}],274:[function(require,module,exports){ module.exports = normalize; /** @@ -52313,7 +52521,7 @@ function normalize(out, a) { } return out } -},{}],272:[function(require,module,exports){ +},{}],275:[function(require,module,exports){ module.exports = transformMat4 /** @@ -52333,7 +52541,7 @@ function transformMat4 (out, a, m) { return out } -},{}],273:[function(require,module,exports){ +},{}],276:[function(require,module,exports){ module.exports = decodeFloat var UINT8_VIEW = new Uint8Array(4) @@ -52347,7 +52555,7 @@ function decodeFloat(x, y, z, w) { return FLOAT_VIEW[0] } -},{}],274:[function(require,module,exports){ +},{}],277:[function(require,module,exports){ var tokenize = require('glsl-tokenizer') var atob = require('atob-lite') @@ -52372,7 +52580,7 @@ function getName(src) { } } -},{"atob-lite":44,"glsl-tokenizer":281}],275:[function(require,module,exports){ +},{"atob-lite":46,"glsl-tokenizer":284}],278:[function(require,module,exports){ module.exports = tokenize var literals100 = require('./lib/literals') @@ -52736,7 +52944,7 @@ function tokenize(opt) { } } -},{"./lib/builtins":277,"./lib/builtins-300es":276,"./lib/literals":279,"./lib/literals-300es":278,"./lib/operators":280}],276:[function(require,module,exports){ +},{"./lib/builtins":280,"./lib/builtins-300es":279,"./lib/literals":282,"./lib/literals-300es":281,"./lib/operators":283}],279:[function(require,module,exports){ // 300es builtins/reserved words that were previously valid in v100 var v100 = require('./builtins') @@ -52807,7 +53015,7 @@ module.exports = v100.concat([ , 'textureProjGradOffset' ]) -},{"./builtins":277}],277:[function(require,module,exports){ +},{"./builtins":280}],280:[function(require,module,exports){ module.exports = [ // Keep this list sorted 'abs' @@ -52959,7 +53167,7 @@ module.exports = [ , 'textureCubeGradEXT' ] -},{}],278:[function(require,module,exports){ +},{}],281:[function(require,module,exports){ var v100 = require('./literals') module.exports = v100.slice().concat([ @@ -53049,7 +53257,7 @@ module.exports = v100.slice().concat([ , 'usampler2DMSArray' ]) -},{"./literals":279}],279:[function(require,module,exports){ +},{"./literals":282}],282:[function(require,module,exports){ module.exports = [ // current 'precision' @@ -53144,7 +53352,7 @@ module.exports = [ , 'using' ] -},{}],280:[function(require,module,exports){ +},{}],283:[function(require,module,exports){ module.exports = [ '<<=' , '>>=' @@ -53193,7 +53401,7 @@ module.exports = [ , '}' ] -},{}],281:[function(require,module,exports){ +},{}],284:[function(require,module,exports){ var tokenize = require('./index') module.exports = tokenizeString @@ -53208,7 +53416,7 @@ function tokenizeString(str, opt) { return tokens } -},{"./index":275}],282:[function(require,module,exports){ +},{"./index":278}],285:[function(require,module,exports){ 'use strict'; module.exports = GridIndex; @@ -53370,7 +53578,7 @@ GridIndex.prototype.toArrayBuffer = function() { return array.buffer; }; -},{}],283:[function(require,module,exports){ +},{}],286:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -53456,7 +53664,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],284:[function(require,module,exports){ +},{}],287:[function(require,module,exports){ "use strict" //High level idea: @@ -53903,7 +54111,7 @@ function incrementalConvexHull(points, randomSearch) { //Extract boundary cells return triangles.boundary() } -},{"robust-orientation":500,"simplicial-complex":511}],285:[function(require,module,exports){ +},{"robust-orientation":504,"simplicial-complex":515}],288:[function(require,module,exports){ "use strict" var bounds = require("binary-search-bounds") @@ -54270,7 +54478,7 @@ function createWrapper(intervals) { return new IntervalTree(createIntervalTree(intervals)) } -},{"binary-search-bounds":62}],286:[function(require,module,exports){ +},{"binary-search-bounds":64}],289:[function(require,module,exports){ "use strict" function invertPermutation(pi, result) { @@ -54282,7 +54490,7 @@ function invertPermutation(pi, result) { } module.exports = invertPermutation -},{}],287:[function(require,module,exports){ +},{}],290:[function(require,module,exports){ "use strict" function iota(n) { @@ -54294,7 +54502,7 @@ function iota(n) { } module.exports = iota -},{}],288:[function(require,module,exports){ +},{}],291:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -54317,7 +54525,7 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],289:[function(require,module,exports){ +},{}],292:[function(require,module,exports){ module.exports = isMobile; function isMobile (ua) { @@ -54331,7 +54539,7 @@ function isMobile (ua) { } -},{}],290:[function(require,module,exports){ +},{}],293:[function(require,module,exports){ 'use strict'; var toString = Object.prototype.toString; @@ -54340,7 +54548,7 @@ module.exports = function (x) { return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({})); }; -},{}],291:[function(require,module,exports){ +},{}],294:[function(require,module,exports){ 'use strict'; var sort = require('./sort'); @@ -54386,7 +54594,7 @@ KDBush.prototype = { function defaultGetX(p) { return p[0]; } function defaultGetY(p) { return p[1]; } -},{"./range":292,"./sort":293,"./within":294}],292:[function(require,module,exports){ +},{"./range":295,"./sort":296,"./within":297}],295:[function(require,module,exports){ 'use strict'; module.exports = range; @@ -54434,7 +54642,7 @@ function range(ids, coords, minX, minY, maxX, maxY, nodeSize) { return result; } -},{}],293:[function(require,module,exports){ +},{}],296:[function(require,module,exports){ 'use strict'; module.exports = sortKD; @@ -54502,7 +54710,7 @@ function swap(arr, i, j) { arr[j] = tmp; } -},{}],294:[function(require,module,exports){ +},{}],297:[function(require,module,exports){ 'use strict'; module.exports = within; @@ -54554,7 +54762,7 @@ function sqDist(ax, ay, bx, by) { return dx * dx + dy * dy; } -},{}],295:[function(require,module,exports){ +},{}],298:[function(require,module,exports){ 'use strict'; function createFunction(parameters, defaultType) { @@ -54727,7 +54935,7 @@ module.exports['piecewise-constant'] = function(parameters) { return createFunction(parameters, 'interval'); }; -},{}],296:[function(require,module,exports){ +},{}],299:[function(require,module,exports){ var path = require('path'); @@ -54789,7 +54997,7 @@ module.exports = { module.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":468}],297:[function(require,module,exports){ +},{"path":472}],300:[function(require,module,exports){ 'use strict'; var format = require('util').format; @@ -54807,7 +55015,7 @@ function ValidationError(key, value /*, message, ...*/) { module.exports = ValidationError; -},{"util":541}],298:[function(require,module,exports){ +},{"util":545}],301:[function(require,module,exports){ 'use strict'; module.exports = function (output) { @@ -54820,7 +55028,7 @@ module.exports = function (output) { return output; }; -},{}],299:[function(require,module,exports){ +},{}],302:[function(require,module,exports){ 'use strict'; module.exports = function getType(val) { @@ -54839,7 +55047,7 @@ module.exports = function getType(val) { } }; -},{}],300:[function(require,module,exports){ +},{}],303:[function(require,module,exports){ 'use strict'; // Turn jsonlint-lines-primitives objects into primitive objects @@ -54851,7 +55059,7 @@ module.exports = function unbundle(value) { } }; -},{}],301:[function(require,module,exports){ +},{}],304:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -54918,7 +55126,7 @@ module.exports = function validate(options) { } }; -},{"../error/validation_error":297,"../util/extend":298,"../util/get_type":299,"./validate_array":302,"./validate_boolean":303,"./validate_color":304,"./validate_constants":305,"./validate_enum":306,"./validate_filter":307,"./validate_function":308,"./validate_layer":310,"./validate_number":312,"./validate_object":313,"./validate_source":315,"./validate_string":316}],302:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/extend":301,"../util/get_type":302,"./validate_array":305,"./validate_boolean":306,"./validate_color":307,"./validate_constants":308,"./validate_enum":309,"./validate_filter":310,"./validate_function":311,"./validate_layer":313,"./validate_number":315,"./validate_object":316,"./validate_source":318,"./validate_string":319}],305:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -54972,7 +55180,7 @@ module.exports = function validateArray(options) { return errors; }; -},{"../error/validation_error":297,"../util/get_type":299,"./validate":301}],303:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"./validate":304}],306:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -54990,7 +55198,7 @@ module.exports = function validateBoolean(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299}],304:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],307:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55013,7 +55221,7 @@ module.exports = function validateColor(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299,"csscolorparser":104}],305:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"csscolorparser":106}],308:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55047,7 +55255,7 @@ module.exports = function validateConstants(options) { }; -},{"../error/validation_error":297,"../util/get_type":299}],306:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],309:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55065,7 +55273,7 @@ module.exports = function validateEnum(options) { return errors; }; -},{"../error/validation_error":297,"../util/unbundle_jsonlint":300}],307:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/unbundle_jsonlint":303}],310:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55170,7 +55378,7 @@ module.exports = function validateFilter(options) { return errors; }; -},{"../error/validation_error":297,"../util/get_type":299,"../util/unbundle_jsonlint":300,"./validate_enum":306}],308:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"../util/unbundle_jsonlint":303,"./validate_enum":309}],311:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55304,7 +55512,7 @@ module.exports = function validateFunction(options) { }; -},{"../error/validation_error":297,"../util/get_type":299,"./validate":301,"./validate_array":302,"./validate_number":312,"./validate_object":313}],309:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"./validate":304,"./validate_array":305,"./validate_number":315,"./validate_object":316}],312:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55328,7 +55536,7 @@ module.exports = function(options) { return errors; }; -},{"../error/validation_error":297,"./validate_string":316}],310:[function(require,module,exports){ +},{"../error/validation_error":300,"./validate_string":319}],313:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55441,7 +55649,7 @@ module.exports = function validateLayer(options) { return errors; }; -},{"../error/validation_error":297,"../util/extend":298,"../util/unbundle_jsonlint":300,"./validate_filter":307,"./validate_layout_property":311,"./validate_object":313,"./validate_paint_property":314}],311:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/extend":301,"../util/unbundle_jsonlint":303,"./validate_filter":310,"./validate_layout_property":314,"./validate_object":316,"./validate_paint_property":317}],314:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -55480,7 +55688,7 @@ module.exports = function validateLayoutProperty(options) { }; -},{"../error/validation_error":297,"./validate":301}],312:[function(require,module,exports){ +},{"../error/validation_error":300,"./validate":304}],315:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -55507,7 +55715,7 @@ module.exports = function validateNumber(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299}],313:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],316:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55560,7 +55768,7 @@ module.exports = function validateObject(options) { return errors; }; -},{"../error/validation_error":297,"../util/get_type":299,"./validate":301}],314:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302,"./validate":304}],317:[function(require,module,exports){ 'use strict'; var validate = require('./validate'); @@ -55600,7 +55808,7 @@ module.exports = function validatePaintProperty(options) { }; -},{"../error/validation_error":297,"./validate":301}],315:[function(require,module,exports){ +},{"../error/validation_error":300,"./validate":304}],318:[function(require,module,exports){ 'use strict'; var ValidationError = require('../error/validation_error'); @@ -55677,7 +55885,7 @@ module.exports = function validateSource(options) { } }; -},{"../error/validation_error":297,"../util/unbundle_jsonlint":300,"./validate_enum":306,"./validate_object":313}],316:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/unbundle_jsonlint":303,"./validate_enum":309,"./validate_object":316}],319:[function(require,module,exports){ 'use strict'; var getType = require('../util/get_type'); @@ -55695,7 +55903,7 @@ module.exports = function validateString(options) { return []; }; -},{"../error/validation_error":297,"../util/get_type":299}],317:[function(require,module,exports){ +},{"../error/validation_error":300,"../util/get_type":302}],320:[function(require,module,exports){ 'use strict'; var validateConstants = require('./validate/validate_constants'); @@ -55765,12 +55973,12 @@ function wrapCleanErrors(inner) { module.exports = validateStyleMin; -},{"../reference/latest.min":318,"./validate/validate":301,"./validate/validate_constants":305,"./validate/validate_filter":307,"./validate/validate_glyphs_url":309,"./validate/validate_layer":310,"./validate/validate_layout_property":311,"./validate/validate_paint_property":314,"./validate/validate_source":315}],318:[function(require,module,exports){ +},{"../reference/latest.min":321,"./validate/validate":304,"./validate/validate_constants":308,"./validate/validate_filter":310,"./validate/validate_glyphs_url":312,"./validate/validate_layer":313,"./validate/validate_layout_property":314,"./validate/validate_paint_property":317,"./validate/validate_source":318}],321:[function(require,module,exports){ module.exports = require('./v8.min.json'); -},{"./v8.min.json":319}],319:[function(require,module,exports){ +},{"./v8.min.json":322}],322:[function(require,module,exports){ module.exports={"$version":8,"$root":{"version":{"required":true,"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":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string"},"transition":{"type":"transition"},"layers":{"required":true,"type":"array","value":"layer"}},"sources":{"*":{"type":"source"}},"source":["source_tile","source_geojson","source_video","source_image"],"source_tile":{"type":{"required":true,"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":true,"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":false},"clusterRadius":{"type":"number","default":400},"clusterMaxZoom":{"type":"number"}},"source_video":{"type":{"required":true,"type":"enum","values":["video"]},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":["image"]},"url":{"required":true,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"layer":{"id":{"type":"string","required":true},"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":false},"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":true,"values":["visible","none"],"default":"visible"}},"layout_fill":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_circle":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_line":{"line-cap":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["butt","round","square"],"default":"butt"},"line-join":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["bevel","round","miter"],"default":"miter"},"line-miter-limit":{"type":"number","default":2,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"miter"}]},"line-round-limit":{"type":"number","default":1.05,"function":"interpolated","zoom-function":true,"property-function":true,"requires":[{"line-join":"round"}]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_symbol":{"symbol-placement":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["point","line"],"default":"point"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":[{"symbol-placement":"line"}]},"symbol-avoid-edges":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false},"icon-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image"]},"icon-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["icon-image","text-field"]},"icon-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["icon-image"]},"icon-size":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"requires":["icon-image"]},"icon-text-fit":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":false,"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":true,"property-function":true,"requires":["icon-image","icon-text-fit","text-field"]},"icon-image":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"tokens":true},"icon-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"property-function":true,"units":"degrees","requires":["icon-image"]},"icon-padding":{"type":"number","default":2,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"units":"pixels","requires":["icon-image"]},"icon-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"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":true,"property-function":true,"requires":["icon-image"]},"text-pitch-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"requires":["text-field"]},"text-rotation-alignment":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"viewport","requires":["text-field"]},"text-field":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":"","tokens":true},"text-font":{"type":"array","value":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"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":true,"property-function":true,"requires":["text-field"]},"text-max-width":{"type":"number","default":10,"minimum":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-line-height":{"type":"number","default":1.2,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-letter-spacing":{"type":"number","default":0,"units":"em","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-justify":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["left","center","right"],"default":"center","requires":["text-field"]},"text-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"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":true,"property-function":true,"requires":["text-field",{"symbol-placement":"line"}]},"text-rotate":{"type":"number","default":0,"period":360,"units":"degrees","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-padding":{"type":"number","default":2,"minimum":0,"units":"pixels","function":"interpolated","zoom-function":true,"property-function":true,"requires":["text-field"]},"text-keep-upright":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":true,"requires":["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["none","uppercase","lowercase"],"default":"none","requires":["text-field"]},"text-offset":{"type":"array","value":"number","units":"ems","function":"interpolated","zoom-function":true,"property-function":true,"length":2,"default":[0,0],"requires":["text-field"]},"text-allow-overlap":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-ignore-placement":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field"]},"text-optional":{"type":"boolean","function":"piecewise-constant","zoom-function":true,"property-function":true,"default":false,"requires":["text-field","icon-image"]},"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"values":["visible","none"],"default":"visible"}},"layout_raster":{"visibility":{"type":"enum","function":"piecewise-constant","zoom-function":true,"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":true,"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":true,"property-function":true,"default":true},"fill-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"fill-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"}]},"fill-outline-color":{"type":"color","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"fill-pattern"},{"fill-antialias":true}]},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"fill-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["fill-translate"]},"fill-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_line":{"line-opacity":{"type":"number","function":"interpolated","zoom-function":true,"property-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"line-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":[{"!":"line-pattern"}]},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["line-translate"]},"line-width":{"type":"number","default":1,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-gap-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-offset":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"line-dasharray":{"type":"array","value":"number","function":"piecewise-constant","zoom-function":true,"property-function":true,"minimum":0,"transition":true,"units":"line widths","requires":[{"!":"line-pattern"}]},"line-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"property-function":true,"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-blur":{"type":"number","default":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels"},"circle-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["circle-translate"]},"circle-pitch-scale":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["icon-image"]},"icon-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["icon-image"]},"icon-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"values":["map","viewport"],"default":"map","requires":["icon-image","icon-translate"]},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"requires":["text-field"]},"text-halo-width":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-halo-blur":{"type":"number","default":0,"minimum":0,"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"function":"interpolated","zoom-function":true,"property-function":true,"transition":true,"units":"pixels","requires":["text-field"]},"text-translate-anchor":{"type":"enum","function":"piecewise-constant","zoom-function":true,"property-function":true,"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":true,"transition":true},"raster-hue-rotate":{"type":"number","default":0,"period":360,"function":"interpolated","zoom-function":true,"transition":true,"units":"degrees"},"raster-brightness-min":{"type":"number","function":"interpolated","zoom-function":true,"default":0,"minimum":0,"maximum":1,"transition":true},"raster-brightness-max":{"type":"number","function":"interpolated","zoom-function":true,"default":1,"minimum":0,"maximum":1,"transition":true},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"function":"interpolated","zoom-function":true,"transition":true,"units":"milliseconds"}},"paint_background":{"background-color":{"type":"color","default":"#000000","function":"interpolated","zoom-function":true,"transition":true,"requires":[{"!":"background-pattern"}]},"background-pattern":{"type":"string","function":"piecewise-constant","zoom-function":true,"transition":true},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"function":"interpolated","zoom-function":true,"transition":true}},"transition":{"duration":{"type":"number","default":300,"minimum":0,"units":"milliseconds"},"delay":{"type":"number","default":0,"minimum":0,"units":"milliseconds"}}} -},{}],320:[function(require,module,exports){ +},{}],323:[function(require,module,exports){ 'use strict'; if (typeof module !== 'undefined' && module.exports) { @@ -55901,7 +56109,7 @@ function isWebGLSupported(failIfMajorPerformanceCaveat) { } } -},{}],321:[function(require,module,exports){ +},{}],324:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -55997,7 +56205,7 @@ ArrayGroup.prototype.getTransferables = function(transferables) { } }; -},{"../util/util":435}],322:[function(require,module,exports){ +},{"../util/util":438}],325:[function(require,module,exports){ 'use strict'; var featureFilter = require('feature-filter'); @@ -56515,7 +56723,7 @@ function createGetUniform(attribute, stopOffset) { }; } -},{"../util/struct_array":433,"../util/util":435,"./array_group":321,"./bucket/circle_bucket":323,"./bucket/fill_bucket":324,"./bucket/line_bucket":325,"./bucket/symbol_bucket":326,"./buffer_group":328,"assert":43,"feature-filter":128}],323:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"./array_group":324,"./bucket/circle_bucket":326,"./bucket/fill_bucket":327,"./bucket/line_bucket":328,"./bucket/symbol_bucket":329,"./buffer_group":331,"assert":45,"feature-filter":130}],326:[function(require,module,exports){ 'use strict'; var Bucket = require('../bucket'); @@ -56637,7 +56845,7 @@ CircleBucket.prototype.addFeature = function(feature) { this.populatePaintArrays('circle', globalProperties, feature.properties, startGroup, startIndex); }; -},{"../../util/util":435,"../bucket":322,"../load_geometry":330}],324:[function(require,module,exports){ +},{"../../util/util":438,"../bucket":325,"../load_geometry":333}],327:[function(require,module,exports){ 'use strict'; var Bucket = require('../bucket'); @@ -56748,7 +56956,7 @@ FillBucket.prototype.addPolygon = function(polygon) { } }; -},{"../../util/classify_rings":423,"../../util/util":435,"../bucket":322,"../load_geometry":330,"earcut":122}],325:[function(require,module,exports){ +},{"../../util/classify_rings":426,"../../util/util":438,"../bucket":325,"../load_geometry":333,"earcut":124}],328:[function(require,module,exports){ 'use strict'; var Bucket = require('../bucket'); @@ -57175,7 +57383,7 @@ LineBucket.prototype.addPieSliceVertex = function(currentVertex, distance, extru } }; -},{"../../util/util":435,"../bucket":322,"../load_geometry":330}],326:[function(require,module,exports){ +},{"../../util/util":438,"../bucket":325,"../load_geometry":333}],329:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -57821,7 +58029,7 @@ SymbolBucket.prototype.addSymbolQuad = function(symbolQuad) { symbolQuad.minScale); }; -},{"../../symbol/anchor":384,"../../symbol/clip_line":386,"../../symbol/collision_feature":388,"../../symbol/get_anchors":390,"../../symbol/mergelines":393,"../../symbol/quads":394,"../../symbol/resolve_text":395,"../../symbol/shaping":396,"../../util/token":434,"../../util/util":435,"../bucket":322,"../load_geometry":330,"point-geometry":476}],327:[function(require,module,exports){ +},{"../../symbol/anchor":387,"../../symbol/clip_line":389,"../../symbol/collision_feature":391,"../../symbol/get_anchors":393,"../../symbol/mergelines":396,"../../symbol/quads":397,"../../symbol/resolve_text":398,"../../symbol/shaping":399,"../../util/token":437,"../../util/util":438,"../bucket":325,"../load_geometry":333,"point-geometry":480}],330:[function(require,module,exports){ 'use strict'; module.exports = Buffer; @@ -57922,7 +58130,7 @@ Buffer.BufferType = { ELEMENT: 'ELEMENT_ARRAY_BUFFER' }; -},{}],328:[function(require,module,exports){ +},{}],331:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -57977,7 +58185,7 @@ BufferGroup.prototype.destroy = function(gl) { } }; -},{"../render/vertex_array_object":350,"../util/util":435,"./buffer":327}],329:[function(require,module,exports){ +},{"../render/vertex_array_object":353,"../util/util":438,"./buffer":330}],332:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -58276,7 +58484,7 @@ function offsetLine(rings, offset) { return newRings; } -},{"../util/dictionary_coder":425,"../util/intersection_tests":430,"../util/struct_array":433,"../util/util":435,"../util/vectortile_to_geojson":436,"./bucket":322,"./load_geometry":330,"feature-filter":128,"grid-index":282,"pbf":470,"point-geometry":476,"vector-tile":542}],330:[function(require,module,exports){ +},{"../util/dictionary_coder":428,"../util/intersection_tests":433,"../util/struct_array":436,"../util/util":438,"../util/vectortile_to_geojson":439,"./bucket":325,"./load_geometry":333,"feature-filter":130,"grid-index":285,"pbf":474,"point-geometry":480,"vector-tile":546}],333:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -58332,7 +58540,7 @@ module.exports = function loadGeometry(feature, bits) { return geometry; }; -},{"../util/util":435,"./bucket":322,"assert":43}],331:[function(require,module,exports){ +},{"../util/util":438,"./bucket":325,"assert":45}],334:[function(require,module,exports){ 'use strict'; module.exports = Coordinate; @@ -58411,7 +58619,7 @@ Coordinate.prototype = { } }; -},{}],332:[function(require,module,exports){ +},{}],335:[function(require,module,exports){ 'use strict'; module.exports = LngLat; @@ -58503,7 +58711,7 @@ LngLat.convert = function (input) { return input; }; -},{"../util/util":435}],333:[function(require,module,exports){ +},{"../util/util":438}],336:[function(require,module,exports){ 'use strict'; module.exports = LngLatBounds; @@ -58695,7 +58903,7 @@ LngLatBounds.convert = function (input) { return new LngLatBounds(input); }; -},{"./lng_lat":332}],334:[function(require,module,exports){ +},{"./lng_lat":335}],337:[function(require,module,exports){ 'use strict'; var LngLat = require('./lng_lat'), @@ -59169,7 +59377,7 @@ Transform.prototype = { } }; -},{"../data/bucket":322,"../source/tile_coord":362,"../util/interpolate":429,"../util/util":435,"./coordinate":331,"./lng_lat":332,"gl-matrix":188,"point-geometry":476}],335:[function(require,module,exports){ +},{"../data/bucket":325,"../source/tile_coord":365,"../util/interpolate":432,"../util/util":438,"./coordinate":334,"./lng_lat":335,"gl-matrix":191,"point-geometry":480}],338:[function(require,module,exports){ 'use strict'; // Font data From Hershey Simplex Font @@ -59302,7 +59510,7 @@ module.exports = function textVertices(text, left, baseline, scale) { return strokes; }; -},{}],336:[function(require,module,exports){ +},{}],339:[function(require,module,exports){ 'use strict'; // jshint -W079 @@ -59369,7 +59577,7 @@ Object.defineProperty(mapboxgl, 'accessToken', { * mapboxgl.supported() // = true */ -},{"../package.json":437,"./geo/lng_lat":332,"./geo/lng_lat_bounds":333,"./style/style":371,"./ui/control/attribution":402,"./ui/control/control":403,"./ui/control/geolocate":404,"./ui/control/navigation":405,"./ui/map":414,"./ui/marker":415,"./ui/popup":416,"./util/ajax":418,"./util/browser":419,"./util/config":424,"./util/evented":427,"./util/util":435,"point-geometry":476}],337:[function(require,module,exports){ +},{"../package.json":440,"./geo/lng_lat":335,"./geo/lng_lat_bounds":336,"./style/style":374,"./ui/control/attribution":405,"./ui/control/control":406,"./ui/control/geolocate":407,"./ui/control/navigation":408,"./ui/map":417,"./ui/marker":418,"./ui/popup":419,"./util/ajax":421,"./util/browser":422,"./util/config":427,"./util/evented":430,"./util/util":438,"point-geometry":480}],340:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -59389,7 +59597,7 @@ module.exports = function(uniforms) { return pragmas; }; -},{"assert":43}],338:[function(require,module,exports){ +},{"assert":45}],341:[function(require,module,exports){ 'use strict'; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); @@ -59482,7 +59690,7 @@ function drawBackground(painter, source, layer) { gl.stencilFunc(gl.EQUAL, 0x80, 0x80); } -},{"../source/pixels_to_tile_units":356,"./create_uniform_pragmas":337}],339:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359,"./create_uniform_pragmas":340}],342:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -59547,7 +59755,7 @@ function drawCircles(painter, source, layer, coords) { } } -},{"../util/browser":419}],340:[function(require,module,exports){ +},{"../util/browser":422}],343:[function(require,module,exports){ 'use strict'; module.exports = drawCollisionDebug; @@ -59582,7 +59790,7 @@ function drawCollisionDebug(painter, source, layer, coords) { } } -},{}],341:[function(require,module,exports){ +},{}],344:[function(require,module,exports){ 'use strict'; var textVertices = require('../lib/debugtext'); @@ -59643,7 +59851,7 @@ function drawDebugTile(painter, source, coord) { gl.drawArrays(gl.LINES, 0, debugTextBuffer.length); } -},{"../data/bucket":322,"../data/buffer":327,"../lib/debugtext":335,"../util/browser":419,"./vertex_array_object":350,"gl-matrix":188}],342:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../lib/debugtext":338,"../util/browser":422,"./vertex_array_object":353,"gl-matrix":191}],345:[function(require,module,exports){ 'use strict'; var pixelsToTileUnits = require('../source/pixels_to_tile_units'); @@ -59840,7 +60048,7 @@ function setPattern(image, opacity, tile, coord, painter, program) { painter.spriteAtlas.bind(gl, true); } -},{"../source/pixels_to_tile_units":356}],343:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359}],346:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -60005,7 +60213,7 @@ module.exports = function drawLine(painter, source, layer, coords) { }; -},{"../source/pixels_to_tile_units":356,"../util/browser":419,"gl-matrix":188}],344:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359,"../util/browser":422,"gl-matrix":191}],347:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -60151,7 +60359,7 @@ function getOpacities(tile, parentTile, layer, transform) { return opacity; } -},{"../util/struct_array":433,"../util/util":435}],345:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438}],348:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -60367,7 +60575,7 @@ function drawSymbol(painter, layer, posMatrix, tile, bucket, bufferGroups, isTex } } -},{"../source/pixels_to_tile_units":356,"../util/browser":419,"./draw_collision_debug":340}],346:[function(require,module,exports){ +},{"../source/pixels_to_tile_units":359,"../util/browser":422,"./draw_collision_debug":343}],349:[function(require,module,exports){ 'use strict'; module.exports = FrameHistory; @@ -60439,7 +60647,7 @@ FrameHistory.prototype.bind = function(gl) { } }; -},{}],347:[function(require,module,exports){ +},{}],350:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -60586,7 +60794,7 @@ LineAtlas.prototype.bind = function(gl) { } }; -},{"../util/util":435}],348:[function(require,module,exports){ +},{"../util/util":438}],351:[function(require,module,exports){ 'use strict'; var browser = require('../util/browser'); @@ -60930,7 +61138,7 @@ Painter.prototype.showOverdrawInspector = function(enabled) { } }; -},{"../data/bucket":322,"../data/buffer":327,"../source/pixels_to_tile_units":356,"../source/source_cache":360,"../util/browser":419,"../util/struct_array":433,"../util/util":435,"./create_uniform_pragmas":337,"./draw_background":338,"./draw_circle":339,"./draw_debug":341,"./draw_fill":342,"./draw_line":343,"./draw_raster":344,"./draw_symbol":345,"./frame_history":346,"./painter/use_program":349,"./vertex_array_object":350,"gl-matrix":188}],349:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../source/pixels_to_tile_units":359,"../source/source_cache":363,"../util/browser":422,"../util/struct_array":436,"../util/util":438,"./create_uniform_pragmas":340,"./draw_background":341,"./draw_circle":342,"./draw_debug":344,"./draw_fill":345,"./draw_line":346,"./draw_raster":347,"./draw_symbol":348,"./frame_history":349,"./painter/use_program":352,"./vertex_array_object":353,"gl-matrix":191}],352:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -61027,7 +61235,7 @@ function applyPragmas(source, pragmas) { }); } -},{"../../util/util":435,"assert":43,"mapbox-gl-shaders":296}],350:[function(require,module,exports){ +},{"../../util/util":438,"assert":45,"mapbox-gl-shaders":299}],353:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -61125,7 +61333,7 @@ VertexArrayObject.prototype.destroy = function(gl) { } }; -},{"assert":43}],351:[function(require,module,exports){ +},{"assert":45}],354:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -61349,7 +61557,7 @@ GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototy } }); -},{"../data/bucket":322,"../util/evented":427,"../util/util":435,"resolve-url":493}],352:[function(require,module,exports){ +},{"../data/bucket":325,"../util/evented":430,"../util/util":438,"resolve-url":497}],355:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -61487,7 +61695,7 @@ GeoJSONWorkerSource.prototype = util.inherit(VectorTileWorkerSource, /** @lends } }); -},{"../util/ajax":418,"../util/util":435,"./geojson_wrapper":353,"./vector_tile_worker_source":364,"geojson-rewind":134,"geojson-vt":138,"supercluster":521,"vt-pbf":548}],353:[function(require,module,exports){ +},{"../util/ajax":421,"../util/util":438,"./geojson_wrapper":356,"./vector_tile_worker_source":367,"geojson-rewind":136,"geojson-vt":140,"supercluster":525,"vt-pbf":552}],356:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -61563,7 +61771,7 @@ FeatureWrapper.prototype.bbox = function() { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON; -},{"../data/bucket":322,"point-geometry":476,"vector-tile":542}],354:[function(require,module,exports){ +},{"../data/bucket":325,"point-geometry":480,"vector-tile":546}],357:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -61742,7 +61950,7 @@ ImageSource.prototype = util.inherit(Evented, /** @lends ImageSource.prototype * } }); -},{"../data/bucket":322,"../data/buffer":327,"../geo/lng_lat":332,"../render/draw_raster":344,"../render/vertex_array_object":350,"../util/ajax":418,"../util/evented":427,"../util/util":435,"./tile_coord":362,"point-geometry":476}],355:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../geo/lng_lat":335,"../render/draw_raster":347,"../render/vertex_array_object":353,"../util/ajax":421,"../util/evented":430,"../util/util":438,"./tile_coord":365,"point-geometry":480}],358:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); var ajax = require('../util/ajax'); @@ -61773,7 +61981,7 @@ module.exports = function(options, callback) { }; -},{"../util/ajax":418,"../util/browser":419,"../util/mapbox":432,"../util/util":435}],356:[function(require,module,exports){ +},{"../util/ajax":421,"../util/browser":422,"../util/mapbox":435,"../util/util":438}],359:[function(require,module,exports){ 'use strict'; var Bucket = require('../data/bucket'); @@ -61798,7 +62006,7 @@ module.exports = function(tile, pixelValue, z) { }; -},{"../data/bucket":322}],357:[function(require,module,exports){ +},{"../data/bucket":325}],360:[function(require,module,exports){ 'use strict'; var TileCoord = require('./tile_coord'); @@ -61869,7 +62077,7 @@ function mergeRenderedFeatureLayers(tiles) { } -},{"./tile_coord":362}],358:[function(require,module,exports){ +},{"./tile_coord":365}],361:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -61966,7 +62174,7 @@ RasterTileSource.prototype = util.inherit(Evented, { } }); -},{"../util/ajax":418,"../util/evented":427,"../util/mapbox":432,"../util/util":435,"./load_tilejson":355}],359:[function(require,module,exports){ +},{"../util/ajax":421,"../util/evented":430,"../util/mapbox":435,"../util/util":438,"./load_tilejson":358}],362:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -62137,7 +62345,7 @@ exports.setType = function (name, type) { * @instance */ -},{"../source/geojson_source":351,"../source/image_source":354,"../source/raster_tile_source":358,"../source/vector_tile_source":363,"../source/video_source":365,"../util/util":435}],360:[function(require,module,exports){ +},{"../source/geojson_source":354,"../source/image_source":357,"../source/raster_tile_source":361,"../source/vector_tile_source":366,"../source/video_source":368,"../util/util":438}],363:[function(require,module,exports){ 'use strict'; var Source = require('./source'); @@ -62675,7 +62883,7 @@ function compareKeyZoom(a, b) { return (a % 32) - (b % 32); } -},{"../data/bucket":322,"../geo/coordinate":331,"../util/evented":427,"../util/lru_cache":431,"../util/util":435,"./source":359,"./tile":361,"./tile_coord":362}],361:[function(require,module,exports){ +},{"../data/bucket":325,"../geo/coordinate":334,"../util/evented":430,"../util/lru_cache":434,"../util/util":438,"./source":362,"./tile":364,"./tile_coord":365}],364:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -62877,7 +63085,7 @@ function unserializeBuckets(input, style) { return output; } -},{"../data/bucket":322,"../data/feature_index":329,"../symbol/collision_box":387,"../symbol/collision_tile":389,"../symbol/symbol_instances":398,"../symbol/symbol_quads":399,"../util/util":435,"../util/vectortile_to_geojson":436,"feature-filter":128,"pbf":470,"vector-tile":542}],362:[function(require,module,exports){ +},{"../data/bucket":325,"../data/feature_index":332,"../symbol/collision_box":390,"../symbol/collision_tile":392,"../symbol/symbol_instances":401,"../symbol/symbol_quads":402,"../util/util":438,"../util/vectortile_to_geojson":439,"feature-filter":130,"pbf":474,"vector-tile":546}],365:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -63071,7 +63279,7 @@ TileCoord.cover = function(z, bounds, actualZ) { }); }; -},{"../geo/coordinate":331,"assert":43,"whoots-js":558}],363:[function(require,module,exports){ +},{"../geo/coordinate":334,"assert":45,"whoots-js":562}],366:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -63178,7 +63386,7 @@ VectorTileSource.prototype = util.inherit(Evented, { } }); -},{"../util/evented":427,"../util/mapbox":432,"../util/util":435,"./load_tilejson":355}],364:[function(require,module,exports){ +},{"../util/evented":430,"../util/mapbox":435,"../util/util":438,"./load_tilejson":358}],367:[function(require,module,exports){ 'use strict'; var ajax = require('../util/ajax'); var vt = require('vector-tile'); @@ -63326,7 +63534,7 @@ VectorTileWorkerSource.prototype = { } }; -},{"../util/ajax":418,"./worker_tile":367,"pbf":470,"vector-tile":542}],365:[function(require,module,exports){ +},{"../util/ajax":421,"./worker_tile":370,"pbf":474,"vector-tile":546}],368:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -63530,7 +63738,7 @@ VideoSource.prototype = util.inherit(Evented, /** @lends VideoSource.prototype * } }); -},{"../data/bucket":322,"../data/buffer":327,"../geo/lng_lat":332,"../render/draw_raster":344,"../render/vertex_array_object":350,"../util/ajax":418,"../util/evented":427,"../util/util":435,"./tile_coord":362,"point-geometry":476}],366:[function(require,module,exports){ +},{"../data/bucket":325,"../data/buffer":330,"../geo/lng_lat":335,"../render/draw_raster":347,"../render/vertex_array_object":353,"../util/ajax":421,"../util/evented":430,"../util/util":438,"./tile_coord":365,"point-geometry":480}],369:[function(require,module,exports){ 'use strict'; var Actor = require('../util/actor'); @@ -63694,7 +63902,7 @@ function createLayerFamilies(layers) { return families; } -},{"../style/style_layer":374,"../util/actor":417,"../util/util":435,"./geojson_worker_source":352,"./vector_tile_worker_source":364}],367:[function(require,module,exports){ +},{"../style/style_layer":377,"../util/actor":420,"../util/util":438,"./geojson_worker_source":355,"./vector_tile_worker_source":367}],370:[function(require,module,exports){ 'use strict'; var FeatureIndex = require('../data/feature_index'); @@ -63967,7 +64175,7 @@ function getLayerId(layer) { return layer.id; } -},{"../data/bucket":322,"../data/feature_index":329,"../symbol/collision_box":387,"../symbol/collision_tile":389,"../symbol/symbol_instances":398,"../symbol/symbol_quads":399,"../util/dictionary_coder":425,"../util/util":435}],368:[function(require,module,exports){ +},{"../data/bucket":325,"../data/feature_index":332,"../symbol/collision_box":390,"../symbol/collision_tile":392,"../symbol/symbol_instances":401,"../symbol/symbol_quads":402,"../util/dictionary_coder":428,"../util/util":438}],371:[function(require,module,exports){ 'use strict'; module.exports = AnimationLoop; @@ -63999,7 +64207,7 @@ AnimationLoop.prototype.cancel = function(n) { }); }; -},{}],369:[function(require,module,exports){ +},{}],372:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -64080,7 +64288,7 @@ ImageSprite.prototype.getSpritePosition = function(name) { return new SpritePosition(); }; -},{"../util/ajax":418,"../util/browser":419,"../util/evented":427,"../util/mapbox":432}],370:[function(require,module,exports){ +},{"../util/ajax":421,"../util/browser":422,"../util/evented":430,"../util/mapbox":435}],373:[function(require,module,exports){ 'use strict'; var parseColorString = require('csscolorparser').parseCSSColor; @@ -64122,7 +64330,7 @@ module.exports = function parseColor(input) { } }; -},{"../util/util":435,"./style_function":373,"csscolorparser":104}],371:[function(require,module,exports){ +},{"../util/util":438,"./style_function":376,"csscolorparser":106}],374:[function(require,module,exports){ 'use strict'; var Evented = require('../util/evented'); @@ -64903,7 +65111,7 @@ Style.prototype = util.inherit(Evented, { }); -},{"../render/line_atlas":347,"../source/query_features":357,"../source/source":359,"../source/source_cache":360,"../symbol/glyph_source":392,"../symbol/sprite_atlas":397,"../util/ajax":418,"../util/browser":419,"../util/dispatcher":426,"../util/evented":427,"../util/mapbox":432,"../util/util":435,"./animation_loop":368,"./image_sprite":369,"./style_function":373,"./style_layer":374,"./style_spec":381,"./validate_style":383}],372:[function(require,module,exports){ +},{"../render/line_atlas":350,"../source/query_features":360,"../source/source":362,"../source/source_cache":363,"../symbol/glyph_source":395,"../symbol/sprite_atlas":400,"../util/ajax":421,"../util/browser":422,"../util/dispatcher":429,"../util/evented":430,"../util/mapbox":435,"../util/util":438,"./animation_loop":371,"./image_sprite":372,"./style_function":376,"./style_layer":377,"./style_spec":384,"./validate_style":386}],375:[function(require,module,exports){ 'use strict'; var MapboxGLFunction = require('./style_function'); @@ -64987,7 +65195,7 @@ function transitioned(calculate) { }; } -},{"../util/util":435,"./parse_color":370,"./style_function":373}],373:[function(require,module,exports){ +},{"../util/util":438,"./parse_color":373,"./style_function":376}],376:[function(require,module,exports){ 'use strict'; var MapboxGLFunction = require('mapbox-gl-function'); @@ -65014,7 +65222,7 @@ exports['piecewise-constant'] = function(parameters) { exports.isFunctionDefinition = MapboxGLFunction.isFunctionDefinition; -},{"mapbox-gl-function":295}],374:[function(require,module,exports){ +},{"mapbox-gl-function":298}],377:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -65361,7 +65569,7 @@ function getDeclarationValue(declaration) { return declaration.value; } -},{"../util/evented":427,"../util/util":435,"./parse_color":370,"./style_declaration":372,"./style_layer/background_style_layer":375,"./style_layer/circle_style_layer":376,"./style_layer/fill_style_layer":377,"./style_layer/line_style_layer":378,"./style_layer/raster_style_layer":379,"./style_layer/symbol_style_layer":380,"./style_spec":381,"./style_transition":382,"./validate_style":383}],375:[function(require,module,exports){ +},{"../util/evented":430,"../util/util":438,"./parse_color":373,"./style_declaration":375,"./style_layer/background_style_layer":378,"./style_layer/circle_style_layer":379,"./style_layer/fill_style_layer":380,"./style_layer/line_style_layer":381,"./style_layer/raster_style_layer":382,"./style_layer/symbol_style_layer":383,"./style_spec":384,"./style_transition":385,"./validate_style":386}],378:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65375,7 +65583,7 @@ module.exports = BackgroundStyleLayer; BackgroundStyleLayer.prototype = util.inherit(StyleLayer, {}); -},{"../../util/util":435,"../style_layer":374}],376:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],379:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65389,7 +65597,7 @@ module.exports = CircleStyleLayer; CircleStyleLayer.prototype = util.inherit(StyleLayer, {}); -},{"../../util/util":435,"../style_layer":374}],377:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],380:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65445,7 +65653,7 @@ FillStyleLayer.prototype = util.inherit(StyleLayer, { module.exports = FillStyleLayer; -},{"../../util/util":435,"../style_layer":374}],378:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],381:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65479,7 +65687,7 @@ LineStyleLayer.prototype = util.inherit(StyleLayer, { } }); -},{"../../util/util":435,"../style_layer":374}],379:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],382:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65493,7 +65701,7 @@ module.exports = RasterStyleLayer; RasterStyleLayer.prototype = util.inherit(StyleLayer, {}); -},{"../../util/util":435,"../style_layer":374}],380:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],383:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -65536,12 +65744,12 @@ SymbolStyleLayer.prototype = util.inherit(StyleLayer, { }); -},{"../../util/util":435,"../style_layer":374}],381:[function(require,module,exports){ +},{"../../util/util":438,"../style_layer":377}],384:[function(require,module,exports){ 'use strict'; module.exports = require('mapbox-gl-style-spec/reference/latest.min'); -},{"mapbox-gl-style-spec/reference/latest.min":318}],382:[function(require,module,exports){ +},{"mapbox-gl-style-spec/reference/latest.min":321}],385:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -65626,7 +65834,7 @@ function interpZoomTransitioned(from, to, t) { } } -},{"../util/interpolate":429,"../util/util":435}],383:[function(require,module,exports){ +},{"../util/interpolate":432,"../util/util":438}],386:[function(require,module,exports){ 'use strict'; module.exports = require('mapbox-gl-style-spec/lib/validate_style.min'); @@ -65650,7 +65858,7 @@ module.exports.throwErrors = function throwErrors(emitter, errors) { } }; -},{"mapbox-gl-style-spec/lib/validate_style.min":317}],384:[function(require,module,exports){ +},{"mapbox-gl-style-spec/lib/validate_style.min":320}],387:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -65673,7 +65881,7 @@ Anchor.prototype.clone = function() { return new Anchor(this.x, this.y, this.angle, this.segment); }; -},{"point-geometry":476}],385:[function(require,module,exports){ +},{"point-geometry":480}],388:[function(require,module,exports){ 'use strict'; module.exports = checkMaxAngle; @@ -65753,7 +65961,7 @@ function checkMaxAngle(line, anchor, labelLength, windowSize, maxAngle) { return true; } -},{}],386:[function(require,module,exports){ +},{}],389:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -65827,7 +66035,7 @@ function clipLine(lines, x1, y1, x2, y2) { return clippedLines; } -},{"point-geometry":476}],387:[function(require,module,exports){ +},{"point-geometry":480}],390:[function(require,module,exports){ 'use strict'; var StructArrayType = require('../util/struct_array'); @@ -65908,7 +66116,7 @@ util.extendAll(CollisionBoxArray.prototype.StructType.prototype, { } }); -},{"../util/struct_array":433,"../util/util":435,"point-geometry":476}],388:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"point-geometry":480}],391:[function(require,module,exports){ 'use strict'; module.exports = CollisionFeature; @@ -66042,7 +66250,7 @@ CollisionFeature.prototype._addLineCollisionBoxes = function(collisionBoxArray, return bboxes; }; -},{}],389:[function(require,module,exports){ +},{}],392:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -66343,7 +66551,7 @@ CollisionTile.prototype.insertCollisionFeature = function(collisionFeature, minP } }; -},{"../data/bucket":322,"grid-index":282,"point-geometry":476}],390:[function(require,module,exports){ +},{"../data/bucket":325,"grid-index":285,"point-geometry":480}],393:[function(require,module,exports){ 'use strict'; var interpolate = require('../util/interpolate'); @@ -66447,7 +66655,7 @@ function resample(line, offset, spacing, angleWindowSize, maxAngle, labelLength, return anchors; } -},{"../symbol/anchor":384,"../util/interpolate":429,"./check_max_angle":385}],391:[function(require,module,exports){ +},{"../symbol/anchor":387,"../util/interpolate":432,"./check_max_angle":388}],394:[function(require,module,exports){ 'use strict'; var ShelfPack = require('shelf-pack'); @@ -66616,7 +66824,7 @@ GlyphAtlas.prototype.updateTexture = function(gl) { } }; -},{"../util/util":435,"shelf-pack":506}],392:[function(require,module,exports){ +},{"../util/util":438,"shelf-pack":510}],395:[function(require,module,exports){ 'use strict'; var normalizeURL = require('../util/mapbox').normalizeGlyphsURL; @@ -66757,7 +66965,7 @@ function glyphUrl(fontstack, range, url, subdomains) { .replace('{range}', range); } -},{"../symbol/glyph_atlas":391,"../util/ajax":418,"../util/glyphs":428,"../util/mapbox":432,"pbf":470}],393:[function(require,module,exports){ +},{"../symbol/glyph_atlas":394,"../util/ajax":421,"../util/glyphs":431,"../util/mapbox":435,"pbf":474}],396:[function(require,module,exports){ 'use strict'; module.exports = function (features, textFeatures, geometries) { @@ -66848,7 +67056,7 @@ module.exports = function (features, textFeatures, geometries) { }; }; -},{}],394:[function(require,module,exports){ +},{}],397:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -67131,7 +67339,7 @@ function getSegmentGlyphs(glyphs, anchor, offset, line, segment, forward) { return placementScale; } -},{"point-geometry":476}],395:[function(require,module,exports){ +},{"point-geometry":480}],398:[function(require,module,exports){ 'use strict'; var resolveTokens = require('../util/token'); @@ -67174,7 +67382,7 @@ function resolveText(features, layoutProperties, codepoints) { return textFeatures; } -},{"../util/token":434}],396:[function(require,module,exports){ +},{"../util/token":437}],399:[function(require,module,exports){ 'use strict'; module.exports = { @@ -67355,7 +67563,7 @@ function PositionedIcon(image, top, bottom, left, right) { this.right = right; } -},{}],397:[function(require,module,exports){ +},{}],400:[function(require,module,exports){ 'use strict'; var ShelfPack = require('shelf-pack'); @@ -67588,7 +67796,7 @@ function AtlasImage(rect, width, height, sdf, pixelRatio) { this.pixelRatio = pixelRatio; } -},{"../util/browser":419,"../util/util":435,"shelf-pack":506}],398:[function(require,module,exports){ +},{"../util/browser":422,"../util/util":438,"shelf-pack":510}],401:[function(require,module,exports){ 'use strict'; var StructArrayType = require('../util/struct_array'); @@ -67633,7 +67841,7 @@ util.extendAll(SymbolInstancesArray.prototype.StructType.prototype, { -},{"../util/struct_array":433,"../util/util":435,"point-geometry":476}],399:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"point-geometry":480}],402:[function(require,module,exports){ 'use strict'; var StructArrayType = require('../util/struct_array'); @@ -67707,7 +67915,7 @@ util.extendAll(SymbolQuadsArray.prototype.StructType.prototype, { }); -},{"../util/struct_array":433,"../util/util":435,"./quads":394,"point-geometry":476}],400:[function(require,module,exports){ +},{"../util/struct_array":436,"../util/util":438,"./quads":397,"point-geometry":480}],403:[function(require,module,exports){ 'use strict'; var DOM = require('../util/dom'); @@ -67882,7 +68090,7 @@ module.exports = function bindHandlers(map, options) { * property. */ -},{"../util/dom":421,"./handler/box_zoom":406,"./handler/dblclick_zoom":407,"./handler/drag_pan":408,"./handler/drag_rotate":409,"./handler/keyboard":410,"./handler/scroll_zoom":411,"./handler/touch_zoom_rotate":412,"point-geometry":476}],401:[function(require,module,exports){ +},{"../util/dom":424,"./handler/box_zoom":409,"./handler/dblclick_zoom":410,"./handler/drag_pan":411,"./handler/drag_rotate":412,"./handler/keyboard":413,"./handler/scroll_zoom":414,"./handler/touch_zoom_rotate":415,"point-geometry":480}],404:[function(require,module,exports){ 'use strict'; var util = require('../util/util'); @@ -68669,7 +68877,7 @@ util.extend(Camera.prototype, /** @lends Map.prototype */{ * @property {MapEventData} data */ -},{"../geo/lng_lat":332,"../geo/lng_lat_bounds":333,"../util/browser":419,"../util/interpolate":429,"../util/util":435,"point-geometry":476}],402:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../geo/lng_lat_bounds":336,"../util/browser":422,"../util/interpolate":432,"../util/util":438,"point-geometry":480}],405:[function(require,module,exports){ 'use strict'; var Control = require('./control'); @@ -68752,7 +68960,7 @@ Attribution.prototype = util.inherit(Control, { } }); -},{"../../util/dom":421,"../../util/util":435,"./control":403}],403:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438,"./control":406}],406:[function(require,module,exports){ 'use strict'; var util = require('../../util/util'); @@ -68807,7 +69015,7 @@ Control.prototype = { util.extend(Control.prototype, Evented); -},{"../../util/evented":427,"../../util/util":435}],404:[function(require,module,exports){ +},{"../../util/evented":430,"../../util/util":438}],407:[function(require,module,exports){ 'use strict'; var Control = require('./control'); @@ -68909,7 +69117,7 @@ Geolocate.prototype = util.inherit(Control, { * */ -},{"../../util/browser":419,"../../util/dom":421,"../../util/util":435,"./control":403}],405:[function(require,module,exports){ +},{"../../util/browser":422,"../../util/dom":424,"../../util/util":438,"./control":406}],408:[function(require,module,exports){ 'use strict'; var Control = require('./control'); @@ -69030,7 +69238,7 @@ function copyMouseEvent(e) { }); } -},{"../../util/dom":421,"../../util/util":435,"./control":403}],406:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438,"./control":406}],409:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -69217,7 +69425,7 @@ BoxZoomHandler.prototype = { * @property {MapBoxZoomEvent} data */ -},{"../../geo/lng_lat_bounds":333,"../../util/dom":421,"../../util/util":435}],407:[function(require,module,exports){ +},{"../../geo/lng_lat_bounds":336,"../../util/dom":424,"../../util/util":438}],410:[function(require,module,exports){ 'use strict'; module.exports = DoubleClickZoomHandler; @@ -69280,7 +69488,7 @@ DoubleClickZoomHandler.prototype = { } }; -},{}],408:[function(require,module,exports){ +},{}],411:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -69516,7 +69724,7 @@ DragPanHandler.prototype = { * @property {MapMouseEvent | MapTouchEvent} data */ -},{"../../util/dom":421,"../../util/util":435}],409:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438}],412:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -69770,7 +69978,7 @@ DragRotateHandler.prototype = { * @property {MapMouseEvent | MapTouchEvent} data */ -},{"../../util/dom":421,"../../util/util":435,"point-geometry":476}],410:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438,"point-geometry":480}],413:[function(require,module,exports){ 'use strict'; module.exports = KeyboardHandler; @@ -69902,7 +70110,7 @@ KeyboardHandler.prototype = { } }; -},{}],411:[function(require,module,exports){ +},{}],414:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -70085,7 +70293,7 @@ ScrollZoomHandler.prototype = { * @property {MapMouseEvent | MapTouchEvent} data */ -},{"../../util/browser":419,"../../util/dom":421,"../../util/util":435}],412:[function(require,module,exports){ +},{"../../util/browser":422,"../../util/dom":424,"../../util/util":438}],415:[function(require,module,exports){ 'use strict'; var DOM = require('../../util/dom'), @@ -70300,7 +70508,7 @@ TouchZoomRotateHandler.prototype = { } }; -},{"../../util/dom":421,"../../util/util":435}],413:[function(require,module,exports){ +},{"../../util/dom":424,"../../util/util":438}],416:[function(require,module,exports){ 'use strict'; /* @@ -70375,7 +70583,7 @@ Hash.prototype = { } }; -},{"../util/util":435}],414:[function(require,module,exports){ +},{"../util/util":438}],417:[function(require,module,exports){ 'use strict'; var Canvas = require('../util/canvas'); @@ -71815,7 +72023,7 @@ function removeNode(node) { * @property {{error: {message: string}}} data */ -},{"../geo/lng_lat":332,"../geo/lng_lat_bounds":333,"../geo/transform":334,"../render/painter":348,"../style/animation_loop":368,"../style/style":371,"../util/browser":419,"../util/canvas":420,"../util/dom":421,"../util/evented":427,"../util/util":435,"./bind_handlers":400,"./camera":401,"./control/attribution":402,"./hash":413,"point-geometry":476}],415:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../geo/lng_lat_bounds":336,"../geo/transform":337,"../render/painter":351,"../style/animation_loop":371,"../style/style":374,"../util/browser":422,"../util/canvas":423,"../util/dom":424,"../util/evented":430,"../util/util":438,"./bind_handlers":403,"./camera":404,"./control/attribution":405,"./hash":416,"point-geometry":480}],418:[function(require,module,exports){ /* eslint-disable */ 'use strict'; @@ -71910,7 +72118,7 @@ Marker.prototype = { } }; -},{"../geo/lng_lat":332,"../util/dom":421,"point-geometry":476}],416:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../util/dom":424,"point-geometry":480}],419:[function(require,module,exports){ 'use strict'; module.exports = Popup; @@ -72164,7 +72372,7 @@ Popup.prototype = util.inherit(Evented, /** @lends Popup.prototype */{ } }); -},{"../geo/lng_lat":332,"../util/dom":421,"../util/evented":427,"../util/util":435}],417:[function(require,module,exports){ +},{"../geo/lng_lat":335,"../util/dom":424,"../util/evented":430,"../util/util":438}],420:[function(require,module,exports){ 'use strict'; module.exports = Actor; @@ -72236,7 +72444,7 @@ Actor.prototype.postMessage = function(message, transferList) { this.target.postMessage(message, transferList); }; -},{}],418:[function(require,module,exports){ +},{}],421:[function(require,module,exports){ 'use strict'; exports.getJSON = function(url, callback) { @@ -72326,7 +72534,7 @@ exports.getVideo = function(urls, callback) { return video; }; -},{}],419:[function(require,module,exports){ +},{}],422:[function(require,module,exports){ 'use strict'; /** @@ -72421,7 +72629,7 @@ webpImgTest.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ// exports.supportsGeolocation = !!navigator.geolocation; -},{"mapbox-gl-supported":320}],420:[function(require,module,exports){ +},{"mapbox-gl-supported":323}],423:[function(require,module,exports){ 'use strict'; var util = require('../util'); @@ -72465,7 +72673,7 @@ Canvas.prototype.getElement = function() { return this.canvas; }; -},{"../util":435,"mapbox-gl-supported":320}],421:[function(require,module,exports){ +},{"../util":438,"mapbox-gl-supported":323}],424:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -72540,7 +72748,7 @@ exports.touchPos = function (el, e) { return points; }; -},{"point-geometry":476}],422:[function(require,module,exports){ +},{"point-geometry":480}],425:[function(require,module,exports){ 'use strict'; var WebWorkify = require('webworkify'); @@ -72548,7 +72756,7 @@ module.exports = function () { return new WebWorkify(require('../../source/worker')); }; -},{"../../source/worker":366,"webworkify":556}],423:[function(require,module,exports){ +},{"../../source/worker":369,"webworkify":560}],426:[function(require,module,exports){ 'use strict'; var quickselect = require('quickselect'); @@ -72608,7 +72816,7 @@ function calculateSignedArea(ring) { return sum; } -},{"quickselect":485}],424:[function(require,module,exports){ +},{"quickselect":489}],427:[function(require,module,exports){ 'use strict'; module.exports = { @@ -72616,7 +72824,7 @@ module.exports = { REQUIRE_ACCESS_TOKEN: true }; -},{}],425:[function(require,module,exports){ +},{}],428:[function(require,module,exports){ 'use strict'; var assert = require('assert'); @@ -72643,7 +72851,7 @@ DictionaryCoder.prototype.decode = function(n) { return this._numberToString[n]; }; -},{"assert":43}],426:[function(require,module,exports){ +},{"assert":45}],429:[function(require,module,exports){ 'use strict'; var util = require('./util'); @@ -72718,7 +72926,7 @@ Dispatcher.prototype = { } }; -},{"./actor":417,"./util":435,"./web_worker":422}],427:[function(require,module,exports){ +},{"./actor":420,"./util":438,"./web_worker":425}],430:[function(require,module,exports){ 'use strict'; var util = require('./util'); @@ -72841,7 +73049,7 @@ var Evented = { module.exports = Evented; -},{"./util":435}],428:[function(require,module,exports){ +},{"./util":438}],431:[function(require,module,exports){ 'use strict'; module.exports = Glyphs; @@ -72876,7 +73084,7 @@ function readGlyph(tag, glyph, pbf) { else if (tag === 7) glyph.advance = pbf.readVarint(); } -},{}],429:[function(require,module,exports){ +},{}],432:[function(require,module,exports){ 'use strict'; module.exports = interpolate; @@ -72917,7 +73125,7 @@ interpolate.array = function(from, to, t) { }); }; -},{}],430:[function(require,module,exports){ +},{}],433:[function(require,module,exports){ 'use strict'; module.exports = { @@ -73083,7 +73291,7 @@ function polygonContainsPoint(ring, p) { return c; } -},{}],431:[function(require,module,exports){ +},{}],434:[function(require,module,exports){ 'use strict'; module.exports = LRUCache; @@ -73208,7 +73416,7 @@ LRUCache.prototype.setMaxSize = function(max) { return this; }; -},{}],432:[function(require,module,exports){ +},{}],435:[function(require,module,exports){ 'use strict'; var config = require('./config'); @@ -73336,7 +73544,7 @@ function replaceTempAccessToken(query) { } } -},{"./browser":419,"./config":424,"./util":435,"url":537}],433:[function(require,module,exports){ +},{"./browser":422,"./config":427,"./util":438,"url":541}],436:[function(require,module,exports){ 'use strict'; // Note: all "sizes" are measured in bytes @@ -73684,7 +73892,7 @@ StructArray.prototype.toArray = function(startIndex, endIndex) { return array; }; -},{"assert":43}],434:[function(require,module,exports){ +},{"assert":45}],437:[function(require,module,exports){ 'use strict'; module.exports = resolveTokens; @@ -73703,7 +73911,7 @@ function resolveTokens(properties, text) { }); } -},{}],435:[function(require,module,exports){ +},{}],438:[function(require,module,exports){ 'use strict'; var UnitBezier = require('unitbezier'); @@ -74162,7 +74370,7 @@ exports.warnOnce = function(message) { } }; -},{"../geo/coordinate":331,"unitbezier":536}],436:[function(require,module,exports){ +},{"../geo/coordinate":334,"unitbezier":540}],439:[function(require,module,exports){ 'use strict'; module.exports = Feature; @@ -74207,7 +74415,7 @@ Feature.prototype = { } }; -},{}],437:[function(require,module,exports){ +},{}],440:[function(require,module,exports){ module.exports={ "_args": [ [ @@ -74248,7 +74456,6 @@ module.exports={ "type": "range" }, "_requiredBy": [ - "#USER", "/" ], "_resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz", @@ -74548,7 +74755,7 @@ module.exports={ "version": "0.22.1" } -},{}],438:[function(require,module,exports){ +},{}],441:[function(require,module,exports){ 'use strict' module.exports = createTable @@ -74614,7 +74821,7 @@ function createTable(dimension) { } return result } -},{"convex-hull":99}],439:[function(require,module,exports){ +},{"convex-hull":101}],442:[function(require,module,exports){ /*jshint unused:true*/ /* Input: matrix ; a 4x4 matrix @@ -74794,7 +75001,7 @@ function combine(out, a, b, scale1, scale2) { out[1] = a[1] * scale1 + b[1] * scale2 out[2] = a[2] * scale1 + b[2] * scale2 } -},{"./normalize":440,"gl-mat4/clone":170,"gl-mat4/create":171,"gl-mat4/determinant":172,"gl-mat4/invert":176,"gl-mat4/transpose":186,"gl-vec3/cross":267,"gl-vec3/dot":268,"gl-vec3/length":269,"gl-vec3/normalize":271}],440:[function(require,module,exports){ +},{"./normalize":443,"gl-mat4/clone":173,"gl-mat4/create":174,"gl-mat4/determinant":175,"gl-mat4/invert":179,"gl-mat4/transpose":189,"gl-vec3/cross":270,"gl-vec3/dot":271,"gl-vec3/length":272,"gl-vec3/normalize":274}],443:[function(require,module,exports){ module.exports = function normalize(out, mat) { var m44 = mat[15] // Cannot normalize. @@ -74805,7 +75012,7 @@ module.exports = function normalize(out, mat) { out[i] = mat[i] * scale return true } -},{}],441:[function(require,module,exports){ +},{}],444:[function(require,module,exports){ var lerp = require('gl-vec3/lerp') var recompose = require('mat4-recompose') @@ -74858,7 +75065,7 @@ function vec3(n) { function vec4() { return [0,0,0,1] } -},{"gl-mat4/determinant":172,"gl-vec3/lerp":270,"mat4-decompose":439,"mat4-recompose":442,"quat-slerp":481}],442:[function(require,module,exports){ +},{"gl-mat4/determinant":175,"gl-vec3/lerp":273,"mat4-decompose":442,"mat4-recompose":445,"quat-slerp":485}],445:[function(require,module,exports){ /* Input: translation ; a 3 component vector scale ; a 3 component vector @@ -74919,7 +75126,7 @@ module.exports = function recomposeMat4(matrix, translation, scale, skew, perspe mat4.scale(matrix, matrix, scale) return matrix } -},{"gl-mat4/create":171,"gl-mat4/fromRotationTranslation":174,"gl-mat4/identity":175,"gl-mat4/multiply":178,"gl-mat4/scale":184,"gl-mat4/translate":185}],443:[function(require,module,exports){ +},{"gl-mat4/create":174,"gl-mat4/fromRotationTranslation":177,"gl-mat4/identity":178,"gl-mat4/multiply":181,"gl-mat4/scale":187,"gl-mat4/translate":188}],446:[function(require,module,exports){ 'use strict' var bsearch = require('binary-search-bounds') @@ -75119,7 +75326,7 @@ function createMatrixCameraController(options) { return new MatrixCameraController(matrix) } -},{"binary-search-bounds":62,"gl-mat4/invert":176,"gl-mat4/lookAt":177,"gl-mat4/rotateX":181,"gl-mat4/rotateY":182,"gl-mat4/rotateZ":183,"gl-mat4/scale":184,"gl-mat4/translate":185,"gl-vec3/normalize":271,"mat4-interpolate":441}],444:[function(require,module,exports){ +},{"binary-search-bounds":64,"gl-mat4/invert":179,"gl-mat4/lookAt":180,"gl-mat4/rotateX":184,"gl-mat4/rotateY":185,"gl-mat4/rotateZ":186,"gl-mat4/scale":187,"gl-mat4/translate":188,"gl-vec3/normalize":274,"mat4-interpolate":444}],447:[function(require,module,exports){ 'use strict' module.exports = monotoneConvexHull2D @@ -75201,7 +75408,7 @@ function monotoneConvexHull2D(points) { //Return result return result } -},{"robust-orientation":500}],445:[function(require,module,exports){ +},{"robust-orientation":504}],448:[function(require,module,exports){ 'use strict' module.exports = mouseListen @@ -75408,7 +75615,7 @@ function mouseListen (element, callback) { return result } -},{"mouse-event":447}],446:[function(require,module,exports){ +},{"mouse-event":450}],449:[function(require,module,exports){ var rootPosition = { left: 0, top: 0 } module.exports = mouseEventOffset @@ -75435,7 +75642,7 @@ function getBoundingClientOffset (element) { } } -},{}],447:[function(require,module,exports){ +},{}],450:[function(require,module,exports){ 'use strict' function mouseButtons(ev) { @@ -75497,7 +75704,7 @@ function mouseRelativeY(ev) { } exports.y = mouseRelativeY -},{}],448:[function(require,module,exports){ +},{}],451:[function(require,module,exports){ 'use strict' var toPX = require('to-px') @@ -75539,7 +75746,7 @@ function mouseWheelListen(element, callback, noScroll) { return listener } -},{"to-px":527}],449:[function(require,module,exports){ +},{"to-px":531}],452:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -75955,7 +76162,7 @@ function createSurfaceExtractor(args) { order, typesig) } -},{"typedarray-pool":533}],450:[function(require,module,exports){ +},{"typedarray-pool":537}],453:[function(require,module,exports){ "use strict" @@ -75967,7 +76174,7 @@ module.exports = function(array, f) { return array } -},{"cwise/lib/wrapper":109}],451:[function(require,module,exports){ +},{"cwise/lib/wrapper":111}],454:[function(require,module,exports){ 'use strict' module.exports = gradient @@ -76265,7 +76472,7 @@ function gradient(out, inp, bc) { var cached = generateGradient(bc) return cached(out, inp) } -},{"cwise-compiler":106,"dup":121}],452:[function(require,module,exports){ +},{"cwise-compiler":108,"dup":123}],455:[function(require,module,exports){ 'use strict' var warp = require('ndarray-warp') @@ -76295,7 +76502,7 @@ function applyHomography(dest, src, Xi) { }) return dest } -},{"gl-matrix-invert":187,"ndarray-warp":459}],453:[function(require,module,exports){ +},{"gl-matrix-invert":190,"ndarray-warp":462}],456:[function(require,module,exports){ "use strict" function interp1d(arr, x) { @@ -76406,7 +76613,7 @@ module.exports.d1 = interp1d module.exports.d2 = interp2d module.exports.d3 = interp3d -},{}],454:[function(require,module,exports){ +},{}],457:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -76869,7 +77076,7 @@ exports.equals = compile({ -},{"cwise-compiler":106}],455:[function(require,module,exports){ +},{"cwise-compiler":108}],458:[function(require,module,exports){ "use strict" var ndarray = require("ndarray") @@ -76892,10 +77099,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":456,"ndarray":460}],456:[function(require,module,exports){ +},{"./doConvert.js":459,"ndarray":463}],459:[function(require,module,exports){ module.exports=require('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":106}],457:[function(require,module,exports){ +},{"cwise-compiler":108}],460:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -77624,7 +77831,7 @@ function compileSort(order, dtype) { } module.exports = compileSort -},{"typedarray-pool":533}],458:[function(require,module,exports){ +},{"typedarray-pool":537}],461:[function(require,module,exports){ "use strict" var compile = require("./lib/compile_sort.js") @@ -77644,7 +77851,7 @@ function sort(array) { } module.exports = sort -},{"./lib/compile_sort.js":457}],459:[function(require,module,exports){ +},{"./lib/compile_sort.js":460}],462:[function(require,module,exports){ 'use strict' var interp = require('ndarray-linear-interpolate') @@ -77676,7 +77883,7 @@ module.exports = function warp(dest, src, func) { return dest } -},{"cwise/lib/wrapper":109,"ndarray-linear-interpolate":453}],460:[function(require,module,exports){ +},{"cwise/lib/wrapper":111,"ndarray-linear-interpolate":456}],463:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -78021,7 +78228,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":287,"is-buffer":288}],461:[function(require,module,exports){ +},{"iota-array":290,"is-buffer":291}],464:[function(require,module,exports){ "use strict" var doubleBits = require("double-bits") @@ -78064,7 +78271,7 @@ function nextafter(x, y) { } return doubleBits.pack(lo, hi) } -},{"double-bits":120}],462:[function(require,module,exports){ +},{"double-bits":122}],465:[function(require,module,exports){ var DEFAULT_NORMALS_EPSILON = 1e-6; var DEFAULT_FACE_EPSILON = 1e-6; @@ -78189,7 +78396,7 @@ exports.faceNormals = function(faces, positions, specifiedEpsilon) { -},{}],463:[function(require,module,exports){ +},{}],466:[function(require,module,exports){ /* object-assign (c) Sindre Sorhus @@ -78281,7 +78488,167 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],464:[function(require,module,exports){ +},{}],467:[function(require,module,exports){ +/** + * @module optical-properties + */ +'use strict' + +module.exports = measure + +var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d') + +canvas.width = 200, canvas.height = 200 + +measure.canvas = canvas + +//returns character [x, y, scale] optical params +function measure (char, options) { + var data, w, h, params + + //figure out argument imageData + if (typeof char === 'string') { + data = getCharImageData(char, options) + w = data.width, h = data.height + } + else if (char instanceof HTMLCanvasElement) { + w = char.width, h = char.height + char = char.getContext('2d') + data = char.getImageData(0, 0, w, h) + } + else if (char instanceof ImageData) { + w = char.width, h = char.height + data = char + } + + params = getOpticalParams(data) + + return params +} + +//draw character in canvas and get it's imagedata +function getCharImageData (char, options) { + if (!options) options = {} + var family = options.family || 'sans-serif' + var w = canvas.width, h = canvas.height + + var size = options.width || options.height || options.size + if (size && size != w) { + w = h = canvas.width = canvas.height = size + } + + var fs = options.fontSize || w/2 + + ctx.fillStyle = '#000' + ctx.fillRect(0, 0, w, h) + + ctx.font = fs + 'px ' + family + ctx.textBaseline = 'middle' + ctx.textAlign = 'center' + ctx.fillStyle = 'white' + ctx.fillText(char, w/2, h/2) + + return ctx.getImageData(0, 0, w, h) +} + + +//walks over imagedata, returns params +function getOpticalParams (data) { + var buf = data.data, w = data.width, h = data.height + + var x, y, r, i, j, sum, xSum, ySum, rowAvg = Array(h), rowAvgX = Array(h), cx, cy, bounds, avg, top = 0, bottom = 0, left = w, right = 0, maxR = 0, rowBounds = Array(h), r2 + + for (y = 0; y < h; y++) { + sum = 0, xSum = 0, j = y*4*w + + bounds = getBounds(buf.subarray(j, j + 4*w), 4) + + if (bounds[0] === bounds[1]) { + continue + } + else { + if (!top) top = y + bottom = y + } + + for (x = bounds[0]; x < bounds[1]; x++) { + i = x*4 + r = buf[j + i] + sum += r + xSum += x*r + } + + rowAvg[y] = sum === 0 ? 0 : sum/w + rowAvgX[y] = sum === 0 ? 0 : xSum/sum + + if (bounds[0] < left) left = bounds[0] + if (bounds[1] > right) right = bounds[1] + + rowBounds[y] = bounds + } + + sum = 0, ySum = 0, xSum = 0 + for (y = 0; y < h; y++) { + avg = rowAvg[y] + if (!avg) continue; + + ySum += avg*y + sum += avg + xSum += rowAvgX[y]*avg + } + + cy = ySum/sum + cx = xSum/sum + + maxR = 0, r2 = 0 + for (y = 0; y < h; y++) { + bounds = rowBounds[y] + if (!bounds) continue + + r2 = Math.max( + dist2(cx - bounds[0], cy - y), + dist2(cx - bounds[1], cy - y) + ) + if (r2 > maxR) { + maxR = r2 + } + } + + return { + center: [cx, cy], + bounds: [left, top, right, bottom+1], + radius: Math.sqrt(maxR) + } +} + +//get [leftId, rightId] pair of bounding values for an array +function getBounds (arr, stride) { + var left = 0, right = arr.length, i = 0 + + if (!stride) stride = 4 + + //find left non-zero value + while (!arr[i] && i < right) { + i+=stride + } + left = i + + //find right non-zero value + i = arr.length + while (!arr[i] && i > left) { + i-=stride + } + right = i + + return [left/stride, right/stride] +} + +function dist2 (x, y) { + return x*x + y*y +} + +},{}],468:[function(require,module,exports){ 'use strict' module.exports = quatFromFrame @@ -78323,7 +78690,7 @@ function quatFromFrame( } return out } -},{}],465:[function(require,module,exports){ +},{}],469:[function(require,module,exports){ 'use strict' module.exports = createOrbitController @@ -78717,7 +79084,7 @@ function createOrbitController(options) { return result } -},{"./lib/quatFromFrame":464,"filtered-vector":129,"gl-mat4/fromQuat":173,"gl-mat4/invert":176,"gl-mat4/lookAt":177}],466:[function(require,module,exports){ +},{"./lib/quatFromFrame":468,"filtered-vector":131,"gl-mat4/fromQuat":176,"gl-mat4/invert":179,"gl-mat4/lookAt":180}],470:[function(require,module,exports){ /*! * pad-left * @@ -78733,7 +79100,7 @@ module.exports = function padLeft(str, num, ch) { ch = typeof ch !== 'undefined' ? (ch + '') : ' '; return repeat(ch, num) + str; }; -},{"repeat-string":492}],467:[function(require,module,exports){ +},{"repeat-string":496}],471:[function(require,module,exports){ module.exports = function parseUnit(str, out) { if (!out) out = [ 0, '' ] @@ -78744,7 +79111,7 @@ module.exports = function parseUnit(str, out) { out[1] = str.match(/[\d.\-\+]*\s*(.*)/)[1] || '' return out } -},{}],468:[function(require,module,exports){ +},{}],472:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -78972,7 +79339,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":479}],469:[function(require,module,exports){ +},{"_process":483}],473:[function(require,module,exports){ 'use strict'; // lightweight Buffer shim for pbf browser build @@ -79133,7 +79500,7 @@ function encodeString(str) { return bytes; } -},{"ieee754":283}],470:[function(require,module,exports){ +},{"ieee754":286}],474:[function(require,module,exports){ (function (global){ 'use strict'; @@ -79559,7 +79926,7 @@ function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pb function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./buffer":469}],471:[function(require,module,exports){ +},{"./buffer":473}],475:[function(require,module,exports){ "use strict" module.exports = permutationSign @@ -79611,7 +79978,7 @@ function permutationSign(p) { return sgn } } -},{"typedarray-pool":533}],472:[function(require,module,exports){ +},{"typedarray-pool":537}],476:[function(require,module,exports){ "use strict" var pool = require("typedarray-pool") @@ -79698,7 +80065,7 @@ function unrank(n, r, p) { exports.rank = rank exports.unrank = unrank -},{"invert-permutation":286,"typedarray-pool":533}],473:[function(require,module,exports){ +},{"invert-permutation":289,"typedarray-pool":537}],477:[function(require,module,exports){ "use strict" module.exports = planarDual @@ -79829,7 +80196,7 @@ function planarDual(cells, positions) { //Combine paths and loops together return cycles } -},{"compare-angle":96}],474:[function(require,module,exports){ +},{"compare-angle":98}],478:[function(require,module,exports){ 'use strict' module.exports = trimLeaves @@ -79885,7 +80252,7 @@ function trimLeaves(edges, positions) { return [ nedges, npositions ] } -},{"edges-to-adjacency-list":123}],475:[function(require,module,exports){ +},{"edges-to-adjacency-list":125}],479:[function(require,module,exports){ 'use strict' module.exports = planarGraphToPolyline @@ -80090,7 +80457,7 @@ function planarGraphToPolyline(edges, positions) { return result } -},{"./lib/trim-leaves":474,"edges-to-adjacency-list":123,"planar-dual":473,"point-in-big-polygon":477,"robust-sum":505,"two-product":531,"uniq":535}],476:[function(require,module,exports){ +},{"./lib/trim-leaves":478,"edges-to-adjacency-list":125,"planar-dual":477,"point-in-big-polygon":481,"robust-sum":509,"two-product":535,"uniq":539}],480:[function(require,module,exports){ 'use strict'; module.exports = Point; @@ -80223,7 +80590,7 @@ Point.convert = function (a) { return a; }; -},{}],477:[function(require,module,exports){ +},{}],481:[function(require,module,exports){ module.exports = preprocessPolygon var orient = require('robust-orientation')[3] @@ -80375,7 +80742,7 @@ function preprocessPolygon(loops) { testSlab) } } -},{"binary-search-bounds":62,"interval-tree-1d":285,"robust-orientation":500,"slab-decomposition":517}],478:[function(require,module,exports){ +},{"binary-search-bounds":64,"interval-tree-1d":288,"robust-orientation":504,"slab-decomposition":521}],482:[function(require,module,exports){ //Optimized version for triangle closest point // Based on Eberly's WildMagick codes // http://www.geometrictools.com/LibMathematics/Distance/Distance.html @@ -80573,7 +80940,7 @@ function closestPoint2d(V0, V1, V2, point, result) { module.exports = closestPoint2d; -},{}],479:[function(require,module,exports){ +},{}],483:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -80744,6 +81111,10 @@ process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); @@ -80755,7 +81126,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],480:[function(require,module,exports){ +},{}],484:[function(require,module,exports){ (function (global){ /*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function(root) { @@ -81292,9 +81663,9 @@ process.umask = function() { return 0; }; }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],481:[function(require,module,exports){ +},{}],485:[function(require,module,exports){ module.exports = require('gl-quat/slerp') -},{"gl-quat/slerp":226}],482:[function(require,module,exports){ +},{"gl-quat/slerp":229}],486:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -81380,7 +81751,7 @@ var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; -},{}],483:[function(require,module,exports){ +},{}],487:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -81467,13 +81838,13 @@ var objectKeys = Object.keys || function (obj) { return res; }; -},{}],484:[function(require,module,exports){ +},{}],488:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); -},{"./decode":482,"./encode":483}],485:[function(require,module,exports){ +},{"./decode":486,"./encode":487}],489:[function(require,module,exports){ 'use strict'; module.exports = partialSort; @@ -81535,7 +81906,7 @@ function defaultCompare(a, b) { return a < b ? -1 : a > b ? 1 : 0; } -},{}],486:[function(require,module,exports){ +},{}],490:[function(require,module,exports){ 'use strict' var bnadd = require('big-rat/add') @@ -81551,7 +81922,7 @@ function add (a, b) { return r } -},{"big-rat/add":46}],487:[function(require,module,exports){ +},{"big-rat/add":48}],491:[function(require,module,exports){ 'use strict' module.exports = float2rat @@ -81566,7 +81937,7 @@ function float2rat(v) { return result } -},{"big-rat":49}],488:[function(require,module,exports){ +},{"big-rat":51}],492:[function(require,module,exports){ 'use strict' var rat = require('big-rat') @@ -81584,7 +81955,7 @@ function muls(a, x) { return r } -},{"big-rat":49,"big-rat/mul":58}],489:[function(require,module,exports){ +},{"big-rat":51,"big-rat/mul":60}],493:[function(require,module,exports){ 'use strict' var bnsub = require('big-rat/sub') @@ -81600,7 +81971,7 @@ function sub(a, b) { return r } -},{"big-rat/sub":60}],490:[function(require,module,exports){ +},{"big-rat/sub":62}],494:[function(require,module,exports){ 'use strict' var compareCell = require('compare-cell') @@ -81633,7 +82004,7 @@ function reduceCellComplex(cells) { return cells } -},{"cell-orientation":81,"compare-cell":97,"compare-oriented-cell":98}],491:[function(require,module,exports){ +},{"cell-orientation":83,"compare-cell":99,"compare-oriented-cell":100}],495:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -91138,7 +91509,7 @@ return wrapREGL; }))); -},{}],492:[function(require,module,exports){ +},{}],496:[function(require,module,exports){ /*! * repeat-string * @@ -91210,7 +91581,7 @@ function repeat(str, num) { return res; } -},{}],493:[function(require,module,exports){ +},{}],497:[function(require,module,exports){ // Copyright 2014 Simon Lydell // X11 (“MIT”) Licensed. (See LICENSE.) @@ -91259,7 +91630,7 @@ void (function(root, factory) { })); -},{}],494:[function(require,module,exports){ +},{}],498:[function(require,module,exports){ (function (global){ module.exports = global.performance && @@ -91270,7 +91641,7 @@ module.exports = } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],495:[function(require,module,exports){ +},{}],499:[function(require,module,exports){ "use strict" module.exports = compressExpansion @@ -91305,7 +91676,7 @@ function compressExpansion(e) { e.length = top return e } -},{}],496:[function(require,module,exports){ +},{}],500:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91409,7 +91780,7 @@ return robustDeterminant") } generateDispatch() -},{"robust-compress":495,"robust-scale":502,"robust-sum":505,"two-product":531}],497:[function(require,module,exports){ +},{"robust-compress":499,"robust-scale":506,"robust-sum":509,"two-product":535}],501:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91424,7 +91795,7 @@ function robustDotProduct(a, b) { } return r } -},{"robust-sum":505,"two-product":531}],498:[function(require,module,exports){ +},{"robust-sum":509,"two-product":535}],502:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91592,7 +91963,7 @@ function generateInSphereTest() { } generateInSphereTest() -},{"robust-scale":502,"robust-subtract":504,"robust-sum":505,"two-product":531}],499:[function(require,module,exports){ +},{"robust-scale":506,"robust-subtract":508,"robust-sum":509,"two-product":535}],503:[function(require,module,exports){ "use strict" var determinant = require("robust-determinant") @@ -91664,7 +92035,7 @@ function generateDispatch() { } generateDispatch() -},{"robust-determinant":496}],500:[function(require,module,exports){ +},{"robust-determinant":500}],504:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91855,7 +92226,7 @@ function generateOrientationProc() { } generateOrientationProc() -},{"robust-scale":502,"robust-subtract":504,"robust-sum":505,"two-product":531}],501:[function(require,module,exports){ +},{"robust-scale":506,"robust-subtract":508,"robust-sum":509,"two-product":535}],505:[function(require,module,exports){ "use strict" var robustSum = require("robust-sum") @@ -91885,7 +92256,7 @@ function robustProduct(a, b) { } return r } -},{"robust-scale":502,"robust-sum":505}],502:[function(require,module,exports){ +},{"robust-scale":506,"robust-sum":509}],506:[function(require,module,exports){ "use strict" var twoProduct = require("two-product") @@ -91936,7 +92307,7 @@ function scaleLinearExpansion(e, scale) { g.length = count return g } -},{"two-product":531,"two-sum":532}],503:[function(require,module,exports){ +},{"two-product":535,"two-sum":536}],507:[function(require,module,exports){ "use strict" module.exports = segmentsIntersect @@ -91984,7 +92355,7 @@ function segmentsIntersect(a0, a1, b0, b1) { return true } -},{"robust-orientation":500}],504:[function(require,module,exports){ +},{"robust-orientation":504}],508:[function(require,module,exports){ "use strict" module.exports = robustSubtract @@ -92141,7 +92512,7 @@ function robustSubtract(e, f) { g.length = count return g } -},{}],505:[function(require,module,exports){ +},{}],509:[function(require,module,exports){ "use strict" module.exports = linearExpansionSum @@ -92298,7 +92669,7 @@ function linearExpansionSum(e, f) { g.length = count return g } -},{}],506:[function(require,module,exports){ +},{}],510:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : @@ -92553,7 +92924,7 @@ Shelf.prototype.resize = function(w) { return ShelfPack; })); -},{}],507:[function(require,module,exports){ +},{}],511:[function(require,module,exports){ "use strict" module.exports = function signum(x) { @@ -92561,7 +92932,7 @@ module.exports = function signum(x) { if(x > 0) { return 1 } return 0.0 } -},{}],508:[function(require,module,exports){ +},{}],512:[function(require,module,exports){ 'use strict' module.exports = boundary @@ -92573,7 +92944,7 @@ function boundary(cells) { return reduce(bnd(cells)) } -},{"boundary-cells":65,"reduce-simplicial-complex":490}],509:[function(require,module,exports){ +},{"boundary-cells":67,"reduce-simplicial-complex":494}],513:[function(require,module,exports){ 'use strict' module.exports = extractContour @@ -92736,7 +93107,7 @@ function extractContour(cells, values, level, d) { vertexWeights: uweights } } -},{"./lib/codegen":510,"ndarray":460,"ndarray-sort":458,"typedarray-pool":533}],510:[function(require,module,exports){ +},{"./lib/codegen":514,"ndarray":463,"ndarray-sort":461,"typedarray-pool":537}],514:[function(require,module,exports){ 'use strict' module.exports = getPolygonizer @@ -92833,7 +93204,7 @@ function getPolygonizer(d) { } return alg } -},{"marching-simplex-table":438,"typedarray-pool":533}],511:[function(require,module,exports){ +},{"marching-simplex-table":441,"typedarray-pool":537}],515:[function(require,module,exports){ "use strict"; "use restrict"; var bits = require("bit-twiddle") @@ -93177,11 +93548,11 @@ function connectedComponents(cells, vertex_count) { } exports.connectedComponents = connectedComponents -},{"bit-twiddle":63,"union-find":534}],512:[function(require,module,exports){ -arguments[4][63][0].apply(exports,arguments) -},{"dup":63}],513:[function(require,module,exports){ -arguments[4][511][0].apply(exports,arguments) -},{"bit-twiddle":512,"dup":511,"union-find":514}],514:[function(require,module,exports){ +},{"bit-twiddle":65,"union-find":538}],516:[function(require,module,exports){ +arguments[4][65][0].apply(exports,arguments) +},{"dup":65}],517:[function(require,module,exports){ +arguments[4][515][0].apply(exports,arguments) +},{"bit-twiddle":516,"dup":515,"union-find":518}],518:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -93238,7 +93609,7 @@ UnionFind.prototype.link = function(x, y) { } -},{}],515:[function(require,module,exports){ +},{}],519:[function(require,module,exports){ "use strict" module.exports = simplifyPolygon @@ -93510,7 +93881,7 @@ function simplifyPolygon(cells, positions, minArea) { edges: ncells } } -},{"robust-orientation":500,"simplicial-complex":513}],516:[function(require,module,exports){ +},{"robust-orientation":504,"simplicial-complex":517}],520:[function(require,module,exports){ "use strict" module.exports = orderSegments @@ -93606,7 +93977,7 @@ function orderSegments(b, a) { } return ar[0] - br[0] } -},{"robust-orientation":500}],517:[function(require,module,exports){ +},{"robust-orientation":504}],521:[function(require,module,exports){ "use strict" module.exports = createSlabDecomposition @@ -93837,7 +94208,7 @@ function createSlabDecomposition(segments) { } return new SlabDecomposition(slabs, lines, horizontal) } -},{"./lib/order-segments":516,"binary-search-bounds":62,"functional-red-black-tree":131,"robust-orientation":500}],518:[function(require,module,exports){ +},{"./lib/order-segments":520,"binary-search-bounds":64,"functional-red-black-tree":133,"robust-orientation":504}],522:[function(require,module,exports){ "use strict" var robustDot = require("robust-dot-product") @@ -93929,44 +94300,52 @@ function negative(points, plane) { } return neg } -},{"robust-dot-product":497,"robust-sum":505}],519:[function(require,module,exports){ -(function(window) { +},{"robust-dot-product":501,"robust-sum":509}],523:[function(require,module,exports){ +/* global window, exports, define */ + +!function() { + 'use strict' + var re = { not_string: /[^s]/, + not_bool: /[^t]/, + not_type: /[^T]/, + not_primitive: /[^v]/, number: /[diefg]/, + numeric_arg: /[bcdiefguxX]/, json: /[j]/, not_json: /[^j]/, text: /^[^\x25]+/, modulo: /^\x25{2}/, - placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/, + placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/, key: /^([a-z_][a-z_\d]*)/i, key_access: /^\.([a-z_][a-z_\d]*)/i, index_access: /^\[(\d+)\]/, sign: /^[\+\-]/ } - function sprintf() { - var key = arguments[0], cache = sprintf.cache - if (!(cache[key] && cache.hasOwnProperty(key))) { - cache[key] = sprintf.parse(key) - } - return sprintf.format.call(null, cache[key], arguments) + function sprintf(key) { + // `arguments` is not an array, but should be fine for this call + return sprintf_format(sprintf_parse(key), arguments) } - sprintf.format = function(parse_tree, argv) { - var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = "" + function vsprintf(fmt, argv) { + return sprintf.apply(null, [fmt].concat(argv || [])) + } + + function sprintf_format(parse_tree, argv) { + var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign for (i = 0; i < tree_length; i++) { - node_type = get_type(parse_tree[i]) - if (node_type === "string") { - output[output.length] = parse_tree[i] + if (typeof parse_tree[i] === 'string') { + output += parse_tree[i] } - else if (node_type === "array") { + else if (Array.isArray(parse_tree[i])) { match = parse_tree[i] // convenience purposes only if (match[2]) { // keyword argument arg = argv[cursor] for (k = 0; k < match[2].length; k++) { if (!arg.hasOwnProperty(match[2][k])) { - throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k])) + throw new Error(sprintf('[sprintf] property "%s" does not exist', match[2][k])) } arg = arg[match[2][k]] } @@ -93978,12 +94357,12 @@ function negative(points, plane) { arg = argv[cursor++] } - if (get_type(arg) == "function") { + if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) { arg = arg() } - if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) { - throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg))) + if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) { + throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg)) } if (re.number.test(match[8])) { @@ -93991,96 +94370,113 @@ function negative(points, plane) { } switch (match[8]) { - case "b": - arg = arg.toString(2) - break - case "c": - arg = String.fromCharCode(arg) - break - case "d": - case "i": + case 'b': + arg = parseInt(arg, 10).toString(2) + break + case 'c': + arg = String.fromCharCode(parseInt(arg, 10)) + break + case 'd': + case 'i': arg = parseInt(arg, 10) - break - case "j": + break + case 'j': arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0) - break - case "e": - arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential() - break - case "f": + break + case 'e': + arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential() + break + case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg) - break - case "g": - arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg) - break - case "o": - arg = arg.toString(8) - break - case "s": - arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg) - break - case "u": - arg = arg >>> 0 - break - case "x": - arg = arg.toString(16) - break - case "X": - arg = arg.toString(16).toUpperCase() - break + break + case 'g': + arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg) + break + case 'o': + arg = (parseInt(arg, 10) >>> 0).toString(8) + break + case 's': + arg = String(arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 't': + arg = String(!!arg) + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'T': + arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'u': + arg = parseInt(arg, 10) >>> 0 + break + case 'v': + arg = arg.valueOf() + arg = (match[7] ? arg.substring(0, match[7]) : arg) + break + case 'x': + arg = (parseInt(arg, 10) >>> 0).toString(16) + break + case 'X': + arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase() + break } if (re.json.test(match[8])) { - output[output.length] = arg + output += arg } else { if (re.number.test(match[8]) && (!is_positive || match[3])) { - sign = is_positive ? "+" : "-" - arg = arg.toString().replace(re.sign, "") + sign = is_positive ? '+' : '-' + arg = arg.toString().replace(re.sign, '') } else { - sign = "" + sign = '' } - pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " " + pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ' pad_length = match[6] - (sign + arg).length - pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : "" - output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg) + pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '' + output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg) } } } - return output.join("") + return output } - sprintf.cache = {} + var sprintf_cache = Object.create(null) + + function sprintf_parse(fmt) { + if (sprintf_cache[fmt]) { + return sprintf_cache[fmt] + } - sprintf.parse = function(fmt) { - var _fmt = fmt, match = [], parse_tree = [], arg_names = 0 + var _fmt = fmt, match, parse_tree = [], arg_names = 0 while (_fmt) { if ((match = re.text.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = match[0] + parse_tree.push(match[0]) } else if ((match = re.modulo.exec(_fmt)) !== null) { - parse_tree[parse_tree.length] = "%" + parse_tree.push('%') } else if ((match = re.placeholder.exec(_fmt)) !== null) { if (match[2]) { arg_names |= 1 var field_list = [], replacement_field = match[2], field_match = [] if ((field_match = re.key.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] - while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") { + field_list.push(field_match[1]) + while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') { if ((field_match = re.key_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else if ((field_match = re.index_access.exec(replacement_field)) !== null) { - field_list[field_list.length] = field_match[1] + field_list.push(field_match[1]) } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } } } else { - throw new SyntaxError("[sprintf] failed to parse named argument key") + throw new SyntaxError('[sprintf] failed to parse named argument key') } match[2] = field_list } @@ -94088,58 +94484,43 @@ function negative(points, plane) { arg_names |= 2 } if (arg_names === 3) { - throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported") + throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported') } - parse_tree[parse_tree.length] = match + parse_tree.push(match) } else { - throw new SyntaxError("[sprintf] unexpected placeholder") + throw new SyntaxError('[sprintf] unexpected placeholder') } _fmt = _fmt.substring(match[0].length) } - return parse_tree - } - - var vsprintf = function(fmt, argv, _argv) { - _argv = (argv || []).slice(0) - _argv.splice(0, 0, fmt) - return sprintf.apply(null, _argv) - } - - /** - * helpers - */ - function get_type(variable) { - return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase() - } - - function str_repeat(input, multiplier) { - return Array(multiplier + 1).join(input) + return sprintf_cache[fmt] = parse_tree } /** * export to either browser or node.js */ - if (typeof exports !== "undefined") { - exports.sprintf = sprintf - exports.vsprintf = vsprintf + /* eslint-disable quote-props */ + if (typeof exports !== 'undefined') { + exports['sprintf'] = sprintf + exports['vsprintf'] = vsprintf } - else { - window.sprintf = sprintf - window.vsprintf = vsprintf + if (typeof window !== 'undefined') { + window['sprintf'] = sprintf + window['vsprintf'] = vsprintf - if (typeof define === "function" && define.amd) { + if (typeof define === 'function' && define['amd']) { define(function() { return { - sprintf: sprintf, - vsprintf: vsprintf + 'sprintf': sprintf, + 'vsprintf': vsprintf } }) } } -})(typeof window === "undefined" ? this : window); + /* eslint-enable quote-props */ +}() -},{}],520:[function(require,module,exports){ +},{}],524:[function(require,module,exports){ "use strict" module.exports = stronglyConnectedComponents @@ -94255,7 +94636,7 @@ function stronglyConnectedComponents(adjList) { return {components: components, adjacencyList: sccAdjList} } -},{}],521:[function(require,module,exports){ +},{}],525:[function(require,module,exports){ 'use strict'; var kdbush = require('kdbush'); @@ -94589,7 +94970,7 @@ function getY(p) { return p.y; } -},{"kdbush":291}],522:[function(require,module,exports){ +},{"kdbush":294}],526:[function(require,module,exports){ 'use strict' module.exports = toSuperScript @@ -94644,7 +95025,7 @@ function toSuperScript(x) { }).join('') } -},{}],523:[function(require,module,exports){ +},{}],527:[function(require,module,exports){ "use strict" module.exports = surfaceNets @@ -94852,7 +95233,7 @@ function surfaceNets(array,level) { } return proc(array,level) } -},{"ndarray-extract-contour":449,"triangulate-hypercube":529,"zero-crossings":576}],524:[function(require,module,exports){ +},{"ndarray-extract-contour":452,"triangulate-hypercube":533,"zero-crossings":580}],528:[function(require,module,exports){ (function (process){ 'use strict' @@ -94942,7 +95323,7 @@ function textGet(font, text, opts) { } }).call(this,require('_process')) -},{"_process":479,"vectorize-text":546}],525:[function(require,module,exports){ +},{"_process":483,"vectorize-text":550}],529:[function(require,module,exports){ 'use strict'; module.exports = TinySDF; @@ -95051,7 +95432,7 @@ function edt1d(f, d, v, z, n) { } } -},{}],526:[function(require,module,exports){ +},{}],530:[function(require,module,exports){ // TinyColor v1.4.1 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -96248,7 +96629,7 @@ else { })(Math); -},{}],527:[function(require,module,exports){ +},{}],531:[function(require,module,exports){ 'use strict' var parseUnit = require('parse-unit') @@ -96309,7 +96690,7 @@ function toPX(str, element) { } return 1 } -},{"parse-unit":467}],528:[function(require,module,exports){ +},{"parse-unit":471}],532:[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) : @@ -96829,7 +97210,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); }))); -},{}],529:[function(require,module,exports){ +},{}],533:[function(require,module,exports){ "use strict" module.exports = triangulateCube @@ -96863,7 +97244,7 @@ function triangulateCube(dimension) { } return result } -},{"gamma":132,"permutation-parity":471,"permutation-rank":472}],530:[function(require,module,exports){ +},{"gamma":134,"permutation-parity":475,"permutation-rank":476}],534:[function(require,module,exports){ 'use strict' module.exports = createTurntableController @@ -97436,7 +97817,7 @@ function createTurntableController(options) { theta, phi) } -},{"filtered-vector":129,"gl-mat4/invert":176,"gl-mat4/rotate":180,"gl-vec3/cross":267,"gl-vec3/dot":268,"gl-vec3/normalize":271}],531:[function(require,module,exports){ +},{"filtered-vector":131,"gl-mat4/invert":179,"gl-mat4/rotate":183,"gl-vec3/cross":270,"gl-vec3/dot":271,"gl-vec3/normalize":274}],535:[function(require,module,exports){ "use strict" module.exports = twoProduct @@ -97470,7 +97851,7 @@ function twoProduct(a, b, result) { return [ y, x ] } -},{}],532:[function(require,module,exports){ +},{}],536:[function(require,module,exports){ "use strict" module.exports = fastTwoSum @@ -97488,7 +97869,7 @@ function fastTwoSum(a, b, result) { } return [ar+br, x] } -},{}],533:[function(require,module,exports){ +},{}],537:[function(require,module,exports){ (function (global,Buffer){ 'use strict' @@ -97705,7 +98086,7 @@ exports.clearCache = function clearCache() { } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"bit-twiddle":63,"buffer":73,"dup":121}],534:[function(require,module,exports){ +},{"bit-twiddle":65,"buffer":75,"dup":123}],538:[function(require,module,exports){ "use strict"; "use restrict"; module.exports = UnionFind; @@ -97768,7 +98149,7 @@ proto.link = function(x, y) { ++ranks[xr]; } } -},{}],535:[function(require,module,exports){ +},{}],539:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -97827,7 +98208,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],536:[function(require,module,exports){ +},{}],540:[function(require,module,exports){ /* * Copyright (C) 2008 Apple Inc. All Rights Reserved. * @@ -97934,7 +98315,7 @@ UnitBezier.prototype.solve = function(x, epsilon) { return this.sampleCurveY(this.solveCurveX(x, epsilon)); }; -},{}],537:[function(require,module,exports){ +},{}],541:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -98668,7 +99049,7 @@ Url.prototype.parseHost = function() { if (host) this.hostname = host; }; -},{"./util":538,"punycode":480,"querystring":484}],538:[function(require,module,exports){ +},{"./util":542,"punycode":484,"querystring":488}],542:[function(require,module,exports){ 'use strict'; module.exports = { @@ -98686,7 +99067,7 @@ module.exports = { } }; -},{}],539:[function(require,module,exports){ +},{}],543:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -98711,14 +99092,14 @@ if (typeof Object.create === 'function') { } } -},{}],540:[function(require,module,exports){ +},{}],544:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],541:[function(require,module,exports){ +},{}],545:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -99308,12 +99689,12 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":540,"_process":479,"inherits":539}],542:[function(require,module,exports){ +},{"./support/isBuffer":544,"_process":483,"inherits":543}],546:[function(require,module,exports){ module.exports.VectorTile = require('./lib/vectortile.js'); module.exports.VectorTileFeature = require('./lib/vectortilefeature.js'); module.exports.VectorTileLayer = require('./lib/vectortilelayer.js'); -},{"./lib/vectortile.js":543,"./lib/vectortilefeature.js":544,"./lib/vectortilelayer.js":545}],543:[function(require,module,exports){ +},{"./lib/vectortile.js":547,"./lib/vectortilefeature.js":548,"./lib/vectortilelayer.js":549}],547:[function(require,module,exports){ 'use strict'; var VectorTileLayer = require('./vectortilelayer'); @@ -99332,7 +99713,7 @@ function readTile(tag, layers, pbf) { } -},{"./vectortilelayer":545}],544:[function(require,module,exports){ +},{"./vectortilelayer":549}],548:[function(require,module,exports){ 'use strict'; var Point = require('point-geometry'); @@ -99567,7 +99948,7 @@ function signedArea(ring) { return sum; } -},{"point-geometry":476}],545:[function(require,module,exports){ +},{"point-geometry":480}],549:[function(require,module,exports){ 'use strict'; var VectorTileFeature = require('./vectortilefeature.js'); @@ -99630,7 +100011,7 @@ VectorTileLayer.prototype.feature = function(i) { return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values); }; -},{"./vectortilefeature.js":544}],546:[function(require,module,exports){ +},{"./vectortilefeature.js":548}],550:[function(require,module,exports){ "use strict" module.exports = createText @@ -99657,7 +100038,7 @@ function createText(str, options) { options) } -},{"./lib/vtext":547}],547:[function(require,module,exports){ +},{"./lib/vtext":551}],551:[function(require,module,exports){ "use strict" module.exports = vectorizeText @@ -99863,7 +100244,7 @@ function vectorizeText(str, canvas, context, options) { return processPixels(pixels, options, size) } -},{"cdt2d":75,"clean-pslg":85,"ndarray":460,"planar-graph-to-polyline":475,"simplify-planar-graph":515,"surface-nets":523}],548:[function(require,module,exports){ +},{"cdt2d":77,"clean-pslg":87,"ndarray":463,"planar-graph-to-polyline":479,"simplify-planar-graph":519,"surface-nets":527}],552:[function(require,module,exports){ var Pbf = require('pbf') var vtpb = require('./vector-tile-pb') var GeoJSONWrapper = require('./lib/geojson_wrapper') @@ -100019,7 +100400,7 @@ function wrapValue (value) { return result } -},{"./lib/geojson_wrapper":549,"./vector-tile-pb":550,"pbf":470}],549:[function(require,module,exports){ +},{"./lib/geojson_wrapper":553,"./vector-tile-pb":554,"pbf":474}],553:[function(require,module,exports){ 'use strict' var Point = require('point-geometry') @@ -100087,7 +100468,7 @@ FeatureWrapper.prototype.bbox = function () { FeatureWrapper.prototype.toGeoJSON = VectorTileFeature.prototype.toGeoJSON -},{"point-geometry":476,"vector-tile":542}],550:[function(require,module,exports){ +},{"point-geometry":480,"vector-tile":546}],554:[function(require,module,exports){ 'use strict'; // tile ======================================== @@ -100193,7 +100574,7 @@ function writeLayer(layer, pbf) { if (layer.extent !== undefined) pbf.writeVarintField(5, layer.extent); } -},{}],551:[function(require,module,exports){ +},{}],555:[function(require,module,exports){ // Copyright (C) 2011 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -100880,7 +101261,7 @@ function writeLayer(layer, pbf) { } })(); -},{}],552:[function(require,module,exports){ +},{}],556:[function(require,module,exports){ var hiddenStore = require('./hidden-store.js'); module.exports = createStore; @@ -100901,7 +101282,7 @@ function createStore() { }; } -},{"./hidden-store.js":553}],553:[function(require,module,exports){ +},{"./hidden-store.js":557}],557:[function(require,module,exports){ module.exports = hiddenStore; function hiddenStore(obj, key) { @@ -100919,7 +101300,7 @@ function hiddenStore(obj, key) { return store; } -},{}],554:[function(require,module,exports){ +},{}],558:[function(require,module,exports){ // Original - @Gozola. // https://gist.github.com/Gozala/1269991 // This is a reimplemented version (with a few bug fixes). @@ -100950,14 +101331,14 @@ function weakMap() { } } -},{"./create-store.js":552}],555:[function(require,module,exports){ +},{"./create-store.js":556}],559:[function(require,module,exports){ var getContext = require('get-canvas-context') module.exports = function getWebGLContext (opt) { return getContext('webgl', opt) } -},{"get-canvas-context":143}],556:[function(require,module,exports){ +},{"get-canvas-context":145}],560:[function(require,module,exports){ var bundleFn = arguments[3]; var sources = arguments[4]; var cache = arguments[5]; @@ -101040,12 +101421,12 @@ module.exports = function (fn, options) { return worker; }; -},{}],557:[function(require,module,exports){ +},{}],561:[function(require,module,exports){ module.exports.RADIUS = 6378137; module.exports.FLATTENING = 1/298.257223563; module.exports.POLAR_RADIUS = 6356752.3142; -},{}],558:[function(require,module,exports){ +},{}],562:[function(require,module,exports){ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -101135,7 +101516,7 @@ exports.getMercCoords = getMercCoords; Object.defineProperty(exports, '__esModule', { value: true }); })); -},{}],559:[function(require,module,exports){ +},{}],563:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -101868,7 +102249,7 @@ function toSolar(yearOrDate, monthOrResult, day, isIntercalaryOrResult, result) } -},{"../main":573,"object-assign":463}],560:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],564:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102052,7 +102433,7 @@ assign(CopticCalendar.prototype, { main.calendars.coptic = CopticCalendar; -},{"../main":573,"object-assign":463}],561:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],565:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102280,7 +102661,7 @@ var centuries = { main.calendars.discworld = DiscworldCalendar; -},{"../main":573,"object-assign":463}],562:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],566:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102464,7 +102845,7 @@ assign(EthiopianCalendar.prototype, { main.calendars.ethiopian = EthiopianCalendar; -},{"../main":573,"object-assign":463}],563:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],567:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102738,7 +103119,7 @@ function mod(a, b) { main.calendars.hebrew = HebrewCalendar; -},{"../main":573,"object-assign":463}],564:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],568:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -102919,7 +103300,7 @@ assign(IslamicCalendar.prototype, { main.calendars.islamic = IslamicCalendar; -},{"../main":573,"object-assign":463}],565:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],569:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103102,7 +103483,7 @@ assign(JulianCalendar.prototype, { main.calendars.julian = JulianCalendar; -},{"../main":573,"object-assign":463}],566:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],570:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103397,7 +103778,7 @@ function amod(a, b) { main.calendars.mayan = MayanCalendar; -},{"../main":573,"object-assign":463}],567:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],571:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -103577,7 +103958,7 @@ assign(NanakshahiCalendar.prototype, { main.calendars.nanakshahi = NanakshahiCalendar; -},{"../main":573,"object-assign":463}],568:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],572:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104000,7 +104381,7 @@ assign(NepaliCalendar.prototype, { main.calendars.nepali = NepaliCalendar; -},{"../main":573,"object-assign":463}],569:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],573:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104190,7 +104571,7 @@ main.calendars.persian = PersianCalendar; main.calendars.jalali = PersianCalendar; -},{"../main":573,"object-assign":463}],570:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],574:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104376,7 +104757,7 @@ assign(TaiwanCalendar.prototype, { main.calendars.taiwan = TaiwanCalendar; -},{"../main":573,"object-assign":463}],571:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],575:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104562,7 +104943,7 @@ assign(ThaiCalendar.prototype, { main.calendars.thai = ThaiCalendar; -},{"../main":573,"object-assign":463}],572:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],576:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -104927,7 +105308,7 @@ var ummalqura_dat = [ 79990]; -},{"../main":573,"object-assign":463}],573:[function(require,module,exports){ +},{"../main":577,"object-assign":466}],577:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -105832,7 +106213,7 @@ _exports.baseCalendar = BaseCalendar; _exports.calendars.gregorian = GregorianCalendar; -},{"object-assign":463}],574:[function(require,module,exports){ +},{"object-assign":466}],578:[function(require,module,exports){ /* * World Calendars * https://github.com/alexcjohnson/world-calendars @@ -106334,7 +106715,7 @@ assign(main.baseCalendar.prototype, { }); -},{"./main":573,"object-assign":463}],575:[function(require,module,exports){ +},{"./main":577,"object-assign":466}],579:[function(require,module,exports){ module.exports = require('cwise-compiler')({ args: ['array', { offset: [1], @@ -106386,7 +106767,7 @@ module.exports = require('cwise-compiler')({ funcName: 'zeroCrossings' }) -},{"cwise-compiler":106}],576:[function(require,module,exports){ +},{"cwise-compiler":108}],580:[function(require,module,exports){ "use strict" module.exports = findZeroCrossings @@ -106399,7 +106780,7 @@ function findZeroCrossings(array, level) { core(array.hi(array.shape[0]-1), cross, level) return cross } -},{"./lib/zc-core":575}],577:[function(require,module,exports){ +},{"./lib/zc-core":579}],581:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -106412,9 +106793,8 @@ function findZeroCrossings(array, level) { 'use strict'; var Lib = require('../../lib'); -var Color = require('../color'); var Axes = require('../../plots/cartesian/axes'); - +var handleAnnotationCommonDefaults = require('./common_defaults'); var attributes = require('./attributes'); @@ -106431,26 +106811,9 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op if(!(visible || clickToShow)) return annOut; - coerce('opacity'); - var bgColor = coerce('bgcolor'); - - var borderColor = coerce('bordercolor'), - borderOpacity = Color.opacity(borderColor); - - coerce('borderpad'); - - var borderWidth = coerce('borderwidth'); - var showArrow = coerce('showarrow'); - - coerce('text', showArrow ? ' ' : 'new text'); - coerce('textangle'); - Lib.coerceFont(coerce, 'font', fullLayout.font); + handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce); - coerce('width'); - coerce('align'); - - var h = coerce('height'); - if(h) coerce('valign'); + var showArrow = annOut.showarrow; // positioning var axLetters = ['x', 'y'], @@ -106492,14 +106855,8 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // if you have one coordinate you should have both Lib.noneOrAll(annIn, annOut, ['x', 'y']); + // if you have one part of arrow length you should have both if(showArrow) { - coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); - coerce('arrowhead'); - coerce('arrowsize'); - coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); - coerce('standoff'); - - // if you have one part of arrow length you should have both Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); } @@ -106509,34 +106866,18 @@ module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, op // put the actual click data to bind to into private attributes // so we don't have to do this little bit of logic on every hover event - annOut._xclick = (xClick === undefined) ? annOut.x : xClick; - annOut._yclick = (yClick === undefined) ? annOut.y : yClick; + annOut._xclick = (xClick === undefined) ? + annOut.x : + Axes.cleanPosition(xClick, gdMock, annOut.xref); + annOut._yclick = (yClick === undefined) ? + annOut.y : + Axes.cleanPosition(yClick, gdMock, annOut.yref); } - var hoverText = coerce('hovertext'); - var globalHoverLabel = fullLayout.hoverlabel || {}; - - if(hoverText) { - var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || - (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) - ); - - var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || - Color.contrast(hoverBG) - ); - - Lib.coerceFont(coerce, 'hoverlabel.font', { - family: globalHoverLabel.font.family, - size: globalHoverLabel.font.size, - color: globalHoverLabel.font.color || hoverBorder - }); - } - coerce('captureevents', !!hoverText); - return annOut; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../color":590,"./attributes":579}],578:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./attributes":583,"./common_defaults":586}],582:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -106601,7 +106942,7 @@ module.exports = [ } ]; -},{}],579:[function(require,module,exports){ +},{}],583:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -106881,7 +107222,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/cartesian/constants":753,"../../plots/font_attributes":772,"./arrow_paths":578}],580:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/constants":765,"../../plots/font_attributes":784,"./arrow_paths":582}],584:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -106984,7 +107325,7 @@ function annAutorange(gd) { }); } -},{"../../lib":709,"../../plots/cartesian/axes":748,"./draw":584}],581:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./draw":589}],585:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107070,18 +107411,22 @@ function getToggleSets(gd, hoverData) { explicitOffSet = [], hoverLen = (hoverData || []).length; - var i, j, anni, showMode, pointj, toggleType; + var i, j, anni, showMode, pointj, xa, ya, toggleType; for(i = 0; i < annotations.length; i++) { anni = annotations[i]; showMode = anni.clicktoshow; + if(showMode) { for(j = 0; j < hoverLen; j++) { pointj = hoverData[j]; - if(pointj.xaxis._id === anni.xref && - pointj.yaxis._id === anni.yref && - pointj.xaxis.d2r(pointj.x) === anni._xclick && - pointj.yaxis.d2r(pointj.y) === anni._yclick + xa = pointj.xaxis; + ya = pointj.yaxis; + + if(xa._id === anni.xref && + ya._id === anni.yref && + xa.d2r(pointj.x) === clickData2r(anni._xclick, xa) && + ya.d2r(pointj.y) === clickData2r(anni._yclick, ya) ) { // match! toggle this annotation // regardless of its clicktoshow mode @@ -107109,7 +107454,80 @@ function getToggleSets(gd, hoverData) { return {on: onSet, off: offSet, explicitOff: explicitOffSet}; } -},{"../../plotly":743}],582:[function(require,module,exports){ +// to handle log axes until v2 +function clickData2r(d, ax) { + return ax.type === 'log' ? ax.l2r(d) : ax.d2r(d); +} + +},{"../../plotly":755}],586:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Color = require('../color'); + +// defaults common to 'annotations' and 'annotations3d' +module.exports = function handleAnnotationCommonDefaults(annIn, annOut, fullLayout, coerce) { + coerce('opacity'); + var bgColor = coerce('bgcolor'); + + var borderColor = coerce('bordercolor'); + var borderOpacity = Color.opacity(borderColor); + + coerce('borderpad'); + + var borderWidth = coerce('borderwidth'); + var showArrow = coerce('showarrow'); + + coerce('text', showArrow ? ' ' : 'new text'); + coerce('textangle'); + Lib.coerceFont(coerce, 'font', fullLayout.font); + + coerce('width'); + coerce('align'); + + var h = coerce('height'); + if(h) coerce('valign'); + + if(showArrow) { + coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine); + coerce('arrowhead'); + coerce('arrowsize'); + coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2); + coerce('standoff'); + + } + + var hoverText = coerce('hovertext'); + var globalHoverLabel = fullLayout.hoverlabel || {}; + + if(hoverText) { + var hoverBG = coerce('hoverlabel.bgcolor', globalHoverLabel.bgcolor || + (Color.opacity(bgColor) ? Color.rgb(bgColor) : Color.defaultLine) + ); + + var hoverBorder = coerce('hoverlabel.bordercolor', globalHoverLabel.bordercolor || + Color.contrast(hoverBG) + ); + + Lib.coerceFont(coerce, 'hoverlabel.font', { + family: globalHoverLabel.font.family, + size: globalHoverLabel.font.size, + color: globalHoverLabel.font.color || hoverBorder + }); + } + + coerce('captureevents', !!hoverText); +}; + +},{"../../lib":721,"../color":600}],587:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107172,7 +107590,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":729,"fast-isnumeric":127}],583:[function(require,module,exports){ +},{"../../lib/to_log_range":741,"fast-isnumeric":129}],588:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107197,7 +107615,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":745,"./annotation_defaults":577}],584:[function(require,module,exports){ +},{"../../plots/array_container_defaults":757,"./annotation_defaults":581}],589:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -107236,7 +107654,8 @@ var drawArrowHead = require('./draw_arrow_head'); module.exports = { draw: draw, - drawOne: drawOne + drawOne: drawOne, + drawRaw: drawRaw }; /* @@ -107257,37 +107676,61 @@ function draw(gd) { } /* - * drawOne: draw a single annotation, potentially with modifications + * drawOne: draw a single cartesian or paper-ref annotation, potentially with modifications * * index (int): the annotation to draw */ function drawOne(gd, index) { - var layout = gd.layout, - fullLayout = gd._fullLayout, - gs = gd._fullLayout._size; + var fullLayout = gd._fullLayout; + var options = fullLayout.annotations[index] || {}; + var xa = Axes.getFromId(gd, options.xref); + var ya = Axes.getFromId(gd, options.yref); - // remove the existing annotation if there is one - fullLayout._infolayer.selectAll('.annotation[data-index="' + index + '"]').remove(); + drawRaw(gd, options, index, false, xa, ya); +} - // remember a few things about what was already there, - var optionsIn = (layout.annotations || [])[index], - options = fullLayout.annotations[index]; +/** + * drawRaw: draw a single annotation, potentially with modifications + * + * @param {DOM element} gd + * @param {object} options : this annotation's fullLayout options + * @param {integer} index : index in 'annotations' container of the annotation to draw + * @param {string} subplotId : id of the annotation's subplot + * - use false for 2d (i.e. cartesian or paper-ref) annotations + * @param {object | undefined} xa : full x-axis object to compute subplot pos-to-px + * @param {object | undefined} ya : ... y-axis + */ +function drawRaw(gd, options, index, subplotId, xa, ya) { + var fullLayout = gd._fullLayout; + var gs = gd._fullLayout._size; + var className; + var annbase; + + if(subplotId) { + className = 'annotation-' + subplotId; + annbase = subplotId + '.annotations[' + index + ']'; + } else { + className = 'annotation'; + annbase = 'annotations[' + index + ']'; + } + + // remove the existing annotation if there is one + fullLayout._infolayer + .selectAll('.' + className + '[data-index="' + index + '"]') + .remove(); var annClipID = 'clip' + fullLayout._uid + '_ann' + index; // this annotation is gone - quit now after deleting it // TODO: use d3 idioms instead of deleting and redrawing every time - if(!optionsIn || options.visible === false) { + if(!options._input || options.visible === false) { d3.selectAll('#' + annClipID).remove(); return; } - var xa = Axes.getFromId(gd, options.xref), - ya = Axes.getFromId(gd, options.yref), - - // calculated pixel positions - // x & y each will get text, head, and tail as appropriate - annPosPx = {x: {}, y: {}}, + // calculated pixel positions + // x & y each will get text, head, and tail as appropriate + var annPosPx = {x: {}, y: {}}, textangle = +options.textangle || 0; // create the components @@ -107295,26 +107738,32 @@ function drawOne(gd, index) { // with border/arrow together this could handle a whole bunch of // cleanup at this point, but works for now var annGroup = fullLayout._infolayer.append('g') - .classed('annotation', true) + .classed(className, true) .attr('data-index', String(index)) .style('opacity', options.opacity); // another group for text+background so that they can rotate together var annTextGroup = annGroup.append('g') - .classed('annotation-text-g', true) - .attr('data-index', String(index)); + .classed('annotation-text-g', true); var annTextGroupInner = annTextGroup.append('g') .style('pointer-events', options.captureevents ? 'all' : null) .call(setCursor, 'default') .on('click', function() { gd._dragging = false; - gd.emit('plotly_clickannotation', { + + var eventData = { index: index, - annotation: optionsIn, + annotation: options._input, fullAnnotation: options, event: d3.event - }); + }; + + if(subplotId) { + eventData.subplotId = subplotId; + } + + gd.emit('plotly_clickannotation', eventData); }); if(options.hovertext) { @@ -107337,7 +107786,8 @@ function drawOne(gd, index) { fontColor: hoverFont.color }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); }) .on('mouseout', function() { @@ -107370,8 +107820,7 @@ function drawOne(gd, index) { var font = options.font; var annText = annTextGroupInner.append('text') - .classed('annotation', true) - .attr('data-unformatted', options.text) + .classed('annotation-text', true) .text(options.text); function textLayout(s) { @@ -107383,29 +107832,24 @@ function drawOne(gd, index) { }[options.align] || 'middle' }); - svgTextUtils.convertToTspans(s, drawGraphicalElements); + svgTextUtils.convertToTspans(s, gd, drawGraphicalElements); return s; } function drawGraphicalElements() { // if the text has *only* a link, make the whole box into a link - var anchor = annText.selectAll('a'); - if(anchor.size() === 1 && anchor.text() === annText.text()) { + var anchor3 = annText.selectAll('a'); + if(anchor3.size() === 1 && anchor3.text() === annText.text()) { var wholeLink = annTextGroupInner.insert('a', ':first-child').attr({ - 'xlink:xlink:href': anchor.attr('xlink:href'), - 'xlink:xlink:show': anchor.attr('xlink:show') + 'xlink:xlink:href': anchor3.attr('xlink:href'), + 'xlink:xlink:show': anchor3.attr('xlink:show') }) .style({cursor: 'pointer'}); wholeLink.node().appendChild(annTextBG.node()); } - - // make sure lines are aligned the way they will be - // at the end, even if their position changes - annText.selectAll('tspan.line').attr({y: 0, x: 0}); - - var mathjaxGroup = annTextGroupInner.select('.annotation-math-group'); + var mathjaxGroup = annTextGroupInner.select('.annotation-text-math-group'); var hasMathjax = !mathjaxGroup.empty(); var anntextBB = Drawing.bBox( (hasMathjax ? mathjaxGroup : annText).node()); @@ -107438,10 +107882,13 @@ function drawOne(gd, index) { } var annotationIsOffscreen = false; - ['x', 'y'].forEach(function(axLetter) { - var axRef = options[axLetter + 'ref'] || axLetter, + var letters = ['x', 'y']; + + for(var i = 0; i < letters.length; i++) { + var axLetter = letters[i], + axRef = options[axLetter + 'ref'] || axLetter, tailRef = options['a' + axLetter + 'ref'], - ax = Axes.getFromId(gd, axRef), + ax = {x: xa, y: ya}[axLetter], dimAngle = (textangle + (axLetter === 'x' ? 0 : -90)) * Math.PI / 180, // note that these two can be either positive or negative annSizeFromWidth = outerWidth * Math.cos(dimAngle), @@ -107481,7 +107928,7 @@ function drawOne(gd, index) { annotationIsOffscreen = true; } - if(annotationIsOffscreen) return; + if(annotationIsOffscreen) continue; } basePx = ax._offset + ax.r2p(options[axLetter]); autoAlignFraction = 0.5; @@ -107563,7 +108010,7 @@ function drawOne(gd, index) { // size/shift are used during dragging options['_' + axLetter + 'size'] = annSize; options['_' + axLetter + 'shift'] = textShift; - }); + } if(annotationIsOffscreen) { annTextGroupInner.remove(); @@ -107588,14 +108035,11 @@ function drawOne(gd, index) { .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } else { - var texty = borderfull + yShift - anntextBB.top, - textx = borderfull + xShift - anntextBB.left; - annText.attr({ - x: textx, - y: texty - }) - .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); - annText.selectAll('tspan.line').attr({y: texty, x: textx}); + var texty = borderfull + yShift - anntextBB.top; + var textx = borderfull + xShift - anntextBB.left; + + annText.call(svgTextUtils.positionText, textx, texty) + .call(Drawing.setClipUrl, isSizeConstrained ? annClipID : null); } annTextClip.select('rect').call(Drawing.setRect, borderfull, borderfull, @@ -107617,8 +108061,6 @@ function drawOne(gd, index) { annTextGroup.attr({transform: 'rotate(' + textangle + ',' + annPosPx.x.text + ',' + annPosPx.y.text + ')'}); - var annbase = 'annotations[' + index + ']'; - /* * add the arrow * uses options[arrowwidth,arrowcolor,arrowhead] for styling @@ -107626,8 +108068,8 @@ function drawOne(gd, index) { * while the head stays put, dx and dy are the pixel offsets */ var drawArrow = function(dx, dy) { - d3.select(gd) - .selectAll('.annotation-arrow-g[data-index="' + index + '"]') + annGroup + .selectAll('.annotation-arrow-g') .remove(); var headX = annPosPx.x.head, @@ -107684,8 +108126,7 @@ function drawOne(gd, index) { var arrowGroup = annGroup.append('g') .style({opacity: Color.opacity(arrowColor)}) - .classed('annotation-arrow-g', true) - .attr('data-index', String(index)); + .classed('annotation-arrow-g', true); var arrow = arrowGroup.append('path') .attr('d', 'M' + tailX + ',' + tailY + 'L' + headX + ',' + headY) @@ -107696,7 +108137,7 @@ function drawOne(gd, index) { // the arrow dragger is a small square right at the head, then a line to the tail, // all expanded by a stroke width of 6px plus the arrow line width - if(gd._context.editable && arrow.node().parentNode) { + if(gd._context.editable && arrow.node().parentNode && !subplotId) { var arrowDragHeadX = headX; var arrowDragHeadY = headY; if(options.standoff) { @@ -107705,10 +108146,9 @@ function drawOne(gd, index) { arrowDragHeadY += options.standoff * (tailY - headY) / arrowLength; } var arrowDrag = arrowGroup.append('path') - .classed('annotation', true) + .classed('annotation-arrow', true) .classed('anndrag', true) .attr({ - 'data-index': String(index), d: 'M3,3H-3V-3H3ZM0,0L' + (tailX - arrowDragHeadX) + ',' + (tailY - arrowDragHeadY), transform: 'translate(' + arrowDragHeadX + ',' + arrowDragHeadY + ')' }) @@ -107724,6 +108164,7 @@ function drawOne(gd, index) { // (head/tail/text) all together dragElement.init({ element: arrowDrag.node(), + gd: gd, prepFn: function() { var pos = Drawing.getTranslate(annTextGroupInner); @@ -107786,6 +108227,7 @@ function drawOne(gd, index) { // textbox and tail, leave the head untouched dragElement.init({ element: annTextGroupInner.node(), + gd: gd, prepFn: function() { baseTextTransform = annTextGroup.attr('transform'); update = {}; @@ -107807,7 +108249,7 @@ function drawOne(gd, index) { drawArrow(dx, dy); } - else { + else if(!subplotId) { if(xa) update[annbase + '.x'] = options.x + dx / xa._m; else { var widthFraction = options._xsize / gs.w, @@ -107835,6 +108277,7 @@ function drawOne(gd, index) { ); } } + else return; annTextGroup.attr({ transform: 'translate(' + dx + ',' + dy + ')' + baseTextTransform @@ -107855,20 +108298,22 @@ function drawOne(gd, index) { } if(gd._context.editable) { - annText.call(svgTextUtils.makeEditable, annTextGroupInner) + annText.call(svgTextUtils.makeEditable, {delegate: annTextGroupInner, gd: gd}) .call(textLayout) .on('edit', function(_text) { options.text = _text; - this.attr({'data-unformatted': options.text}); this.call(textLayout); + var update = {}; - update['annotations[' + index + '].text'] = options.text; + update[annbase + '.text'] = options.text; + if(xa && xa.autorange) { update[xa._name + '.autorange'] = true; } if(ya && ya.autorange) { update[ya._name + '.autorange'] = true; } + Plotly.relayout(gd, update); }); } @@ -107896,7 +108341,7 @@ function lineIntersect(x1, y1, x2, y2, x3, y3, x4, y4) { return {x: x1 + a * t, y: y1 + d * t}; } -},{"../../lib":709,"../../lib/setcursor":724,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../color":590,"../dragelement":611,"../drawing":614,"../fx":631,"./draw_arrow_head":585,"d3":118}],585:[function(require,module,exports){ +},{"../../lib":721,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../color":600,"../dragelement":621,"../drawing":624,"../fx":641,"./draw_arrow_head":590,"d3":120}],590:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108010,7 +108455,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { function drawhead(p, rot) { if(!headStyle.path) return; if(style > 5) rot = 0; // don't rotate square or circle - d3.select(el.parentElement).append('path') + d3.select(el.parentNode).append('path') .attr({ 'class': el3.attr('class'), d: headStyle.path, @@ -108030,7 +108475,7 @@ module.exports = function drawArrowHead(el3, style, ends, mag, standoff) { if(doEnd) drawhead(end, endRot); }; -},{"../color":590,"../drawing":614,"./arrow_paths":578,"d3":118,"fast-isnumeric":127}],586:[function(require,module,exports){ +},{"../color":600,"../drawing":624,"./arrow_paths":582,"d3":120,"fast-isnumeric":129}],591:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108055,6 +108500,7 @@ module.exports = { calcAutorange: require('./calc_autorange'), draw: drawModule.draw, drawOne: drawModule.drawOne, + drawRaw: drawModule.drawRaw, hasClickToShow: clickModule.hasClickToShow, onClick: clickModule.onClick, @@ -108062,7 +108508,314 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":579,"./calc_autorange":580,"./click":581,"./convert_coords":582,"./defaults":583,"./draw":584}],587:[function(require,module,exports){ +},{"./attributes":583,"./calc_autorange":584,"./click":585,"./convert_coords":587,"./defaults":588,"./draw":589}],592:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 annAtts = require('../annotations/attributes'); + +module.exports = { + _isLinkedToArray: 'annotation', + + visible: annAtts.visible, + x: { + valType: 'any', + + + }, + y: { + valType: 'any', + + + }, + z: { + valType: 'any', + + + }, + ax: { + valType: 'number', + + + }, + ay: { + valType: 'number', + + + }, + + xanchor: annAtts.xanchor, + xshift: annAtts.xshift, + yanchor: annAtts.yanchor, + yshift: annAtts.yshift, + + text: annAtts.text, + textangle: annAtts.textangle, + font: annAtts.font, + width: annAtts.width, + height: annAtts.height, + opacity: annAtts.opacity, + align: annAtts.align, + valign: annAtts.valign, + bgcolor: annAtts.bgcolor, + bordercolor: annAtts.bordercolor, + borderpad: annAtts.borderpad, + borderwidth: annAtts.borderwidth, + showarrow: annAtts.showarrow, + arrowcolor: annAtts.arrowcolor, + arrowhead: annAtts.arrowhead, + arrowsize: annAtts.arrowsize, + arrowwidth: annAtts.arrowwidth, + standoff: annAtts.standoff, + hovertext: annAtts.hovertext, + hoverlabel: annAtts.hoverlabel, + captureevents: annAtts.captureevents + + // maybes later? + // clicktoshow: annAtts.clicktoshow, + // xclick: annAtts.xclick, + // yclick: annAtts.yclick, + + // not needed! + // axref: 'pixel' + // ayref: 'pixel' + // xref: 'x' + // yref: 'y + // zref: 'z' +}; + +},{"../annotations/attributes":583}],593:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); + +module.exports = function convert(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + mockAnnAxes(anns[i], scene); + } + + scene.fullLayout._infolayer + .selectAll('.annotation-' + scene.id) + .remove(); +}; + +function mockAnnAxes(ann, scene) { + var fullSceneLayout = scene.fullSceneLayout; + var domain = fullSceneLayout.domain; + var size = scene.fullLayout._size; + + var base = { + // this gets fill in on render + pdata: null, + + // to get setConvert to not execute cleanly + type: 'linear', + + // don't try to update them on `editable: true` + autorange: false, + + // set infinite range so that annotation draw routine + // does not try to remove 'outside-range' annotations, + // this case is handled in the render loop + range: [-Infinity, Infinity] + }; + + ann._xa = {}; + Lib.extendFlat(ann._xa, base); + Axes.setConvert(ann._xa); + ann._xa._offset = size.l + domain.x[0] * size.w; + ann._xa.l2p = function() { + return 0.5 * (1 + ann.pdata[0] / ann.pdata[3]) * size.w * (domain.x[1] - domain.x[0]); + }; + + ann._ya = {}; + Lib.extendFlat(ann._ya, base); + Axes.setConvert(ann._ya); + ann._ya._offset = size.t + (1 - domain.y[1]) * size.h; + ann._ya.l2p = function() { + return 0.5 * (1 - ann.pdata[1] / ann.pdata[3]) * size.h * (domain.y[1] - domain.y[0]); + }; +} + +},{"../../lib":721,"../../plots/cartesian/axes":760}],594:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Axes = require('../../plots/cartesian/axes'); +var handleArrayContainerDefaults = require('../../plots/array_container_defaults'); +var handleAnnotationCommonDefaults = require('../annotations/common_defaults'); +var attributes = require('./attributes'); + +module.exports = function handleDefaults(sceneLayoutIn, sceneLayoutOut, opts) { + handleArrayContainerDefaults(sceneLayoutIn, sceneLayoutOut, { + name: 'annotations', + handleItemDefaults: handleAnnotationDefaults, + fullLayout: opts.fullLayout + }); +}; + +function handleAnnotationDefaults(annIn, annOut, sceneLayout, opts, itemOpts) { + function coerce(attr, dflt) { + return Lib.coerce(annIn, annOut, attributes, attr, dflt); + } + + function coercePosition(axLetter) { + var axName = axLetter + 'axis'; + + // mock in such way that getFromId grabs correct 3D axis + var gdMock = { _fullLayout: {} }; + gdMock._fullLayout[axName] = sceneLayout[axName]; + + return Axes.coercePosition(annOut, gdMock, coerce, axLetter, axLetter, 0.5); + } + + + var visible = coerce('visible', !itemOpts.itemIsNotPlainObject); + if(!visible) return annOut; + + handleAnnotationCommonDefaults(annIn, annOut, opts.fullLayout, coerce); + + coercePosition('x'); + coercePosition('y'); + coercePosition('z'); + + // if you have one coordinate you should all three + Lib.noneOrAll(annIn, annOut, ['x', 'y', 'z']); + + // hard-set here for completeness + annOut.xref = 'x'; + annOut.yref = 'y'; + annOut.zref = 'z'; + + coerce('xanchor'); + coerce('yanchor'); + coerce('xshift'); + coerce('yshift'); + + if(annOut.showarrow) { + annOut.axref = 'pixel'; + annOut.ayref = 'pixel'; + + // TODO maybe default values should be bigger than the 2D case? + coerce('ax', -10); + coerce('ay', -30); + + // if you have one part of arrow length you should have both + Lib.noneOrAll(annIn, annOut, ['ax', 'ay']); + } + + return annOut; +} + +},{"../../lib":721,"../../plots/array_container_defaults":757,"../../plots/cartesian/axes":760,"../annotations/common_defaults":586,"./attributes":592}],595:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 drawRaw = require('../annotations/draw').drawRaw; +var project = require('../../plots/gl3d/project'); +var axLetters = ['x', 'y', 'z']; + +module.exports = function draw(scene) { + var fullSceneLayout = scene.fullSceneLayout; + var dataScale = scene.dataScale; + var anns = fullSceneLayout.annotations; + + for(var i = 0; i < anns.length; i++) { + var ann = anns[i]; + var annotationIsOffscreen = false; + + for(var j = 0; j < 3; j++) { + var axLetter = axLetters[j]; + var pos = ann[axLetter]; + var ax = fullSceneLayout[axLetter + 'axis']; + var posFraction = ax.r2fraction(pos); + + if(posFraction < 0 || posFraction > 1) { + annotationIsOffscreen = true; + break; + } + } + + if(annotationIsOffscreen) { + scene.fullLayout._infolayer + .select('.annotation-' + scene.id + '[data-index="' + i + '"]') + .remove(); + } else { + ann.pdata = project(scene.glplot.cameraParams, [ + fullSceneLayout.xaxis.r2l(ann.x) * dataScale[0], + fullSceneLayout.yaxis.r2l(ann.y) * dataScale[1], + fullSceneLayout.zaxis.r2l(ann.z) * dataScale[2] + ]); + + drawRaw(scene.graphDiv, ann, i, scene.id, ann._xa, ann._ya); + } + } +}; + +},{"../../plots/gl3d/project":812,"../annotations/draw":589}],596:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 = { + moduleType: 'component', + name: 'annotations3d', + + schema: { + layout: { + 'scene.annotations': require('./attributes') + } + }, + + layoutAttributes: require('./attributes'), + handleDefaults: require('./defaults'), + + convert: require('./convert'), + draw: require('./draw') +}; + +},{"./attributes":592,"./convert":593,"./defaults":594,"./draw":595}],597:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108095,7 +108848,7 @@ require('world-calendars/dist/calendars/taiwan'); require('world-calendars/dist/calendars/thai'); require('world-calendars/dist/calendars/ummalqura'); -},{"world-calendars/dist/calendars/chinese":559,"world-calendars/dist/calendars/coptic":560,"world-calendars/dist/calendars/discworld":561,"world-calendars/dist/calendars/ethiopian":562,"world-calendars/dist/calendars/hebrew":563,"world-calendars/dist/calendars/islamic":564,"world-calendars/dist/calendars/julian":565,"world-calendars/dist/calendars/mayan":566,"world-calendars/dist/calendars/nanakshahi":567,"world-calendars/dist/calendars/nepali":568,"world-calendars/dist/calendars/persian":569,"world-calendars/dist/calendars/taiwan":570,"world-calendars/dist/calendars/thai":571,"world-calendars/dist/calendars/ummalqura":572,"world-calendars/dist/main":573,"world-calendars/dist/plus":574}],588:[function(require,module,exports){ +},{"world-calendars/dist/calendars/chinese":563,"world-calendars/dist/calendars/coptic":564,"world-calendars/dist/calendars/discworld":565,"world-calendars/dist/calendars/ethiopian":566,"world-calendars/dist/calendars/hebrew":567,"world-calendars/dist/calendars/islamic":568,"world-calendars/dist/calendars/julian":569,"world-calendars/dist/calendars/mayan":570,"world-calendars/dist/calendars/nanakshahi":571,"world-calendars/dist/calendars/nepali":572,"world-calendars/dist/calendars/persian":573,"world-calendars/dist/calendars/taiwan":574,"world-calendars/dist/calendars/thai":575,"world-calendars/dist/calendars/ummalqura":576,"world-calendars/dist/main":577,"world-calendars/dist/plus":578}],598:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108354,7 +109107,7 @@ module.exports = { worldCalFmt: worldCalFmt }; -},{"../../constants/numerical":690,"../../lib":709,"./calendars":587}],589:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"./calendars":597}],599:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108394,7 +109147,7 @@ exports.borderLine = '#BEC8D9'; // gives back exactly lightLine if the other colors are defaults. exports.lightFraction = 100 * (0xe - 0x4) / (0xf - 0x4); -},{}],590:[function(require,module,exports){ +},{}],600:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108565,7 +109318,7 @@ function cleanOne(val) { return 'rgb(' + rgbStr + ')'; } -},{"./attributes":589,"fast-isnumeric":127,"tinycolor2":526}],591:[function(require,module,exports){ +},{"./attributes":599,"fast-isnumeric":129,"tinycolor2":530}],601:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108721,7 +109474,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/cartesian/layout_attributes":759,"../../plots/font_attributes":772}],592:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/layout_attributes":771,"../../plots/font_attributes":784}],602:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108788,7 +109541,7 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) { coerce('titleside'); }; -},{"../../lib":709,"../../plots/cartesian/tick_label_defaults":766,"../../plots/cartesian/tick_mark_defaults":767,"../../plots/cartesian/tick_value_defaults":768,"./attributes":591}],593:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/tick_label_defaults":778,"../../plots/cartesian/tick_mark_defaults":779,"../../plots/cartesian/tick_value_defaults":780,"./attributes":601}],603:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -108814,6 +109567,8 @@ var setCursor = require('../../lib/setcursor'); var Drawing = require('../drawing'); var Color = require('../color'); var Titles = require('../titles'); +var svgTextUtils = require('../../lib/svg_text_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; var handleAxisDefaults = require('../../plots/cartesian/axis_defaults'); var handleAxisPositionDefaults = require('../../plots/cartesian/position_defaults'); @@ -109087,7 +109842,7 @@ module.exports = function draw(gd, id) { lineSize = 15.6; if(titleText.node()) { lineSize = - parseInt(titleText.style('font-size'), 10) * 1.3; + parseInt(titleText.style('font-size'), 10) * LINE_SPACING; } if(mathJaxNode) { titleHeight = Drawing.bBox(mathJaxNode).height; @@ -109099,8 +109854,7 @@ module.exports = function draw(gd, id) { } else if(titleText.node() && !titleText.classed('js-placeholder')) { - titleHeight = Drawing.bBox( - titleGroup.node()).height; + titleHeight = Drawing.bBox(titleText.node()).height; } if(titleHeight) { // buffer btwn colorbar and title @@ -109113,8 +109867,7 @@ module.exports = function draw(gd, id) { } else { cbAxisOut.domain[0] += titleHeight / gs.h; - var nlines = Math.max(1, - titleText.selectAll('tspan.line').size()); + var nlines = svgTextUtils.lineCount(titleText); titleTrans[1] += (1 - nlines) * lineSize; } @@ -109347,6 +110100,7 @@ module.exports = function draw(gd, id) { dragElement.init({ element: container.node(), + gd: gd, prepFn: function() { t0 = container.attr('transform'); setCursor(container); @@ -109421,7 +110175,7 @@ module.exports = function draw(gd, id) { return component; }; -},{"../../lib":709,"../../lib/extend":701,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_defaults":750,"../../plots/cartesian/layout_attributes":759,"../../plots/cartesian/position_defaults":762,"../../plots/plots":811,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"../titles":679,"./attributes":591,"d3":118,"tinycolor2":526}],594:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib":721,"../../lib/extend":713,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_defaults":762,"../../plots/cartesian/layout_attributes":771,"../../plots/cartesian/position_defaults":774,"../../plots/plots":823,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"../titles":689,"./attributes":601,"d3":120,"tinycolor2":530}],604:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109440,7 +110194,7 @@ module.exports = function hasColorbar(container) { return Lib.isPlainObject(container.colorbar); }; -},{"../../lib":709}],595:[function(require,module,exports){ +},{"../../lib":721}],605:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109495,7 +110249,7 @@ module.exports = { } }; -},{}],596:[function(require,module,exports){ +},{}],606:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109574,7 +110328,7 @@ module.exports = function calc(trace, vals, containerStr, cLetter) { } }; -},{"../../lib":709,"./flip_scale":601,"./scales":608}],597:[function(require,module,exports){ +},{"../../lib":721,"./flip_scale":611,"./scales":618}],607:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109618,7 +110372,7 @@ module.exports = function makeColorScaleAttributes(context) { }; }; -},{"../../lib/extend":701,"./attributes":595,"./scales.js":608}],598:[function(require,module,exports){ +},{"../../lib/extend":713,"./attributes":605,"./scales.js":618}],608:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109634,7 +110388,7 @@ var scales = require('./scales'); module.exports = scales.RdBu; -},{"./scales":608}],599:[function(require,module,exports){ +},{"./scales":618}],609:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109698,7 +110452,7 @@ module.exports = function colorScaleDefaults(traceIn, traceOut, layout, coerce, if(showScale) colorbarDefaults(containerIn, containerOut, layout); }; -},{"../../lib":709,"../colorbar/defaults":592,"../colorbar/has_colorbar":594,"./flip_scale":601,"./is_valid_scale":605,"fast-isnumeric":127}],600:[function(require,module,exports){ +},{"../../lib":721,"../colorbar/defaults":602,"../colorbar/has_colorbar":604,"./flip_scale":611,"./is_valid_scale":615,"fast-isnumeric":129}],610:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109735,7 +110489,7 @@ module.exports = function extractScale(scl, cmin, cmax) { }; }; -},{}],601:[function(require,module,exports){ +},{}],611:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109760,7 +110514,7 @@ module.exports = function flipScale(scl) { return sclNew; }; -},{}],602:[function(require,module,exports){ +},{}],612:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109800,7 +110554,7 @@ module.exports = function getScale(scl, dflt) { return scl; }; -},{"./default_scale":598,"./is_valid_scale_array":606,"./scales":608}],603:[function(require,module,exports){ +},{"./default_scale":608,"./is_valid_scale_array":616,"./scales":618}],613:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109846,7 +110600,7 @@ module.exports = function hasColorscale(trace, containerStr) { ); }; -},{"../../lib":709,"./is_valid_scale":605,"fast-isnumeric":127}],604:[function(require,module,exports){ +},{"../../lib":721,"./is_valid_scale":615,"fast-isnumeric":129}],614:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109880,7 +110634,7 @@ exports.extractScale = require('./extract_scale'); exports.makeColorScaleFunc = require('./make_color_scale_func'); -},{"./attributes":595,"./calc":596,"./default_scale":598,"./defaults":599,"./extract_scale":600,"./flip_scale":601,"./get_scale":602,"./has_colorscale":603,"./is_valid_scale":605,"./make_color_scale_func":607,"./scales":608}],605:[function(require,module,exports){ +},{"./attributes":605,"./calc":606,"./default_scale":608,"./defaults":609,"./extract_scale":610,"./flip_scale":611,"./get_scale":612,"./has_colorscale":613,"./is_valid_scale":615,"./make_color_scale_func":617,"./scales":618}],615:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109901,7 +110655,7 @@ module.exports = function isValidScale(scl) { else return isValidScaleArray(scl); }; -},{"./is_valid_scale_array":606,"./scales":608}],606:[function(require,module,exports){ +},{"./is_valid_scale_array":616,"./scales":618}],616:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -109938,7 +110692,7 @@ module.exports = function isValidScaleArray(scl) { return true; }; -},{"tinycolor2":526}],607:[function(require,module,exports){ +},{"tinycolor2":530}],617:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110034,7 +110788,7 @@ function colorArray2rbga(colorArray) { return tinycolor(colorObj).toRgbString(); } -},{"../color":590,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],608:[function(require,module,exports){ +},{"../color":600,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],618:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110165,7 +110919,7 @@ module.exports = { ] }; -},{}],609:[function(require,module,exports){ +},{}],619:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110198,7 +110952,7 @@ module.exports = function align(v, dv, v0, v1, anchor) { return vc; }; -},{}],610:[function(require,module,exports){ +},{}],620:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110236,7 +110990,7 @@ module.exports = function getCursor(x, y, xanchor, yanchor) { return cursorset[y][x]; }; -},{"../../lib":709}],611:[function(require,module,exports){ +},{"../../lib":721}],621:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110265,6 +111019,15 @@ dragElement.unhoverRaw = unhover.raw; /** * Abstracts click & drag interactions + * + * During the interaction, a "coverSlip" element - a transparent + * div covering the whole page - is created, which has two key effects: + * - Lets you drag beyond the boundaries of the plot itself without + * dropping (but if you drag all the way out of the browser window the + * interaction will end) + * - Freezes the cursor: whatever mouse cursor the drag element had when the + * interaction started gets copied to the coverSlip for use until mouseup + * * @param {object} options with keys: * element (required) the DOM element to drag * prepFn (optional) function(event, startX, startY) @@ -110283,28 +111046,20 @@ dragElement.unhoverRaw = unhover.raw; * numClicks is how many clicks we've registered within * a doubleclick time * e is the original event - * setCursor (optional) function(event) - * executed on mousemove before mousedown - * the purpose of this callback is to update the mouse cursor before - * the click & drag interaction has been initiated */ dragElement.init = function init(options) { - var gd = Lib.getPlotDiv(options.element) || {}, + var gd = options.gd, numClicks = 1, DBLCLICKDELAY = interactConstants.DBLCLICKDELAY, startX, startY, newMouseDownTime, dragCover, - initialTarget, - initialOnMouseMove; + initialTarget; if(!gd._mouseDownTime) gd._mouseDownTime = 0; function onStart(e) { - // disable call to options.setCursor(evt) - options.element.onmousemove = initialOnMouseMove; - // make dragging and dragged into properties of gd // so that others can look at and modify them gd._dragged = false; @@ -110355,10 +111110,6 @@ dragElement.init = function init(options) { } function onDone(e) { - // re-enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - dragCover.onmousemove = null; dragCover.onmouseup = null; dragCover.onmouseout = null; @@ -110405,10 +111156,6 @@ dragElement.init = function init(options) { return Lib.pauseEvent(e); } - // enable call to options.setCursor(evt) - initialOnMouseMove = options.element.onmousemove; - if(options.setCursor) options.element.onmousemove = options.setCursor; - options.element.onmousedown = onStart; options.element.style.pointerEvents = 'all'; }; @@ -110438,7 +111185,7 @@ function finishDrag(gd) { if(gd._replotPending) Plotly.plot(gd); } -},{"../../constants/interactions":689,"../../lib":709,"../../plotly":743,"../../plots/cartesian/constants":753,"./align":609,"./cursor":610,"./unhover":612}],612:[function(require,module,exports){ +},{"../../constants/interactions":701,"../../lib":721,"../../plotly":755,"../../plots/cartesian/constants":765,"./align":619,"./cursor":620,"./unhover":622}],622:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110494,7 +111241,7 @@ unhover.raw = function unhoverRaw(gd, evt) { } }; -},{"../../lib/events":700}],613:[function(require,module,exports){ +},{"../../lib/events":712}],623:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110518,7 +111265,7 @@ exports.dash = { }; -},{}],614:[function(require,module,exports){ +},{}],624:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -110541,6 +111288,9 @@ var Lib = require('../../lib'); var svgTextUtils = require('../../lib/svg_text_utils'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); +var alignment = require('../../constants/alignment'); +var LINE_SPACING = alignment.LINE_SPACING; + var subTypes = require('../../traces/scatter/subtypes'); var makeBubbleSizeFn = require('../../traces/scatter/make_bubble_size_func'); @@ -110562,13 +111312,19 @@ drawing.font = function(s, family, size, color) { if(color) s.call(Color.fill, color); }; +/* + * Positioning helpers + * Note: do not use `setPosition` with nodes modified by + * `svgTextUtils.convertToTspans`. Use `svgTextUtils.positionText` + * instead, so that elements get updated to match. + */ drawing.setPosition = function(s, x, y) { s.attr('x', x).attr('y', y); }; drawing.setSize = function(s, w, h) { s.attr('width', w).attr('height', h); }; drawing.setRect = function(s, x, y, w, h) { s.call(drawing.setPosition, x, y).call(drawing.setSize, w, h); }; -/** Translate / remove node +/** Translate node * * @param {object} d : calcdata point item * @param {sel} sel : d3 selction of node to translate @@ -110577,7 +111333,7 @@ drawing.setRect = function(s, x, y, w, h) { * * @return {boolean} : * true if selection got translated - * false if selection got removed + * false if selection could not get translated */ drawing.translatePoint = function(d, sel, xa, ya) { // put xp and yp into d if pixel scaling is already done @@ -110592,7 +111348,6 @@ drawing.translatePoint = function(d, sel, xa, ya) { sel.attr('transform', 'translate(' + x + ',' + y + ')'); } } else { - sel.remove(); return false; } @@ -110678,6 +111433,16 @@ drawing.dashStyle = function(dash, lineWidth) { return dash; }; +// Same as fillGroupStyle, except in this case the selection may be a transition +drawing.singleFillStyle = function(sel) { + var node = d3.select(sel.node()); + var data = node.data(); + var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor; + if(fillcolor) { + sel.call(Color.fill, fillcolor); + } +}; + drawing.fillGroupStyle = function(s) { s.style('stroke-width', 0) .each(function(d) { @@ -110904,7 +111669,7 @@ drawing.singlePointStyle = function(d, sel, trace, markerScale, lineScale, gd) { }; -drawing.pointStyle = function(s, trace) { +drawing.pointStyle = function(s, trace, gd) { if(!s.size()) return; // allow array marker and marker line colors to be @@ -110912,7 +111677,6 @@ drawing.pointStyle = function(s, trace) { var marker = trace.marker; var markerScale = drawing.tryColorscale(marker, ''); var lineScale = drawing.tryColorscale(marker, 'line'); - var gd = Lib.getPlotDiv(s.node()); s.each(function(d) { drawing.singlePointStyle(d, d3.select(this), trace, markerScale, lineScale, gd); @@ -110933,9 +111697,8 @@ drawing.tryColorscale = function(marker, prefix) { }; // draw text at points -var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}, - LINEEXPAND = 1.3; -drawing.textPointStyle = function(s, trace) { +var TEXTOFFSETSIGN = {start: 1, end: -1, middle: 0, bottom: 1, top: -1}; +drawing.textPointStyle = function(s, trace, gd) { s.each(function(d) { var p = d3.select(this), text = d.tx || trace.text; @@ -110966,21 +111729,16 @@ drawing.textPointStyle = function(s, trace) { d.tc || trace.textfont.color) .attr('text-anchor', h) .text(text) - .call(svgTextUtils.convertToTspans); - var pgroup = d3.select(this.parentNode), - tspans = p.selectAll('tspan.line'), - numLines = ((tspans[0].length || 1) - 1) * LINEEXPAND + 1, - dx = TEXTOFFSETSIGN[h] * r, - dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + + .call(svgTextUtils.convertToTspans, gd); + + var pgroup = d3.select(this.parentNode); + var numLines = (svgTextUtils.lineCount(p) - 1) * LINE_SPACING + 1; + var dx = TEXTOFFSETSIGN[h] * r; + var dy = fontSize * 0.75 + TEXTOFFSETSIGN[v] * r + (TEXTOFFSETSIGN[v] - 1) * numLines * fontSize / 2; // fix the overall text group position pgroup.attr('transform', 'translate(' + dx + ',' + dy + ')'); - - // then fix multiline text - if(numLines > 1) { - tspans.attr({ x: p.attr('x'), y: p.attr('y') }); - } }); }; @@ -111119,34 +111877,87 @@ drawing.makeTester = function() { drawing.testref = testref; }; -// use our offscreen tester to get a clientRect for an element, -// in a reference frame where it isn't translated and its anchor -// point is at (0,0) -// always returns a copy of the bbox, so the caller can modify it safely -var savedBBoxes = []; +/* + * use our offscreen tester to get a clientRect for an element, + * in a reference frame where it isn't translated and its anchor + * point is at (0,0) + * always returns a copy of the bbox, so the caller can modify it safely + */ +drawing.savedBBoxes = {}; +var savedBBoxesCount = 0; var maxSavedBBoxes = 10000; -drawing.bBox = function(node) { - // cache elements we've already measured so we don't have to - // remeasure the same thing many times - var saveNum = node.attributes['data-bb']; - if(saveNum && saveNum.value) { - return Lib.extendFlat({}, savedBBoxes[saveNum.value]); +drawing.bBox = function(node, hash) { + /* + * Cache elements we've already measured so we don't have to + * remeasure the same thing many times + * We have a few bBox callers though who pass a node larger than + * a or a MathJax , such as an axis group containing many labels. + * These will not generate a hash (unless we figure out an appropriate + * hash key for them) and thus we will not hash them. + */ + if(!hash) hash = nodeHash(node); + var out; + if(hash) { + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } + else if(node.children.length === 1) { + /* + * If we have only one child element, which is itself hashable, make + * a new hash from this element plus its x,y,transform + * These bounding boxes *include* x,y,transform - mostly for use by + * callers trying to avoid overlaps (ie titles) + */ + var innerNode = node.children[0]; + + hash = nodeHash(innerNode); + if(hash) { + var x = +innerNode.getAttribute('x') || 0; + var y = +innerNode.getAttribute('y') || 0; + var transform = innerNode.getAttribute('transform'); + + if(!transform) { + // in this case, just varying x and y, don't bother caching + // the final bBox because the alteration is quick. + var innerBB = drawing.bBox(innerNode, hash); + if(x) { + innerBB.left += x; + innerBB.right += x; + } + if(y) { + innerBB.top += y; + innerBB.bottom += y; + } + return innerBB; + } + /* + * else we have a transform - rather than make a complicated + * (and error-prone and probably slow) transform parser/calculator, + * just continue on calculating the boundingClientRect of the group + * and use the new composite hash to cache it. + * That said, `innerNode.transform.baseVal` is an array of + * `SVGTransform` objects, that *do* seem to have a nice matrix + * multiplication interface that we could use to avoid making + * another getBoundingClientRect call... + */ + hash += '~' + x + '~' + y + '~' + transform; + + out = drawing.savedBBoxes[hash]; + if(out) return Lib.extendFlat({}, out); + } } - var tester3 = drawing.tester; - var tester = tester3.node(); + var tester = drawing.tester.node(); // copy the node to test into the tester var testNode = node.cloneNode(true); tester.appendChild(testNode); - // standardize its position... do we really want to do this? - d3.select(testNode).attr({ - x: 0, - y: 0, - transform: '' - }); + // standardize its position (and newline tspans if any) + d3.select(testNode) + .attr('transform', null) + .call(svgTextUtils.positionText, 0, 0); var testRect = testNode.getBoundingClientRect(); var refRect = drawing.testref @@ -111167,18 +111978,29 @@ drawing.bBox = function(node) { // make sure we don't have too many saved boxes, // or a long session could overload on memory // by saving boxes for long-gone elements - if(savedBBoxes.length >= maxSavedBBoxes) { - d3.selectAll('[data-bb]').attr('data-bb', null); - savedBBoxes = []; + if(savedBBoxesCount >= maxSavedBBoxes) { + drawing.savedBBoxes = {}; + savedBBoxesCount = 0; } // cache this bbox - node.setAttribute('data-bb', savedBBoxes.length); - savedBBoxes.push(bb); + if(hash) drawing.savedBBoxes[hash] = bb; + savedBBoxesCount++; return Lib.extendFlat({}, bb); }; +// capture everything about a node (at least in our usage) that +// impacts its bounding box, given that bBox clears x, y, and transform +function nodeHash(node) { + var inputText = node.getAttribute('data-unformatted'); + if(inputText === null) return; + return inputText + + node.getAttribute('data-math') + + node.getAttribute('text-anchor') + + node.getAttribute('style'); +} + /* * make a robust clipPath url from a local id * note! We'd better not be exporting from a page @@ -111333,17 +112155,7 @@ drawing.setTextPointsScale = function(selection, xScale, yScale) { }); }; -drawing.measureText = function(tester, text, font) { - var dummyText = tester.append('text') - .text(text) - .call(drawing.font, font); - - var bbox = drawing.bBox(dummyText.node()); - dummyText.remove(); - return bbox; -}; - -},{"../../constants/xmlns_namespaces":692,"../../lib":709,"../../lib/svg_text_utils":728,"../../registry":826,"../../traces/scatter/make_bubble_size_func":1023,"../../traces/scatter/subtypes":1028,"../color":590,"../colorscale":604,"./symbol_defs":615,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],615:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../constants/xmlns_namespaces":704,"../../lib":721,"../../lib/svg_text_utils":740,"../../registry":838,"../../traces/scatter/make_bubble_size_func":1037,"../../traces/scatter/subtypes":1042,"../color":600,"../colorscale":614,"./symbol_defs":625,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],625:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -111819,7 +112631,7 @@ module.exports = { } }; -},{"d3":118}],616:[function(require,module,exports){ +},{"d3":120}],626:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -111918,7 +112730,7 @@ module.exports = { } }; -},{}],617:[function(require,module,exports){ +},{}],627:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -111981,7 +112793,7 @@ function calcOneAxis(calcTrace, trace, axis, coord) { Axes.expand(axis, vals, {padded: true}); } -},{"../../plots/cartesian/axes":748,"../../registry":826,"./compute_error":618,"fast-isnumeric":127}],618:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../../registry":838,"./compute_error":628,"fast-isnumeric":129}],628:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112077,7 +112889,7 @@ function makeComputeErrorValue(type, value) { } } -},{}],619:[function(require,module,exports){ +},{}],629:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112154,7 +112966,7 @@ module.exports = function(traceIn, traceOut, defaultColor, opts) { } }; -},{"../../lib":709,"../../registry":826,"./attributes":616,"fast-isnumeric":127}],620:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838,"./attributes":626,"fast-isnumeric":129}],630:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112213,7 +113025,7 @@ errorBars.hoverInfo = function(calcPoint, trace, hoverPoint) { } }; -},{"./attributes":616,"./calc":617,"./defaults":619,"./plot":621,"./style":622}],621:[function(require,module,exports){ +},{"./attributes":626,"./calc":627,"./defaults":629,"./plot":631,"./style":632}],631:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112377,7 +113189,7 @@ function errorCoords(d, xa, ya) { return out; } -},{"../../traces/scatter/subtypes":1028,"d3":118,"fast-isnumeric":127}],622:[function(require,module,exports){ +},{"../../traces/scatter/subtypes":1042,"d3":120,"fast-isnumeric":129}],632:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112414,7 +113226,7 @@ module.exports = function style(traces) { }); }; -},{"../color":590,"d3":118}],623:[function(require,module,exports){ +},{"../color":600,"d3":120}],633:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112450,7 +113262,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772}],624:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784}],634:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112466,30 +113278,46 @@ var Registry = require('../../registry'); module.exports = function calc(gd) { var calcdata = gd.calcdata; + var fullLayout = gd._fullLayout; + + function makeCoerceHoverInfo(trace) { + return function(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); + }; + } for(var i = 0; i < calcdata.length; i++) { var cd = calcdata[i]; var trace = cd[0].trace; - if(!trace.hoverlabel) continue; + // don't include hover calc fields for pie traces + // as calcdata items might be sorted by value and + // won't match the data array order. + if(Registry.traceIs(trace, 'pie')) continue; - var mergeFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.mergeArray; + var fillFn = Registry.traceIs(trace, '2dMap') ? paste : Lib.fillArray; - mergeFn(trace.hoverlabel.bgcolor, cd, 'hbg'); - mergeFn(trace.hoverlabel.bordercolor, cd, 'hbc'); - mergeFn(trace.hoverlabel.font.size, cd, 'hts'); - mergeFn(trace.hoverlabel.font.color, cd, 'htc'); - mergeFn(trace.hoverlabel.font.family, cd, 'htf'); + fillFn(trace.hoverinfo, cd, 'hi', makeCoerceHoverInfo(trace)); + + if(!trace.hoverlabel) continue; + + fillFn(trace.hoverlabel.bgcolor, cd, 'hbg'); + fillFn(trace.hoverlabel.bordercolor, cd, 'hbc'); + fillFn(trace.hoverlabel.font.size, cd, 'hts'); + fillFn(trace.hoverlabel.font.color, cd, 'htc'); + fillFn(trace.hoverlabel.font.family, cd, 'htf'); } }; -function paste(traceAttr, cd, cdAttr) { +function paste(traceAttr, cd, cdAttr, fn) { + fn = fn || Lib.identity; + if(Array.isArray(traceAttr)) { - cd[0][cdAttr] = traceAttr; + cd[0][cdAttr] = fn(traceAttr); } } -},{"../../lib":709,"../../registry":826}],625:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838}],635:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112501,10 +113329,19 @@ function paste(traceAttr, cd, cdAttr) { 'use strict'; var Registry = require('../../registry'); +var hover = require('./hover').hover; -module.exports = function click(gd, evt) { +module.exports = function click(gd, evt, subplot) { var annotationsDone = Registry.getComponentMethod('annotations', 'onClick')(gd, gd._hoverdata); + // fallback to fail-safe in case the plot type's hover method doesn't pass the subplot. + // Ternary, for example, didn't, but it was caught because tested. + if(subplot !== undefined) { + // The true flag at the end causes it to re-run the hover computation to figure out *which* + // point is being clicked. Without this, clicking is somewhat unreliable. + hover(gd, evt, subplot, true); + } + function emitClick() { gd.emit('plotly_click', {points: gd._hoverdata, event: evt}); } if(gd._hoverdata && evt && evt.target) { @@ -112518,7 +113355,7 @@ module.exports = function click(gd, evt) { } }; -},{"../../registry":826}],626:[function(require,module,exports){ +},{"../../registry":838,"./hover":639}],636:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112550,7 +113387,7 @@ module.exports = { HOVERMINTIME: 50 }; -},{}],627:[function(require,module,exports){ +},{}],637:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112573,7 +113410,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleHoverLabelDefaults(traceIn, traceOut, coerce, layout.hoverlabel); }; -},{"../../lib":709,"./attributes":623,"./hoverlabel_defaults":630}],628:[function(require,module,exports){ +},{"../../lib":721,"./attributes":633,"./hoverlabel_defaults":640}],638:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112584,6 +113421,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'use strict'; +var Lib = require('../../lib'); var constants = require('./constants'); // look for either subplot or xaxis and yaxis attributes @@ -112660,7 +113498,33 @@ function quadrature(dx, dy) { }; } -},{"./constants":626}],629:[function(require,module,exports){ +/** Appends values inside array attributes corresponding to given point number + * + * @param {object} pointData : point data object (gets mutated here) + * @param {object} trace : full trace object + * @param {number} pointNumber : point number + */ +exports.appendArrayPointValue = function(pointData, trace, pointNumber) { + var arrayAttrs = trace._arrayAttrs; + + for(var i = 0; i < arrayAttrs.length; i++) { + var astr = arrayAttrs[i]; + var key; + + if(astr === 'ids') key = 'id'; + else if(astr === 'locations') key = 'location'; + else key = astr; + + if(pointData[key] === undefined) { + var val = Lib.nestedProperty(trace, astr).get(); + pointData[key] = Array.isArray(pointNumber) ? + val[pointNumber[0]][pointNumber[1]] : + val[pointNumber]; + } + } +}; + +},{"../../lib":721,"./constants":636}],639:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -112729,7 +113593,7 @@ var HOVERTEXTPAD = constants.HOVERTEXTPAD; // // We wrap the hovers in a timer, to limit their frequency. // The actual rendering is done by private function _hover. -exports.hover = function hover(gd, evt, subplot) { +exports.hover = function hover(gd, evt, subplot, noHoverEvent) { if(typeof gd === 'string') gd = document.getElementById(gd); if(gd._lastHoverTime === undefined) gd._lastHoverTime = 0; @@ -112741,13 +113605,13 @@ exports.hover = function hover(gd, evt, subplot) { // Is it more than 100ms since the last update? If so, force // an update now (synchronously) and exit if(Date.now() > gd._lastHoverTime + constants.HOVERMINTIME) { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); return; } // Queue up the next hover for 100ms from now (if no further events) gd._hoverTimer = setTimeout(function() { - _hover(gd, evt, subplot); + _hover(gd, evt, subplot, noHoverEvent); gd._lastHoverTime = Date.now(); gd._hoverTimer = undefined; }, constants.HOVERMINTIME); @@ -112824,15 +113688,15 @@ exports.loneHover = function loneHover(hoverItem, opts) { outerContainer: outerContainer3 }; - var hoverLabel = createHoverText([pointData], fullOpts); + var hoverLabel = createHoverText([pointData], fullOpts, opts.gd); alignHoverText(hoverLabel, fullOpts.rotateLabels); return hoverLabel.node(); }; // The actual implementation is here: -function _hover(gd, evt, subplot) { - if(subplot === 'pie' || subplot === 'sankey') { +function _hover(gd, evt, subplot, noHoverEvent) { + if((subplot === 'pie' || subplot === 'sankey') && !noHoverEvent) { gd.emit('plotly_hover', { event: evt.originalEvent, points: [evt] @@ -113017,11 +113881,11 @@ function _hover(gd, evt, subplot) { trace: trace, xa: xaArray[subploti], ya: yaArray[subploti], - name: (gd.data.length > 1 || trace.hoverinfo.indexOf('name') !== -1) ? trace.name : undefined, // point properties - override all of these index: false, // point index in trace - only used by plotly.js hoverdata consumers distance: Math.min(distance, constants.MAXDIST), // pixel distance or pseudo-distance color: Color.defaultLine, // trace color + name: trace.name, x0: undefined, x1: undefined, y0: undefined, @@ -113120,6 +113984,7 @@ function _hover(gd, evt, subplot) { if(pt.zLabelVal !== undefined) out.z = pt.zLabelVal; } + helpers.appendArrayPointValue(out, pt.trace, pt.index); newhoverdata.push(out); } @@ -113153,7 +114018,7 @@ function _hover(gd, evt, subplot) { commonLabelOpts: fullLayout.hoverlabel }; - var hoverLabels = createHoverText(hoverData, labelOpts); + var hoverLabels = createHoverText(hoverData, labelOpts, gd); hoverAvoidOverlaps(hoverData, rotateLabels ? 'xa' : 'ya'); @@ -113167,7 +114032,7 @@ function _hover(gd, evt, subplot) { } // don't emit events if called manually - if(!evt.target || !hoverChanged(gd, evt, oldhoverdata)) return; + if(!evt.target || noHoverEvent || !hoverChanged(gd, evt, oldhoverdata)) return; if(oldhoverdata) { gd.emit('plotly_unhover', { @@ -113186,7 +114051,7 @@ function _hover(gd, evt, subplot) { }); } -function createHoverText(hoverData, opts) { +function createHoverText(hoverData, opts, gd) { var hovermode = opts.hovermode; var rotateLabels = opts.rotateLabels; var bgColor = opts.bgColor; @@ -113221,7 +114086,7 @@ function createHoverText(hoverData, opts) { // to have common labels var i, traceHoverinfo; for(i = 0; i < hoverData.length; i++) { - traceHoverinfo = hoverData[i].trace.hoverinfo; + traceHoverinfo = hoverData[i].hoverinfo || hoverData[i].trace.hoverinfo; var parts = traceHoverinfo.split('+'); if(parts.indexOf('all') === -1 && parts.indexOf(hovermode) === -1) { @@ -113258,23 +114123,16 @@ function createHoverText(hoverData, opts) { .attr('data-notex', 1); ltext.text(t0) - .call(svgTextUtils.convertToTspans) - .call(Drawing.setPosition, 0, 0) - .selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); label.attr('transform', ''); var tbb = ltext.node().getBoundingClientRect(); if(hovermode === 'x') { ltext.attr('text-anchor', 'middle') - .call(Drawing.setPosition, 0, (xa.side === 'top' ? + .call(svgTextUtils.positionText, 0, (xa.side === 'top' ? (outerTop - tbb.bottom - HOVERARROWSIZE - HOVERTEXTPAD) : - (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + (outerTop - tbb.top + HOVERARROWSIZE + HOVERTEXTPAD))); var topsign = xa.side === 'top' ? '-' : ''; lpath.attr('d', 'M0,0' + @@ -113290,14 +114148,9 @@ function createHoverText(hoverData, opts) { } else { ltext.attr('text-anchor', ya.side === 'right' ? 'start' : 'end') - .call(Drawing.setPosition, + .call(svgTextUtils.positionText, (ya.side === 'right' ? 1 : -1) * (HOVERTEXTPAD + HOVERARROWSIZE), - outerTop - tbb.top - tbb.height / 2) - .selectAll('tspan.line') - .attr({ - x: ltext.attr('x'), - y: ltext.attr('y') - }); + outerTop - tbb.top - tbb.height / 2); var leftsign = ya.side === 'right' ? '' : '-'; lpath.attr('d', 'M0,0' + @@ -113387,7 +114240,9 @@ function createHoverText(hoverData, opts) { else if(d.yLabel === undefined) text = d.xLabel; else text = '(' + d.xLabel + ', ' + d.yLabel + ')'; - if(d.text && !Array.isArray(d.text)) text += (text ? '
' : '') + d.text; + if(d.text && !Array.isArray(d.text)) { + text += (text ? '
' : '') + d.text; + } // if 'text' is empty at this point, // put 'name' in main label and don't show secondary label @@ -113403,12 +114258,10 @@ function createHoverText(hoverData, opts) { d.fontFamily || fontFamily, d.fontSize || fontSize, d.fontColor || contrastColor) - .call(Drawing.setPosition, 0, 0) .text(text) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); var tx2 = g.select('text.name'), tx2width = 0; @@ -113420,11 +114273,9 @@ function createHoverText(hoverData, opts) { d.fontSize || fontSize, traceColor) .text(name) - .call(Drawing.setPosition, 0, 0) .attr('data-notex', 1) - .call(svgTextUtils.convertToTspans); - tx2.selectAll('tspan.line') - .call(Drawing.setPosition, 0, 0); + .call(svgTextUtils.positionText, 0, 0) + .call(svgTextUtils.convertToTspans, gd); tx2width = tx2.node().getBoundingClientRect().width + 2 * HOVERTEXTPAD; } else { @@ -113692,17 +114543,12 @@ function alignHoverText(hoverLabels, rotateLabels) { 'V' + (offsetY - HOVERARROWSIZE) + 'Z')); - tx.call(Drawing.setPosition, - txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD) - .selectAll('tspan.line') - .attr({ - x: tx.attr('x'), - y: tx.attr('y') - }); + tx.call(svgTextUtils.positionText, + txx + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); if(d.tx2width) { - g.select('text.name, text.name tspan.line') - .call(Drawing.setPosition, + g.select('text.name') + .call(svgTextUtils.positionText, tx2x + alignShift * HOVERTEXTPAD + offsetX, offsetY + d.ty0 - d.by / 2 + HOVERTEXTPAD); g.select('rect') @@ -113719,6 +114565,30 @@ function cleanPoint(d, hovermode) { var cd0 = d.cd[0]; var cd = d.cd[d.index] || {}; + function fill(key, calcKey, traceKey) { + var val; + + if(cd[calcKey]) { + val = cd[calcKey]; + } else if(cd0[calcKey]) { + var arr = cd0[calcKey]; + if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { + val = arr[d.index[0]][d.index[1]]; + } + } else { + val = Lib.nestedProperty(trace, traceKey).get(); + } + + if(val) d[key] = val; + } + + fill('hoverinfo', 'hi', 'hoverinfo'); + fill('color', 'hbg', 'hoverlabel.bgcolor'); + fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); + fill('fontFamily', 'htf', 'hoverlabel.font.family'); + fill('fontSize', 'hts', 'hoverlabel.font.size'); + fill('fontColor', 'htc', 'hoverlabel.font.color'); + d.posref = hovermode === 'y' ? (d.x0 + d.x1) / 2 : (d.y0 + d.y1) / 2; // then constrain all the positions to be on the plot @@ -113786,7 +114656,7 @@ function cleanPoint(d, hovermode) { if(hovermode === 'y') d.distance += 1; } - var infomode = d.trace.hoverinfo; + var infomode = d.hoverinfo || d.trace.hoverinfo; if(infomode !== 'all') { infomode = infomode.split('+'); if(infomode.indexOf('x') === -1) d.xLabel = undefined; @@ -113796,29 +114666,6 @@ function cleanPoint(d, hovermode) { if(infomode.indexOf('name') === -1) d.name = undefined; } - function fill(key, calcKey, traceKey) { - var val; - - if(cd[calcKey]) { - val = cd[calcKey]; - } else if(cd0[calcKey]) { - var arr = cd0[calcKey]; - if(Array.isArray(arr) && Array.isArray(arr[d.index[0]])) { - val = arr[d.index[0]][d.index[1]]; - } - } else { - val = Lib.nestedProperty(trace, traceKey).get(); - } - - if(val) d[key] = val; - } - - fill('color', 'hbg', 'hoverlabel.bgcolor'); - fill('borderColor', 'hbc', 'hoverlabel.bordercolor'); - fill('fontFamily', 'htf', 'hoverlabel.font.family'); - fill('fontSize', 'hts', 'hoverlabel.font.size'); - fill('fontColor', 'htc', 'hoverlabel.font.color'); - return d; } @@ -113970,7 +114817,7 @@ function hoverChanged(gd, evt, oldhoverdata) { return false; } -},{"../../lib":709,"../../lib/events":700,"../../lib/override_cursor":718,"../../lib/svg_text_utils":728,"../../plots/cartesian/axes":748,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"./constants":626,"./helpers":628,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],630:[function(require,module,exports){ +},{"../../lib":721,"../../lib/events":712,"../../lib/override_cursor":730,"../../lib/svg_text_utils":740,"../../plots/cartesian/axes":760,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"./constants":636,"./helpers":638,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],640:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -113991,7 +114838,7 @@ module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts Lib.coerceFont(coerce, 'hoverlabel.font', opts.font); }; -},{"../../lib":709}],631:[function(require,module,exports){ +},{"../../lib":721}],641:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114029,7 +114876,10 @@ module.exports = { getDistanceFunction: helpers.getDistanceFunction, getClosest: helpers.getClosest, inbox: helpers.inbox, + appendArrayPointValue: helpers.appendArrayPointValue, + castHoverOption: castHoverOption, + castHoverinfo: castHoverinfo, hover: require('./hover').hover, unhover: dragElement.unhover, @@ -114051,23 +114901,21 @@ function loneUnhover(containerOrSelection) { selection.selectAll('.spikeline').remove(); } -// Handler for trace-wide vs per-point hover label options +// helpers for traces that use Fx.loneHover + function castHoverOption(trace, ptNumber, attr) { - var labelOpts = trace.hoverlabel || {}; - var val = Lib.nestedProperty(labelOpts, attr).get(); + return Lib.castOption(trace, ptNumber, 'hoverlabel.' + attr); +} - if(Array.isArray(val)) { - if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { - return val[ptNumber[0]][ptNumber[1]]; - } else { - return val[ptNumber]; - } - } else { - return val; +function castHoverinfo(trace, fullLayout, ptNumber) { + function _coerce(val) { + return Lib.coerceHoverinfo({hoverinfo: val}, {_module: trace._module}, fullLayout); } + + return Lib.castOption(trace, ptNumber, 'hoverinfo', _coerce); } -},{"../../lib":709,"../dragelement":611,"./attributes":623,"./calc":624,"./click":625,"./constants":626,"./defaults":627,"./helpers":628,"./hover":629,"./layout_attributes":632,"./layout_defaults":633,"./layout_global_defaults":634,"d3":118}],632:[function(require,module,exports){ +},{"../../lib":721,"../dragelement":621,"./attributes":633,"./calc":634,"./click":635,"./constants":636,"./defaults":637,"./helpers":638,"./hover":639,"./layout_attributes":642,"./layout_defaults":643,"./layout_global_defaults":644,"d3":120}],642:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114120,7 +114968,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"./constants":626}],633:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"./constants":636}],643:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114168,7 +115016,7 @@ function isHoriz(fullData) { return out; } -},{"../../lib":709,"./layout_attributes":632}],634:[function(require,module,exports){ +},{"../../lib":721,"./layout_attributes":642}],644:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114191,7 +115039,7 @@ module.exports = function supplyLayoutGlobalDefaults(layoutIn, layoutOut) { handleHoverLabelDefaults(layoutIn, layoutOut, coerce); }; -},{"../../lib":709,"./hoverlabel_defaults":630,"./layout_attributes":632}],635:[function(require,module,exports){ +},{"../../lib":721,"./hoverlabel_defaults":640,"./layout_attributes":642}],645:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114313,7 +115161,7 @@ module.exports = { } }; -},{"../../plots/cartesian/constants":753}],636:[function(require,module,exports){ +},{"../../plots/cartesian/constants":765}],646:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114396,7 +115244,7 @@ module.exports = function convertCoords(gd, ax, newType, doExtra) { } }; -},{"../../lib/to_log_range":729,"fast-isnumeric":127}],637:[function(require,module,exports){ +},{"../../lib/to_log_range":741,"fast-isnumeric":129}],647:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114457,7 +115305,7 @@ function imageDefaults(imageIn, imageOut, fullLayout) { return imageOut; } -},{"../../lib":709,"../../plots/array_container_defaults":745,"../../plots/cartesian/axes":748,"./attributes":635}],638:[function(require,module,exports){ +},{"../../lib":721,"../../plots/array_container_defaults":757,"../../plots/cartesian/axes":760,"./attributes":645}],648:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114678,7 +115526,7 @@ module.exports = function draw(gd) { } }; -},{"../../constants/xmlns_namespaces":692,"../../plots/cartesian/axes":748,"../drawing":614,"d3":118}],639:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../../plots/cartesian/axes":760,"../drawing":624,"d3":120}],649:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114701,7 +115549,7 @@ module.exports = { convertCoords: require('./convert_coords') }; -},{"./attributes":635,"./convert_coords":636,"./defaults":637,"./draw":638}],640:[function(require,module,exports){ +},{"./attributes":645,"./convert_coords":646,"./defaults":647,"./draw":648}],650:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114750,7 +115598,7 @@ exports.isMiddleAnchor = function isMiddleAnchor(opts) { ); }; -},{}],641:[function(require,module,exports){ +},{}],651:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114841,7 +115689,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"../color/attributes":589}],642:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"../color/attributes":599}],652:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114859,7 +115707,7 @@ module.exports = { scrollBarMargin: 4 }; -},{}],643:[function(require,module,exports){ +},{}],653:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114952,7 +115800,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) { Lib.noneOrAll(containerIn, containerOut, ['x', 'y']); }; -},{"../../lib":709,"../../plots/layout_attributes":802,"../../registry":826,"./attributes":641,"./helpers":646}],644:[function(require,module,exports){ +},{"../../lib":721,"../../plots/layout_attributes":814,"../../registry":838,"./attributes":651,"./helpers":656}],654:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -114977,6 +115825,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var constants = require('./constants'); var interactConstants = require('../../constants/interactions'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var getLegendData = require('./get_legend_data'); var style = require('./style'); var helpers = require('./helpers'); @@ -115066,7 +115916,7 @@ module.exports = function draw(gd) { traces.enter().append('g').attr('class', 'traces'); traces.exit().remove(); - traces.call(style) + traces.call(style, gd) .style('opacity', function(d) { var trace = d[0].trace; if(Registry.traceIs(trace, 'pie')) { @@ -115272,6 +116122,7 @@ module.exports = function draw(gd) { dragElement.init({ element: legend.node(), + gd: gd, prepFn: function() { var transform = Drawing.getTranslate(legend); @@ -115323,30 +116174,24 @@ function drawTexts(g, gd) { var text = g.selectAll('text.legendtext') .data([0]); + text.enter().append('text').classed('legendtext', true); - text.attr({ - x: 40, - y: 0, - 'data-unformatted': name - }) - .style('text-anchor', 'start') - .classed('user-select-none', true) - .call(Drawing.font, fullLayout.legend.font) - .text(name); + + text.attr('text-anchor', 'start') + .classed('user-select-none', true) + .call(Drawing.font, fullLayout.legend.font) + .text(name); function textLayout(s) { - svgTextUtils.convertToTspans(s, function() { - s.selectAll('tspan.line').attr({x: s.attr('x')}); - g.call(computeTextDimensions, gd); + svgTextUtils.convertToTspans(s, gd, function() { + computeTextDimensions(g, gd); }); } if(gd._context.editable && !isPie) { - text.call(svgTextUtils.makeEditable) + text.call(svgTextUtils.makeEditable, {gd: gd}) .call(textLayout) .on('edit', function(text) { - this.attr({'data-unformatted': text}); - this.text(text) .call(textLayout); @@ -115511,20 +116356,21 @@ function handleClick(g, gd, numClicks) { } function computeTextDimensions(g, gd) { - var legendItem = g.data()[0][0], - mathjaxGroup = g.select('g[class*=math-group]'), - opts = gd._fullLayout.legend, - lineHeight = opts.font.size * 1.3, - height, - width; + var legendItem = g.data()[0][0]; if(!legendItem.trace.showlegend) { g.remove(); return; } - if(mathjaxGroup.node()) { - var mathjaxBB = Drawing.bBox(mathjaxGroup.node()); + var mathjaxGroup = g.select('g[class*=math-group]'); + var mathjaxNode = mathjaxGroup.node(); + var opts = gd._fullLayout.legend; + var lineHeight = opts.font.size * LINE_SPACING; + var height, width; + + if(mathjaxNode) { + var mathjaxBB = Drawing.bBox(mathjaxNode); height = mathjaxBB.height; width = mathjaxBB.width; @@ -115532,18 +116378,19 @@ function computeTextDimensions(g, gd) { Drawing.setTranslate(mathjaxGroup, 0, (height / 4)); } else { - var text = g.selectAll('.legendtext'), - textSpans = g.selectAll('.legendtext>tspan'), - textLines = textSpans[0].length || 1; + var text = g.select('.legendtext'); + var textLines = svgTextUtils.lineCount(text); + var textNode = text.node(); height = lineHeight * textLines; - width = text.node() && Drawing.bBox(text.node()).width; + width = textNode ? Drawing.bBox(textNode).width : 0; // approximation to height offset to center the font // to avoid getBoundingClientRect var textY = lineHeight * (0.3 + (1 - textLines) / 2); - text.attr('y', textY); - textSpans.attr('y', textY); + // TODO: this 40 should go in a constants file (along with other + // values related to the legend symbol size) + svgTextUtils.positionText(text, 40, textY); } height = Math.max(height, 16) + 3; @@ -115778,7 +116625,7 @@ function expandHorizontalMargin(gd) { }); } -},{"../../constants/interactions":689,"../../lib":709,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/plots":811,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"./anchor_utils":640,"./constants":642,"./get_legend_data":645,"./helpers":646,"./style":648,"d3":118}],645:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../constants/interactions":701,"../../lib":721,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/plots":823,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"./anchor_utils":650,"./constants":652,"./get_legend_data":655,"./helpers":656,"./style":658,"d3":120}],655:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115883,7 +116730,7 @@ module.exports = function getLegendData(calcdata, opts) { return legendData; }; -},{"../../registry":826,"./helpers":646}],646:[function(require,module,exports){ +},{"../../registry":838,"./helpers":656}],656:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115914,7 +116761,7 @@ exports.isReversed = function isReversed(legendLayout) { return (legendLayout.traceorder || '').indexOf('reversed') !== -1; }; -},{"../../registry":826}],647:[function(require,module,exports){ +},{"../../registry":838}],657:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115938,7 +116785,7 @@ module.exports = { style: require('./style') }; -},{"./attributes":641,"./defaults":643,"./draw":644,"./style":648}],648:[function(require,module,exports){ +},{"./attributes":651,"./defaults":653,"./draw":654,"./style":658}],658:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -115961,7 +116808,7 @@ var subTypes = require('../../traces/scatter/subtypes'); var stylePie = require('../../traces/pie/style_one'); -module.exports = function style(s) { +module.exports = function style(s, gd) { s.each(function(d) { var traceGroup = d3.select(this); @@ -115999,179 +116846,179 @@ module.exports = function style(s) { .each(stylePies) .each(styleLines) .each(stylePoints); -}; -function styleLines(d) { - var trace = d[0].trace, - showFill = trace.visible && trace.fill && trace.fill !== 'none', - showLine = subTypes.hasLines(trace); + function styleLines(d) { + var trace = d[0].trace, + showFill = trace.visible && trace.fill && trace.fill !== 'none', + showLine = subTypes.hasLines(trace); - if(trace && trace._module && trace._module.name === 'contourcarpet') { - showLine = trace.contours.showlines; - showFill = trace.contours.coloring === 'fill'; - } + if(trace && trace._module && trace._module.name === 'contourcarpet') { + showLine = trace.contours.showlines; + showFill = trace.contours.coloring === 'fill'; + } - var fill = d3.select(this).select('.legendfill').selectAll('path') - .data(showFill ? [d] : []); - fill.enter().append('path').classed('js-fill', true); - fill.exit().remove(); - fill.attr('d', 'M5,0h30v6h-30z') - .call(Drawing.fillGroupStyle); + var fill = d3.select(this).select('.legendfill').selectAll('path') + .data(showFill ? [d] : []); + fill.enter().append('path').classed('js-fill', true); + fill.exit().remove(); + fill.attr('d', 'M5,0h30v6h-30z') + .call(Drawing.fillGroupStyle); - var line = d3.select(this).select('.legendlines').selectAll('path') - .data(showLine ? [d] : []); - line.enter().append('path').classed('js-line', true) - .attr('d', 'M5,0h30'); - line.exit().remove(); - line.call(Drawing.lineGroupStyle); -} + var line = d3.select(this).select('.legendlines').selectAll('path') + .data(showLine ? [d] : []); + line.enter().append('path').classed('js-line', true) + .attr('d', 'M5,0h30'); + line.exit().remove(); + line.call(Drawing.lineGroupStyle); + } -function stylePoints(d) { - var d0 = d[0], - trace = d0.trace, - showMarkers = subTypes.hasMarkers(trace), - showText = subTypes.hasText(trace), - showLines = subTypes.hasLines(trace); + function stylePoints(d) { + var d0 = d[0], + trace = d0.trace, + showMarkers = subTypes.hasMarkers(trace), + showText = subTypes.hasText(trace), + showLines = subTypes.hasLines(trace); - var dMod, tMod; + var dMod, tMod; - // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; - // use d0.trace to infer arrayOk attributes + // 'scatter3d' and 'scattergeo' don't use gd.calcdata yet; + // use d0.trace to infer arrayOk attributes - function boundVal(attrIn, arrayToValFn, bounds) { - var valIn = Lib.nestedProperty(trace, attrIn).get(), - valToBound = (Array.isArray(valIn) && arrayToValFn) ? - arrayToValFn(valIn) : valIn; + function boundVal(attrIn, arrayToValFn, bounds) { + var valIn = Lib.nestedProperty(trace, attrIn).get(), + valToBound = (Array.isArray(valIn) && arrayToValFn) ? + arrayToValFn(valIn) : valIn; - if(bounds) { - if(valToBound < bounds[0]) return bounds[0]; - else if(valToBound > bounds[1]) return bounds[1]; + if(bounds) { + if(valToBound < bounds[0]) return bounds[0]; + else if(valToBound > bounds[1]) return bounds[1]; + } + return valToBound; } - return valToBound; - } - function pickFirst(array) { return array[0]; } + function pickFirst(array) { return array[0]; } - // constrain text, markers, etc so they'll fit on the legend - if(showMarkers || showText || showLines) { - var dEdit = {}, - tEdit = {}; + // constrain text, markers, etc so they'll fit on the legend + if(showMarkers || showText || showLines) { + var dEdit = {}, + tEdit = {}; - if(showMarkers) { - dEdit.mc = boundVal('marker.color', pickFirst); - dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); - dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); - dEdit.mlc = boundVal('marker.line.color', pickFirst); - dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); - tEdit.marker = { - sizeref: 1, - sizemin: 1, - sizemode: 'diameter' - }; - } + if(showMarkers) { + dEdit.mc = boundVal('marker.color', pickFirst); + dEdit.mo = boundVal('marker.opacity', Lib.mean, [0.2, 1]); + dEdit.ms = boundVal('marker.size', Lib.mean, [2, 16]); + dEdit.mlc = boundVal('marker.line.color', pickFirst); + dEdit.mlw = boundVal('marker.line.width', Lib.mean, [0, 5]); + tEdit.marker = { + sizeref: 1, + sizemin: 1, + sizemode: 'diameter' + }; + } - if(showLines) { - tEdit.line = { - width: boundVal('line.width', pickFirst, [0, 10]) - }; + if(showLines) { + tEdit.line = { + width: boundVal('line.width', pickFirst, [0, 10]) + }; + } + + if(showText) { + dEdit.tx = 'Aa'; + dEdit.tp = boundVal('textposition', pickFirst); + dEdit.ts = 10; + dEdit.tc = boundVal('textfont.color', pickFirst); + dEdit.tf = boundVal('textfont.family', pickFirst); + } + + dMod = [Lib.minExtend(d0, dEdit)]; + tMod = Lib.minExtend(trace, tEdit); } - if(showText) { - dEdit.tx = 'Aa'; - dEdit.tp = boundVal('textposition', pickFirst); - dEdit.ts = 10; - dEdit.tc = boundVal('textfont.color', pickFirst); - dEdit.tf = boundVal('textfont.family', pickFirst); - } - - dMod = [Lib.minExtend(d0, dEdit)]; - tMod = Lib.minExtend(trace, tEdit); - } - - var ptgroup = d3.select(this).select('g.legendpoints'); - - var pts = ptgroup.selectAll('path.scatterpts') - .data(showMarkers ? dMod : []); - pts.enter().append('path').classed('scatterpts', true) - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.call(Drawing.pointStyle, tMod); - - // 'mrc' is set in pointStyle and used in textPointStyle: - // constrain it here - if(showMarkers) dMod[0].mrc = 3; - - var txt = ptgroup.selectAll('g.pointtext') - .data(showText ? dMod : []); - txt.enter() - .append('g').classed('pointtext', true) - .append('text').attr('transform', 'translate(20,0)'); - txt.exit().remove(); - txt.selectAll('text').call(Drawing.textPointStyle, tMod); -} - -function styleBars(d) { - var trace = d[0].trace, - marker = trace.marker || {}, - markerLine = marker.line || {}, - barpath = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbar') - .data(Registry.traceIs(trace, 'bar') ? [d] : []); - barpath.enter().append('path').classed('legendbar', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - barpath.exit().remove(); - barpath.each(function(d) { - var p = d3.select(this), - d0 = d[0], - w = (d0.mlw + 1 || markerLine.width + 1) - 1; + var ptgroup = d3.select(this).select('g.legendpoints'); - p.style('stroke-width', w + 'px') - .call(Color.fill, d0.mc || marker.color); + var pts = ptgroup.selectAll('path.scatterpts') + .data(showMarkers ? dMod : []); + pts.enter().append('path').classed('scatterpts', true) + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.call(Drawing.pointStyle, tMod, gd); - if(w) { - p.call(Color.stroke, d0.mlc || markerLine.color); - } - }); -} + // 'mrc' is set in pointStyle and used in textPointStyle: + // constrain it here + if(showMarkers) dMod[0].mrc = 3; -function styleBoxes(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendbox') - .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendbox', true) - // if we want the median bar, prepend M6,0H-6 - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); - pts.each(function() { - var w = trace.line.width, - p = d3.select(this); + var txt = ptgroup.selectAll('g.pointtext') + .data(showText ? dMod : []); + txt.enter() + .append('g').classed('pointtext', true) + .append('text').attr('transform', 'translate(20,0)'); + txt.exit().remove(); + txt.selectAll('text').call(Drawing.textPointStyle, tMod, gd); + } - p.style('stroke-width', w + 'px') - .call(Color.fill, trace.fillcolor); + function styleBars(d) { + var trace = d[0].trace, + marker = trace.marker || {}, + markerLine = marker.line || {}, + barpath = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbar') + .data(Registry.traceIs(trace, 'bar') ? [d] : []); + barpath.enter().append('path').classed('legendbar', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + barpath.exit().remove(); + barpath.each(function(d) { + var p = d3.select(this), + d0 = d[0], + w = (d0.mlw + 1 || markerLine.width + 1) - 1; + + p.style('stroke-width', w + 'px') + .call(Color.fill, d0.mc || marker.color); + + if(w) { + p.call(Color.stroke, d0.mlc || markerLine.color); + } + }); + } - if(w) { - p.call(Color.stroke, trace.line.color); - } - }); -} + function styleBoxes(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendbox') + .data(Registry.traceIs(trace, 'box') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendbox', true) + // if we want the median bar, prepend M6,0H-6 + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + pts.each(function() { + var w = trace.line.width, + p = d3.select(this); -function stylePies(d) { - var trace = d[0].trace, - pts = d3.select(this).select('g.legendpoints') - .selectAll('path.legendpie') - .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); - pts.enter().append('path').classed('legendpie', true) - .attr('d', 'M6,6H-6V-6H6Z') - .attr('transform', 'translate(20,0)'); - pts.exit().remove(); + p.style('stroke-width', w + 'px') + .call(Color.fill, trace.fillcolor); - if(pts.size()) pts.call(stylePie, d[0], trace); -} + if(w) { + p.call(Color.stroke, trace.line.color); + } + }); + } -},{"../../lib":709,"../../registry":826,"../../traces/pie/style_one":994,"../../traces/scatter/subtypes":1028,"../color":590,"../drawing":614,"d3":118}],649:[function(require,module,exports){ + function stylePies(d) { + var trace = d[0].trace, + pts = d3.select(this).select('g.legendpoints') + .selectAll('path.legendpie') + .data(Registry.traceIs(trace, 'pie') && trace.visible ? [d] : []); + pts.enter().append('path').classed('legendpie', true) + .attr('d', 'M6,6H-6V-6H6Z') + .attr('transform', 'translate(20,0)'); + pts.exit().remove(); + + if(pts.size()) pts.call(stylePie, d[0], trace); + } +}; + +},{"../../lib":721,"../../registry":838,"../../traces/pie/style_one":1008,"../../traces/scatter/subtypes":1042,"../color":600,"../drawing":624,"d3":120}],659:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116749,7 +117596,7 @@ function setSpikelineVisibility(gd) { return aobj; } -},{"../../../build/ploticon":2,"../../lib":709,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../../snapshot/download":828}],650:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":721,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../../snapshot/download":840}],660:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116763,7 +117610,7 @@ function setSpikelineVisibility(gd) { exports.manage = require('./manage'); -},{"./manage":651}],651:[function(require,module,exports){ +},{"./manage":661}],661:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -116887,7 +117734,7 @@ function getButtonGroups(gd, buttonsToRemove, buttonsToAdd) { if(((hasCartesian || hasGL2D) && !allAxesFixed) || hasTernary) { dragModeGroup = ['zoom2d', 'pan2d']; } - if((hasCartesian || hasTernary) && isSelectable(fullData)) { + if((hasCartesian || hasTernary || hasGL2D) && isSelectable(fullData)) { dragModeGroup.push('select2d'); dragModeGroup.push('lasso2d'); } @@ -116939,7 +117786,7 @@ function isSelectable(fullData) { if(!trace._module || !trace._module.selectPoints) continue; - if(trace.type === 'scatter' || trace.type === 'scatterternary') { + if(trace.type === 'scatter' || trace.type === 'scatterternary' || trace.type === 'scattergl') { if(scatterSubTypes.hasMarkers(trace) || scatterSubTypes.hasText(trace)) { selectable = true; } @@ -116991,7 +117838,7 @@ function fillCustomButton(customButtons) { return customButtons; } -},{"../../plots/cartesian/axes":748,"../../traces/scatter/subtypes":1028,"./buttons":649,"./modebar":652}],652:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../../traces/scatter/subtypes":1042,"./buttons":659,"./modebar":662}],662:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117285,7 +118132,7 @@ function createModeBar(gd, buttons) { module.exports = createModeBar; -},{"../../../build/ploticon":2,"../../lib":709,"d3":118}],653:[function(require,module,exports){ +},{"../../../build/ploticon":2,"../../lib":721,"d3":120}],663:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117375,7 +118222,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"../color/attributes":589,"./button_attributes":654}],654:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"../color/attributes":599,"./button_attributes":664}],664:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117416,7 +118263,7 @@ module.exports = { } }; -},{}],655:[function(require,module,exports){ +},{}],665:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117445,7 +118292,7 @@ module.exports = { darkAmount: 10 }; -},{}],656:[function(require,module,exports){ +},{}],666:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117544,7 +118391,7 @@ function getPosDflt(containerOut, layout, counterAxes) { return [containerOut.domain[0], posY + constants.yPad]; } -},{"../../lib":709,"../color":590,"./attributes":653,"./button_attributes":654,"./constants":655}],657:[function(require,module,exports){ +},{"../../lib":721,"../color":600,"./attributes":663,"./button_attributes":664,"./constants":665}],667:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117566,6 +118413,8 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var axisIds = require('../../plots/cartesian/axis_ids'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var getUpdateObject = require('./get_update_object'); @@ -117606,7 +118455,7 @@ module.exports = function draw(gd) { d.isActive = isActive(axisLayout, d, update); button.call(drawButtonRect, selectorLayout, d); - button.call(drawButtonText, selectorLayout, d); + button.call(drawButtonText, selectorLayout, d, gd); button.on('click', function() { if(gd._dragged) return; @@ -117693,11 +118542,9 @@ function getFillColor(selectorLayout, d) { selectorLayout.bgcolor; } -function drawButtonText(button, selectorLayout, d) { +function drawButtonText(button, selectorLayout, d, gd) { function textLayout(s) { - svgTextUtils.convertToTspans(s); - - // TODO do we need anything else here? + svgTextUtils.convertToTspans(s, gd); } var text = button.selectAll('text') @@ -117729,26 +118576,23 @@ function reposition(gd, buttons, opts, axName) { var borderWidth = opts.borderwidth; buttons.each(function() { - var button = d3.select(this), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var text = button.select('.selector-text'); - var tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, 16) + 3; + var tHeight = opts.font.size * LINE_SPACING; + var hEff = Math.max(tHeight * svgTextUtils.lineCount(text), 16) + 3; opts.height = Math.max(opts.height, hEff); }); buttons.each(function() { - var button = d3.select(this), - rect = button.select('.selector-rect'), - text = button.select('.selector-text'), - tspans = text.selectAll('tspan'); + var button = d3.select(this); + var rect = button.select('.selector-rect'); + var text = button.select('.selector-text'); - var tWidth = text.node() && Drawing.bBox(text.node()).width, - tHeight = opts.font.size * 1.3, - tLines = tspans[0].length || 1; + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var tHeight = opts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); var wEff = Math.max(tWidth + 10, constants.minButtonWidth); @@ -117767,13 +118611,8 @@ function reposition(gd, buttons, opts, axName) { height: opts.height }); - var textAttrs = { - x: wEff / 2, - y: opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3 - }; - - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, wEff / 2, + opts.height / 2 - ((tLines - 1) * tHeight / 2) + 3); opts.width += wEff + 5; }); @@ -117819,7 +118658,7 @@ function reposition(gd, buttons, opts, axName) { }); } -},{"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/cartesian/axis_ids":751,"../../plots/plots":811,"../color":590,"../drawing":614,"../legend/anchor_utils":640,"./constants":655,"./get_update_object":658,"d3":118}],658:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axis_ids":763,"../../plots/plots":823,"../color":600,"../drawing":624,"../legend/anchor_utils":650,"./constants":665,"./get_update_object":668,"d3":120}],668:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117876,7 +118715,7 @@ function getXRange(axisLayout, buttonLayout) { return [range0, range1]; } -},{"d3":118}],659:[function(require,module,exports){ +},{"d3":120}],669:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117903,7 +118742,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":653,"./defaults":656,"./draw":657}],660:[function(require,module,exports){ +},{"./attributes":663,"./defaults":666,"./draw":667}],670:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -117967,7 +118806,7 @@ module.exports = { } }; -},{"../color/attributes":589}],661:[function(require,module,exports){ +},{"../color/attributes":599}],671:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118003,7 +118842,7 @@ module.exports = function calcAutorange(gd) { } }; -},{"../../plots/cartesian/axes":748,"./constants":662}],662:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"./constants":672}],672:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118055,7 +118894,7 @@ module.exports = { extraPad: 15 }; -},{}],663:[function(require,module,exports){ +},{}],673:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118112,7 +118951,7 @@ module.exports = function handleDefaults(layoutIn, layoutOut, axName) { containerOut._input = containerIn; }; -},{"../../lib":709,"./attributes":660}],664:[function(require,module,exports){ +},{"../../lib":721,"./attributes":670}],674:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118663,7 +119502,7 @@ function clearPushMargins(gd) { } } -},{"../../lib":709,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian":758,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../color":590,"../dragelement":611,"../drawing":614,"./constants":662,"d3":118}],665:[function(require,module,exports){ +},{"../../lib":721,"../../lib/setcursor":736,"../../plotly":755,"../../plots/cartesian":770,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../color":600,"../dragelement":621,"../drawing":624,"./constants":672,"d3":120}],675:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118690,7 +119529,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":660,"./calc_autorange":661,"./defaults":663,"./draw":664}],666:[function(require,module,exports){ +},{"./attributes":670,"./calc_autorange":671,"./defaults":673,"./draw":674}],676:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118787,7 +119626,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../traces/scatter/attributes":1008,"../annotations/attributes":579,"../drawing/attributes":613}],667:[function(require,module,exports){ +},{"../../lib/extend":713,"../../traces/scatter/attributes":1022,"../annotations/attributes":583,"../drawing/attributes":623}],677:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118833,7 +119672,7 @@ module.exports = function calcAutorange(gd) { }; function shapeBounds(ax, v0, v1, path, paramsToUse) { - var convertVal = (ax.type === 'category') ? Number : ax.d2c; + var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c; if(v0 !== undefined) return [convertVal(v0), convertVal(v1)]; if(!path) return; @@ -118864,7 +119703,7 @@ function shapeBounds(ax, v0, v1, path, paramsToUse) { if(max >= min) return [min, max]; } -},{"../../lib":709,"../../plots/cartesian/axes":748,"./constants":668,"./helpers":671}],668:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./constants":678,"./helpers":681}],678:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118928,7 +119767,7 @@ module.exports = { } }; -},{}],669:[function(require,module,exports){ +},{}],679:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -118953,7 +119792,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { handleArrayContainerDefaults(layoutIn, layoutOut, opts); }; -},{"../../plots/array_container_defaults":745,"./shape_defaults":673}],670:[function(require,module,exports){ +},{"../../plots/array_container_defaults":757,"./shape_defaults":683}],680:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119086,8 +119925,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { var xa, ya, x2p, y2p, p2x, p2y; var dragOptions = { - setCursor: updateDragMode, element: shapePath.node(), + gd: gd, prepFn: startDrag, doneFn: endDrag }, @@ -119096,6 +119935,8 @@ function setupDragElement(gd, shapePath, shapeOptions, index) { dragElement.init(dragOptions); + shapePath.node().onmousemove = updateDragMode; + function updateDragMode(evt) { // choose 'move' or 'resize' // based on initial position of cursor within the drag element @@ -119328,7 +120169,7 @@ function movePath(pathIn, moveX, moveY) { }); } -},{"../../lib":709,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian/axes":748,"../color":590,"../dragelement":611,"../drawing":614,"./constants":668,"./helpers":671}],671:[function(require,module,exports){ +},{"../../lib":721,"../../lib/setcursor":736,"../../plotly":755,"../../plots/cartesian/axes":760,"../color":600,"../dragelement":621,"../drawing":624,"./constants":678,"./helpers":681}],681:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119409,7 +120250,7 @@ exports.getPixelToData = function(gd, axis, isVertical) { return pixelToData; }; -},{}],672:[function(require,module,exports){ +},{}],682:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119435,7 +120276,7 @@ module.exports = { drawOne: drawModule.drawOne }; -},{"./attributes":666,"./calc_autorange":667,"./defaults":669,"./draw":670}],673:[function(require,module,exports){ +},{"./attributes":676,"./calc_autorange":677,"./defaults":679,"./draw":680}],683:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119534,7 +120375,7 @@ module.exports = function handleShapeDefaults(shapeIn, shapeOut, fullLayout, opt return shapeOut; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"./attributes":666,"./helpers":671}],674:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"./attributes":676,"./helpers":681}],684:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119557,7 +120398,7 @@ var stepsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -119582,6 +120423,12 @@ var stepsAttrs = { valType: 'string', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -119768,7 +120615,7 @@ module.exports = { }, }; -},{"../../lib/extend":701,"../../plots/animation_attributes":744,"../../plots/font_attributes":772,"../../plots/pad_attributes":810,"./constants":675}],675:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/animation_attributes":756,"../../plots/font_attributes":784,"../../plots/pad_attributes":822,"./constants":685}],685:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119816,9 +120663,6 @@ module.exports = { // padding around item text textPadX: 40, - // font size to height scale - fontSizeToHeight: 1.3, - // arrow offset off right edge arrowOffsetX: 4, @@ -119865,7 +120709,7 @@ module.exports = { currentValueInset: 0, }; -},{}],676:[function(require,module,exports){ +},{}],686:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119963,14 +120807,16 @@ function stepsDefaults(sliderIn, sliderOut) { valueIn = valuesIn[i]; valueOut = {}; - if(!Lib.isPlainObject(valueIn) || !Array.isArray(valueIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(valueIn) || (valueOut.method !== 'skip' && !Array.isArray(valueIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label', 'step-' + i); coerce('value', valueOut.label); + coerce('execute'); valuesOut.push(valueOut); } @@ -119978,7 +120824,7 @@ function stepsDefaults(sliderIn, sliderOut) { return valuesOut; } -},{"../../lib":709,"../../plots/array_container_defaults":745,"./attributes":674,"./constants":675}],677:[function(require,module,exports){ +},{"../../lib":721,"../../plots/array_container_defaults":757,"./attributes":684,"./constants":685}],687:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -119999,11 +120845,12 @@ var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); var constants = require('./constants'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; module.exports = function draw(gd) { var fullLayout = gd._fullLayout, - sliderData = makeSliderData(fullLayout); + sliderData = makeSliderData(fullLayout, gd); // draw a container for *all* sliders: var sliders = fullLayout._infolayer @@ -120067,24 +120914,18 @@ module.exports = function draw(gd) { }); drawSlider(gd, d3.select(this), sliderOpts); - - // makeInputProxy(gd, d3.select(this), sliderOpts); }); }; -/* function makeInputProxy(gd, sliderGroup, sliderOpts) { - sliderOpts.inputProxy = gd._fullLayout._paperdiv.selectAll('input.' + constants.inputProxyClass) - .data([0]); -}*/ - // This really only just filters by visibility: -function makeSliderData(fullLayout) { +function makeSliderData(fullLayout, gd) { var contOpts = fullLayout[constants.name], sliderData = []; for(var i = 0; i < contOpts.length; i++) { var item = contOpts[i]; if(!item.visible || !item.steps.length) continue; + item.gd = gd; sliderData.push(item); } @@ -120112,14 +120953,12 @@ function findDimensions(gd, sliderOpts) { var text = drawLabel(labelGroup, {step: stepOpts}, sliderOpts); - var tWidth = (text.node() && Drawing.bBox(text.node()).width) || 0; - - // This just overwrites with the last. Which is fine as long as - // the bounding box (probably incorrectly) measures the text *on - // a single line*: - labelHeight = (text.node() && Drawing.bBox(text.node()).height) || 0; - - maxLabelWidth = Math.max(maxLabelWidth, tWidth); + var textNode = text.node(); + if(textNode) { + var bBox = Drawing.bBox(textNode); + labelHeight = Math.max(labelHeight, bBox.height); + maxLabelWidth = Math.max(maxLabelWidth, bBox.width); + } }); sliderLabels.remove(); @@ -120129,26 +120968,8 @@ function findDimensions(gd, sliderOpts) { constants.gripHeight ); - sliderOpts.currentValueMaxWidth = 0; - sliderOpts.currentValueHeight = 0; - sliderOpts.currentValueTotalHeight = 0; - - if(sliderOpts.currentvalue.visible) { - // Get the dimensions of the current value label: - var dummyGroup = Drawing.tester.append('g'); - - sliderLabels.each(function(stepOpts) { - var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); - var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; - sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); - sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); - }); - - sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; - - dummyGroup.remove(); - } - + // calculate some overall dimensions - some of these are needed for + // calculating the currentValue dimensions var graphSize = gd._fullLayout._size; sliderOpts.lx = graphSize.l + graphSize.w * sliderOpts.x; sliderOpts.ly = graphSize.t + graphSize.h * (1 - sliderOpts.y); @@ -120175,6 +120996,31 @@ function findDimensions(gd, sliderOpts) { sliderOpts.labelStride = Math.max(1, Math.ceil(computedSpacePerLabel / availableSpacePerLabel)); sliderOpts.labelHeight = labelHeight; + // loop over all possible values for currentValue to find the + // area we need for it + sliderOpts.currentValueMaxWidth = 0; + sliderOpts.currentValueHeight = 0; + sliderOpts.currentValueTotalHeight = 0; + sliderOpts.currentValueMaxLines = 1; + + if(sliderOpts.currentvalue.visible) { + // Get the dimensions of the current value label: + var dummyGroup = Drawing.tester.append('g'); + + sliderLabels.each(function(stepOpts) { + var curValPrefix = drawCurrentValue(dummyGroup, sliderOpts, stepOpts.label); + var curValSize = (curValPrefix.node() && Drawing.bBox(curValPrefix.node())) || {width: 0, height: 0}; + var lines = svgTextUtils.lineCount(curValPrefix); + sliderOpts.currentValueMaxWidth = Math.max(sliderOpts.currentValueMaxWidth, Math.ceil(curValSize.width)); + sliderOpts.currentValueHeight = Math.max(sliderOpts.currentValueHeight, Math.ceil(curValSize.height)); + sliderOpts.currentValueMaxLines = Math.max(sliderOpts.currentValueMaxLines, lines); + }); + + sliderOpts.currentValueTotalHeight = sliderOpts.currentValueHeight + sliderOpts.currentvalue.offset; + + dummyGroup.remove(); + } + sliderOpts.height = sliderOpts.currentValueTotalHeight + constants.tickOffset + sliderOpts.ticklen + constants.labelOffset + sliderOpts.labelHeight + sliderOpts.pad.t + sliderOpts.pad.b; var xanchor = 'left'; @@ -120266,7 +121112,10 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', textAnchor); + .attr({ + 'text-anchor': textAnchor, + 'data-notex': 1 + }); var str = sliderOpts.currentvalue.prefix ? sliderOpts.currentvalue.prefix : ''; @@ -120283,9 +121132,14 @@ function drawCurrentValue(sliderGroup, sliderOpts, valueOverride) { text.call(Drawing.font, sliderOpts.currentvalue.font) .text(str) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); + + var lines = svgTextUtils.lineCount(text); + + var y0 = (sliderOpts.currentValueMaxLines + 1 - lines) * + sliderOpts.currentvalue.font.size * LINE_SPACING; - Drawing.setTranslate(text, x0, sliderOpts.currentValueHeight); + svgTextUtils.positionText(text, x0, y0); return text; } @@ -120317,11 +121171,14 @@ function drawLabel(item, data, sliderOpts) { text.enter().append('text') .classed(constants.labelClass, true) .classed('user-select-none', true) - .attr('text-anchor', 'middle'); + .attr({ + 'text-anchor': 'middle', + 'data-notex': 1 + }); text.call(Drawing.font, sliderOpts.font) .text(data.step.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, sliderOpts.gd); return text; } @@ -120348,7 +121205,13 @@ function drawLabelGroup(sliderGroup, sliderOpts) { Drawing.setTranslate(item, normalizedValueToPosition(sliderOpts, d.fraction), - constants.tickOffset + sliderOpts.ticklen + sliderOpts.labelHeight + constants.labelOffset + sliderOpts.currentValueTotalHeight + constants.tickOffset + + sliderOpts.ticklen + + // position is the baseline of the top line of text only, even + // if the label spans multiple lines + sliderOpts.font.size * LINE_SPACING + + constants.labelOffset + + sliderOpts.currentValueTotalHeight ); }); @@ -120390,7 +121253,9 @@ function setActive(gd, sliderGroup, sliderOpts, index, doCallback, doTransition) var _step = sliderGroup._nextMethod.step; if(!_step.method) return; - Plots.executeAPICommand(gd, _step.method, _step.args); + if(_step.execute) { + Plots.executeAPICommand(gd, _step.method, _step.args); + } sliderGroup._nextMethod = null; sliderGroup._nextMethodRaf = null; @@ -120580,7 +121445,7 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":728,"../../plots/plots":811,"../color":590,"../drawing":614,"../legend/anchor_utils":640,"./constants":675,"d3":118}],678:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib/svg_text_utils":740,"../../plots/plots":823,"../color":600,"../drawing":624,"../legend/anchor_utils":650,"./constants":685,"d3":120}],688:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120603,7 +121468,7 @@ module.exports = { draw: require('./draw') }; -},{"./attributes":674,"./constants":675,"./defaults":676,"./draw":677}],679:[function(require,module,exports){ +},{"./attributes":684,"./constants":685,"./defaults":686,"./draw":687}],689:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120626,6 +121491,7 @@ var Color = require('../color'); var svgTextUtils = require('../../lib/svg_text_utils'); var interactConstants = require('../../constants/interactions'); +var PLACEHOLDER_RE = /Click to enter .+ title/; var Titles = module.exports = {}; @@ -120658,29 +121524,34 @@ var Titles = module.exports = {}; * title, include here. Otherwise it will go in fullLayout._infolayer */ Titles.draw = function(gd, titleClass, options) { - var cont = options.propContainer, - prop = options.propName, - traceIndex = options.traceIndex, - name = options.dfltName, - avoid = options.avoid || {}, - attributes = options.attributes, - transform = options.transform, - group = options.containerGroup, + var cont = options.propContainer; + var prop = options.propName; + var traceIndex = options.traceIndex; + var name = options.dfltName; + var avoid = options.avoid || {}; + var attributes = options.attributes; + var transform = options.transform; + var group = options.containerGroup; - fullLayout = gd._fullLayout, - font = cont.titlefont.family, - fontSize = cont.titlefont.size, - fontColor = cont.titlefont.color, + var fullLayout = gd._fullLayout; + var font = cont.titlefont.family; + var fontSize = cont.titlefont.size; + var fontColor = cont.titlefont.color; + + var opacity = 1; + var isplaceholder = false; + var txt = cont.title.trim(); + var editable = gd._context.editable; - opacity = 1, - isplaceholder = false, - txt = cont.title.trim(); if(txt === '') opacity = 0; - if(txt.match(/Click to enter .+ title/)) { + if(txt.match(PLACEHOLDER_RE)) { opacity = 0.2; isplaceholder = true; + if(!editable) txt = ''; } + var elShouldExist = txt || editable; + if(!group) { group = fullLayout._infolayer.selectAll('.g-' + titleClass) .data([0]); @@ -120689,7 +121560,7 @@ Titles.draw = function(gd, titleClass, options) { } var el = group.selectAll('text') - .data([0]); + .data(elShouldExist ? [0] : []); el.enter().append('text'); el.text(txt) // this is hacky, but convertToTspans uses the class @@ -120698,6 +121569,9 @@ Titles.draw = function(gd, titleClass, options) { // correct one (only relevant for colorbars, at least // for now) - ie don't use .classed .attr('class', titleClass); + el.exit().remove(); + + if(!elShouldExist) return; function titleLayout(titleEl) { Lib.syncOrAsync([drawTitle, scootTitle], titleEl); @@ -120717,11 +121591,8 @@ Titles.draw = function(gd, titleClass, options) { 'font-weight': Plots.fontWeight }) .attr(attributes) - .call(svgTextUtils.convertToTspans) - .attr(attributes); + .call(svgTextUtils.convertToTspans, gd); - titleEl.selectAll('tspan.line') - .attr(attributes); return Plots.previousPromises(gd); } @@ -120733,33 +121604,33 @@ Titles.draw = function(gd, titleClass, options) { // move toward avoid.side (= left, right, top, bottom) if needed // can include pad (pixels, default 2) - var shift = 0, - backside = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top' - }[avoid.side], - shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? - -1 : 1, - pad = isNumeric(avoid.pad) ? avoid.pad : 2, - titlebb = Drawing.bBox(titleGroup.node()), - paperbb = { - left: 0, - top: 0, - right: fullLayout.width, - bottom: fullLayout.height - }, - maxshift = avoid.maxShift || ( - (paperbb[avoid.side] - titlebb[avoid.side]) * - ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); + var shift = 0; + var backside = { + left: 'right', + right: 'left', + top: 'bottom', + bottom: 'top' + }[avoid.side]; + var shiftSign = (['left', 'top'].indexOf(avoid.side) !== -1) ? + -1 : 1; + var pad = isNumeric(avoid.pad) ? avoid.pad : 2; + var titlebb = Drawing.bBox(titleGroup.node()); + var paperbb = { + left: 0, + top: 0, + right: fullLayout.width, + bottom: fullLayout.height + }; + var maxshift = avoid.maxShift || ( + (paperbb[avoid.side] - titlebb[avoid.side]) * + ((avoid.side === 'left' || avoid.side === 'top') ? -1 : 1)); // Prevent the title going off the paper if(maxshift < 0) shift = maxshift; else { // so we don't have to offset each avoided element, // give the title the opposite offset - var offsetLeft = avoid.offsetLeft || 0, - offsetTop = avoid.offsetTop || 0; + var offsetLeft = avoid.offsetLeft || 0; + var offsetTop = avoid.offsetTop || 0; titlebb.left -= offsetLeft; titlebb.right -= offsetLeft; titlebb.top -= offsetTop; @@ -120790,8 +121661,7 @@ Titles.draw = function(gd, titleClass, options) { } } - el.attr({'data-unformatted': txt}) - .call(titleLayout); + el.call(titleLayout); var placeholderText = 'Click to enter ' + name + ' title'; @@ -120799,8 +121669,7 @@ Titles.draw = function(gd, titleClass, options) { opacity = 0; isplaceholder = true; txt = placeholderText; - el.attr({'data-unformatted': txt}) - .text(txt) + el.text(txt) .on('mouseover.opacity', function() { d3.select(this).transition() .duration(interactConstants.SHOW_PLACEHOLDER).style('opacity', 1); @@ -120811,11 +121680,11 @@ Titles.draw = function(gd, titleClass, options) { }); } - if(gd._context.editable) { + if(editable) { if(!txt) setPlaceholder(); else el.on('.opacity', null); - el.call(svgTextUtils.makeEditable) + el.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { if(traceIndex !== undefined) Plotly.restyle(gd, prop, text, traceIndex); else Plotly.relayout(gd, prop, text); @@ -120825,18 +121694,14 @@ Titles.draw = function(gd, titleClass, options) { .call(titleLayout); }) .on('input', function(d) { - this.text(d || ' ').attr(attributes) - .selectAll('tspan.line') - .attr(attributes); + this.text(d || ' ') + .call(svgTextUtils.positionText, attributes.x, attributes.y); }); } - else if(!txt || txt.match(/Click to enter .+ title/)) { - el.remove(); - } el.classed('js-placeholder', isplaceholder); }; -},{"../../constants/interactions":689,"../../lib":709,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/plots":811,"../color":590,"../drawing":614,"d3":118,"fast-isnumeric":127}],680:[function(require,module,exports){ +},{"../../constants/interactions":701,"../../lib":721,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/plots":823,"../color":600,"../drawing":624,"d3":120,"fast-isnumeric":129}],690:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -120857,7 +121722,7 @@ var buttonsAttrs = { method: { valType: 'enumerated', - values: ['restyle', 'relayout', 'animate', 'update'], + values: ['restyle', 'relayout', 'animate', 'update', 'skip'], dflt: 'restyle', @@ -120878,6 +121743,12 @@ var buttonsAttrs = { dflt: '', + }, + execute: { + valType: 'boolean', + + dflt: true, + } }; @@ -120983,7 +121854,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../../plots/font_attributes":772,"../../plots/pad_attributes":810,"../color/attributes":589}],681:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/font_attributes":784,"../../plots/pad_attributes":822,"../color/attributes":599}],691:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121030,9 +121901,6 @@ module.exports = { textPadX: 24, arrowPadX: 16, - // font size to height scale - fontSizeToHeight: 1.3, - // item rect radii rx: 2, ry: 2, @@ -121056,10 +121924,18 @@ module.exports = { activeColor: '#F4FAFF', // color given to hovered buttons - hoverColor: '#F4FAFF' + hoverColor: '#F4FAFF', + + // symbol for menu open arrow + arrowSymbol: { + left: '◄', + right: '►', + up: '▲', + down: '▼' + } }; -},{}],682:[function(require,module,exports){ +},{}],692:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121138,13 +122014,15 @@ function buttonsDefaults(menuIn, menuOut) { buttonIn = buttonsIn[i]; buttonOut = {}; - if(!Lib.isPlainObject(buttonIn) || !Array.isArray(buttonIn.args)) { + coerce('method'); + + if(!Lib.isPlainObject(buttonIn) || (buttonOut.method !== 'skip' && !Array.isArray(buttonIn.args))) { continue; } - coerce('method'); coerce('args'); coerce('label'); + coerce('execute'); buttonOut._index = i; buttonsOut.push(buttonOut); @@ -121153,7 +122031,7 @@ function buttonsDefaults(menuIn, menuOut) { return buttonsOut; } -},{"../../lib":709,"../../plots/array_container_defaults":745,"./attributes":680,"./constants":681}],683:[function(require,module,exports){ +},{"../../lib":721,"../../plots/array_container_defaults":757,"./attributes":690,"./constants":691}],693:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -121173,6 +122051,8 @@ var Drawing = require('../drawing'); var svgTextUtils = require('../../lib/svg_text_utils'); var anchorUtils = require('../legend/anchor_utils'); +var LINE_SPACING = require('../../constants/alignment').LINE_SPACING; + var constants = require('./constants'); var ScrollBox = require('./scrollbox'); @@ -121358,7 +122238,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { }; header - .call(drawItem, menuOpts, headerOpts) + .call(drawItem, menuOpts, headerOpts, gd) .call(setItemPosition, menuOpts, posOpts, positionOverrides); // draw drop arrow at the right edge @@ -121370,7 +122250,7 @@ function drawHeader(gd, gHeader, gButton, scrollBox, menuOpts) { .classed('user-select-none', true) .attr('text-anchor', 'end') .call(Drawing.font, menuOpts.font) - .text('▼'); + .text(constants.arrowSymbol[menuOpts.direction]); arrow.attr({ x: menuOpts.headerWidth - constants.arrowOffsetX + menuOpts.pad.l, @@ -121478,7 +122358,7 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { var button = d3.select(this); button - .call(drawItem, menuOpts, buttonOpts) + .call(drawItem, menuOpts, buttonOpts, gd) .call(setItemPosition, menuOpts, posOpts); button.on('click', function() { @@ -121487,7 +122367,9 @@ function drawButtons(gd, gHeader, gButton, scrollBox, menuOpts) { setActive(gd, menuOpts, buttonOpts, gHeader, gButton, scrollBox, buttonIndex); - Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + if(buttonOpts.execute) { + Plots.executeAPICommand(gd, buttonOpts.method, buttonOpts.args); + } gd.emit('plotly_buttonclicked', {menu: menuOpts, button: buttonOpts, active: menuOpts.active}); }); @@ -121588,9 +122470,9 @@ function hideScrollBox(scrollBox) { } } -function drawItem(item, menuOpts, itemOpts) { +function drawItem(item, menuOpts, itemOpts, gd) { item.call(drawItemRect, menuOpts) - .call(drawItemText, menuOpts, itemOpts); + .call(drawItemText, menuOpts, itemOpts, gd); } function drawItemRect(item, menuOpts) { @@ -121610,18 +122492,21 @@ function drawItemRect(item, menuOpts) { .style('stroke-width', menuOpts.borderwidth + 'px'); } -function drawItemText(item, menuOpts, itemOpts) { +function drawItemText(item, menuOpts, itemOpts, gd) { var text = item.selectAll('text') .data([0]); text.enter().append('text') .classed(constants.itemTextClassName, true) .classed('user-select-none', true) - .attr('text-anchor', 'start'); + .attr({ + 'text-anchor': 'start', + 'data-notex': 1 + }); text.call(Drawing.font, menuOpts.font) .text(itemOpts.label) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); } function styleButtons(buttons, menuOpts) { @@ -121672,19 +122557,18 @@ function findDimensions(gd, menuOpts) { fakeButtons.each(function(buttonOpts, i) { var button = d3.select(this); - button.call(drawItem, menuOpts, buttonOpts); + button.call(drawItem, menuOpts, buttonOpts, gd); - var text = button.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'); + var text = button.select('.' + constants.itemTextClassName); // width is given by max width of all buttons - var tWidth = text.node() && Drawing.bBox(text.node()).width, - wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); + var tWidth = text.node() && Drawing.bBox(text.node()).width; + var wEff = Math.max(tWidth + constants.textPadX, constants.minWidth); // height is determined by item text - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var hEff = Math.max(tHeight * tLines, constants.minHeight) + constants.textOffsetY; hEff = Math.ceil(hEff); wEff = Math.ceil(wEff); @@ -121778,34 +122662,29 @@ function findDimensions(gd, menuOpts) { // set item positions (mutates posOpts) function setItemPosition(item, menuOpts, posOpts, overrideOpts) { overrideOpts = overrideOpts || {}; - var rect = item.select('.' + constants.itemRectClassName), - text = item.select('.' + constants.itemTextClassName), - tspans = text.selectAll('tspan'), - borderWidth = menuOpts.borderwidth, - index = posOpts.index; + var rect = item.select('.' + constants.itemRectClassName); + var text = item.select('.' + constants.itemTextClassName); + var borderWidth = menuOpts.borderwidth; + var index = posOpts.index; Drawing.setTranslate(item, borderWidth + posOpts.x, borderWidth + posOpts.y); var isVertical = ['up', 'down'].indexOf(menuOpts.direction) !== -1; + var finalHeight = overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1); rect.attr({ x: 0, y: 0, width: overrideOpts.width || (isVertical ? menuOpts.width1 : menuOpts.widths[index]), - height: overrideOpts.height || (isVertical ? menuOpts.heights[index] : menuOpts.height1) + height: finalHeight }); - var tHeight = menuOpts.font.size * constants.fontSizeToHeight, - tLines = tspans[0].length || 1, - spanOffset = ((tLines - 1) * tHeight / 4); - - var textAttrs = { - x: constants.textOffsetX, - y: menuOpts.heights[index] / 2 - spanOffset + constants.textOffsetY - }; + var tHeight = menuOpts.font.size * LINE_SPACING; + var tLines = svgTextUtils.lineCount(text); + var spanOffset = ((tLines - 1) * tHeight / 2); - text.attr(textAttrs); - tspans.attr(textAttrs); + svgTextUtils.positionText(text, constants.textOffsetX, + finalHeight / 2 - spanOffset + constants.textOffsetY); if(isVertical) { posOpts.y += menuOpts.heights[index] + posOpts.yPad; @@ -121821,8 +122700,8 @@ function removeAllButtons(gButton) { } function clearPushMargins(gd) { - var pushMargins = gd._fullLayout._pushmargin || {}, - keys = Object.keys(pushMargins); + var pushMargins = gd._fullLayout._pushmargin || {}; + var keys = Object.keys(pushMargins); for(var i = 0; i < keys.length; i++) { var k = keys[i]; @@ -121833,9 +122712,9 @@ function clearPushMargins(gd) { } } -},{"../../lib/svg_text_utils":728,"../../plots/plots":811,"../color":590,"../drawing":614,"../legend/anchor_utils":640,"./constants":681,"./scrollbox":685,"d3":118}],684:[function(require,module,exports){ -arguments[4][678][0].apply(exports,arguments) -},{"./attributes":680,"./constants":681,"./defaults":682,"./draw":683,"dup":678}],685:[function(require,module,exports){ +},{"../../constants/alignment":696,"../../lib/svg_text_utils":740,"../../plots/plots":823,"../color":600,"../drawing":624,"../legend/anchor_utils":650,"./constants":691,"./scrollbox":695,"d3":120}],694:[function(require,module,exports){ +arguments[4][688][0].apply(exports,arguments) +},{"./attributes":690,"./constants":691,"./defaults":692,"./draw":693,"dup":688}],695:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122306,7 +123185,43 @@ ScrollBox.prototype.setTranslate = function setTranslate(translateX, translateY) } }; -},{"../../lib":709,"../color":590,"../drawing":614,"d3":118}],686:[function(require,module,exports){ +},{"../../lib":721,"../color":600,"../drawing":624,"d3":120}],696:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'; + +// fraction of some size to get to a named position +module.exports = { + // from bottom left: this is the origin of our paper-reference + // positioning system + FROM_BL: { + left: 0, + center: 0.5, + right: 1, + bottom: 0, + middle: 0.5, + top: 1 + }, + // from top left: this is the screen pixel positioning origin + FROM_TL: { + left: 0, + center: 0.5, + right: 1, + bottom: 1, + middle: 0.5, + top: 0 + }, + // multiple of fontSize to get the vertical offset between lines + LINE_SPACING: 1.3 +}; + +},{}],697:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122327,7 +123242,141 @@ module.exports = { longdashdot: [8, 1, 1, 1] }; -},{}],687:[function(require,module,exports){ +},{}],698:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 extendFlat = require('../lib/extend').extendFlat; + +var symbolsWithOpenSupport = { + 'circle': { + unicode: '●' + }, + 'square': { + unicode: '■' + }, + 'diamond': { + unicode: '◆' + }, + 'cross': { + unicode: '✚' + }, + 'x': { + unicode: '❌' + }, + 'triangle-up': { + unicode: '▲' + }, + 'triangle-down': { + unicode: '▼' + }, + 'triangle-left': { + unicode: '◄' + }, + 'triangle-right': { + unicode: '►' + }, + 'triangle-ne': { + unicode: '◥' + }, + 'triangle-nw': { + unicode: '◤' + }, + 'triangle-se': { + unicode: '◢' + }, + 'triangle-sw': { + unicode: '◣' + }, + 'pentagon': { + unicode: '⬟' + }, + 'hexagon': { + unicode: '⬢' + }, + 'hexagon2': { + unicode: '⬣' + }, + 'star': { + unicode: '★' + }, + 'diamond-tall': { + unicode: '♦' + }, + 'bowtie': { + unicode: '⧓' + }, + 'diamond-x': { + unicode: '❖' + }, + 'cross-thin': { + unicode: '+', + noBorder: true + }, + 'asterisk': { + unicode: '✳', + noBorder: true + }, + 'y-up': { + unicode: '⅄', + noBorder: true + }, + 'y-down': { + unicode: 'Y', + noBorder: true + }, + 'line-ew': { + unicode: '─', + noBorder: true + }, + 'line-ns': { + unicode: '│', + noBorder: true + } +}; + +var openSymbols = {}; +var keys = Object.keys(symbolsWithOpenSupport); + +for(var i = 0; i < keys.length; i++) { + var k = keys[i]; + openSymbols[k + '-open'] = extendFlat({}, symbolsWithOpenSupport[k]); +} + +var otherSymbols = { + 'circle-cross-open': { + unicode: '⨁', + noFill: true + }, + 'circle-x-open': { + unicode: '⨂', + noFill: true + }, + 'square-cross-open': { + unicode: '⊞', + noFill: true + }, + 'square-x-open': { + unicode: '⊠', + noFill: true + } +}; + +module.exports = extendFlat({}, + symbolsWithOpenSupport, + openSymbols, + otherSymbols +); + +},{"../lib/extend":713}],699:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122348,7 +123397,7 @@ module.exports = { longdashdot: [[0.5, 0.7, 0.8, 1], 10] }; -},{}],688:[function(require,module,exports){ +},{}],700:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122371,7 +123420,7 @@ module.exports = { x: '❌' }; -},{}],689:[function(require,module,exports){ +},{}],701:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122395,7 +123444,7 @@ module.exports = { DBLCLICKDELAY: 300 }; -},{}],690:[function(require,module,exports){ +},{}],702:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122448,7 +123497,7 @@ module.exports = { ALMOST_EQUAL: 1 - 1e-6 }; -},{}],691:[function(require,module,exports){ +},{}],703:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122486,7 +123535,7 @@ module.exports = { }; -},{}],692:[function(require,module,exports){ +},{}],704:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122510,7 +123559,7 @@ exports.svgAttrs = { 'xmlns:xlink': exports.xlink }; -},{}],693:[function(require,module,exports){ +},{}],705:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122528,7 +123577,7 @@ exports.svgAttrs = { var Plotly = require('./plotly'); // package version injected by `npm run preprocess` -exports.version = '1.27.1'; +exports.version = '1.28.0'; // inject promise polyfill require('es6-promise').polyfill(); @@ -122569,6 +123618,7 @@ exports.register([ require('./components/fx'), require('./components/legend'), require('./components/annotations'), + require('./components/annotations3d'), require('./components/shapes'), require('./components/images'), require('./components/updatemenus'), @@ -122590,7 +123640,7 @@ exports.Queue = require('./lib/queue'); // export d3 used in the bundle exports.d3 = require('d3'); -},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":586,"./components/fx":631,"./components/images":639,"./components/legend":647,"./components/rangeselector":659,"./components/rangeslider":665,"./components/shapes":672,"./components/sliders":678,"./components/updatemenus":684,"./fonts/mathjax_config":694,"./lib/queue":721,"./plot_api/plot_schema":737,"./plot_api/register":738,"./plot_api/set_plot_config":739,"./plot_api/to_image":741,"./plot_api/validate":742,"./plotly":743,"./snapshot":831,"./snapshot/download":828,"./traces/scatter":1018,"d3":118,"es6-promise":124}],694:[function(require,module,exports){ +},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":591,"./components/annotations3d":596,"./components/fx":641,"./components/images":649,"./components/legend":657,"./components/rangeselector":669,"./components/rangeslider":675,"./components/shapes":682,"./components/sliders":688,"./components/updatemenus":694,"./fonts/mathjax_config":706,"./lib/queue":733,"./plot_api/plot_schema":749,"./plot_api/register":750,"./plot_api/set_plot_config":751,"./plot_api/to_image":753,"./plot_api/validate":754,"./plotly":755,"./snapshot":843,"./snapshot/download":840,"./traces/scatter":1032,"d3":120,"es6-promise":126}],706:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122623,7 +123673,7 @@ if(typeof MathJax !== 'undefined') { exports.MathJax = false; } -},{}],695:[function(require,module,exports){ +},{}],707:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122640,7 +123690,7 @@ module.exports = function arrayToCalcItem(traceAttr, calcItem, calcAttr, i) { if(Array.isArray(traceAttr)) calcItem[calcAttr] = traceAttr[i]; }; -},{}],696:[function(require,module,exports){ +},{}],708:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122673,7 +123723,7 @@ module.exports = function cleanNumber(v) { return BADNUM; }; -},{"../constants/numerical":690,"fast-isnumeric":127}],697:[function(require,module,exports){ +},{"../constants/numerical":702,"fast-isnumeric":129}],709:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -122688,6 +123738,7 @@ module.exports = function cleanNumber(v) { var isNumeric = require('fast-isnumeric'); var tinycolor = require('tinycolor2'); +var baseTraceAttrs = require('../plots/attributes'); var getColorscale = require('../components/colorscale/get_scale'); var colorscaleNames = Object.keys(require('../components/colorscale/scales')); var nestedProperty = require('./nested_property'); @@ -122713,6 +123764,20 @@ exports.valObjects = { if(opts.coerceNumber) v = +v; if(opts.values.indexOf(v) === -1) propOut.set(dflt); else propOut.set(v); + }, + validateFunction: function(v, opts) { + if(opts.coerceNumber) v = +v; + + var values = opts.values; + for(var i = 0; i < values.length; i++) { + var k = String(values[i]); + + if((k.charAt(0) === '/' && k.charAt(k.length - 1) === '/')) { + var regex = new RegExp(k.substr(1, k.length - 2)); + if(regex.test(v)) return true; + } else if(v === values[i]) return true; + } + return false; } }, 'boolean': { @@ -122965,6 +124030,35 @@ exports.coerceFont = function(coerce, attr, dfltObj) { return out; }; +/** Coerce shortcut for 'hoverinfo' + * handling 1-vs-multi-trace dflt logic + * + * @param {object} traceIn : user trace object + * @param {object} traceOut : full trace object (requires _module ref) + * @param {object} layoutOut : full layout object (require _dataLength ref) + * @return {any} : the coerced value + */ +exports.coerceHoverinfo = function(traceIn, traceOut, layoutOut) { + var moduleAttrs = traceOut._module.attributes; + var attrs = moduleAttrs.hoverinfo ? + {hoverinfo: moduleAttrs.hoverinfo} : + baseTraceAttrs; + + var valObj = attrs.hoverinfo; + var dflt; + + if(layoutOut._dataLength === 1) { + var flags = valObj.dflt === 'all' ? + valObj.flags.slice() : + valObj.dflt.split('+'); + + flags.splice(flags.indexOf('name'), 1); + dflt = flags.join('+'); + } + + return exports.coerce(traceIn, traceOut, attrs, 'hoverinfo', dflt); +}; + exports.validate = function(value, opts) { var valObject = exports.valObjects[opts.valType]; @@ -122984,7 +124078,7 @@ exports.validate = function(value, opts) { return out !== failed; }; -},{"../components/colorscale/get_scale":602,"../components/colorscale/scales":608,"./nested_property":715,"fast-isnumeric":127,"tinycolor2":526}],698:[function(require,module,exports){ +},{"../components/colorscale/get_scale":612,"../components/colorscale/scales":618,"../plots/attributes":758,"./nested_property":727,"fast-isnumeric":129,"tinycolor2":530}],710:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123612,7 +124706,7 @@ exports.findExactDates = function(data, calendar) { }; }; -},{"../constants/numerical":690,"../registry":826,"./loggers":712,"./mod":714,"d3":118,"fast-isnumeric":127}],699:[function(require,module,exports){ +},{"../constants/numerical":702,"../registry":838,"./loggers":724,"./mod":726,"d3":120,"fast-isnumeric":129}],711:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123641,7 +124735,7 @@ module.exports = function ensureArray(out, n) { return out; }; -},{}],700:[function(require,module,exports){ +},{}],712:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123807,7 +124901,7 @@ var Events = { module.exports = Events; -},{"events":125}],701:[function(require,module,exports){ +},{"events":127}],713:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123921,7 +125015,7 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) { return target; } -},{"./is_plain_object.js":711}],702:[function(require,module,exports){ +},{"./is_plain_object.js":723}],714:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -123972,7 +125066,7 @@ module.exports = function filterUnique(array) { return out; }; -},{}],703:[function(require,module,exports){ +},{}],715:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124003,7 +125097,7 @@ module.exports = function filterVisible(container) { return out; }; -},{}],704:[function(require,module,exports){ +},{}],716:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124065,7 +125159,7 @@ function countryNameToISO3(countryName) { return false; } -},{"../lib":709,"country-regex":103}],705:[function(require,module,exports){ +},{"../lib":721,"country-regex":105}],717:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124202,7 +125296,7 @@ exports.makeBlank = function() { }; }; -},{"../constants/numerical":690}],706:[function(require,module,exports){ +},{"../constants/numerical":702}],718:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124290,7 +125384,7 @@ function formatColor(containerIn, opacityIn, len) { module.exports = formatColor; -},{"../components/color/attributes":589,"../components/colorscale":604,"color-rgba":91,"fast-isnumeric":127}],707:[function(require,module,exports){ +},{"../components/color/attributes":599,"../components/colorscale":614,"color-rgba":93,"fast-isnumeric":129}],719:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124359,7 +125453,7 @@ function convertHTMLToUnicode(html) { module.exports = convertHTMLToUnicode; -},{"../constants/string_mappings":691,"superscript-text":522}],708:[function(require,module,exports){ +},{"../constants/string_mappings":703,"superscript-text":526}],720:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124375,7 +125469,7 @@ module.exports = convertHTMLToUnicode; module.exports = function identity(d) { return d; }; -},{}],709:[function(require,module,exports){ +},{}],721:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -124388,6 +125482,11 @@ module.exports = function identity(d) { return d; }; 'use strict'; var d3 = require('d3'); +var isNumeric = require('fast-isnumeric'); + +var numConstants = require('../constants/numerical'); +var FP_SAFE = numConstants.FP_SAFE; +var BADNUM = numConstants.BADNUM; var lib = module.exports = {}; @@ -124404,6 +125503,7 @@ lib.valObjects = coerceModule.valObjects; lib.coerce = coerceModule.coerce; lib.coerce2 = coerceModule.coerce2; lib.coerceFont = coerceModule.coerceFont; +lib.coerceHoverinfo = coerceModule.coerceHoverinfo; lib.validate = coerceModule.validate; var datesModule = require('./dates'); @@ -124465,6 +125565,13 @@ lib.pushUnique = require('./push_unique'); lib.cleanNumber = require('./clean_number'); +lib.ensureNumber = 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; +}; + lib.noop = require('./noop'); lib.identity = require('./identity'); @@ -124715,6 +125822,15 @@ lib.noneOrAll = function(containerIn, containerOut, attrList) { } }; +/** merges calcdata field (given by cdAttr) with traceAttr values + * + * N.B. Loop over minimum of cd.length and traceAttr.length + * i.e. it does not try to fill in beyond traceAttr.length-1 + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + */ lib.mergeArray = function(traceAttr, cd, cdAttr) { if(Array.isArray(traceAttr)) { var imax = Math.min(traceAttr.length, cd.length); @@ -124722,6 +125838,51 @@ lib.mergeArray = function(traceAttr, cd, cdAttr) { } }; +/** fills calcdata field (given by cdAttr) with traceAttr values + * or function of traceAttr values (e.g. some fallback) + * + * N.B. Loops over all cd items. + * + * @param {array} traceAttr : trace attribute + * @param {object} cd : calcdata trace + * @param {string} cdAttr : calcdata key + * @param {function} [fn] : optional function to apply to each array item + */ +lib.fillArray = function(traceAttr, cd, cdAttr, fn) { + fn = fn || lib.identity; + + if(Array.isArray(traceAttr)) { + for(var i = 0; i < cd.length; i++) { + cd[i][cdAttr] = fn(traceAttr[i]); + } + } +}; + +/** Handler for trace-wide vs per-point options + * + * @param {object} trace : (full) trace object + * @param {number} ptNumber : index of the point in question + * @param {string} astr : attribute string + * @param {function} [fn] : optional function to apply to each array item + * + * @return {any} + */ +lib.castOption = function(trace, ptNumber, astr, fn) { + fn = fn || lib.identity; + + var val = lib.nestedProperty(trace, astr).get(); + + if(Array.isArray(val)) { + if(Array.isArray(ptNumber) && Array.isArray(val[ptNumber[0]])) { + return fn(val[ptNumber[0]][ptNumber[1]]); + } else { + return fn(val[ptNumber]); + } + } else { + return val; + } +}; + /** Returns target as set by 'target' transform attribute * * @param {object} trace : full trace object @@ -124762,7 +125923,7 @@ lib.minExtend = function(obj1, obj2) { for(i = 0; i < keys.length; i++) { k = keys[i]; v = obj1[k]; - if(k.charAt(0) === '_' || typeof v === 'function') continue; + if(k.charAt(0) === '_' || typeof v === 'function' || k === 'glTrace') continue; else if(k === 'module') objOut[k] = v; else if(Array.isArray(v)) objOut[k] = v.slice(0, arrayLen); else if(v && (typeof v === 'object')) objOut[k] = lib.minExtend(obj1[k], obj2[k]); @@ -124792,13 +125953,6 @@ lib.containsAny = function(s, fragments) { return false; }; -// get the parent Plotly plot of any element. Whoo jquery-free tree climbing! -lib.getPlotDiv = function(el) { - for(; el && el.removeAttribute; el = el.parentNode) { - if(lib.isPlotDiv(el)) return el; - } -}; - lib.isPlotDiv = function(el) { var el3 = d3.select(el); return el3.node() instanceof HTMLElement && @@ -125039,7 +126193,7 @@ lib.numSeparate = function(value, separators, separatethousands) { return x1 + x2; }; -},{"./clean_number":696,"./coerce":697,"./dates":698,"./ensure_array":699,"./extend":701,"./filter_unique":702,"./filter_visible":703,"./identity":708,"./is_array":710,"./is_plain_object":711,"./loggers":712,"./matrix":713,"./mod":714,"./nested_property":715,"./noop":716,"./notifier":717,"./push_unique":720,"./relink_private":722,"./search":723,"./stats":726,"./to_log_range":729,"d3":118}],710:[function(require,module,exports){ +},{"../constants/numerical":702,"./clean_number":708,"./coerce":709,"./dates":710,"./ensure_array":711,"./extend":713,"./filter_unique":714,"./filter_visible":715,"./identity":720,"./is_array":722,"./is_plain_object":723,"./loggers":724,"./matrix":725,"./mod":726,"./nested_property":727,"./noop":728,"./notifier":729,"./push_unique":732,"./relink_private":734,"./search":735,"./stats":738,"./to_log_range":741,"d3":120,"fast-isnumeric":129}],722:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125063,7 +126217,7 @@ module.exports = function isArray(a) { return Array.isArray(a) || ab.isView(a); }; -},{}],711:[function(require,module,exports){ +},{}],723:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125092,7 +126246,7 @@ module.exports = function isPlainObject(obj) { ); }; -},{}],712:[function(require,module,exports){ +},{}],724:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125166,7 +126320,7 @@ function apply(f, args) { } } -},{"../plot_api/plot_config":736}],713:[function(require,module,exports){ +},{"../plot_api/plot_config":748}],725:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125276,7 +126430,7 @@ exports.apply2DTransform2 = function(transform) { }; }; -},{}],714:[function(require,module,exports){ +},{}],726:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125296,7 +126450,7 @@ module.exports = function mod(v, d) { return out < 0 ? out + d : out; }; -},{}],715:[function(require,module,exports){ +},{}],727:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125600,7 +126754,7 @@ function badContainer(container, propStr, propParts) { }; } -},{"../plot_api/container_array_match":732,"./is_array":710,"./is_plain_object":711,"fast-isnumeric":127}],716:[function(require,module,exports){ +},{"../plot_api/container_array_match":744,"./is_array":722,"./is_plain_object":723,"fast-isnumeric":129}],728:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125616,7 +126770,7 @@ function badContainer(container, propStr, propParts) { module.exports = function noop() {}; -},{}],717:[function(require,module,exports){ +},{}],729:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125698,7 +126852,7 @@ module.exports = function(text, displayLength) { }); }; -},{"d3":118,"fast-isnumeric":127}],718:[function(require,module,exports){ +},{"d3":120,"fast-isnumeric":129}],730:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125747,7 +126901,7 @@ module.exports = function overrideCursor(el3, csr) { } }; -},{"./setcursor":724}],719:[function(require,module,exports){ +},{"./setcursor":736}],731:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -125988,7 +127142,7 @@ polygon.filter = function filter(pts, tolerance) { }; }; -},{"../constants/numerical":690,"./matrix":713}],720:[function(require,module,exports){ +},{"../constants/numerical":702,"./matrix":725}],732:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126026,7 +127180,7 @@ module.exports = function pushUnique(array, item) { return array; }; -},{}],721:[function(require,module,exports){ +},{}],733:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126237,7 +127391,7 @@ queue.plotDo = function(gd, func, args) { module.exports = queue; -},{"../lib":709,"../plot_api/plot_config":736}],722:[function(require,module,exports){ +},{"../lib":721,"../plot_api/plot_config":748}],734:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126294,7 +127448,7 @@ module.exports = function relinkPrivateKeys(toContainer, fromContainer) { } }; -},{"./is_array":710,"./is_plain_object":711}],723:[function(require,module,exports){ +},{"./is_array":722,"./is_plain_object":723}],735:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126405,7 +127559,7 @@ exports.roundUp = function(val, arrayIn, reverse) { return arrayIn[low]; }; -},{"./loggers":712,"fast-isnumeric":127}],724:[function(require,module,exports){ +},{"./loggers":724,"fast-isnumeric":129}],736:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126428,7 +127582,7 @@ module.exports = function setCursor(el3, csr) { if(csr) el3.classed('cursor-' + csr, true); }; -},{}],725:[function(require,module,exports){ +},{}],737:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126477,7 +127631,7 @@ module.exports = function showWebGlMsg(scene) { return false; }; -},{"../components/color":590}],726:[function(require,module,exports){ +},{"../components/color":600}],738:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126573,7 +127727,7 @@ exports.interp = function(arr, n) { return frac * arr[Math.ceil(n)] + (1 - frac) * arr[Math.floor(n)]; }; -},{"fast-isnumeric":127}],727:[function(require,module,exports){ +},{"fast-isnumeric":129}],739:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126594,7 +127748,7 @@ function str2RgbaArray(color) { module.exports = str2RgbaArray; -},{"color-rgba":91}],728:[function(require,module,exports){ +},{"color-rgba":93}],740:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -126613,62 +127767,7 @@ var d3 = require('d3'); var Lib = require('../lib'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); var stringMappings = require('../constants/string_mappings'); - -var DOM_PARSER; - -exports.getDOMParser = function() { - if(DOM_PARSER) { - return DOM_PARSER; - } else if(window.DOMParser) { - DOM_PARSER = new window.DOMParser(); - return DOM_PARSER; - } else { - throw new Error('Cannot initialize DOMParser'); - } -}; - -// Append SVG - -d3.selection.prototype.appendSVG = function(_svgString) { - var skeleton = [ - '', - _svgString, - '' - ].join(''); - - var domParser = exports.getDOMParser(); - var dom = domParser.parseFromString(skeleton, 'application/xml'); - var childNode = dom.documentElement.firstChild; - - while(childNode) { - this.node().appendChild(this.node().ownerDocument.importNode(childNode, true)); - childNode = childNode.nextSibling; - } - if(dom.querySelector('parsererror')) { - Lib.log(dom.querySelector('parsererror div').textContent); - return null; - } - return d3.select(this.node().lastChild); -}; - -// Text utilities - -exports.html_entity_decode = function(s) { - var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); - var replaced = s.replace(/(&[^;]*;)/gi, function(d) { - if(d === '<') { return '<'; } // special handling for brackets - if(d === '&rt;') { return '>'; } - if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } - return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode - }); - hiddenDiv.remove(); - return replaced; -}; - -exports.xml_entity_encode = function(str) { - return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); -}; +var LINE_SPACING = require('../constants/alignment').LINE_SPACING; // text converter @@ -126676,42 +127775,44 @@ function getSize(_selection, _dimension) { return _selection.node().getBoundingClientRect()[_dimension]; } -exports.convertToTspans = function(_context, _callback) { +var FIND_TEX = /([^$]*)([$]+[^$]*[$]+)([^$]*)/; + +exports.convertToTspans = function(_context, gd, _callback) { var str = _context.text(); - var converted = convertToSVG(str); - var that = _context; // Until we get tex integrated more fully (so it can be used along with non-tex) // allow some elements to prohibit it by attaching 'data-notex' to the original - var tex = (!that.attr('data-notex')) && converted.match(/([^$]*)([$]+[^$]*[$]+)([^$]*)/); - var result = str; - var parent = d3.select(that.node().parentNode); + var tex = (!_context.attr('data-notex')) && + (typeof MathJax !== 'undefined') && + str.match(FIND_TEX); + + var parent = d3.select(_context.node().parentNode); if(parent.empty()) return; - var svgClass = (that.attr('class')) ? that.attr('class').split(' ')[0] : 'text'; + var svgClass = (_context.attr('class')) ? _context.attr('class').split(' ')[0] : 'text'; svgClass += '-math'; parent.selectAll('svg.' + svgClass).remove(); parent.selectAll('g.' + svgClass + '-group').remove(); - _context.style({visibility: null}); - for(var up = _context.node(); up && up.removeAttribute; up = up.parentNode) { - up.removeAttribute('data-bb'); - } + _context.style('display', null) + .attr({ + // some callers use data-unformatted *from the element* in 'cancel' + // so we need it here even if we're going to turn it into math + // these two (plus style and text-anchor attributes) form the key we're + // going to use for Drawing.bBox + 'data-unformatted': str, + 'data-math': 'N' + }); function showText() { if(!parent.empty()) { - svgClass = that.attr('class') + '-math'; + svgClass = _context.attr('class') + '-math'; parent.select('svg.' + svgClass).remove(); } _context.text('') - .style({ - visibility: 'inherit', - 'white-space': 'pre' - }); - - result = _context.appendSVG(converted); + .style('white-space', 'pre'); - if(!result) _context.text(str); + var hasLink = buildSVGText(_context.node(), str); - if(_context.select('a').size()) { + if(hasLink) { // at least in Chrome, pointer-events does not seem // to be honored in children of elements // so if we have an anchor, we have to make the @@ -126719,14 +127820,15 @@ exports.convertToTspans = function(_context, _callback) { _context.style('pointer-events', 'all'); } - if(_callback) _callback.call(that); + exports.positionText(_context); + + if(_callback) _callback.call(_context); } if(tex) { - 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)}; + _context.style('display', 'none'); + var config = {fontSize: parseInt(_context.style('font-size'), 10)}; texToSVG(tex[2], config, function(_svgEl, _glyphDefs, _svgBBox) { parent.selectAll('svg.' + svgClass).remove(); @@ -126741,7 +127843,11 @@ exports.convertToTspans = function(_context, _callback) { var mathjaxGroup = parent.append('g') .classed(svgClass + '-group', true) - .attr({'pointer-events': 'none'}); + .attr({ + 'pointer-events': 'none', + 'data-unformatted': str, + 'data-math': 'Y' + }); mathjaxGroup.node().appendChild(newSvg.node()); @@ -126758,36 +127864,36 @@ exports.convertToTspans = function(_context, _callback) { }) .style({overflow: 'visible', 'pointer-events': 'none'}); - var fill = that.style('fill') || 'black'; + var fill = _context.style('fill') || 'black'; newSvg.select('g').attr({fill: fill, stroke: fill}); var newSvgW = getSize(newSvg, 'width'), newSvgH = getSize(newSvg, 'height'), - newX = +that.attr('x') - newSvgW * - {start: 0, middle: 0.5, end: 1}[that.attr('text-anchor') || 'start'], + newX = +_context.attr('x') - newSvgW * + {start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'], // font baseline is about 1/4 fontSize below centerline - textHeight = parseInt(that.style('font-size'), 10) || - getSize(that, 'height'), + textHeight = parseInt(_context.style('font-size'), 10) || + getSize(_context, 'height'), dy = -textHeight / 4; if(svgClass[0] === 'y') { mathjaxGroup.attr({ - transform: 'rotate(' + [-90, +that.attr('x'), +that.attr('y')] + + transform: 'rotate(' + [-90, +_context.attr('x'), +_context.attr('y')] + ') translate(' + [-newSvgW / 2, dy - newSvgH / 2] + ')' }); - newSvg.attr({x: +that.attr('x'), y: +that.attr('y')}); + newSvg.attr({x: +_context.attr('x'), y: +_context.attr('y')}); } else if(svgClass[0] === 'l') { - newSvg.attr({x: that.attr('x'), y: dy - (newSvgH / 2)}); + newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)}); } else if(svgClass[0] === 'a') { newSvg.attr({x: 0, y: dy}); } else { - newSvg.attr({x: newX, y: (+that.attr('y') + dy - newSvgH / 2)}); + newSvg.attr({x: newX, y: (+_context.attr('y') + dy - newSvgH / 2)}); } - if(_callback) _callback.call(that, mathjaxGroup); + if(_callback) _callback.call(_context, mathjaxGroup); resolve(mathjaxGroup); }); })); @@ -126800,9 +127906,12 @@ exports.convertToTspans = function(_context, _callback) { // MathJax +var LT_MATCH = /(<|<|<)/g; +var GT_MATCH = /(>|>|>)/g; + function cleanEscapesForTex(s) { - return s.replace(/(<|<|<)/g, '\\lt ') - .replace(/(>|>|>)/g, '\\gt '); + return s.replace(LT_MATCH, '\\lt ') + .replace(GT_MATCH, '\\gt '); } function texToSVG(_texString, _config, _callback) { @@ -126833,23 +127942,35 @@ var TAG_STYLES = { // would like to use baseline-shift for sub/sup but FF doesn't support it // so we need to use dy along with the uber hacky shift-back-to // baseline below - sup: 'font-size:70%" dy="-0.6em', - sub: 'font-size:70%" dy="0.3em', + sup: 'font-size:70%', + sub: 'font-size:70%', b: 'font-weight:bold', i: 'font-style:italic', a: 'cursor:pointer', span: '', - br: '', em: 'font-style:italic;font-weight:bold' }; -// sub/sup: extra tspan with zero-width space to get back to the right baseline -var TAG_CLOSE = { - sup: '', - sub: '' +// baseline shifts for sub and sup +var SHIFT_DY = { + sub: '0.3em', + sup: '-0.6em' }; +// reset baseline by adding a tspan (empty except for a zero-width space) +// with dy of -70% * SHIFT_DY (because font-size=70%) +var RESET_DY = { + sub: '-0.21em', + sup: '0.42em' +}; +var ZERO_WIDTH_SPACE = '\u200b'; -var PROTOCOLS = ['http:', 'https:', 'mailto:']; +/* + * Whitelist of protocols in user-supplied urls. Mostly we want to avoid javascript + * and related attack vectors. The empty items are there for IE, that in various + * versions treats relative paths as having different flavors of no protocol, while + * other browsers have these explicitly inherit the protocol of the page they're in. + */ +var PROTOCOLS = ['http:', 'https:', 'mailto:', '', undefined, ':']; var STRIP_TAGS = new RegExp(']*)?/?>', 'g'); @@ -126860,24 +127981,43 @@ var ENTITY_TO_UNICODE = Object.keys(stringMappings.entityToUnicode).map(function }; }); -var UNICODE_TO_ENTITY = Object.keys(stringMappings.unicodeToEntity).map(function(k) { - return { - regExp: new RegExp(k, 'g'), - sub: '&' + stringMappings.unicodeToEntity[k] + ';' - }; -}); - var NEWLINES = /(\r\n?|\n)/g; var SPLIT_TAGS = /(<[^<>]*>)/; var ONE_TAG = /<(\/?)([^ >]*)(\s+(.*))?>/i; -// Style and href: pull them out of either single or double quotes. -// Because we hack in other attributes with style (sub & sup), drop any trailing -// semicolon in user-supplied styles so we can consistently append the tag-dependent style +var BR_TAG = //i; + +/* + * style and href: pull them out of either single or double quotes. Also + * - target: (_blank|_self|_parent|_top|framename) + * note that you can't use target to get a popup but if you use popup, + * a `framename` will be passed along as the name of the popup window. + * per the spec, cannot contain whitespace. + * for backward compatibility we default to '_blank' + * - popup: a custom one for us to enable popup (new window) links. String + * for window.open -> strWindowFeatures, like 'menubar=yes,width=500,height=550' + * note that at least in Chrome, you need to give at least one property + * in this string or the page will open in a new tab anyway. We follow this + * convention and will not make a popup if this string is empty. + * per the spec, cannot contain whitespace. + * + * Because we hack in other attributes with style (sub & sup), drop any trailing + * semicolon in user-supplied styles so we can consistently append the tag-dependent style + */ var STYLEMATCH = /(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i; var HREFMATCH = /(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i; +var TARGETMATCH = /(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; +var POPUPMATCH = /(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i; + +// dedicated matcher for these quoted regexes, that can return their results +// in two different places +function getQuotedMatch(_str, re) { + if(!_str) return null; + var match = _str.match(re); + return match && (match[3] || match[4]); +} var COLORMATCH = /(^|;)\s*color:/; @@ -126888,26 +128028,32 @@ exports.plainText = function(_str) { }; function replaceFromMapObject(_str, list) { - var out = _str || ''; + if(!_str) return ''; for(var i = 0; i < list.length; i++) { var item = list[i]; - out = out.replace(item.regExp, item.sub); + _str = _str.replace(item.regExp, item.sub); } - return out; + return _str; } function convertEntities(_str) { return replaceFromMapObject(_str, ENTITY_TO_UNICODE); } -function encodeForHTML(_str) { - return replaceFromMapObject(_str, UNICODE_TO_ENTITY); -} - -function convertToSVG(_str) { - _str = convertEntities(_str) +/* + * buildSVGText: convert our pseudo-html into SVG tspan elements, and attach these + * to containerNode + * + * @param {svg text element} containerNode: the node to insert this text into + * @param {string} str: the pseudo-html string to convert to svg + * + * @returns {bool}: does the result contain any links? We need to handle the text element + * somewhat differently if it does, so just keep track of this when it happens. + */ +function buildSVGText(containerNode, str) { + str = convertEntities(str) /* * Normalize behavior between IE and others wrt newlines and whitespace:pre * this combination makes IE barf https://github.com/plotly/plotly.js/issues/746 @@ -126917,122 +128063,197 @@ function convertToSVG(_str) { */ .replace(NEWLINES, ' '); - var result = _str - .split(SPLIT_TAGS).map(function(d) { - var match = d.match(ONE_TAG); - var tag = match && match[2].toLowerCase(); - var tagStyle = TAG_STYLES[tag]; - - if(tagStyle !== undefined) { - var isClose = match[1]; - if(isClose) return (tag === 'a' ? '' : '') + (TAG_CLOSE[tag] || ''); - - // break: later we'll turn these into newline s - // but we need to know about all the other tags first - if(tag === 'br') return '
'; - - /** - * extra includes href and any random extra css (that's supported by svg) - * use this like to change font in the middle - * - * at one point we supported but as this isn't even - * valid HTML anymore and we dropped it accidentally for many months, we will not - * resurrect it. - */ - var extra = match[4]; + var hasLink = false; - var out; + // as we're building the text, keep track of what elements we're nested inside + // nodeStack will be an array of {node, type, style, href, target, popup} + // where only type: 'a' gets the last 3 and node is only added when it's created + var nodeStack = []; + var currentNode; + var currentLine = -1; - // anchor is the only tag that doesn't turn into a tspan - if(tag === 'a') { - var hrefMatch = extra && extra.match(HREFMATCH); - var href = hrefMatch && (hrefMatch[3] || hrefMatch[4]); + function newLine() { + currentLine++; - out = ' 1) { + for(var i = 1; i < oldNodeStack.length; i++) { + enterNode(oldNodeStack[i]); + } + } + } + + function enterNode(nodeSpec) { + var type = nodeSpec.type; + var nodeAttrs = {}; + var nodeType; + + if(type === 'a') { + nodeType = 'a'; + var target = nodeSpec.target; + var href = nodeSpec.href; + var popup = nodeSpec.popup; + if(href) { + nodeAttrs = { + 'xlink:xlink:show': (target === '_blank' || target.charAt(0) !== '_') ? 'new' : 'replace', + target: target, + 'xlink:xlink:href': href + }; + if(popup) { + nodeAttrs.onclick = 'window.open("' + href + '","' + target + '","' + + popup + '");return false;'; } + } + } + else nodeType = 'tspan'; + + if(nodeSpec.style) nodeAttrs.style = nodeSpec.style; + + var newNode = document.createElementNS(xmlnsNamespaces.svg, nodeType); + + if(type === 'sup' || type === 'sub') { + addTextNode(currentNode, ZERO_WIDTH_SPACE); + currentNode.appendChild(newNode); + + var resetter = document.createElementNS(xmlnsNamespaces.svg, 'tspan'); + addTextNode(resetter, ZERO_WIDTH_SPACE); + d3.select(resetter).attr('dy', RESET_DY[type]); + nodeAttrs.dy = SHIFT_DY[type]; + + currentNode.appendChild(newNode); + currentNode.appendChild(resetter); + } + else { + currentNode.appendChild(newNode); + } + + d3.select(newNode).attr(nodeAttrs); + + currentNode = nodeSpec.node = newNode; + nodeStack.push(nodeSpec); + } + + function addTextNode(node, text) { + node.appendChild(document.createTextNode(text)); + } + + function exitNode(type) { + var innerNode = nodeStack.pop(); + if(type !== innerNode.type) { + Lib.log('Start tag <' + innerNode.type + '> doesnt match end tag <' + + type + '>. Pretending it did match.', str); + } + currentNode = nodeStack[nodeStack.length - 1].node; + } + + var hasLines = BR_TAG.test(str); + + if(hasLines) newLine(); + else { + currentNode = containerNode; + nodeStack = [{node: containerNode}]; + } + + var parts = str.split(SPLIT_TAGS); + for(var i = 0; i < parts.length; i++) { + var parti = parts[i]; + var match = parti.match(ONE_TAG); + var tagType = match && match[2].toLowerCase(); + var tagStyle = TAG_STYLES[tagType]; + + if(tagType === 'br') { + newLine(); + } + else if(tagStyle === undefined) { + addTextNode(currentNode, parti); + } + else { + // tag - open or close + if(match[1]) { + exitNode(tagType); + } + else { + var extra = match[4]; + + var nodeSpec = {type: tagType}; // now add style, from both the tag name and any extra css // Most of the svg css that users will care about is just like html, // but font color is different (uses fill). Let our users ignore this. - var cssMatch = extra && extra.match(STYLEMATCH); - var css = cssMatch && (cssMatch[3] || cssMatch[4]); + var css = getQuotedMatch(extra, STYLEMATCH); if(css) { - css = encodeForHTML(css.replace(COLORMATCH, '$1 fill:')); + css = css.replace(COLORMATCH, '$1 fill:'); if(tagStyle) css += ';' + tagStyle; } else if(tagStyle) css = tagStyle; - if(css) return out + ' style="' + css + '">'; + if(css) nodeSpec.style = css; - return out + '>'; - } - else { - return exports.xml_entity_encode(d).replace(/ which isn't a tspan even now!) - // we should really do this in a type-aware way *before* converting to tspans. - var indices = []; - for(var index = result.indexOf('
'); index > 0; index = result.indexOf('
', index + 1)) { - indices.push(index); - } - var count = 0; - indices.forEach(function(d) { - var brIndex = d + count; - var search = result.slice(0, brIndex); - var previousOpenTag = ''; - for(var i2 = search.length - 1; i2 >= 0; i2--) { - var isTag = search[i2].match(/<(\/?).*>/i); - if(isTag && search[i2] !== '
') { - if(!isTag[1]) previousOpenTag = search[i2]; - break; + var href = getQuotedMatch(extra, HREFMATCH); + + if(href) { + // check safe protocols + var dummyAnchor = document.createElement('a'); + dummyAnchor.href = href; + if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) { + nodeSpec.href = href; + nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank'; + nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH); + } + } + } + + enterNode(nodeSpec); } } - if(previousOpenTag) { - result.splice(brIndex + 1, 0, previousOpenTag); - result.splice(brIndex, 0, '
'); - count += 2; - } - }); - - var joined = result.join(''); - var splitted = joined.split(/
/gi); - if(splitted.length > 1) { - result = splitted.map(function(d, i) { - // TODO: figure out max font size of this line and alter dy - // this requires either: - // 1) bringing the base font size into convertToTspans, or - // 2) only allowing relative percentage font sizes. - // I think #2 is the way to go - return '' + d + ''; - }); } - return result.join(''); + return hasLink; } +exports.lineCount = function lineCount(s) { + return s.selectAll('tspan.line').size() || 1; +}; + +exports.positionText = function positionText(s, x, y) { + return s.each(function() { + var text = d3.select(this); + + function setOrGet(attr, val) { + if(val === undefined) { + val = text.attr(attr); + if(val === null) { + text.attr(attr, 0); + val = 0; + } + } + else text.attr(attr, val); + return val; + } + + var thisX = setOrGet('x', x); + var thisY = setOrGet('y', y); + + if(this.nodeName === 'text') { + text.selectAll('tspan.line').attr({x: thisX, y: thisY}); + } + }); +}; + function alignHTMLWith(_base, container, options) { var alignH = options.horizontalAlign, alignV = options.verticalAlign || 'top', @@ -127069,28 +128290,41 @@ function alignHTMLWith(_base, container, options) { }; } -// Editable title - -exports.makeEditable = function(context, _delegate, options) { - if(!options) options = {}; - var that = this; +/* + * Editable title + * @param {d3.selection} context: the element being edited. Normally text, + * but if it isn't, you should provide the styling options + * @param {object} options: + * @param {div} options.gd: graphDiv + * @param {d3.selection} options.delegate: item to bind events to if not this + * @param {boolean} options.immediate: start editing now (true) or on click (false, default) + * @param {string} options.fill: font color if not as shown + * @param {string} options.background: background color if not as shown + * @param {string} options.text: initial text, if not as shown + * @param {string} options.horizontalAlign: alignment of the edit box wrt. the bound element + * @param {string} options.verticalAlign: alignment of the edit box wrt. the bound element + */ + +exports.makeEditable = function(context, options) { + var gd = options.gd; + var _delegate = options.delegate; var dispatch = d3.dispatch('edit', 'input', 'cancel'); - var textSelection = d3.select(this.node()) - .style({'pointer-events': 'all'}); + var handlerElement = _delegate || context; + + context.style({'pointer-events': _delegate ? 'none' : 'all'}); - var handlerElement = _delegate || textSelection; - if(_delegate) textSelection.style({'pointer-events': 'none'}); + if(context.size() !== 1) throw new Error('boo'); function handleClick() { appendEditable(); - that.style({opacity: 0}); + context.style({opacity: 0}); // also hide any mathjax svg var svgClass = handlerElement.attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } } @@ -127105,63 +128339,62 @@ exports.makeEditable = function(context, _delegate, options) { } function appendEditable() { - var gd = Lib.getPlotDiv(that.node()), - plotDiv = d3.select(gd), + var plotDiv = d3.select(gd), container = plotDiv.select('.svg-container'), div = container.append('div'); div.classed('plugin-editable editable', true) .style({ position: 'absolute', - 'font-family': that.style('font-family') || 'Arial', - 'font-size': that.style('font-size') || 12, - color: options.fill || that.style('fill') || 'black', + 'font-family': context.style('font-family') || 'Arial', + 'font-size': context.style('font-size') || 12, + color: options.fill || context.style('fill') || 'black', opacity: 1, 'background-color': options.background || 'transparent', outline: '#ffffff33 1px solid', - margin: [-parseFloat(that.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', + margin: [-parseFloat(context.style('font-size')) / 8 + 1, 0, 0, -1].join('px ') + 'px', padding: '0', 'box-sizing': 'border-box' }) .attr({contenteditable: true}) - .text(options.text || that.attr('data-unformatted')) - .call(alignHTMLWith(that, container, options)) + .text(options.text || context.attr('data-unformatted')) + .call(alignHTMLWith(context, container, options)) .on('blur', function() { gd._editing = false; - that.text(this.textContent) + context.text(this.textContent) .style({opacity: 1}); var svgClass = d3.select(this).attr('class'), mathjaxClass; if(svgClass) mathjaxClass = '.' + svgClass.split(' ')[0] + '-math-group'; else mathjaxClass = '[class*=-math-group]'; if(mathjaxClass) { - d3.select(that.node().parentNode).select(mathjaxClass).style({opacity: 0}); + d3.select(context.node().parentNode).select(mathjaxClass).style({opacity: 0}); } var text = this.textContent; d3.select(this).transition().duration(0).remove(); d3.select(document).on('mouseup', null); - dispatch.edit.call(that, text); + dispatch.edit.call(context, text); }) .on('focus', function() { - var context = this; + var editDiv = this; gd._editing = true; d3.select(document).on('mouseup', function() { - if(d3.event.target === context) return false; + if(d3.event.target === editDiv) return false; if(document.activeElement === div.node()) div.node().blur(); }); }) .on('keyup', function() { if(d3.event.which === 27) { gd._editing = false; - that.style({opacity: 1}); + context.style({opacity: 1}); d3.select(this) .style({opacity: 0}) .on('blur', function() { return false; }) .transition().remove(); - dispatch.cancel.call(that, this.textContent); + dispatch.cancel.call(context, this.textContent); } else { - dispatch.input.call(that, this.textContent); - d3.select(this).call(alignHTMLWith(that, container, options)); + dispatch.input.call(context, this.textContent); + d3.select(this).call(alignHTMLWith(context, container, options)); } }) .on('keydown', function() { @@ -127173,10 +128406,10 @@ exports.makeEditable = function(context, _delegate, options) { if(options.immediate) handleClick(); else handlerElement.on('click', handleClick); - return d3.rebind(this, dispatch, 'on'); + return d3.rebind(context, dispatch, 'on'); }; -},{"../constants/string_mappings":691,"../constants/xmlns_namespaces":692,"../lib":709,"d3":118}],729:[function(require,module,exports){ +},{"../constants/alignment":696,"../constants/string_mappings":703,"../constants/xmlns_namespaces":704,"../lib":721,"d3":120}],741:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127204,7 +128437,7 @@ module.exports = function toLogRange(val, range) { return newVal; }; -},{"fast-isnumeric":127}],730:[function(require,module,exports){ +},{"fast-isnumeric":129}],742:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127240,7 +128473,7 @@ topojsonUtils.getTopojsonFeatures = function(trace, topojson) { return topojsonFeature(topojson, obj).features; }; -},{"../plots/geo/constants":774,"topojson-client":528}],731:[function(require,module,exports){ +},{"../plots/geo/constants":786,"topojson-client":532}],743:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127274,7 +128507,7 @@ module.exports = function truncate(arrayIn, len) { throw new Error('This array type is not yet supported by `truncate`.'); }; -},{}],732:[function(require,module,exports){ +},{}],744:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127332,7 +128565,7 @@ module.exports = function containerArrayMatch(astr) { return {array: arrayStr, index: Number(match[1]), property: match[3] || ''}; }; -},{"../registry":826}],733:[function(require,module,exports){ +},{"../registry":838}],745:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -127550,7 +128783,6 @@ function cleanAxRef(container, attr) { // Make a few changes to the data right away // before it gets used for anything exports.cleanData = function(data, existingData) { - // Enforce unique IDs var suids = [], // seen uids --- so we can weed out incoming repeats uids = data.concat(Array.isArray(existingData) ? existingData : []) @@ -127683,18 +128915,38 @@ exports.cleanData = function(data, existingData) { if(!Lib.isPlainObject(transform)) continue; - if(transform.type === 'filter') { - if(transform.filtersrc) { - transform.target = transform.filtersrc; - delete transform.filtersrc; - } + switch(transform.type) { + case 'filter': + if(transform.filtersrc) { + transform.target = transform.filtersrc; + delete transform.filtersrc; + } - if(transform.calendar) { - if(!transform.valuecalendar) { - transform.valuecalendar = transform.calendar; + if(transform.calendar) { + if(!transform.valuecalendar) { + transform.valuecalendar = transform.calendar; + } + delete transform.calendar; } - delete transform.calendar; - } + break; + + case 'groupby': + // Name has changed from `style` to `styles`, so use `style` but prefer `styles`: + transform.styles = transform.styles || transform.style; + + if(transform.styles && !Array.isArray(transform.styles)) { + var prevStyles = transform.styles; + var styleKeys = Object.keys(prevStyles); + + transform.styles = []; + for(var j = 0; j < styleKeys.length; j++) { + transform.styles.push({ + target: styleKeys[j], + value: prevStyles[styleKeys[j]] + }); + } + } + break; } } } @@ -127750,7 +129002,7 @@ exports.swapXYData = function(trace) { Lib.swapAttrs(trace, ['error_?.color', 'error_?.thickness', 'error_?.width']); } } - if(trace.hoverinfo) { + if(typeof trace.hoverinfo === 'string') { var hoverInfoParts = trace.hoverinfo.split('+'); for(i = 0; i < hoverInfoParts.length; i++) { if(hoverInfoParts[i] === 'x') hoverInfoParts[i] = 'y'; @@ -127853,7 +129105,7 @@ exports.hasParent = function(aobj, attr) { return false; }; -},{"../components/color":590,"../lib":709,"../plots/cartesian/axes":748,"../plots/plots":811,"../registry":826,"fast-isnumeric":127,"gl-mat4/fromQuat":173}],734:[function(require,module,exports){ +},{"../components/color":600,"../lib":721,"../plots/cartesian/axes":760,"../plots/plots":823,"../registry":838,"fast-isnumeric":129,"gl-mat4/fromQuat":176}],746:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -128067,7 +129319,7 @@ exports.applyContainerArrayChanges = function applyContainerArrayChanges(gd, np, return true; }; -},{"../lib/is_plain_object":711,"../lib/loggers":712,"../lib/nested_property":715,"../lib/noop":716,"../lib/search":723,"../registry":826,"./container_array_match":732}],735:[function(require,module,exports){ +},{"../lib/is_plain_object":723,"../lib/loggers":724,"../lib/nested_property":727,"../lib/noop":728,"../lib/search":735,"../registry":838,"./container_array_match":744}],747:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -128102,7 +129354,9 @@ var manageArrays = require('./manage_arrays'); var helpers = require('./helpers'); var subroutines = require('./subroutines'); var cartesianConstants = require('../plots/cartesian/constants'); -var enforceAxisConstraints = require('../plots/cartesian/constraints'); +var axisConstraints = require('../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var axisIds = require('../plots/cartesian/axis_ids'); @@ -128259,9 +129513,7 @@ Plotly.plot = function(gd, data, layout, config) { } return Lib.syncOrAsync([ - subroutines.layoutStyles, - drawAxes, - initInteractions + subroutines.layoutStyles ], gd); } @@ -128290,19 +129542,19 @@ Plotly.plot = function(gd, data, layout, config) { // in case the margins changed, draw margin pushers again function marginPushersAgain() { - var seq = JSON.stringify(fullLayout._size) === oldmargins ? - [] : - [marginPushers, subroutines.layoutStyles]; + if(JSON.stringify(fullLayout._size) === oldmargins) return; - // re-initialize cartesian interaction, - // which are sometimes cleared during marginPushers - seq = seq.concat(initInteractions); - - return Lib.syncOrAsync(seq, gd); + return Lib.syncOrAsync([ + marginPushers, + subroutines.layoutStyles + ], gd); } function positionAndAutorange() { - if(!recalc) return; + if(!recalc) { + enforceAxisConstraints(gd); + return; + } var subplots = Plots.getSubplotIds(fullLayout, 'cartesian'), modules = fullLayout._modules; @@ -128340,7 +129592,10 @@ Plotly.plot = function(gd, data, layout, config) { var axList = Plotly.Axes.list(gd, '', true); for(var i = 0; i < axList.length; i++) { - Plotly.Axes.doAutoRange(axList[i]); + var ax = axList[i]; + cleanAxisConstraints(gd, ax); + + Plotly.Axes.doAutoRange(ax); } enforceAxisConstraints(gd); @@ -128440,6 +129695,7 @@ Plotly.plot = function(gd, data, layout, config) { drawAxes, drawData, finalDraw, + initInteractions, Plots.rehover ]; @@ -128537,7 +129793,7 @@ function plotPolar(gd, data, layout) { var placeholderText = 'Click to enter title'; var titleLayout = function() { - this.call(svgTextUtils.convertToTspans); + this.call(svgTextUtils.convertToTspans, gd); // TODO: html/mathjax // TODO: center title }; @@ -128546,9 +129802,10 @@ function plotPolar(gd, data, layout) { .call(titleLayout); if(gd._context.editable) { - title.attr({'data-unformatted': txt}); if(!txt || txt === placeholderText) { opacity = 0.2; + // placeholder is not going through convertToTspans + // so needs explicit data-unformatted title.attr({'data-unformatted': placeholderText}) .text(placeholderText) .style({opacity: opacity}) @@ -128563,11 +129820,10 @@ function plotPolar(gd, data, layout) { } var setContenteditable = function() { - this.call(svgTextUtils.makeEditable) + this.call(svgTextUtils.makeEditable, {gd: gd}) .on('edit', function(text) { gd.framework({layout: {title: text}}); - this.attr({'data-unformatted': text}) - .text(text) + this.text(text) .call(titleLayout); this.call(setContenteditable); }) @@ -129453,6 +130709,7 @@ function _restyle(gd, aobj, _traces) { ]; var zscl = ['zmin', 'zmax'], + cscl = ['cmin', 'cmax'], xbins = ['xbins.start', 'xbins.end', 'xbins.size'], ybins = ['ybins.start', 'ybins.end', 'ybins.size'], contourAttrs = ['contours.start', 'contours.end', 'contours.size']; @@ -129552,6 +130809,9 @@ function _restyle(gd, aobj, _traces) { if(zscl.indexOf(ai) !== -1) { doextra('zauto', false, i); } + if(cscl.indexOf(ai) !== -1) { + doextra('cauto', false, i); + } else if(ai === 'colorscale') { doextra('autocolorscale', false, i); } @@ -129983,10 +131243,12 @@ function _relayout(gd, aobj) { // we're editing the (auto)range of, so we can tell the others constrained // to scale with them that it's OK for them to shrink var rangesAltered = {}; + var axId; function recordAlteredAxis(pleafPlus) { var axId = axisIds.name2id(pleafPlus.split('.')[0]); rangesAltered[axId] = 1; + return axId; } // alter gd.layout @@ -130008,7 +131270,8 @@ function _relayout(gd, aobj) { // trunk nodes (everything except the leaf) ptrunk = p.parts.slice(0, pend).join('.'), parentIn = Lib.nestedProperty(gd.layout, ptrunk).get(), - parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + parentFull = Lib.nestedProperty(fullLayout, ptrunk).get(), + vOld = p.get(); if(vi === undefined) continue; @@ -130016,7 +131279,7 @@ function _relayout(gd, aobj) { // axis reverse is special - it is its own inverse // op and has no flag. - undoit[ai] = (pleaf === 'reverse') ? vi : p.get(); + undoit[ai] = (pleaf === 'reverse') ? vi : vOld; // Setting width or height to null must reset the graph's width / height // back to its initial value as computed during the first pass in Plots.plotAutoSize. @@ -130029,11 +131292,25 @@ function _relayout(gd, aobj) { else if(pleafPlus.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/)) { doextra(ptrunk + '.autorange', false); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleafPlus.match(/^[xyz]axis[0-9]*\.autorange$/)) { doextra([ptrunk + '.range[0]', ptrunk + '.range[1]'], undefined); recordAlteredAxis(pleafPlus); + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); + var axFull = Lib.nestedProperty(fullLayout, ptrunk).get(); + if(axFull._inputDomain) { + // if we're autoranging and this axis has a constrained domain, + // reset it so we don't get locked into a shrunken size + axFull._input.domain = axFull._inputDomain.slice(); + } + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)) { + Lib.nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null); + } + else if(pleafPlus.match(/^[xyz]axis[0-9]*\.constrain.*$/)) { + flags.docalc = true; } else if(pleafPlus.match(/^aspectratio\.[xyz]$/)) { doextra(proot + '.aspectmode', 'manual'); @@ -130113,6 +131390,7 @@ function _relayout(gd, aobj) { // will not make sense, so autorange it. doextra(ptrunk + '.autorange', true); } + Lib.nestedProperty(fullLayout, ptrunk + '._inputRange').set(null); } else if(pleaf.match(cartesianConstants.AX_NAME_PATTERN)) { var fullProp = Lib.nestedProperty(fullLayout, ai).get(), @@ -130211,7 +131489,16 @@ function _relayout(gd, aobj) { } else if(fullLayout._has('gl2d') && (ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor') - ) flags.doplot = true; + ) { + flags.doplot = true; + } + else if(fullLayout._has('gl2d') && + (ai === 'dragmode' && + (vi === 'lasso' || vi === 'select') && + !(vOld === 'lasso' || vOld === 'select')) + ) { + flags.docalc = true; + } else if(ai === 'hiddenlabels') flags.docalc = true; else if(proot.indexOf('legend') !== -1) flags.dolegend = true; else if(ai.indexOf('title') !== -1) flags.doticks = true; @@ -130259,7 +131546,7 @@ function _relayout(gd, aobj) { // figure out if we need to recalculate axis constraints var constraints = fullLayout._axisConstraintGroups; - for(var axId in rangesAltered) { + for(axId in rangesAltered) { for(i = 0; i < constraints.length; i++) { var group = constraints[i]; if(group[axId]) { @@ -131093,7 +132380,7 @@ function makePlotFramework(gd) { gd.emit('plotly_framework'); } -},{"../components/drawing":614,"../components/errorbars":620,"../constants/xmlns_namespaces":692,"../lib":709,"../lib/events":700,"../lib/queue":721,"../lib/svg_text_utils":728,"../plotly":743,"../plots/cartesian/axis_ids":751,"../plots/cartesian/constants":753,"../plots/cartesian/constraints":755,"../plots/cartesian/graph_interact":757,"../plots/plots":811,"../plots/polar":814,"../registry":826,"./helpers":733,"./manage_arrays":734,"./subroutines":740,"d3":118,"fast-isnumeric":127}],736:[function(require,module,exports){ +},{"../components/drawing":624,"../components/errorbars":630,"../constants/xmlns_namespaces":704,"../lib":721,"../lib/events":712,"../lib/queue":733,"../lib/svg_text_utils":740,"../plotly":755,"../plots/cartesian/axis_ids":763,"../plots/cartesian/constants":765,"../plots/cartesian/constraints":767,"../plots/cartesian/graph_interact":769,"../plots/plots":823,"../plots/polar":826,"../registry":838,"./helpers":745,"./manage_arrays":746,"./subroutines":752,"d3":120,"fast-isnumeric":129}],748:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -131219,7 +132506,7 @@ function defaultSetBackground(gd, bgColor) { } } -},{}],737:[function(require,module,exports){ +},{}],749:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -131378,7 +132665,10 @@ exports.findArrayAttributes = function(trace) { return stack.join('.'); } - exports.crawl(trace._module.attributes, callback); + exports.crawl(baseAttributes, callback); + if(trace._module && trace._module.attributes) { + exports.crawl(trace._module.attributes, callback); + } if(trace.transforms) { var transforms = trace.transforms; @@ -131398,9 +132688,8 @@ exports.findArrayAttributes = function(trace) { // 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) { + if(trace._fullInput && trace._fullInput._module && trace._fullInput._module.attributes) { exports.crawl(trace._fullInput._module.attributes, callback); - arrayAttributes = Lib.filterUnique(arrayAttributes); } @@ -131625,7 +132914,7 @@ function insertAttrs(baseAttrs, newAttrs, astr) { np.set(extendDeep(np.get() || {}, newAttrs)); } -},{"../lib":709,"../plots/animation_attributes":744,"../plots/attributes":746,"../plots/frame_attributes":773,"../plots/layout_attributes":802,"../plots/polar/area_attributes":812,"../plots/polar/axis_attributes":813,"../registry":826}],738:[function(require,module,exports){ +},{"../lib":721,"../plots/animation_attributes":756,"../plots/attributes":758,"../plots/frame_attributes":785,"../plots/layout_attributes":814,"../plots/polar/area_attributes":824,"../plots/polar/axis_attributes":825,"../registry":838}],750:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -131724,7 +133013,7 @@ function registerComponentModule(newModule) { Registry.registerComponent(newModule); } -},{"../lib":709,"../registry":826}],739:[function(require,module,exports){ +},{"../lib":721,"../registry":838}],751:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -131750,7 +133039,7 @@ module.exports = function setPlotConfig(configObj) { return Lib.extendFlat(Plotly.defaultConfig, configObj); }; -},{"../lib":709,"../plotly":743}],740:[function(require,module,exports){ +},{"../lib":721,"../plotly":755}],752:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -131879,15 +133168,16 @@ exports.lsInner = function(gd) { var freefinished = []; subplotSelection.each(function(subplot) { - var plotinfo = fullLayout._plots[subplot], - xa = Plotly.Axes.getFromId(gd, subplot, 'x'), + var plotinfo = fullLayout._plots[subplot]; + + var xa = Plotly.Axes.getFromId(gd, subplot, 'x'), ya = Plotly.Axes.getFromId(gd, subplot, 'y'); // reset scale in case the margins have changed xa.setScale(); ya.setScale(); - if(plotinfo.bg) { + if(plotinfo.bg && fullLayout._has('cartesian')) { plotinfo.bg .call(Drawing.setRect, xa._offset - gs.p, ya._offset - gs.p, @@ -132007,27 +133297,29 @@ exports.lsInner = function(gd) { rightpos += xa._offset - gs.l; } - plotinfo.xlines - .attr('transform', originx) - .attr('d', ( - (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + - (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + - (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || - // so it doesn't barf with no lines shown - 'M0,0') - .style('stroke-width', xlw + 'px') - .call(Color.stroke, xa.showline ? - xa.linecolor : 'rgba(0,0,0,0)'); - plotinfo.ylines - .attr('transform', originy) - .attr('d', ( - (showleft ? ('M' + leftpos + ypathSuffix) : '') + - (showright ? ('M' + rightpos + ypathSuffix) : '') + - (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || - 'M0,0') - .attr('stroke-width', ylw + 'px') - .call(Color.stroke, ya.showline ? - ya.linecolor : 'rgba(0,0,0,0)'); + if(fullLayout._has('cartesian')) { + plotinfo.xlines + .attr('transform', originx) + .attr('d', ( + (showbottom ? (xpathPrefix + bottompos + xpathSuffix) : '') + + (showtop ? (xpathPrefix + toppos + xpathSuffix) : '') + + (showfreex ? (xpathPrefix + freeposx + xpathSuffix) : '')) || + // so it doesn't barf with no lines shown + 'M0,0') + .style('stroke-width', xlw + 'px') + .call(Color.stroke, xa.showline ? + xa.linecolor : 'rgba(0,0,0,0)'); + plotinfo.ylines + .attr('transform', originy) + .attr('d', ( + (showleft ? ('M' + leftpos + ypathSuffix) : '') + + (showright ? ('M' + rightpos + ypathSuffix) : '') + + (showfreey ? ('M' + freeposy + ypathSuffix) : '')) || + 'M0,0') + .attr('stroke-width', ylw + 'px') + .call(Color.stroke, ya.showline ? + ya.linecolor : 'rgba(0,0,0,0)'); + } plotinfo.xaxislayer.attr('transform', originx); plotinfo.yaxislayer.attr('transform', originy); @@ -132128,19 +133420,22 @@ exports.doTicksRelayout = function(gd) { exports.doModeBar = function(gd) { var fullLayout = gd._fullLayout; - var subplotIds, i; + var subplotIds, scene, i; ModeBar.manage(gd); initInteractions(gd); subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d'); for(i = 0; i < subplotIds.length; i++) { - var scene = fullLayout[subplotIds[i]]._scene; + scene = fullLayout[subplotIds[i]]._scene; scene.updateFx(fullLayout.dragmode, fullLayout.hovermode); } - // no need to do this for gl2d subplots, - // Plots.linkSubplots takes care of it all. + subplotIds = Plots.getSubplotIds(fullLayout, 'gl2d'); + for(i = 0; i < subplotIds.length; i++) { + scene = fullLayout._plots[subplotIds[i]]._scene2d; + scene.updateFx(fullLayout.dragmode); + } return Plots.previousPromises(gd); }; @@ -132157,7 +133452,7 @@ exports.doCamera = function(gd) { } }; -},{"../components/color":590,"../components/drawing":614,"../components/modebar":650,"../components/titles":679,"../lib":709,"../plotly":743,"../plots/cartesian/graph_interact":757,"../plots/plots":811,"../registry":826,"d3":118}],741:[function(require,module,exports){ +},{"../components/color":600,"../components/drawing":624,"../components/modebar":660,"../components/titles":689,"../lib":721,"../plotly":755,"../plots/cartesian/graph_interact":769,"../plots/plots":823,"../registry":838,"d3":120}],753:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132267,7 +133562,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":709,"../plotly":743,"../snapshot/cloneplot":827,"../snapshot/helpers":830,"../snapshot/svgtoimg":832,"../snapshot/tosvg":834,"fast-isnumeric":127}],742:[function(require,module,exports){ +},{"../lib":721,"../plotly":755,"../snapshot/cloneplot":839,"../snapshot/helpers":842,"../snapshot/svgtoimg":844,"../snapshot/tosvg":846,"fast-isnumeric":129}],754:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132489,6 +133784,11 @@ function crawl(objIn, objOut, schema, list, base, path) { else if(!Lib.validate(valIn, nestedSchema)) { list.push(format('value', base, p, valIn)); } + else if(nestedSchema.valType === 'enumerated' && + ((nestedSchema.coerceNumber && valIn !== +valOut) || valIn !== valOut) + ) { + list.push(format('dynamic', base, p, valIn, valOut)); + } } return list; @@ -132537,6 +133837,16 @@ var code2msgFunc = { return inBase(base) + target + ' ' + astr + ' did not get coerced'; }, + dynamic: function(base, astr, valIn, valOut) { + return [ + inBase(base) + 'key', + astr, + '(set to \'' + valIn + '\')', + 'got reset to', + '\'' + valOut + '\'', + 'during defaults.' + ].join(' '); + }, invisible: function(base) { return 'Trace ' + base[1] + ' got defaulted to be not visible'; }, @@ -132554,7 +133864,7 @@ function inBase(base) { return 'In ' + base + ', '; } -function format(code, base, path, valIn) { +function format(code, base, path, valIn, valOut) { path = path || ''; var container, trace; @@ -132571,8 +133881,8 @@ function format(code, base, path, valIn) { trace = null; } - var astr = convertPathToAttributeString(path), - msg = code2msgFunc[code](base, astr, valIn); + var astr = convertPathToAttributeString(path); + var msg = code2msgFunc[code](base, astr, valIn, valOut); // log to console if logger config option is enabled Lib.log(msg); @@ -132638,7 +133948,7 @@ function convertPathToAttributeString(path) { return astr; } -},{"../lib":709,"../plots/plots":811,"./plot_schema":737}],743:[function(require,module,exports){ +},{"../lib":721,"../plots/plots":823,"./plot_schema":749}],755:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132672,7 +133982,7 @@ exports.ModeBar = require('./components/modebar'); // plot api require('./plot_api/plot_api'); -},{"./components/modebar":650,"./plot_api/plot_api":735,"./plot_api/plot_config":736,"./plots/cartesian/axes":748,"./plots/plots":811}],744:[function(require,module,exports){ +},{"./components/modebar":660,"./plot_api/plot_api":747,"./plot_api/plot_config":748,"./plots/cartesian/axes":760,"./plots/plots":823}],756:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132774,7 +134084,7 @@ module.exports = { } }; -},{}],745:[function(require,module,exports){ +},{}],757:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132855,7 +134165,7 @@ module.exports = function handleArrayContainerDefaults(parentObjIn, parentObjOut } }; -},{"../lib":709}],746:[function(require,module,exports){ +},{"../lib":721}],758:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132912,11 +134222,20 @@ module.exports = { dflt: '' }, + ids: { + valType: 'data_array', + + }, + customdata: { + valType: 'data_array', + + }, hoverinfo: { valType: 'flaglist', flags: ['x', 'y', 'z', 'text', 'name'], extras: ['all', 'none', 'skip'], + arrayOk: true, dflt: 'all', }, @@ -132940,7 +134259,7 @@ module.exports = { } }; -},{"../components/fx/attributes":623}],747:[function(require,module,exports){ +},{"../components/fx/attributes":633}],759:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132967,7 +134286,7 @@ module.exports = { } }; -},{}],748:[function(require,module,exports){ +},{}],760:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -132997,7 +134316,6 @@ var ONEDAY = constants.ONEDAY; var ONEHOUR = constants.ONEHOUR; var ONEMIN = constants.ONEMIN; var ONESEC = constants.ONESEC; -var BADNUM = constants.BADNUM; var axes = module.exports = {}; @@ -133070,33 +134388,27 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption * - for other types: coerce them to numbers */ axes.coercePosition = function(containerOut, gd, coerce, axRef, attr, dflt) { - var pos, - newPos; + var cleanPos, pos; if(axRef === 'paper' || axRef === 'pixel') { + cleanPos = Lib.ensureNumber; pos = coerce(attr, dflt); - } - else { + } else { var ax = axes.getFromId(gd, axRef); - dflt = ax.fraction2r(dflt); pos = coerce(attr, dflt); - - 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, BADNUM, ax.calendar); - return; - } + cleanPos = ax.cleanPos; } - // finally make sure we have a number (unless date type already returned a string) - containerOut[attr] = isNumeric(pos) ? Number(pos) : dflt; + + containerOut[attr] = cleanPos(pos); +}; + +axes.cleanPosition = function(pos, gd, axRef) { + var cleanPos = (axRef === 'paper' || axRef === 'pixel') ? + Lib.ensureNumber : + axes.getFromId(gd, axRef).cleanPos; + + return cleanPos(pos); }; axes.getDataToCoordFunc = function(gd, trace, target, targetArray) { @@ -133337,6 +134649,9 @@ axes.doAutoRange = function(ax) { if(ax.autorange && hasDeps) { ax.range = axes.getAutoRange(ax); + ax._r = ax.range.slice(); + ax._rl = Lib.simpleMap(ax._r, ax.r2l); + // doAutoRange will get called on fullLayout, // but we want to report its results back to layout @@ -133432,6 +134747,13 @@ axes.expand = function(ax, data, options) { i, j, v, di, dmin, dmax, ppadiplus, ppadiminus, includeThis, vmin, vmax; + // domain-constrained axes: base extrappad on the unconstrained + // domain so it's consistent as the domain changes + if(extrappad && (ax.constrain === 'domain') && ax._inputDomain) { + extrappad *= (ax._inputDomain[1] - ax._inputDomain[0]) / + (ax.domain[1] - ax.domain[0]); + } + function getPad(item) { if(Array.isArray(item)) { return function(i) { return Math.max(Number(item[i]||0), 0); }; @@ -134783,10 +136105,10 @@ axes.doTicks = function(gd, axid, skipTitle) { var thisLabel = d3.select(this), newPromise = gd._promises.length; thisLabel - .call(Drawing.setPosition, labelx(d), labely(d)) + .call(svgTextUtils.positionText, labelx(d), labely(d)) .call(Drawing.font, d.font, d.fontSize, d.fontColor) .text(d.text) - .call(svgTextUtils.convertToTspans); + .call(svgTextUtils.convertToTspans, gd); newPromise = gd._promises[newPromise]; if(newPromise) { // if we have an async label, we'll deal with that @@ -134819,17 +136141,10 @@ axes.doTicks = function(gd, axid, skipTitle) { (labely(d) - d.fontSize / 2) + ')') : ''); if(mathjaxGroup.empty()) { - var txt = thisLabel.select('text').attr({ + thisLabel.select('text').attr({ transform: transform, 'text-anchor': anchor }); - - if(!txt.empty()) { - txt.selectAll('tspan.line').attr({ - x: txt.attr('x'), - y: txt.attr('y') - }); - } } else { var mjShift = @@ -135295,7 +136610,7 @@ function swapAxisAttrs(layout, key, xFullAxes, yFullAxes) { } } -},{"../../components/color":590,"../../components/drawing":614,"../../components/titles":679,"../../constants/numerical":690,"../../lib":709,"../../lib/svg_text_utils":728,"../../registry":826,"./axis_autotype":749,"./axis_ids":751,"./layout_attributes":759,"./layout_defaults":760,"./set_convert":765,"d3":118,"fast-isnumeric":127}],749:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/titles":689,"../../constants/numerical":702,"../../lib":721,"../../lib/svg_text_utils":740,"../../registry":838,"./axis_autotype":761,"./axis_ids":763,"./layout_attributes":771,"./layout_defaults":772,"./set_convert":777,"d3":120,"fast-isnumeric":129}],761:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135370,7 +136685,7 @@ function category(a) { return curvecats > curvenums * 2; } -},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],750:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],762:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135493,7 +136808,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce, return containerOut; }; -},{"../../components/color/attributes":589,"../../lib":709,"../../registry":826,"./category_order_defaults":752,"./layout_attributes":759,"./ordered_categories":761,"./set_convert":765,"./tick_label_defaults":766,"./tick_mark_defaults":767,"./tick_value_defaults":768,"tinycolor2":526}],751:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib":721,"../../registry":838,"./category_order_defaults":764,"./layout_attributes":771,"./ordered_categories":773,"./set_convert":777,"./tick_label_defaults":778,"./tick_mark_defaults":779,"./tick_value_defaults":780,"tinycolor2":530}],763:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135615,7 +136930,7 @@ exports.getFromTrace = function(gd, fullTrace, type) { return ax; }; -},{"../../lib":709,"../../registry":826,"../plots":811,"./constants":753}],752:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838,"../plots":823,"./constants":765}],764:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135649,7 +136964,7 @@ module.exports = function handleCategoryOrderDefaults(containerIn, containerOut, } }; -},{}],753:[function(require,module,exports){ +},{}],765:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135704,7 +137019,7 @@ module.exports = { DFLTRANGEY: [-1, 4] }; -},{}],754:[function(require,module,exports){ +},{}],766:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135722,10 +137037,25 @@ var id2name = require('./axis_ids').id2name; module.exports = function handleConstraintDefaults(containerIn, containerOut, coerce, allAxisIds, layoutOut) { var constraintGroups = layoutOut._axisConstraintGroups; + var thisID = containerOut._id; + var letter = thisID.charAt(0); + + if(containerOut.fixedrange) return; + + // coerce the constraint mechanics even if this axis has no scaleanchor + // because it may be the anchor of another axis. + coerce('constrain'); + Lib.coerce(containerIn, containerOut, { + constraintoward: { + valType: 'enumerated', + values: letter === 'x' ? ['left', 'center', 'right'] : ['bottom', 'middle', 'top'], + dflt: letter === 'x' ? 'center' : 'middle' + } + }, 'constraintoward'); - if(containerOut.fixedrange || !containerIn.scaleanchor) return; + if(!containerIn.scaleanchor) return; - var constraintOpts = getConstraintOpts(constraintGroups, containerOut._id, allAxisIds, layoutOut); + var constraintOpts = getConstraintOpts(constraintGroups, thisID, allAxisIds, layoutOut); var scaleanchor = Lib.coerce(containerIn, containerOut, { scaleanchor: { @@ -135744,7 +137074,7 @@ module.exports = function handleConstraintDefaults(containerIn, containerOut, co if(!scaleratio) scaleratio = containerOut.scaleratio = 1; updateConstraintGroups(constraintGroups, constraintOpts.thisGroup, - containerOut._id, scaleanchor, scaleratio); + thisID, scaleanchor, scaleratio); } else if(allAxisIds.indexOf(containerIn.scaleanchor) !== -1) { Lib.warn('ignored ' + containerOut._name + '.scaleanchor: "' + @@ -135843,7 +137173,7 @@ function updateConstraintGroups(constraintGroups, thisGroup, thisID, scaleanchor thisGroup[scaleanchor] = 1; } -},{"../../lib":709,"./axis_ids":751}],755:[function(require,module,exports){ +},{"../../lib":721,"./axis_ids":763}],767:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135860,12 +137190,14 @@ var scaleZoom = require('./scale_zoom'); var ALMOST_EQUAL = require('../../constants/numerical').ALMOST_EQUAL; +var FROM_BL = require('../../constants/alignment').FROM_BL; + -module.exports = function enforceAxisConstraints(gd) { +exports.enforce = function enforceAxisConstraints(gd) { var fullLayout = gd._fullLayout; var constraintGroups = fullLayout._axisConstraintGroups; - var i, j, axisID, ax, normScale; + var i, j, axisID, ax, normScale, mode, factor; for(i = 0; i < constraintGroups.length; i++) { var group = constraintGroups[i]; @@ -135881,12 +137213,18 @@ module.exports = function enforceAxisConstraints(gd) { var matchScale = Infinity; var normScales = {}; var axes = {}; + var hasAnyDomainConstraint = false; // find the (normalized) scale of each axis in the group for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; axes[axisID] = ax = fullLayout[id2name(axisID)]; + if(ax._inputDomain) ax.domain = ax._inputDomain.slice(); + else ax._inputDomain = ax.domain.slice(); + + if(!ax._inputRange) ax._inputRange = ax.range.slice(); + // set axis scale here so we can use _m rather than // having to calculate it from length and range ax.setScale(); @@ -135894,32 +137232,153 @@ module.exports = function enforceAxisConstraints(gd) { // abs: inverted scales still satisfy the constraint normScales[axisID] = normScale = Math.abs(ax._m) / group[axisID]; minScale = Math.min(minScale, normScale); - if(ax._constraintShrinkable) { - // this has served its purpose, so remove it - delete ax._constraintShrinkable; - } - else { + if(ax.constrain === 'domain' || !ax._constraintShrinkable) { matchScale = Math.min(matchScale, normScale); } + + // this has served its purpose, so remove it + delete ax._constraintShrinkable; maxScale = Math.max(maxScale, normScale); + + if(ax.constrain === 'domain') hasAnyDomainConstraint = true; } // Do we have a constraint mismatch? Give a small buffer for rounding errors - if(minScale > ALMOST_EQUAL * maxScale) continue; + if(minScale > ALMOST_EQUAL * maxScale && !hasAnyDomainConstraint) continue; // now increase any ranges we need to until all normalized scales are equal for(j = 0; j < axisIDs.length; j++) { axisID = axisIDs[j]; normScale = normScales[axisID]; + ax = axes[axisID]; + mode = ax.constrain; + + // even if the scale didn't change, if we're shrinking domain + // we need to recalculate in case `constraintoward` changed + if(normScale !== matchScale || mode === 'domain') { + factor = normScale / matchScale; + + if(mode === 'range') { + scaleZoom(ax, factor); + } + else { + // mode === 'domain' + + var inputDomain = ax._inputDomain; + var domainShrunk = (ax.domain[1] - ax.domain[0]) / + (inputDomain[1] - inputDomain[0]); + var rangeShrunk = (ax.r2l(ax.range[1]) - ax.r2l(ax.range[0])) / + (ax.r2l(ax._inputRange[1]) - ax.r2l(ax._inputRange[0])); + + factor /= domainShrunk; + + if(factor * rangeShrunk < 1) { + // we've asked to magnify the axis more than we can just by + // enlarging the domain - so we need to constrict range + ax.domain = ax._input.domain = inputDomain.slice(); + scaleZoom(ax, factor); + continue; + } + + if(rangeShrunk < 1) { + // the range has previously been constricted by ^^, but we've + // switched to the domain-constricted regime, so reset range + ax.range = ax._input.range = ax._inputRange.slice(); + factor *= rangeShrunk; + } - if(normScale !== matchScale) { - scaleZoom(axes[axisID], normScale / matchScale); + if(ax.autorange && ax._min.length && ax._max.length) { + /* + * range & factor may need to change because range was + * calculated for the larger scaling, so some pixel + * paddings may get cut off when we reduce the domain. + * + * This is easier than the regular autorange calculation + * because we already know the scaling `m`, but we still + * need to cut out impossible constraints (like + * annotations with super-long arrows). That's what + * outerMin/Max are for - if the expansion was going to + * go beyond the original domain, it must be impossible + */ + var rl0 = ax.r2l(ax.range[0]); + var rl1 = ax.r2l(ax.range[1]); + var rangeCenter = (rl0 + rl1) / 2; + var rangeMin = rangeCenter; + var rangeMax = rangeCenter; + var halfRange = Math.abs(rl1 - rangeCenter); + // extra tiny bit for rounding errors, in case we actually + // *are* expanding to the full domain + var outerMin = rangeCenter - halfRange * factor * 1.0001; + var outerMax = rangeCenter + halfRange * factor * 1.0001; + + updateDomain(ax, factor); + ax.setScale(); + var m = Math.abs(ax._m); + var newVal; + var k; + + for(k = 0; k < ax._min.length; k++) { + newVal = ax._min[k].val - ax._min[k].pad / m; + if(newVal > outerMin && newVal < rangeMin) { + rangeMin = newVal; + } + } + + for(k = 0; k < ax._max.length; k++) { + newVal = ax._max[k].val + ax._max[k].pad / m; + if(newVal < outerMax && newVal > rangeMax) { + rangeMax = newVal; + } + } + + var domainExpand = (rangeMax - rangeMin) / (2 * halfRange); + factor /= domainExpand; + + rangeMin = ax.l2r(rangeMin); + rangeMax = ax.l2r(rangeMax); + ax.range = ax._input.range = (rl0 < rl1) ? + [rangeMin, rangeMax] : [rangeMax, rangeMin]; + } + + updateDomain(ax, factor); + } } } } }; -},{"../../constants/numerical":690,"./axis_ids":751,"./scale_zoom":763}],756:[function(require,module,exports){ +// For use before autoranging, check if this axis was previously constrained +// by domain but no longer is +exports.clean = function cleanConstraints(gd, ax) { + if(ax._inputDomain) { + var isConstrained = false; + var axId = ax._id; + var constraintGroups = gd._fullLayout._axisConstraintGroups; + for(var j = 0; j < constraintGroups.length; j++) { + if(constraintGroups[j][axId]) { + isConstrained = true; + break; + } + } + if(!isConstrained || ax.constrain !== 'domain') { + ax._input.domain = ax.domain = ax._inputDomain; + delete ax._inputDomain; + } + } +}; + +function updateDomain(ax, factor) { + var inputDomain = ax._inputDomain; + var centerFraction = FROM_BL[ax.constraintoward]; + var center = inputDomain[0] + (inputDomain[1] - inputDomain[0]) * centerFraction; + + ax.domain = ax._input.domain = [ + center + (inputDomain[0] - center) / factor, + center + (inputDomain[1] - center) / factor + ]; +} + +},{"../../constants/alignment":696,"../../constants/numerical":702,"./axis_ids":763,"./scale_zoom":775}],768:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -135942,6 +137401,9 @@ var Color = require('../../components/color'); var Drawing = require('../../components/drawing'); var setCursor = require('../../lib/setcursor'); var dragElement = require('../../components/dragelement'); +var FROM_TL = require('../../constants/alignment').FROM_TL; + +var Plots = require('../plots'); var doTicks = require('./axes').doTicks; var getFromId = require('./axis_ids').getFromId; @@ -136051,7 +137513,6 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { element: dragger, gd: gd, plotinfo: plotinfo, - doubleclick: doubleClick, prepFn: function(e, startX, startY) { var dragModeNow = gd._fullLayout.dragmode; @@ -136105,6 +137566,9 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { zb, corners; + // collected changes to be made to the plot by relayout at the end + var updates = {}; + function zoomPrep(e, startX, startY) { var dragBBox = dragger.getBoundingClientRect(); x0 = startX - dragBBox.left; @@ -136203,8 +137667,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // TODO: edit linked axes in zoomAxRanges and in dragTail - if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, xaLinked); - if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, yaLinked); + if(zoomMode === 'xy' || zoomMode === 'x') zoomAxRanges(xa, box.l / pw, box.r / pw, updates, xaLinked); + if(zoomMode === 'xy' || zoomMode === 'y') zoomAxRanges(ya, (ph - box.b) / ph, (ph - box.t) / ph, updates, yaLinked); removeZoombox(gd); dragTail(zoomMode); @@ -136237,7 +137701,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(gd._context.showAxisRangeEntryBoxes) { d3.select(dragger) - .call(svgTextUtils.makeEditable, null, { + .call(svgTextUtils.makeEditable, { + gd: gd, immediate: true, background: fullLayout.paper_bgcolor, text: String(initialText), @@ -136256,11 +137721,11 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { } // scroll zoom, on all draggers except corners - var scrollViewBox = [0, 0, pw, ph], - // wait a little after scrolling before redrawing - redrawTimer = null, - REDRAWDELAY = constants.REDRAWDELAY, - mainplot = plotinfo.mainplot ? + var scrollViewBox = [0, 0, pw, ph]; + // wait a little after scrolling before redrawing + var redrawTimer = null; + var REDRAWDELAY = constants.REDRAWDELAY; + var mainplot = plotinfo.mainplot ? fullLayout._plots[plotinfo.mainplot] : plotinfo; function zoomWheel(e) { @@ -136445,6 +137910,8 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { ticksAndAnnotations(yActive, xActive); } + // Draw ticks and annotations (and other components) when ranges change. + // Also records the ranges that have changed for use by update at the end. function ticksAndAnnotations(ns, ew) { var activeAxIds = [], i; @@ -136464,8 +137931,13 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { pushActiveAxIds(yaLinked); } + updates = {}; for(i = 0; i < activeAxIds.length; i++) { - doTicks(gd, activeAxIds[i], true); + var axId = activeAxIds[i]; + doTicks(gd, axId, true); + var ax = getFromId(gd, axId); + updates[ax._name + '.range[0]'] = ax.range[0]; + updates[ax._name + '.range[1]'] = ax.range[1]; } function redrawObjs(objArray, method, shortCircuit) { @@ -136562,24 +138034,17 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { function dragTail(zoommode) { if(zoommode === undefined) zoommode = (ew ? 'x' : '') + (ns ? 'y' : ''); - var attrs = {}; - // revert to the previous axis settings, then apply the new ones - // through relayout - this lets relayout manage undo/redo - var axesToModify; - if(zoommode === 'xy') axesToModify = xa.concat(ya); - else if(zoommode === 'x') axesToModify = xa; - else if(zoommode === 'y') axesToModify = ya; - - for(var i = 0; i < axesToModify.length; i++) { - var axi = axesToModify[i]; - if(axi._r[0] !== axi.range[0]) attrs[axi._name + '.range[0]'] = axi.range[0]; - if(axi._r[1] !== axi.range[1]) attrs[axi._name + '.range[1]'] = axi.range[1]; - - axi.range = axi._input.range = axi._r.slice(); - } - + // put the subplot viewboxes back to default (Because we're going to) + // be repositioning the data in the relayout. But DON'T call + // ticksAndAnnotations again - it's unnecessary and would overwrite `updates` updateSubplots([0, 0, pw, ph]); - Plotly.relayout(gd, attrs); + + // since we may have been redrawing some things during the drag, we may have + // accumulated MathJax promises - wait for them before we relayout. + Lib.syncOrAsync([ + Plots.previousPromises, + function() { Plotly.relayout(gd, updates); } + ], gd); } // updateSubplots - find all plot viewboxes that should be @@ -136614,11 +138079,15 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(scaleFactor) { ax.range = ax._r.slice(); scaleZoom(ax, scaleFactor); - return ax._length * (1 - scaleFactor) / 2; + return getShift(ax, scaleFactor); } return 0; } + function getShift(ax, scaleFactor) { + return ax._length * (1 - scaleFactor) * FROM_TL[ax.constraintoward || 'middle']; + } + for(i = 0; i < subplots.length; i++) { var subplot = plotinfos[subplots[i]], @@ -136629,7 +138098,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editX2) { xScaleFactor2 = xScaleFactor; - clipDx = viewBox[0]; + clipDx = ew ? viewBox[0] : getShift(xa2, xScaleFactor2); } else { xScaleFactor2 = getLinkedScaleFactor(xa2); @@ -136638,7 +138107,7 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) { if(editY2) { yScaleFactor2 = yScaleFactor; - clipDy = viewBox[1]; + clipDy = ns ? viewBox[1] : getShift(ya2, yScaleFactor2); } else { yScaleFactor2 = getLinkedScaleFactor(ya2); @@ -136721,7 +138190,7 @@ function getEndText(ax, end) { } } -function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { +function zoomAxRanges(axList, r0Fraction, r1Fraction, updates, linkedAxes) { var i, axi, axRangeLinear0, @@ -136737,13 +138206,15 @@ function zoomAxRanges(axList, r0Fraction, r1Fraction, linkedAxes) { axi.l2r(axRangeLinear0 + axRangeLinearSpan * r0Fraction), axi.l2r(axRangeLinear0 + axRangeLinearSpan * r1Fraction) ]; + updates[axi._name + '.range[0]'] = axi.range[0]; + updates[axi._name + '.range[1]'] = axi.range[1]; } // zoom linked axes about their centers if(linkedAxes && linkedAxes.length) { var linkedR0Fraction = (r0Fraction + (1 - r1Fraction)) / 2; - zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction); + zoomAxRanges(linkedAxes, linkedR0Fraction, 1 - linkedR0Fraction, updates); } } @@ -136920,7 +138391,7 @@ function calcLinks(constraintGroups, xIDs, yIDs) { }; } -},{"../../components/color":590,"../../components/dragelement":611,"../../components/drawing":614,"../../lib":709,"../../lib/setcursor":724,"../../lib/svg_text_utils":728,"../../plotly":743,"../../registry":826,"./axes":748,"./axis_ids":751,"./constants":753,"./scale_zoom":763,"./select":764,"d3":118,"tinycolor2":526}],757:[function(require,module,exports){ +},{"../../components/color":600,"../../components/dragelement":621,"../../components/drawing":624,"../../constants/alignment":696,"../../lib":721,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../registry":838,"../plots":823,"./axes":760,"./axis_ids":763,"./constants":765,"./scale_zoom":775,"./select":776,"d3":120,"tinycolor2":530}],769:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -136943,7 +138414,7 @@ var dragBox = require('./dragbox'); module.exports = function initInteractions(gd) { var fullLayout = gd._fullLayout; - if(!fullLayout._has('cartesian') || gd._context.staticPlot) return; + if((!fullLayout._has('cartesian') && !fullLayout._has('gl2d')) || gd._context.staticPlot) return; var subplots = Object.keys(fullLayout._plots || {}).sort(function(a, b) { // sort overlays last, then by x axis number, then y axis number @@ -136961,8 +138432,6 @@ module.exports = function initInteractions(gd) { subplots.forEach(function(subplot) { var plotinfo = fullLayout._plots[subplot]; - if(!fullLayout._has('cartesian')) return; - var xa = plotinfo.xaxis, ya = plotinfo.yaxis, @@ -137020,7 +138489,7 @@ module.exports = function initInteractions(gd) { }; maindrag.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, subplot); }; // corner draggers @@ -137081,7 +138550,7 @@ module.exports = function initInteractions(gd) { }; }; -},{"../../components/dragelement":611,"../../components/fx":631,"./constants":753,"./dragbox":756,"fast-isnumeric":127}],758:[function(require,module,exports){ +},{"../../components/dragelement":621,"../../components/fx":641,"./constants":765,"./dragbox":768,"fast-isnumeric":129}],770:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -137268,6 +138737,11 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) oldFullLayout._infolayer.select('.' + axIds[i] + 'title').remove(); } } + + // clean selection + if(oldFullLayout._zoomlayer) { + oldFullLayout._zoomlayer.selectAll('.select-outline').remove(); + } }; exports.drawFramework = function(gd) { @@ -137470,7 +138944,7 @@ function joinLayer(parent, nodeType, className) { return layer; } -},{"../../lib":709,"../plots":811,"./attributes":747,"./axis_ids":751,"./constants":753,"./layout_attributes":759,"./transition_axes":769,"d3":118}],759:[function(require,module,exports){ +},{"../../lib":721,"../plots":823,"./attributes":759,"./axis_ids":763,"./constants":765,"./layout_attributes":771,"./transition_axes":781,"d3":120}],771:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -137565,6 +139039,20 @@ module.exports = { dflt: 1, + }, + constrain: { + valType: 'enumerated', + values: ['range', 'domain'], + dflt: 'range', + + + }, + // constraintoward: not used directly, just put here for reference + constraintoward: { + valType: 'enumerated', + values: ['left', 'center', 'right', 'top', 'middle', 'bottom'], + + }, // ticks tickmode: { @@ -137862,7 +139350,7 @@ module.exports = { } }; -},{"../../components/color/attributes":589,"../../components/drawing/attributes":613,"../../lib/extend":701,"../font_attributes":772,"./constants":753}],760:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../components/drawing/attributes":623,"../../lib/extend":713,"../font_attributes":784,"./constants":765}],772:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138135,7 +139623,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { } }; -},{"../../components/color":590,"../../lib":709,"../../registry":826,"../layout_attributes":802,"./axis_defaults":750,"./axis_ids":751,"./constants":753,"./constraint_defaults":754,"./layout_attributes":759,"./position_defaults":762,"./type_defaults":770}],761:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../registry":838,"../layout_attributes":814,"./axis_defaults":762,"./axis_ids":763,"./constants":765,"./constraint_defaults":766,"./layout_attributes":771,"./position_defaults":774,"./type_defaults":782}],773:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138214,7 +139702,7 @@ module.exports = function orderedCategories(axisLetter, categoryorder, categorya } }; -},{"d3":118}],762:[function(require,module,exports){ +},{"d3":120}],774:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138279,7 +139767,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer return containerOut; }; -},{"../../lib":709,"fast-isnumeric":127}],763:[function(require,module,exports){ +},{"../../lib":721,"fast-isnumeric":129}],775:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138291,20 +139779,23 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer 'use strict'; +var FROM_BL = require('../../constants/alignment').FROM_BL; + module.exports = function scaleZoom(ax, factor, centerFraction) { - if(centerFraction === undefined) centerFraction = 0.5; + if(centerFraction === undefined) { + centerFraction = FROM_BL[ax.constraintoward || 'center']; + } var rangeLinear = [ax.r2l(ax.range[0]), ax.r2l(ax.range[1])]; var center = rangeLinear[0] + (rangeLinear[1] - rangeLinear[0]) * centerFraction; - var newHalfSpan = (center - rangeLinear[0]) * factor; ax.range = ax._input.range = [ - ax.l2r(center - newHalfSpan), - ax.l2r(center + newHalfSpan) + ax.l2r(center + (rangeLinear[0] - center) * factor), + ax.l2r(center + (rangeLinear[1] - center) * factor) ]; }; -},{}],764:[function(require,module,exports){ +},{"../../constants/alignment":696}],776:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138318,6 +139809,7 @@ module.exports = function scaleZoom(ax, factor, centerFraction) { var polygon = require('../../lib/polygon'); var color = require('../../components/color'); +var appendArrayPointValue = require('../../components/fx/helpers').appendArrayPointValue; var axes = require('./axes'); var constants = require('./constants'); @@ -138458,7 +139950,9 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { selection = []; for(i = 0; i < searchTraces.length; i++) { searchInfo = searchTraces[i]; - [].push.apply(selection, searchInfo.selectPoints(searchInfo, poly)); + [].push.apply(selection, fillSelectionItem( + searchInfo.selectPoints(searchInfo, poly), searchInfo + )); } eventData = {points: selection}; @@ -138504,7 +139998,24 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) { }; }; -},{"../../components/color":590,"../../lib/polygon":719,"./axes":748,"./constants":753}],765:[function(require,module,exports){ +function fillSelectionItem(selection, searchInfo) { + if(Array.isArray(selection)) { + var trace = searchInfo.cd[0].trace; + + for(var i = 0; i < selection.length; i++) { + var sel = selection[i]; + + sel.curveNumber = trace.index; + sel.data = trace._input; + sel.fullData = trace; + appendArrayPointValue(sel, trace, sel.pointNumber); + } + } + + return selection; +} + +},{"../../components/color":600,"../../components/fx/helpers":638,"../../lib/polygon":731,"./axes":760,"./constants":765}],777:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -138523,6 +140034,7 @@ var Lib = require('../../lib'); var cleanNumber = Lib.cleanNumber; var ms2DateTime = Lib.ms2DateTime; var dateTime2ms = Lib.dateTime2ms; +var ensureNumber = Lib.ensureNumber; var numConstants = require('../../constants/numerical'); var FP_SAFE = numConstants.FP_SAFE; @@ -138535,13 +140047,6 @@ 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; -} - /** * Define the conversion functions for an axis data is used in 5 ways: * @@ -138659,7 +140164,7 @@ module.exports = function setConvert(ax, fullLayout) { if(index !== undefined) return index; } - if(typeof v === 'number') { return v; } + if(isNumeric(v)) return +v; } function l2p(v) { @@ -138672,8 +140177,8 @@ module.exports = function setConvert(ax, fullLayout) { function p2l(px) { return (px - ax._b) / ax._m; } // conversions among c/l/p are fairly simple - do them together for all axis types - ax.c2l = (ax.type === 'log') ? toLog : num; - ax.l2c = (ax.type === 'log') ? fromLog : num; + ax.c2l = (ax.type === 'log') ? toLog : ensureNumber; + ax.l2c = (ax.type === 'log') ? fromLog : ensureNumber; ax.l2p = l2p; ax.p2l = p2l; @@ -138689,10 +140194,12 @@ module.exports = function setConvert(ax, fullLayout) { if(['linear', '-'].indexOf(ax.type) !== -1) { // all are data vals, but d and r need cleaning ax.d2r = ax.r2d = ax.d2c = ax.r2c = ax.d2l = ax.r2l = cleanNumber; - ax.c2d = ax.c2r = ax.l2d = ax.l2r = num; + ax.c2d = ax.c2r = ax.l2d = ax.l2r = ensureNumber; - ax.d2p = ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.d2p = ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2d = ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'log') { // d and c are data vals, r and l are logged (but d and r need cleaning) @@ -138700,16 +140207,18 @@ module.exports = function setConvert(ax, fullLayout) { ax.r2d = ax.r2c = function(v) { return fromLog(cleanNumber(v)); }; ax.d2c = ax.r2l = cleanNumber; - ax.c2d = ax.l2r = num; + ax.c2d = ax.l2r = ensureNumber; ax.c2r = toLog; ax.l2d = fromLog; - ax.d2p = function(v, clip) { return l2p(ax.d2r(v, clip)); }; + ax.d2p = function(v, clip) { return ax.l2p(ax.d2r(v, clip)); }; ax.p2d = function(px) { return fromLog(p2l(px)); }; - ax.r2p = function(v) { return l2p(cleanNumber(v)); }; + ax.r2p = function(v) { return ax.l2p(cleanNumber(v)); }; ax.p2r = p2l; + + ax.cleanPos = ensureNumber; } else if(ax.type === 'date') { // r and d are date strings, l and c are ms @@ -138727,26 +140236,38 @@ module.exports = function setConvert(ax, fullLayout) { ax.d2c = ax.r2c = ax.d2l = ax.r2l = dt2ms; ax.c2d = ax.c2r = ax.l2d = ax.l2r = ms2dt; - ax.d2p = ax.r2p = function(v, _, calendar) { return l2p(dt2ms(v, 0, calendar)); }; + ax.d2p = ax.r2p = function(v, _, calendar) { return ax.l2p(dt2ms(v, 0, calendar)); }; ax.p2d = ax.p2r = function(px, r, calendar) { return ms2dt(p2l(px), r, calendar); }; + + ax.cleanPos = function(v) { return Lib.cleanDate(v, BADNUM, ax.calendar); }; } else if(ax.type === 'category') { - // d is categories; r, c, and l are indices - // TODO: should r accept category names too? - // ie r2c and r2l would be getCategoryIndex (and r2p would change) + // d is categories (string) + // c and l are indices (numbers) + // r is categories or numbers - ax.d2r = ax.d2c = ax.d2l = setCategoryIndex; + ax.d2c = ax.d2l = setCategoryIndex; ax.r2d = ax.c2d = ax.l2d = getCategoryName; - // special d2l variant that won't add categories - ax.d2l_noadd = getCategoryIndex; + ax.d2r = ax.d2l_noadd = getCategoryIndex; + + ax.r2c = function(v) { + var index = getCategoryIndex(v); + return index !== undefined ? index : ax.fraction2r(0.5); + }; - ax.r2l = ax.l2r = ax.r2c = ax.c2r = num; + ax.l2r = ax.c2r = ensureNumber; + ax.r2l = getCategoryIndex; - ax.d2p = function(v) { return l2p(getCategoryIndex(v)); }; + ax.d2p = function(v) { return ax.l2p(ax.r2c(v)); }; ax.p2d = function(px) { return getCategoryName(p2l(px)); }; - ax.r2p = l2p; + ax.r2p = ax.d2p; ax.p2r = p2l; + + ax.cleanPos = function(v) { + if(typeof v === 'string' && v !== '') return v; + return ensureNumber(v); + }; } // find the range value at the specified (linear) fraction of the axis @@ -138947,7 +140468,7 @@ module.exports = function setConvert(ax, fullLayout) { delete ax._forceTick0; }; -},{"../../constants/numerical":690,"../../lib":709,"./axis_ids":751,"./constants":753,"d3":118,"fast-isnumeric":127}],766:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"./axis_ids":763,"./constants":765,"d3":120,"fast-isnumeric":129}],778:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139031,7 +140552,7 @@ function getShowAttrDflt(containerIn) { } } -},{"../../lib":709}],767:[function(require,module,exports){ +},{"../../lib":721}],779:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139064,7 +140585,7 @@ module.exports = function handleTickDefaults(containerIn, containerOut, coerce, } }; -},{"../../lib":709,"./layout_attributes":759}],768:[function(require,module,exports){ +},{"../../lib":721,"./layout_attributes":771}],780:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139148,7 +140669,7 @@ module.exports = function handleTickValueDefaults(containerIn, containerOut, coe } }; -},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],769:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],781:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139464,7 +140985,7 @@ module.exports = function transitionAxes(gd, newLayout, transitionOpts, makeOnCo return Promise.resolve(); }; -},{"../../components/drawing":614,"../../plotly":743,"../../registry":826,"./axes":748,"d3":118}],770:[function(require,module,exports){ +},{"../../components/drawing":624,"../../plotly":755,"../../registry":838,"./axes":760,"d3":120}],782:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139592,7 +141113,7 @@ function isBoxWithoutPositionCoords(trace, axLetter) { ); } -},{"../../registry":826,"./axis_autotype":749,"./axis_ids":751}],771:[function(require,module,exports){ +},{"../../registry":838,"./axis_autotype":761,"./axis_ids":763}],783:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -139857,6 +141378,8 @@ function bindingValueHasChanged(gd, binding, cache) { * A list of arguments passed to the API command */ exports.executeAPICommand = function(gd, method, args) { + if(method === 'skip') return Promise.resolve(); + var apiMethod = Plotly[method]; var allArgs = [gd]; @@ -140017,7 +141540,7 @@ function crawl(attrs, callback, path, depth) { }); } -},{"../lib":709,"../plotly":743}],772:[function(require,module,exports){ +},{"../lib":721,"../plotly":755}],784:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140048,7 +141571,7 @@ module.exports = { } }; -},{}],773:[function(require,module,exports){ +},{}],785:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140094,7 +141617,7 @@ module.exports = { } }; -},{}],774:[function(require,module,exports){ +},{}],786:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140254,7 +141777,7 @@ params.layerNameToAdjective = { // base layers drawn over choropleth params.baseLayersOverChoropleth = ['rivers', 'lakes']; -},{}],775:[function(require,module,exports){ +},{}],787:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140727,7 +142250,7 @@ function createMockAxis(fullLayout) { return mockAxis; } -},{"../../components/color":590,"../../components/drawing":614,"../../components/fx":631,"../../lib/topojson_utils":730,"../cartesian/axes":748,"../plots":811,"./constants":774,"./projections":782,"./set_scale":783,"./zoom":784,"./zoom_reset":785,"d3":118,"topojson-client":528}],776:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/fx":641,"../../lib/topojson_utils":742,"../cartesian/axes":760,"../plots":823,"./constants":786,"./projections":794,"./set_scale":795,"./zoom":796,"./zoom_reset":797,"d3":120,"topojson-client":532}],788:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140807,7 +142330,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":811,"./geo":775,"./layout/attributes":777,"./layout/defaults":780,"./layout/layout_attributes":781}],777:[function(require,module,exports){ +},{"../../plots/plots":823,"./geo":787,"./layout/attributes":789,"./layout/defaults":792,"./layout/layout_attributes":793}],789:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140828,7 +142351,7 @@ module.exports = { } }; -},{}],778:[function(require,module,exports){ +},{}],790:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140883,7 +142406,7 @@ module.exports = { } }; -},{"../../../components/color/attributes":589}],779:[function(require,module,exports){ +},{"../../../components/color/attributes":599}],791:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -140957,7 +142480,7 @@ module.exports = function supplyGeoAxisLayoutDefaults(geoLayoutIn, geoLayoutOut) } }; -},{"../../../lib":709,"../constants":774,"./axis_attributes":778}],780:[function(require,module,exports){ +},{"../../../lib":721,"../constants":786,"./axis_attributes":790}],792:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141076,7 +142599,7 @@ function handleGeoDefaults(geoLayoutIn, geoLayoutOut, coerce) { ]; } -},{"../../subplot_defaults":818,"../constants":774,"./axis_defaults":779,"./layout_attributes":781}],781:[function(require,module,exports){ +},{"../../subplot_defaults":830,"../constants":786,"./axis_defaults":791,"./layout_attributes":793}],793:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141309,7 +142832,7 @@ module.exports = { lataxis: geoAxesAttrs }; -},{"../../../components/color/attributes":589,"../constants":774,"./axis_attributes":778}],782:[function(require,module,exports){ +},{"../../../components/color/attributes":599,"../constants":786,"./axis_attributes":790}],794:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141755,7 +143278,7 @@ function addProjectionsToD3(d3) { module.exports = addProjectionsToD3; -},{}],783:[function(require,module,exports){ +},{}],795:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -141906,7 +143429,7 @@ function getBounds(projection, rangeBox) { return d3.geo.path().projection(projection).bounds(rangeBox); } -},{"./constants":774,"d3":118}],784:[function(require,module,exports){ +},{"./constants":786,"d3":120}],796:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142333,7 +143856,7 @@ function d3_eventDispatch(target) { return dispatch; } -},{"d3":118}],785:[function(require,module,exports){ +},{"d3":120}],797:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142362,7 +143885,7 @@ module.exports = function createGeoZoomReset(geo, geoLayout) { return zoomReset; }; -},{}],786:[function(require,module,exports){ +},{}],798:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142496,7 +144019,7 @@ function createCamera(scene) { if(Math.abs(dx * dydx) > Math.abs(dy)) { result.boxEnd[1] = result.boxStart[1] + - Math.abs(dx) * dydx * (Math.sign(dy) || 1); + Math.abs(dx) * dydx * (dy >= 0 ? 1 : -1); // gl-select-box clips to the plot area bounds, // which breaks the axis constraint, so don't allow @@ -142514,7 +144037,7 @@ function createCamera(scene) { } else { result.boxEnd[0] = result.boxStart[0] + - Math.abs(dy) / dydx * (Math.sign(dx) || 1); + Math.abs(dy) / dydx * (dx >= 0 ? 1 : -1); if(result.boxEnd[0] < dataBox[0]) { result.boxEnd[0] = dataBox[0]; @@ -142644,7 +144167,7 @@ function createCamera(scene) { return result; } -},{"../cartesian/constants":753,"mouse-change":445,"mouse-wheel":448}],787:[function(require,module,exports){ +},{"../cartesian/constants":765,"mouse-change":448,"mouse-wheel":451}],799:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142890,7 +144413,7 @@ function createAxes2D(scene) { module.exports = createAxes2D; -},{"../../lib/html2unicode":707,"../../lib/str2rgbarray":727,"../cartesian/axes":748,"../plots":811}],788:[function(require,module,exports){ +},{"../../lib/html2unicode":719,"../../lib/str2rgbarray":739,"../cartesian/axes":760,"../plots":823}],800:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -142905,7 +144428,8 @@ module.exports = createAxes2D; var Scene2D = require('./scene2d'); var Plots = require('../plots'); var xmlnsNamespaces = require('../../constants/xmlns_namespaces'); - +var constants = require('../cartesian/constants'); +var Cartesian = require('../cartesian'); exports.name = 'gl2d'; @@ -142913,15 +144437,9 @@ exports.attr = ['xaxis', 'yaxis']; exports.idRoot = ['x', 'y']; -exports.idRegex = { - x: /^x([2-9]|[1-9][0-9]+)?$/, - y: /^y([2-9]|[1-9][0-9]+)?$/ -}; +exports.idRegex = constants.idRegex; -exports.attrRegex = { - x: /^xaxis([2-9]|[1-9][0-9]+)?$/, - y: /^yaxis([2-9]|[1-9][0-9]+)?$/ -}; +exports.attrRegex = constants.attrRegex; exports.attributes = require('../cartesian/attributes'); @@ -142975,6 +144493,15 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) delete oldFullLayout._plots[id]; } } + + // since we use cartesian interactions, do cartesian clean + Cartesian.clean.apply(this, arguments); +}; + +exports.drawFramework = function(gd) { + if(!gd._context.staticPlot) { + Cartesian.drawFramework(gd); + } }; exports.toSVG = function(gd) { @@ -143002,7 +144529,7 @@ exports.toSVG = function(gd) { } }; -},{"../../constants/xmlns_namespaces":692,"../cartesian/attributes":747,"../plots":811,"./scene2d":789}],789:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../cartesian":770,"../cartesian/attributes":759,"../cartesian/constants":765,"../plots":823,"./scene2d":801}],801:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143027,7 +144554,9 @@ var createOptions = require('./convert'); var createCamera = require('./camera'); var convertHTMLToUnicode = require('../../lib/html2unicode'); var showNoWebGlMsg = require('../../lib/show_no_webgl_msg'); -var enforceAxisConstraints = require('../../plots/cartesian/constraints'); +var axisConstraints = require('../../plots/cartesian/constraints'); +var enforceAxisConstraints = axisConstraints.enforce; +var cleanAxisConstraints = axisConstraints.clean; var AXES = ['xaxis', 'yaxis']; var STATIC_CANVAS, STATIC_CONTEXT; @@ -143072,6 +144601,11 @@ function Scene2D(options, fullLayout) { // last pick result this.pickResult = null; + // is the mouse over the plot? + // it's OK if this says true when it's not, so long as + // when we get a mouseout we set it to false before handling + this.isMouseOver = true; + this.bounds = [Infinity, Infinity, -Infinity, -Infinity]; // flag to stop render loop @@ -143152,12 +144686,22 @@ proto.makeFramework = function() { // create div to catch the mouse event var mouseContainer = this.mouseContainer = document.createElement('div'); mouseContainer.style.position = 'absolute'; + mouseContainer.style['pointer-events'] = 'auto'; // append canvas, hover svg and mouse div to container var container = this.container; container.appendChild(canvas); container.appendChild(svgContainer); container.appendChild(mouseContainer); + + var self = this; + mouseContainer.addEventListener('mouseout', function() { + self.isMouseOver = false; + self.unhover(); + }); + mouseContainer.addEventListener('mouseover', function() { + self.isMouseOver = true; + }); }; proto.toImage = function(format) { @@ -143248,13 +144792,6 @@ proto.computeTickMarks = function() { this.xaxis.setScale(); this.yaxis.setScale(); - // override _length from backward compatibility - // even though setScale 'should' give the correct result - this.xaxis._length = - this.glplot.viewBox[2] - this.glplot.viewBox[0]; - this.yaxis._length = - this.glplot.viewBox[3] - this.glplot.viewBox[1]; - var nextTicks = [ Axes.calcTicks(this.xaxis), Axes.calcTicks(this.yaxis) @@ -143376,6 +144913,7 @@ proto.plot = function(fullData, calcData, fullLayout) { this.updateRefs(fullLayout); this.updateTraces(fullData, calcData); + this.updateFx(fullLayout.dragmode); var width = fullLayout.width, height = fullLayout.height; @@ -143386,6 +144924,15 @@ proto.plot = function(fullData, calcData, fullLayout) { options.merge(fullLayout); options.screenBox = [0, 0, width, height]; + var mockGraphDiv = {_fullLayout: { + _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, + xaxis: this.xaxis, + yaxis: this.yaxis + }}; + + cleanAxisConstraints(mockGraphDiv, this.xaxis); + cleanAxisConstraints(mockGraphDiv, this.yaxis); + var size = fullLayout._size, domainX = this.xaxis.domain, domainY = this.yaxis.domain; @@ -143432,12 +144979,7 @@ proto.plot = function(fullData, calcData, fullLayout) { ax.setScale(); } - var mockLayout = { - _axisConstraintGroups: this.graphDiv._fullLayout._axisConstraintGroups, - xaxis: this.xaxis, - yaxis: this.yaxis - }; - enforceAxisConstraints({_fullLayout: mockLayout}); + enforceAxisConstraints(mockGraphDiv); options.ticks = this.computeTickMarks(); @@ -143512,11 +145054,19 @@ proto.updateTraces = function(fullData, calcData) { this.glplot.objects.sort(function(a, b) { return a._trace.index - b._trace.index; }); +}; +proto.updateFx = function(dragmode) { + if(dragmode === 'lasso' || dragmode === 'select') { + this.mouseContainer.style['pointer-events'] = 'none'; + } else { + this.mouseContainer.style['pointer-events'] = 'auto'; + } }; proto.emitPointAction = function(nextSelection, eventType) { var uid = nextSelection.trace.uid; + var ptNumber = nextSelection.pointIndex; var trace; for(var i = 0; i < this.fullData.length; i++) { @@ -143525,18 +145075,20 @@ proto.emitPointAction = function(nextSelection, eventType) { } } - this.graphDiv.emit(eventType, { - points: [{ - x: nextSelection.traceCoord[0], - y: nextSelection.traceCoord[1], - curveNumber: trace.index, - pointNumber: nextSelection.pointIndex, - data: trace._input, - fullData: this.fullData, - xaxis: this.xaxis, - yaxis: this.yaxis - }] - }); + var pointData = { + x: nextSelection.traceCoord[0], + y: nextSelection.traceCoord[1], + curveNumber: trace.index, + pointNumber: ptNumber, + data: trace._input, + fullData: this.fullData, + xaxis: this.xaxis, + yaxis: this.yaxis + }; + + Fx.appendArrayPointValue(pointData, trace, ptNumber); + + this.graphDiv.emit(eventType, {points: [pointData]}); }; proto.draw = function() { @@ -143579,7 +145131,7 @@ proto.draw = function() { glplot.setDirty(); } - else if(!camera.panning) { + else if(!camera.panning && this.isMouseOver) { this.selectBox.enabled = false; var size = fullLayout._size, @@ -143628,8 +145180,11 @@ proto.draw = function() { // also it's important to copy, otherwise data is lost by the time event data is read this.emitPointAction(nextSelection, 'plotly_hover'); - var hoverinfo = selection.hoverinfo; - if(hoverinfo !== 'all') { + var trace = this.fullData[selection.trace.index] || {}; + var ptNumber = selection.pointIndex; + var hoverinfo = Fx.castHoverinfo(trace, fullLayout, ptNumber); + + if(hoverinfo && hoverinfo !== 'all') { var parts = hoverinfo.split('+'); if(parts.indexOf('x') === -1) selection.traceCoord[0] = undefined; if(parts.indexOf('y') === -1) selection.traceCoord[1] = undefined; @@ -143638,9 +145193,6 @@ proto.draw = function() { if(parts.indexOf('name') === -1) selection.name = undefined; } - var trace = this.fullData[selection.trace.index] || {}; - var ptNumber = selection.pointIndex; - Fx.loneHover({ x: selection.screenCoord[0], y: selection.screenCoord[1], @@ -143655,7 +145207,8 @@ proto.draw = function() { fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') }, { - container: this.svgContainer + container: this.svgContainer, + gd: this.graphDiv }); } } @@ -143663,14 +145216,20 @@ proto.draw = function() { // Remove hover effects if we're not over a point OR // if we're zooming or panning (in which case result is not set) - if(!result && this.lastPickResult) { + if(!result) { + this.unhover(); + } + + glplot.draw(); +}; + +proto.unhover = function() { + if(this.lastPickResult) { this.spikes.update({}); this.lastPickResult = null; this.graphDiv.emit('plotly_unhover'); Fx.loneUnhover(this.svgContainer); } - - glplot.draw(); }; proto.hoverFormatter = function(axisName, val) { @@ -143680,7 +145239,7 @@ proto.hoverFormatter = function(axisName, val) { return Axes.tickText(axis, axis.c2l(val), 'hover').text; }; -},{"../../components/fx":631,"../../lib/html2unicode":707,"../../lib/show_no_webgl_msg":725,"../../plots/cartesian/axes":748,"../../plots/cartesian/constraints":755,"../../registry":826,"./camera":786,"./convert":787,"gl-plot2d":214,"gl-select-box":248,"gl-spikes2d":257,"webgl-context":555}],790:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib/html2unicode":719,"../../lib/show_no_webgl_msg":737,"../../plots/cartesian/axes":760,"../../plots/cartesian/constraints":767,"../../registry":838,"./camera":798,"./convert":799,"gl-plot2d":217,"gl-select-box":251,"gl-spikes2d":260,"webgl-context":559}],802:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -143697,6 +145256,7 @@ var now = require('right-now'); var createView = require('3d-view'); var mouseChange = require('mouse-change'); var mouseWheel = require('mouse-wheel'); +var mouseOffset = require('mouse-event-offset'); function createCamera(element, options) { element = element || document.body; @@ -143862,8 +145422,24 @@ function createCamera(element, options) { return false; }); - var lastX = 0, lastY = 0; - mouseChange(element, function(buttons, x, y, mods) { + var lastX = 0, lastY = 0, lastMods = {shift: false, control: false, alt: false, meta: false}; + mouseChange(element, handleInteraction); + + // enable simple touch interactions + element.addEventListener('touchstart', function(ev) { + var xy = mouseOffset(ev.changedTouches[0], element); + handleInteraction(0, xy[0], xy[1], lastMods); + handleInteraction(1, xy[0], xy[1], lastMods); + }); + element.addEventListener('touchmove', function(ev) { + var xy = mouseOffset(ev.changedTouches[0], element); + handleInteraction(1, xy[0], xy[1], lastMods); + }); + element.addEventListener('touchend', function() { + handleInteraction(0, lastX, lastY, lastMods); + }); + + function handleInteraction(buttons, x, y, mods) { var keyBindingMode = camera.keyBindingMode; if(keyBindingMode === false) return; @@ -143908,9 +145484,10 @@ function createCamera(element, options) { lastX = x; lastY = y; + lastMods = mods; return true; - }); + } mouseWheel(element, function(dx, dy) { if(camera.keyBindingMode === false) return; @@ -143929,7 +145506,7 @@ function createCamera(element, options) { return camera; } -},{"3d-view":35,"mouse-change":445,"mouse-wheel":448,"right-now":494}],791:[function(require,module,exports){ +},{"3d-view":35,"mouse-change":448,"mouse-event-offset":449,"mouse-wheel":451,"right-now":498}],803:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144005,6 +145582,12 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) if(!newFullLayout[oldSceneKey] && !!oldFullLayout[oldSceneKey]._scene) { oldFullLayout[oldSceneKey]._scene.destroy(); + + if(oldFullLayout._infolayer) { + oldFullLayout._infolayer + .selectAll('.annotation-' + oldSceneKey) + .remove(); + } } } }; @@ -144046,7 +145629,7 @@ exports.cleanId = function cleanId(id) { return 'scene' + sceneNum; }; -},{"../../constants/xmlns_namespaces":692,"../../lib":709,"../plots":811,"./layout/attributes":792,"./layout/defaults":796,"./layout/layout_attributes":797,"./scene":801}],792:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../../lib":721,"../plots":823,"./layout/attributes":804,"./layout/defaults":808,"./layout/layout_attributes":809,"./scene":813}],804:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144067,7 +145650,7 @@ module.exports = { } }; -},{}],793:[function(require,module,exports){ +},{}],805:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144174,7 +145757,7 @@ module.exports = { zerolinewidth: axesAttrs.zerolinewidth }; -},{"../../../components/color":590,"../../../lib/extend":701,"../../cartesian/layout_attributes":759}],794:[function(require,module,exports){ +},{"../../../components/color":600,"../../../lib/extend":713,"../../cartesian/layout_attributes":771}],806:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144246,7 +145829,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) { } }; -},{"../../../lib":709,"../../cartesian/axis_defaults":750,"../../cartesian/type_defaults":770,"./axis_attributes":793,"tinycolor2":526}],795:[function(require,module,exports){ +},{"../../../lib":721,"../../cartesian/axis_defaults":762,"../../cartesian/type_defaults":782,"./axis_attributes":805,"tinycolor2":530}],807:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144409,7 +145992,7 @@ function createAxesOptions(plotlyOptions) { module.exports = createAxesOptions; -},{"../../../lib/html2unicode":707,"../../../lib/str2rgbarray":727}],796:[function(require,module,exports){ +},{"../../../lib/html2unicode":719,"../../../lib/str2rgbarray":739}],808:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144423,10 +146006,11 @@ module.exports = createAxesOptions; var Lib = require('../../../lib'); var Color = require('../../../components/color'); +var Registry = require('../../../registry'); var handleSubplotDefaults = require('../../subplot_defaults'); -var layoutAttributes = require('./layout_attributes'); var supplyGl3dAxisLayoutDefaults = require('./axis_defaults'); +var layoutAttributes = require('./layout_attributes'); module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { @@ -144445,6 +146029,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { type: 'gl3d', attributes: layoutAttributes, handleDefaults: handleGl3dDefaults, + fullLayout: layoutOut, font: layoutOut.font, fullData: fullData, getDfltFromLayout: getDfltFromLayout, @@ -144509,11 +146094,15 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) { calendar: opts.calendar }); + Registry.getComponentMethod('annotations3d', 'handleDefaults')( + sceneLayoutIn, sceneLayoutOut, opts + ); + coerce('dragmode', opts.getDfltFromLayout('dragmode')); coerce('hovermode', opts.getDfltFromLayout('hovermode')); } -},{"../../../components/color":590,"../../../lib":709,"../../subplot_defaults":818,"./axis_defaults":794,"./layout_attributes":797}],797:[function(require,module,exports){ +},{"../../../components/color":600,"../../../lib":721,"../../../registry":838,"../../subplot_defaults":830,"./axis_defaults":806,"./layout_attributes":809}],809:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144549,6 +146138,8 @@ function makeVector(x, y, z) { } module.exports = { + _arrayAttrRegexps: [/^scene([2-9]|[1-9][0-9]+)?\.annotations/], + bgcolor: { valType: 'color', @@ -144641,7 +146232,7 @@ module.exports = { } }; -},{"../../../lib/extend":701,"./axis_attributes":793}],798:[function(require,module,exports){ +},{"../../../lib/extend":713,"./axis_attributes":805}],810:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144693,7 +146284,7 @@ function createSpikeOptions(layout) { module.exports = createSpikeOptions; -},{"../../../lib/str2rgbarray":727}],799:[function(require,module,exports){ +},{"../../../lib/str2rgbarray":739}],811:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144789,7 +146380,7 @@ function computeTickMarks(scene) { scene.contourLevels = contourLevelsFromTicks(ticks); } -},{"../../../lib":709,"../../../lib/html2unicode":707,"../../cartesian/axes":748}],800:[function(require,module,exports){ +},{"../../../lib":721,"../../../lib/html2unicode":719,"../../cartesian/axes":760}],812:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144823,7 +146414,7 @@ function project(camera, v) { module.exports = project; -},{}],801:[function(require,module,exports){ +},{}],813:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -144838,6 +146429,7 @@ module.exports = project; var createPlot = require('gl-plot3d'); var getContext = require('webgl-context'); +var Registry = require('../../registry'); var Lib = require('../../lib'); var Axes = require('../../plots/cartesian/axes'); @@ -144855,7 +146447,6 @@ var computeTickMarks = require('./layout/tick_marks'); var STATIC_CANVAS, STATIC_CONTEXT; function render(scene) { - var trace; // update size of svg container @@ -144893,8 +146484,8 @@ function render(scene) { if(lastPicked !== null) { var pdata = project(scene.glplot.cameraParams, selection.dataCoordinate); trace = lastPicked.data; - var hoverinfo = trace.hoverinfo; var ptNumber = selection.index; + var hoverinfo = Fx.castHoverinfo(trace, scene.fullLayout, ptNumber); var xVal = formatter('xaxis', selection.traceCoordinate[0]), yVal = formatter('yaxis', selection.traceCoordinate[1]), @@ -144924,22 +146515,25 @@ function render(scene) { fontSize: Fx.castHoverOption(trace, ptNumber, 'font.size'), fontColor: Fx.castHoverOption(trace, ptNumber, 'font.color') }, { - container: svgContainer + container: svgContainer, + gd: scene.graphDiv }); } - var eventData = { - points: [{ - x: selection.traceCoordinate[0], - y: selection.traceCoordinate[1], - z: selection.traceCoordinate[2], - data: trace._input, - fullData: trace, - curveNumber: trace.index, - pointNumber: ptNumber - }] + var pointData = { + x: selection.traceCoordinate[0], + y: selection.traceCoordinate[1], + z: selection.traceCoordinate[2], + data: trace._input, + fullData: trace, + curveNumber: trace.index, + pointNumber: ptNumber }; + Fx.appendArrayPointValue(pointData, trace, ptNumber); + + var eventData = {points: [pointData]}; + if(selection.buttons && selection.distance < 5) { scene.graphDiv.emit('plotly_click', eventData); } @@ -144953,6 +146547,8 @@ function render(scene) { Fx.loneUnhover(svgContainer); scene.graphDiv.emit('plotly_unhover', oldEventData); } + + scene.drawAnnotations(scene); } function initializeGLPlot(scene, fullLayout, canvas, gl) { @@ -145005,7 +146601,7 @@ function initializeGLPlot(scene, fullLayout, canvas, gl) { if(scene.fullSceneLayout.dragmode === false) return; var update = {}; - update[scene.id] = getLayoutCamera(scene.camera); + update[scene.id + '.camera'] = getLayoutCamera(scene.camera); scene.saveCamera(scene.graphDiv.layout); scene.graphDiv.emit('plotly_relayout', update); }; @@ -145095,6 +146691,9 @@ function Scene(options, fullLayout) { this.contourLevels = [ [], [], [] ]; + this.convertAnnotations = Registry.getComponentMethod('annotations3d', 'convert'); + this.drawAnnotations = Registry.getComponentMethod('annotations3d', 'draw'); + if(!initializeGLPlot(this, fullLayout)) return; // todo check the necessity for this line } @@ -145219,6 +146818,9 @@ proto.plot = function(sceneData, fullLayout, layout) { // Save scale this.dataScale = dataScale; + // after computeTraceBounds where ax._categories are filled in + this.convertAnnotations(this); + // Update traces for(i = 0; i < sceneData.length; ++i) { data = sceneData[i]; @@ -145278,13 +146880,28 @@ proto.plot = function(sceneData, fullLayout, layout) { if(axis.autorange) { sceneBounds[0][i] = Infinity; sceneBounds[1][i] = -Infinity; - for(j = 0; j < this.glplot.objects.length; ++j) { - var objBounds = this.glplot.objects[j].bounds; - sceneBounds[0][i] = Math.min(sceneBounds[0][i], - objBounds[0][i] / dataScale[i]); - sceneBounds[1][i] = Math.max(sceneBounds[1][i], - objBounds[1][i] / dataScale[i]); + + var objects = this.glplot.objects; + var annotations = this.fullSceneLayout.annotations || []; + var axLetter = axis._name.charAt(0); + + for(j = 0; j < objects.length; j++) { + var objBounds = objects[j].bounds; + sceneBounds[0][i] = Math.min(sceneBounds[0][i], objBounds[0][i] / dataScale[i]); + sceneBounds[1][i] = Math.max(sceneBounds[1][i], objBounds[1][i] / dataScale[i]); + } + + for(j = 0; j < annotations.length; j++) { + var ann = annotations[j]; + + // N.B. not taking into consideration the arrowhead + if(ann.visible) { + var pos = axis.r2l(ann[axLetter]); + sceneBounds[0][i] = Math.min(sceneBounds[0][i], pos); + sceneBounds[1][i] = Math.max(sceneBounds[1][i], pos); + } } + if('rangemode' in axis && axis.rangemode === 'tozero') { sceneBounds[0][i] = Math.min(sceneBounds[0][i], 0); sceneBounds[1][i] = Math.max(sceneBounds[1][i], 0); @@ -145298,9 +146915,9 @@ proto.plot = function(sceneData, fullLayout, layout) { sceneBounds[1][i] += d / 32.0; } } else { - var range = fullSceneLayout[axisProperties[i]].range; - sceneBounds[0][i] = range[0]; - sceneBounds[1][i] = range[1]; + var range = axis.range; + sceneBounds[0][i] = axis.r2l(range[0]); + sceneBounds[1][i] = axis.r2l(range[1]); } if(sceneBounds[0][i] === sceneBounds[1][i]) { sceneBounds[0][i] -= 1; @@ -145542,7 +147159,7 @@ proto.toImage = function(format) { }; proto.setConvert = function() { - for(var i = 0; i < 3; ++i) { + for(var i = 0; i < 3; i++) { var ax = this.fullSceneLayout[axisProperties[i]]; Axes.setConvert(ax, this.fullLayout); ax.setScale = Lib.noop; @@ -145551,7 +147168,7 @@ proto.setConvert = function() { module.exports = Scene; -},{"../../components/fx":631,"../../lib":709,"../../lib/show_no_webgl_msg":725,"../../lib/str2rgbarray":727,"../../plots/cartesian/axes":748,"./camera":790,"./layout/convert":795,"./layout/spikes":798,"./layout/tick_marks":799,"./project":800,"gl-plot3d":216,"webgl-context":555}],802:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib":721,"../../lib/show_no_webgl_msg":737,"../../lib/str2rgbarray":739,"../../plots/cartesian/axes":760,"../../registry":838,"./camera":802,"./layout/convert":807,"./layout/spikes":810,"./layout/tick_marks":811,"./project":812,"gl-plot3d":219,"webgl-context":559}],814:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145694,7 +147311,7 @@ module.exports = { } }; -},{"../components/color/attributes":589,"../lib":709,"./font_attributes":772}],803:[function(require,module,exports){ +},{"../components/color/attributes":599,"../lib":721,"./font_attributes":784}],815:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145724,7 +147341,7 @@ module.exports = { mapOnErrorMsg: 'Mapbox error.' }; -},{}],804:[function(require,module,exports){ +},{}],816:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145798,7 +147415,7 @@ module.exports = function convertTextOpts(textposition, iconSize) { return { anchor: anchor, offset: offset }; }; -},{"../../lib":709}],805:[function(require,module,exports){ +},{"../../lib":721}],817:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -145941,7 +147558,7 @@ function findAccessToken(gd, mapboxIds) { return accessToken; } -},{"../../constants/xmlns_namespaces":692,"../plots":811,"./constants":803,"./layout_attributes":807,"./layout_defaults":808,"./mapbox":809,"mapbox-gl":336}],806:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../plots":823,"./constants":815,"./layout_attributes":819,"./layout_defaults":820,"./mapbox":821,"mapbox-gl":339}],818:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146166,7 +147783,7 @@ module.exports = function createMapboxLayer(mapbox, index, opts) { return mapboxLayer; }; -},{"../../lib":709,"./convert_text_opts":804}],807:[function(require,module,exports){ +},{"../../lib":721,"./convert_text_opts":816}],819:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146370,7 +147987,7 @@ module.exports = { }; -},{"../../components/color":590,"../../lib":709,"../../traces/scatter/attributes":1008,"../font_attributes":772}],808:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../traces/scatter/attributes":1022,"../font_attributes":784}],820:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146466,7 +148083,7 @@ function handleLayerDefaults(containerIn, containerOut) { } } -},{"../../lib":709,"../subplot_defaults":818,"./layout_attributes":807}],809:[function(require,module,exports){ +},{"../../lib":721,"../subplot_defaults":830,"./layout_attributes":819}],821:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146930,7 +148547,7 @@ function convertCenter(center) { return [center.lon, center.lat]; } -},{"../../components/fx":631,"../../lib":709,"./constants":803,"./layers":806,"./layout_attributes":807,"mapbox-gl":336}],810:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib":721,"./constants":815,"./layers":818,"./layout_attributes":819,"mapbox-gl":339}],822:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146968,7 +148585,7 @@ module.exports = { } }; -},{}],811:[function(require,module,exports){ +},{}],823:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -146984,6 +148601,7 @@ var d3 = require('d3'); var isNumeric = require('fast-isnumeric'); var Plotly = require('../plotly'); +var PlotSchema = require('../plot_api/plot_schema'); var Registry = require('../registry'); var Lib = require('../lib'); var Color = require('../components/color'); @@ -147476,12 +149094,38 @@ plots.supplyDefaults = function(gd) { // update object references in calcdata if((gd.calcdata || []).length === newFullData.length) { for(i = 0; i < newFullData.length; i++) { - var trace = newFullData[i]; - (gd.calcdata[i][0] || {}).trace = trace; + var newTrace = newFullData[i]; + var cd0 = gd.calcdata[i][0]; + if(cd0 && cd0.trace) { + if(cd0.trace._hasCalcTransform) { + remapTransformedArrays(cd0, newTrace); + } else { + cd0.trace = newTrace; + } + } } } }; +function remapTransformedArrays(cd0, newTrace) { + var oldTrace = cd0.trace; + var arrayAttrs = oldTrace._arrayAttrs; + var transformedArrayHash = {}; + var i, astr; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + transformedArrayHash[astr] = Lib.nestedProperty(oldTrace, astr).get().slice(); + } + + cd0.trace = newTrace; + + for(i = 0; i < arrayAttrs.length; i++) { + astr = arrayAttrs[i]; + Lib.nestedProperty(cd0.trace, astr).set(transformedArrayHash[astr]); + } +} + // Create storage for all of the data related to frames and transitions: plots.createTransitionData = function(gd) { // Set up the default keyframe if it doesn't exist: @@ -147806,12 +149450,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde } if(visible) { + coerce('customdata'); + coerce('ids'); + var _module = plots.getModule(traceOut); traceOut._module = _module; - // gets overwritten in pie, geo and ternary modules - coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined); - if(plots.traceIs(traceOut, 'showLegend')) { coerce('showlegend'); coerce('legendgroup'); @@ -147824,7 +149468,10 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde // TODO add per-base-plot-module trace defaults step - if(_module) _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + if(_module) { + _module.supplyDefaults(traceIn, traceOut, defaultColor, layout); + Lib.coerceHoverinfo(traceIn, traceOut, layout); + } if(!plots.traceIs(traceOut, 'noOpacity')) coerce('opacity'); @@ -148757,6 +150404,10 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts) // of essentially the whole supplyDefaults step, so that it seems sensible to just use // supplyDefaults even though it's heavier than would otherwise be desired for // transitions: + + // first delete calcdata so supplyDefaults knows a calc step is coming + delete gd.calcdata; + plots.supplyDefaults(gd); plots.doCalcdata(gd); @@ -148972,7 +150623,13 @@ plots.doCalcdata = function(gd, traces) { } } - var hasCategoryAxis = initCategories(axList); + // find array attributes in trace + for(i = 0; i < fullData.length; i++) { + trace = fullData[i]; + trace._arrayAttrs = PlotSchema.findArrayAttributes(trace); + } + + initCategories(axList); var hasCalcTransform = false; @@ -148993,6 +150650,7 @@ plots.doCalcdata = function(gd, traces) { _module = transformsRegistry[transform.type]; if(_module && _module.calcTransform) { + trace._hasCalcTransform = true; hasCalcTransform = true; _module.calcTransform(gd, trace, transform); } @@ -149040,25 +150698,11 @@ plots.doCalcdata = function(gd, traces) { } Registry.getComponentMethod('fx', 'calc')(gd); - - // To handle the case of components using category names as coordinates, we - // need to re-supply defaults for these objects now, after calc has - // finished populating the category mappings - // Any component that uses `Axes.coercePosition` falls into this category - if(hasCategoryAxis) { - var dataReferencedComponents = ['annotations', 'shapes', 'images']; - for(i = 0; i < dataReferencedComponents.length; i++) { - Registry.getComponentMethod(dataReferencedComponents[i], 'supplyLayoutDefaults')( - gd.layout, fullLayout, fullData); - } - } }; +// initialize the category list, if there is one, so we start over +// to be filled in later by ax.d2c function initCategories(axList) { - var hasCategoryAxis = false; - - // initialize the category list, if there is one, so we start over - // to be filled in later by ax.d2c for(var i = 0; i < axList.length; i++) { axList[i]._categories = axList[i]._initialCategories.slice(); @@ -149067,11 +150711,7 @@ function initCategories(axList) { for(var j = 0; j < axList[i]._categories.length; j++) { axList[i]._categoriesMap[axList[i]._categories[j]] = j; } - - if(axList[i].type === 'category') hasCategoryAxis = true; } - - return hasCategoryAxis; } plots.rehover = function(gd) { @@ -149144,7 +150784,7 @@ plots.generalUpdatePerTraceModule = function(subplot, subplotCalcData, subplotLa subplot.traceHash = traceHash; }; -},{"../components/color":590,"../components/errorbars":620,"../constants/numerical":690,"../lib":709,"../plotly":743,"../registry":826,"./animation_attributes":744,"./attributes":746,"./command":771,"./font_attributes":772,"./frame_attributes":773,"./layout_attributes":802,"d3":118,"fast-isnumeric":127}],812:[function(require,module,exports){ +},{"../components/color":600,"../components/errorbars":630,"../constants/numerical":702,"../lib":721,"../plot_api/plot_schema":749,"../plotly":755,"../registry":838,"./animation_attributes":756,"./attributes":758,"./command":783,"./font_attributes":784,"./frame_attributes":785,"./layout_attributes":814,"d3":120,"fast-isnumeric":129}],824:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -149169,7 +150809,7 @@ module.exports = { } }; -},{"../../traces/scatter/attributes":1008}],813:[function(require,module,exports){ +},{"../../traces/scatter/attributes":1022}],825:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -149284,7 +150924,7 @@ module.exports = { } }; -},{"../../lib/extend":701,"../cartesian/layout_attributes":759}],814:[function(require,module,exports){ +},{"../../lib/extend":713,"../cartesian/layout_attributes":771}],826:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -149299,7 +150939,7 @@ var Polar = module.exports = require('./micropolar'); Polar.manager = require('./micropolar_manager'); -},{"./micropolar":815,"./micropolar_manager":816}],815:[function(require,module,exports){ +},{"./micropolar":827,"./micropolar_manager":828}],827:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150718,7 +152358,7 @@ var µ = module.exports = { version: '0.2.2' }; return exports; }; -},{"../../lib":709,"d3":118}],816:[function(require,module,exports){ +},{"../../lib":721,"d3":120}],828:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150804,7 +152444,7 @@ manager.fillLayout = function(_gd) { _gd._fullLayout = extendDeepAll(dflts, _gd.layout); }; -},{"../../components/color":590,"../../lib":709,"./micropolar":815,"./undo_manager":817,"d3":118}],817:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"./micropolar":827,"./undo_manager":829,"d3":120}],829:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150870,7 +152510,7 @@ module.exports = function UndoManager() { }; }; -},{}],818:[function(require,module,exports){ +},{}],830:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -150945,7 +152585,7 @@ module.exports = function handleSubplotDefaults(layoutIn, layoutOut, fullData, o } }; -},{"../lib":709,"./plots":811}],819:[function(require,module,exports){ +},{"../lib":721,"./plots":823}],831:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151019,7 +152659,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":811,"./layout/attributes":820,"./layout/defaults":823,"./layout/layout_attributes":824,"./ternary":825}],820:[function(require,module,exports){ +},{"../../plots/plots":823,"./layout/attributes":832,"./layout/defaults":835,"./layout/layout_attributes":836,"./ternary":837}],832:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151040,7 +152680,7 @@ module.exports = { } }; -},{}],821:[function(require,module,exports){ +},{}],833:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151100,7 +152740,7 @@ module.exports = { } }; -},{"../../../lib/extend":701,"../../cartesian/layout_attributes":759}],822:[function(require,module,exports){ +},{"../../../lib/extend":713,"../../cartesian/layout_attributes":771}],834:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151184,7 +152824,7 @@ module.exports = function supplyLayoutDefaults(containerIn, containerOut, option } }; -},{"../../../lib":709,"../../cartesian/tick_label_defaults":766,"../../cartesian/tick_mark_defaults":767,"../../cartesian/tick_value_defaults":768,"./axis_attributes":821,"tinycolor2":526}],823:[function(require,module,exports){ +},{"../../../lib":721,"../../cartesian/tick_label_defaults":778,"../../cartesian/tick_mark_defaults":779,"../../cartesian/tick_value_defaults":780,"./axis_attributes":833,"tinycolor2":530}],835:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151247,7 +152887,7 @@ function handleTernaryDefaults(ternaryLayoutIn, ternaryLayoutOut, coerce, option } } -},{"../../../components/color":590,"../../subplot_defaults":818,"./axis_defaults":822,"./layout_attributes":824}],824:[function(require,module,exports){ +},{"../../../components/color":600,"../../subplot_defaults":830,"./axis_defaults":834,"./layout_attributes":836}],836:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151303,7 +152943,7 @@ module.exports = { caxis: ternaryAxesAttrs }; -},{"../../../components/color/attributes":589,"./axis_attributes":821}],825:[function(require,module,exports){ +},{"../../../components/color/attributes":599,"./axis_attributes":833}],837:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -151937,7 +153577,7 @@ proto.initInteractions = function() { }; dragger.onclick = function(evt) { - Fx.click(gd, evt); + Fx.click(gd, evt, _this.id); }; dragElement.init(dragOptions); @@ -151949,7 +153589,7 @@ function removeZoombox(gd) { .remove(); } -},{"../../components/color":590,"../../components/dragelement":611,"../../components/drawing":614,"../../components/fx":631,"../../components/titles":679,"../../lib":709,"../../lib/extend":701,"../../plotly":743,"../cartesian/axes":748,"../cartesian/constants":753,"../cartesian/select":764,"../cartesian/set_convert":765,"../plots":811,"d3":118,"tinycolor2":526}],826:[function(require,module,exports){ +},{"../../components/color":600,"../../components/dragelement":621,"../../components/drawing":624,"../../components/fx":641,"../../components/titles":689,"../../lib":721,"../../lib/extend":713,"../../plotly":755,"../cartesian/axes":760,"../cartesian/constants":765,"../cartesian/select":776,"../cartesian/set_convert":777,"../plots":823,"d3":120,"tinycolor2":530}],838:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152140,7 +153780,7 @@ function getTraceType(traceType) { return traceType; } -},{"./lib/loggers":712,"./lib/noop":716,"./lib/push_unique":720,"./plots/attributes":746}],827:[function(require,module,exports){ +},{"./lib/loggers":724,"./lib/noop":728,"./lib/push_unique":732,"./plots/attributes":758}],839:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152312,7 +153952,7 @@ module.exports = function clonePlot(graphObj, options) { return plotTile; }; -},{"../lib":709,"../plots/plots":811}],828:[function(require,module,exports){ +},{"../lib":721,"../plots/plots":823}],840:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152378,7 +154018,7 @@ function downloadImage(gd, opts) { module.exports = downloadImage; -},{"../lib":709,"../plot_api/to_image":741,"./filesaver":829}],829:[function(require,module,exports){ +},{"../lib":721,"../plot_api/to_image":753,"./filesaver":841}],841:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152446,7 +154086,7 @@ var fileSaver = function(url, name) { module.exports = fileSaver; -},{}],830:[function(require,module,exports){ +},{}],842:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152479,7 +154119,7 @@ exports.getRedrawFunc = function(gd) { }; }; -},{}],831:[function(require,module,exports){ +},{}],843:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152505,7 +154145,7 @@ var Snapshot = { module.exports = Snapshot; -},{"./cloneplot":827,"./download":828,"./helpers":830,"./svgtoimg":832,"./toimage":833,"./tosvg":834}],832:[function(require,module,exports){ +},{"./cloneplot":839,"./download":840,"./helpers":842,"./svgtoimg":844,"./toimage":845,"./tosvg":846}],844:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152543,7 +154183,7 @@ function svgToImg(opts) { // url in svg are single quoted // since we changed double to single // we'll need to change these to double-quoted - svg = svg.replace(/(\('#)(.*)('\))/gi, '(\"$2\")'); + svg = svg.replace(/(\('#)([^']*)('\))/gi, '(\"$2\")'); // font names with spaces will be escaped single-quoted // we'll need to change these to double-quoted svg = svg.replace(/(\\')/gi, '\"'); @@ -152636,7 +154276,7 @@ function svgToImg(opts) { module.exports = svgToImg; -},{"../lib":709,"events":125}],833:[function(require,module,exports){ +},{"../lib":721,"events":127}],845:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152716,7 +154356,7 @@ function toImage(gd, opts) { module.exports = toImage; -},{"../lib":709,"../plotly":743,"./cloneplot":827,"./helpers":830,"./svgtoimg":832,"./tosvg":834,"events":125}],834:[function(require,module,exports){ +},{"../lib":721,"../plotly":755,"./cloneplot":839,"./helpers":842,"./svgtoimg":844,"./tosvg":846,"events":127}],846:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152730,12 +154370,29 @@ module.exports = toImage; var d3 = require('d3'); -var svgTextUtils = require('../lib/svg_text_utils'); var Drawing = require('../components/drawing'); var Color = require('../components/color'); var xmlnsNamespaces = require('../constants/xmlns_namespaces'); +var DOUBLEQUOTE_REGEX = /"/g; +var DUMMY_SUB = 'TOBESTRIPPED'; +var DUMMY_REGEX = new RegExp('("' + DUMMY_SUB + ')|(' + DUMMY_SUB + '")', 'g'); + +function htmlEntityDecode(s) { + var hiddenDiv = d3.select('body').append('div').style({display: 'none'}).html(''); + var replaced = s.replace(/(&[^;]*;)/gi, function(d) { + if(d === '<') { return '<'; } // special handling for brackets + if(d === '&rt;') { return '>'; } + if(d.indexOf('<') !== -1 || d.indexOf('>') !== -1) { return ''; } + return hiddenDiv.html(d).text(); // everything else, let the browser decode it to unicode + }); + hiddenDiv.remove(); + return replaced; +} +function xmlEntityEncode(str) { + return str.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g, '&'); +} module.exports = function toSVG(gd, format) { var fullLayout = gd._fullLayout, @@ -152788,20 +154445,22 @@ module.exports = function toSVG(gd, format) { svg.node().style.background = ''; svg.selectAll('text') - .attr('data-unformatted', null) + .attr({'data-unformatted': null, 'data-math': null}) .each(function() { var txt = d3.select(this); - // hidden text is pre-formatting mathjax, - // the browser ignores it but it can still confuse batik - if(txt.style('visibility') === 'hidden') { + // hidden text is pre-formatting mathjax, the browser ignores it + // but in a static plot it's useless and it can confuse batik + // we've tried to standardize on display:none but make sure we still + // catch visibility:hidden if it ever arises + if(txt.style('visibility') === 'hidden' || txt.style('display') === 'none') { txt.remove(); return; } else { - // force other visibility value to export as visible + // clear other visibility/display values to default // to not potentially confuse non-browser SVG implementations - txt.style('visibility', 'visible'); + txt.style({visibility: null, display: null}); } // Font family styles break things because of quotation marks, @@ -152809,10 +154468,21 @@ module.exports = function toSVG(gd, format) { // to a string (browsers convert singles back) var ff = txt.style('font-family'); if(ff && ff.indexOf('"') !== -1) { - txt.style('font-family', ff.replace(/"/g, 'TOBESTRIPPED')); + txt.style('font-family', ff.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); } }); + svg.selectAll('.point').each(function() { + var pt = d3.select(this); + var fill = pt.style('fill'); + + // similar to font family styles above, + // we must remove " after the SVG DOM has been serialized + if(fill && fill.indexOf('url(') !== -1) { + pt.style('fill', fill.replace(DOUBLEQUOTE_REGEX, DUMMY_SUB)); + } + }); + if(format === 'pdf' || format === 'eps') { // these formats make the extra line MathJax adds around symbols look super thick in some cases // it looks better if this is removed entirely. @@ -152826,16 +154496,16 @@ module.exports = function toSVG(gd, format) { svg.node().setAttributeNS(xmlnsNamespaces.xmlns, 'xmlns:xlink', xmlnsNamespaces.xlink); var s = new window.XMLSerializer().serializeToString(svg.node()); - s = svgTextUtils.html_entity_decode(s); - s = svgTextUtils.xml_entity_encode(s); + s = htmlEntityDecode(s); + s = xmlEntityEncode(s); - // Fix quotations around font strings - s = s.replace(/("TOBESTRIPPED)|(TOBESTRIPPED")/g, '\''); + // Fix quotations around font strings and gradient URLs + s = s.replace(DUMMY_REGEX, '\''); return s; }; -},{"../components/color":590,"../components/drawing":614,"../constants/xmlns_namespaces":692,"../lib/svg_text_utils":728,"d3":118}],835:[function(require,module,exports){ +},{"../components/color":600,"../components/drawing":624,"../constants/xmlns_namespaces":704,"d3":120}],847:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152868,7 +154538,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":709}],836:[function(require,module,exports){ +},{"../../lib":721}],848:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -152993,7 +154663,7 @@ module.exports = { } }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/errorbars/attributes":616,"../../lib/extend":701,"../../plots/font_attributes":772,"../scatter/attributes":1008}],837:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/errorbars/attributes":626,"../../lib/extend":713,"../../plots/font_attributes":784,"../scatter/attributes":1022}],849:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153086,7 +154756,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"../../plots/cartesian/axes":748,"./arrays_to_calcdata":835,"fast-isnumeric":127}],838:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"../../plots/cartesian/axes":760,"./arrays_to_calcdata":847,"fast-isnumeric":129}],850:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153146,7 +154816,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":590,"../../components/errorbars/defaults":619,"../../lib":709,"../bar/style_defaults":847,"../scatter/xy_defaults":1030,"./attributes":836}],839:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars/defaults":629,"../../lib":721,"../bar/style_defaults":859,"../scatter/xy_defaults":1044,"./attributes":848}],851:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153258,7 +154928,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return [pointData]; }; -},{"../../components/color":590,"../../components/errorbars":620,"../../components/fx":631}],840:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars":630,"../../components/fx":641}],852:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153294,7 +154964,7 @@ Bar.meta = { module.exports = Bar; -},{"../../plots/cartesian":758,"../scatter/colorbar":1011,"./arrays_to_calcdata":835,"./attributes":836,"./calc":837,"./defaults":838,"./hover":839,"./layout_attributes":841,"./layout_defaults":842,"./plot":843,"./set_positions":844,"./style":846}],841:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../scatter/colorbar":1025,"./arrays_to_calcdata":847,"./attributes":848,"./calc":849,"./defaults":850,"./hover":851,"./layout_attributes":853,"./layout_defaults":854,"./plot":855,"./set_positions":856,"./style":858}],853:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153338,7 +155008,7 @@ module.exports = { } }; -},{}],842:[function(require,module,exports){ +},{}],854:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153396,7 +155066,7 @@ module.exports = function(layoutIn, layoutOut, fullData) { coerce('bargroupgap'); }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"./layout_attributes":841}],843:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"./layout_attributes":853}],855:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -153538,22 +155208,17 @@ module.exports = function plot(gd, plotinfo, cdbar) { function appendBarText(gd, bar, calcTrace, i, x0, x1, y0, y1) { function appendTextNode(bar, text, textFont) { var textSelection = bar.append('text') - // prohibit tex interpretation until we can handle - // tex and regular text together - .attr('data-notex', 1) .text(text) .attr({ 'class': 'bartext', transform: '', - 'data-bb': '', 'text-anchor': 'middle', - x: 0, - y: 0 + // prohibit tex interpretation until we can handle + // tex and regular text together + 'data-notex': 1 }) - .call(Drawing.font, textFont); - - textSelection.call(svgTextUtils.convertToTspans); - textSelection.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(Drawing.font, textFont) + .call(svgTextUtils.convertToTspans, gd); return textSelection; } @@ -153916,7 +155581,7 @@ function coerceColor(attributeDefinition, value, defaultValue) { attributeDefinition.dflt; } -},{"../../components/color":590,"../../components/drawing":614,"../../components/errorbars":620,"../../lib":709,"../../lib/svg_text_utils":728,"./attributes":836,"d3":118,"fast-isnumeric":127,"tinycolor2":526}],844:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/errorbars":630,"../../lib":721,"../../lib/svg_text_utils":740,"./attributes":848,"d3":120,"fast-isnumeric":129,"tinycolor2":530}],856:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154516,7 +156181,7 @@ function getAxisLetter(ax) { return ax._id.charAt(0); } -},{"../../constants/numerical":690,"../../plots/cartesian/axes":748,"../../registry":826,"./sieve.js":845,"fast-isnumeric":127}],845:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../plots/cartesian/axes":760,"../../registry":838,"./sieve.js":857,"fast-isnumeric":129}],857:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154618,7 +156283,7 @@ Sieve.prototype.getLabel = function getLabel(position, value) { return prefix + label; }; -},{"../../constants/numerical":690,"../../lib":709}],846:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721}],858:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154688,15 +156353,12 @@ module.exports = function style(gd) { p.call(Color.stroke, lineColor); } }); - // TODO: text markers on bars, either extra text or just bar values - // d3.select(this).selectAll('text') - // .call(Drawing.textPointStyle,d.t||d[0].t); }); s.call(ErrorBars.style); }; -},{"../../components/color":590,"../../components/drawing":614,"../../components/errorbars":620,"d3":118}],847:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/errorbars":630,"d3":120}],859:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154733,7 +156395,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default coerce('marker.line.width'); }; -},{"../../components/color":590,"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603}],848:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613}],860:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -154866,7 +156528,7 @@ module.exports = { fillcolor: scatterAttrs.fillcolor }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../scatter/attributes":1008}],849:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../scatter/attributes":1022}],861:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155015,7 +156677,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"fast-isnumeric":127}],850:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"fast-isnumeric":129}],862:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155088,7 +156750,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../lib":709,"../../registry":826,"./attributes":848}],851:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../registry":838,"./attributes":860}],863:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155197,7 +156859,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return closeData; }; -},{"../../components/color":590,"../../components/fx":631,"../../lib":709,"../../plots/cartesian/axes":748}],852:[function(require,module,exports){ +},{"../../components/color":600,"../../components/fx":641,"../../lib":721,"../../plots/cartesian/axes":760}],864:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155230,7 +156892,7 @@ Box.meta = { module.exports = Box; -},{"../../plots/cartesian":758,"./attributes":848,"./calc":849,"./defaults":850,"./hover":851,"./layout_attributes":853,"./layout_defaults":854,"./plot":855,"./set_positions":856,"./style":857}],853:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":860,"./calc":861,"./defaults":862,"./hover":863,"./layout_attributes":865,"./layout_defaults":866,"./plot":867,"./set_positions":868,"./style":869}],865:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155268,7 +156930,7 @@ module.exports = { } }; -},{}],854:[function(require,module,exports){ +},{}],866:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155302,7 +156964,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) { coerce('boxgroupgap'); }; -},{"../../lib":709,"../../registry":826,"./layout_attributes":853}],855:[function(require,module,exports){ +},{"../../lib":721,"../../registry":838,"./layout_attributes":865}],867:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155542,7 +157204,7 @@ module.exports = function plot(gd, plotinfo, cdbox) { }); }; -},{"../../components/drawing":614,"../../lib":709,"d3":118}],856:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"d3":120}],868:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155636,7 +157298,7 @@ module.exports = function setPositions(gd, plotinfo) { } }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826}],857:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838}],869:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155671,11 +157333,11 @@ module.exports = function style(gd) { }) .call(Color.stroke, trace.line.color); d3.select(this).selectAll('g.points path') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, gd); }); }; -},{"../../components/color":590,"../../components/drawing":614,"d3":118}],858:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"d3":120}],870:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155728,7 +157390,7 @@ module.exports = { whiskerwidth: Lib.extendFlat({}, boxAttrs.whiskerwidth, { dflt: 0 }) }; -},{"../../lib":709,"../box/attributes":848,"../ohlc/attributes":967}],859:[function(require,module,exports){ +},{"../../lib":721,"../box/attributes":860,"../ohlc/attributes":981}],871:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155776,7 +157438,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.fillcolor'); } -},{"../../lib":709,"../ohlc/direction_defaults":969,"../ohlc/helpers":970,"../ohlc/ohlc_defaults":972,"./attributes":858}],860:[function(require,module,exports){ +},{"../../lib":721,"../ohlc/direction_defaults":983,"../ohlc/helpers":984,"../ohlc/ohlc_defaults":986,"./attributes":870}],872:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155806,7 +157468,7 @@ module.exports = { register(require('../box')); register(require('./transform')); -},{"../../plot_api/register":738,"../../plots/cartesian":758,"../box":852,"./attributes":858,"./defaults":859,"./transform":861}],861:[function(require,module,exports){ +},{"../../plot_api/register":750,"../../plots/cartesian":770,"../box":864,"./attributes":870,"./defaults":871,"./transform":873}],873:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -155818,6 +157480,8 @@ register(require('./transform')); 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); var helpers = require('../ohlc/helpers'); @@ -155924,7 +157588,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { }; for(var i = 0; i < len; i++) { - if(filterFn(open[i], close[i])) { + if(filterFn(open[i], close[i]) && isNumeric(high[i]) && isNumeric(low[i])) { appendX(i); appendY(open[i], high[i], low[i], close[i]); } @@ -155934,7 +157598,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { trace.y = y; }; -},{"../../lib":709,"../ohlc/helpers":970}],862:[function(require,module,exports){ +},{"../../lib":721,"../ohlc/helpers":984,"fast-isnumeric":129}],874:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156002,7 +157666,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) { }); } -},{"./axis_defaults":867}],863:[function(require,module,exports){ +},{"./axis_defaults":879}],875:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156047,7 +157711,7 @@ function minMax(a, depth) { return [min, max]; } -},{}],864:[function(require,module,exports){ +},{}],876:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156136,7 +157800,7 @@ module.exports = { }, }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../../plots/font_attributes":772,"./axis_attributes":866}],865:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../../plots/font_attributes":784,"./axis_attributes":878}],877:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156241,7 +157905,7 @@ module.exports = function(carpet, carpetcd, a, b) { return segments; }; -},{}],866:[function(require,module,exports){ +},{}],878:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156570,7 +158234,7 @@ module.exports = { }, }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../../plots/font_attributes":772}],867:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../../plots/font_attributes":784}],879:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156803,7 +158467,7 @@ function setAutoType(ax, data) { ax.type = autoType(data, calendar); } -},{"../../components/color":590,"../../lib":709,"../../plots/cartesian/axis_autotype":749,"../../plots/cartesian/category_order_defaults":752,"../../plots/cartesian/ordered_categories":761,"../../plots/cartesian/set_convert":765,"../../plots/cartesian/tick_label_defaults":766,"../../plots/cartesian/tick_value_defaults":768,"../../registry":826,"./attributes":864}],868:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../plots/cartesian/axis_autotype":761,"../../plots/cartesian/category_order_defaults":764,"../../plots/cartesian/ordered_categories":773,"../../plots/cartesian/set_convert":777,"../../plots/cartesian/tick_label_defaults":778,"../../plots/cartesian/tick_value_defaults":780,"../../registry":838,"./attributes":876}],880:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156904,7 +158568,7 @@ module.exports = function calc(gd, trace) { return [t]; }; -},{"../../plots/cartesian/axes":748,"../heatmap/clean_2d_array":929,"./array_minmax":863,"./calc_clippath":869,"./calc_gridlines":870,"./calc_labels":871,"./cheater_basis":873,"./map_2d_array":885,"./smooth_fill_2d_array":889}],869:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../heatmap/clean_2d_array":941,"./array_minmax":875,"./calc_clippath":881,"./calc_gridlines":882,"./calc_labels":883,"./cheater_basis":885,"./map_2d_array":897,"./smooth_fill_2d_array":901}],881:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -156956,7 +158620,7 @@ module.exports = function makeClipPath(xctrl, yctrl, aax, bax) { return segments; }; -},{}],870:[function(require,module,exports){ +},{}],882:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157299,7 +158963,7 @@ module.exports = function calcGridlines(trace, cd, axisLetter, crossAxisLetter) } }; -},{"../../lib/extend":701,"../../plots/cartesian/axes":748}],871:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/axes":760}],883:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157360,7 +159024,7 @@ module.exports = function calcLabels(trace, axis) { } }; -},{"../../lib/extend":701,"../../plots/cartesian/axes":748}],872:[function(require,module,exports){ +},{"../../lib/extend":713,"../../plots/cartesian/axes":760}],884:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157402,7 +159066,7 @@ module.exports = function makeControlPoints(p0, p1, p2, smoothness) { ]]; }; -},{}],873:[function(require,module,exports){ +},{}],885:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157470,7 +159134,7 @@ module.exports = function(a, b, cheaterslope) { return data; }; -},{"../../lib":709}],874:[function(require,module,exports){ +},{"../../lib":721}],886:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157822,7 +159486,7 @@ module.exports = function computeControlPoints(xe, ye, x, y, asmoothing, bsmooth return [xe, ye]; }; -},{"../../lib":709,"./catmull_rom":872}],875:[function(require,module,exports){ +},{"../../lib":721,"./catmull_rom":884}],887:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157838,7 +159502,7 @@ module.exports = { RELATIVE_CULL_TOLERANCE: 1e-6 }; -},{}],876:[function(require,module,exports){ +},{}],888:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -157990,7 +159654,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { } }; -},{}],877:[function(require,module,exports){ +},{}],889:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158118,7 +159782,7 @@ module.exports = function(arrays, asmoothing, bsmoothing) { }; -},{}],878:[function(require,module,exports){ +},{}],890:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158269,7 +159933,7 @@ module.exports = function(arrays, na, nb, asmoothing, bsmoothing) { }; -},{}],879:[function(require,module,exports){ +},{}],891:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158331,7 +159995,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, dfltColor, fullLayou } }; -},{"../../components/color/attributes":589,"../../lib":709,"./ab_defaults":862,"./attributes":864,"./set_convert":888,"./xy_defaults":890}],880:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib":721,"./ab_defaults":874,"./attributes":876,"./set_convert":900,"./xy_defaults":902}],892:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158347,7 +160011,7 @@ module.exports = function(data) { return Array.isArray(data[0]); }; -},{}],881:[function(require,module,exports){ +},{}],893:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158377,7 +160041,7 @@ Carpet.meta = { module.exports = Carpet; -},{"../../plots/cartesian":758,"./attributes":864,"./calc":868,"./defaults":879,"./plot":887}],882:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":876,"./calc":880,"./defaults":891,"./plot":899}],894:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158413,7 +160077,7 @@ module.exports = function(gd, trace) { return firstAxis; }; -},{}],883:[function(require,module,exports){ +},{}],895:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158444,7 +160108,7 @@ module.exports = function makePath(xp, yp, isBicubic) { return path.join(isBicubic ? '' : 'L'); }; -},{}],884:[function(require,module,exports){ +},{}],896:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158479,7 +160143,7 @@ module.exports = function mapArray(out, data, func) { return out; }; -},{}],885:[function(require,module,exports){ +},{}],897:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158524,7 +160188,7 @@ module.exports = function mapArray(out, data, func) { return out; }; -},{}],886:[function(require,module,exports){ +},{}],898:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158566,7 +160230,7 @@ module.exports = function orientText(trace, xaxis, yaxis, xy, dxy, refDxy) { }; }; -},{}],887:[function(require,module,exports){ +},{}],899:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -158583,6 +160247,7 @@ var Drawing = require('../../components/drawing'); var map1dArray = require('./map_1d_array'); var makepath = require('./makepath'); var orientText = require('./orient_text'); +var svgTextUtils = require('../../lib/svg_text_utils'); module.exports = function plot(gd, plotinfo, cdcarpet) { for(var i = 0; i < cdcarpet.length; i++) { @@ -158628,10 +160293,10 @@ function plotOne(gd, plotinfo, cd) { drawGridLines(xa, ya, boundaryLayer, aax, 'a-boundary', aax._boundarylines); drawGridLines(xa, ya, boundaryLayer, bax, 'b-boundary', bax._boundarylines); - var maxAExtent = drawAxisLabels(Drawing.tester, xa, ya, trace, t, labelLayer, aax._labels, 'a-label'); - var maxBExtent = drawAxisLabels(Drawing.tester, xa, ya, trace, t, labelLayer, bax._labels, 'b-label'); + var maxAExtent = drawAxisLabels(gd, xa, ya, trace, t, labelLayer, aax._labels, 'a-label'); + var maxBExtent = drawAxisLabels(gd, xa, ya, trace, t, labelLayer, bax._labels, 'b-label'); - drawAxisTitles(labelLayer, trace, t, xa, ya, maxAExtent, maxBExtent); + drawAxisTitles(gd, labelLayer, trace, t, xa, ya, maxAExtent, maxBExtent); // Swap for debugging in order to draw directly: // drawClipPath(trace, axisLayer, xa, ya); @@ -158702,7 +160367,7 @@ function drawGridLines(xaxis, yaxis, layer, axis, axisLetter, gridlines) { gridJoin.exit().remove(); } -function drawAxisLabels(tester, xaxis, yaxis, trace, t, layer, labels, labelClass) { +function drawAxisLabels(gd, xaxis, yaxis, trace, t, layer, labels, labelClass) { var labelJoin = layer.selectAll('text.' + labelClass).data(labels); labelJoin.enter().append('text') @@ -158721,20 +160386,26 @@ function drawAxisLabels(tester, xaxis, yaxis, trace, t, layer, labels, labelClas orientation = orientText(trace, xaxis, yaxis, label.xy, [Math.cos(angle), Math.sin(angle)]); } var direction = (label.endAnchor ? -1 : 1) * orientation.flip; - var bbox = Drawing.measureText(tester, label.text, label.font); - d3.select(this) - .attr('text-anchor', direction > 0 ? 'start' : 'end') + var labelEl = d3.select(this) + .attr({ + 'text-anchor': direction > 0 ? 'start' : 'end', + 'data-notex': 1 + }) + .call(Drawing.font, label.font) .text(label.text) - .attr('transform', + .call(svgTextUtils.convertToTspans, gd); + + var bbox = Drawing.bBox(this); + + labelEl.attr('transform', // Translate to the correct point: 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + // Rotate to line up with grid line tangent: 'rotate(' + orientation.angle + ')' + // Adjust the baseline and indentation: 'translate(' + label.axis.labelpadding * direction + ',' + bbox.height * 0.3 + ')' - ) - .call(Drawing.font, label.font.family, label.font.size, label.font.color); + ); maxExtent = Math.max(maxExtent, bbox.width + label.axis.labelpadding); }); @@ -158744,23 +160415,23 @@ function drawAxisLabels(tester, xaxis, yaxis, trace, t, layer, labels, labelClas return maxExtent; } -function drawAxisTitles(layer, trace, t, xa, ya, maxAExtent, maxBExtent) { +function drawAxisTitles(gd, layer, trace, t, xa, ya, maxAExtent, maxBExtent) { var a, b, xy, dxy; a = 0.5 * (trace.a[0] + trace.a[trace.a.length - 1]); b = trace.b[0]; xy = trace.ab2xy(a, b, true); dxy = trace.dxyda_rough(a, b); - drawAxisTitle(layer, trace, t, xy, dxy, trace.aaxis, xa, ya, maxAExtent, 'a-title'); + drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.aaxis, xa, ya, maxAExtent, 'a-title'); a = trace.a[0]; b = 0.5 * (trace.b[0] + trace.b[trace.b.length - 1]); xy = trace.ab2xy(a, b, true); dxy = trace.dxydb_rough(a, b); - drawAxisTitle(layer, trace, t, xy, dxy, trace.baxis, xa, ya, maxBExtent, 'b-title'); + drawAxisTitle(gd, layer, trace, t, xy, dxy, trace.baxis, xa, ya, maxBExtent, 'b-title'); } -function drawAxisTitle(layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClass) { +function drawAxisTitle(gd, layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClass) { var data = []; if(axis.title) data.push(axis.title); var titleJoin = layer.selectAll('text.' + labelClass).data(data); @@ -158783,6 +160454,7 @@ function drawAxisTitle(layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClas var el = d3.select(this); el.text(axis.title || '') + .call(svgTextUtils.convertToTspans, gd) .attr('transform', 'translate(' + orientation.p[0] + ',' + orientation.p[1] + ') ' + 'rotate(' + orientation.angle + ') ' + @@ -158796,7 +160468,7 @@ function drawAxisTitle(layer, trace, t, xy, dxy, axis, xa, ya, offset, labelClas titleJoin.exit().remove(); } -},{"../../components/drawing":614,"./makepath":883,"./map_1d_array":884,"./orient_text":886,"d3":118}],888:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib/svg_text_utils":740,"./makepath":895,"./map_1d_array":896,"./orient_text":898,"d3":120}],900:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159083,7 +160755,7 @@ module.exports = function setConvert(trace) { }; }; -},{"../../lib/search":723,"./compute_control_points":874,"./constants":875,"./create_i_derivative_evaluator":876,"./create_j_derivative_evaluator":877,"./create_spline_evaluator":878}],889:[function(require,module,exports){ +},{"../../lib/search":735,"./compute_control_points":886,"./constants":887,"./create_i_derivative_evaluator":888,"./create_j_derivative_evaluator":889,"./create_spline_evaluator":890}],901:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159306,7 +160978,7 @@ module.exports = function smoothFill2dArray(data, a, b) { return data; }; -},{"../../lib":709}],890:[function(require,module,exports){ +},{"../../lib":721}],902:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159344,7 +161016,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, coerce) { return true; }; -},{"../heatmap/convert_column_xyz":931,"./has_columns":880}],891:[function(require,module,exports){ +},{"../heatmap/convert_column_xyz":943,"./has_columns":892}],903:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159392,7 +161064,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../../plots/attributes":746,"../scattergeo/attributes":1045}],892:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../../plots/attributes":758,"../scattergeo/attributes":1059}],904:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159411,7 +161083,7 @@ module.exports = function calc(gd, trace) { colorscaleCalc(trace, trace.z, '', 'z'); }; -},{"../../components/colorscale/calc":596}],893:[function(require,module,exports){ +},{"../../components/colorscale/calc":606}],905:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159462,11 +161134,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults( traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'} ); - - coerce('hoverinfo', (layout._dataLength === 1) ? 'location+z+text' : undefined); }; -},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":891}],894:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":903}],906:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159485,7 +161155,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],895:[function(require,module,exports){ +},{}],907:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159555,7 +161225,7 @@ function makeHoverInfo(pointData, trace, pt, axis) { pointData.extraText = text.join('
'); } -},{"../../plots/cartesian/axes":748,"./attributes":891}],896:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"./attributes":903}],908:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159587,7 +161257,7 @@ Choropleth.meta = { module.exports = Choropleth; -},{"../../plots/geo":776,"../heatmap/colorbar":930,"./attributes":891,"./calc":892,"./defaults":893,"./event_data":894,"./hover":895,"./plot":897}],897:[function(require,module,exports){ +},{"../../plots/geo":788,"../heatmap/colorbar":942,"./attributes":903,"./calc":904,"./defaults":905,"./event_data":906,"./hover":907,"./plot":909}],909:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159721,7 +161391,7 @@ function style(geo) { }); } -},{"../../components/color":590,"../../components/colorscale":604,"../../components/drawing":614,"../../lib/array_to_calc_item":695,"../../lib/geo_location_utils":704,"../../lib/topojson_utils":730,"../../plots/geo/constants":774,"d3":118}],898:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorscale":614,"../../components/drawing":624,"../../lib/array_to_calc_item":707,"../../lib/geo_location_utils":716,"../../lib/topojson_utils":742,"../../plots/geo/constants":786,"d3":120}],910:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159824,7 +161494,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../components/drawing/attributes":613,"../../lib/extend":701,"../heatmap/attributes":927,"../scatter/attributes":1008}],899:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../components/drawing/attributes":623,"../../lib/extend":713,"../heatmap/attributes":939,"../scatter/attributes":1022}],911:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159928,7 +161598,7 @@ function autoContours(start, end, ncontours) { return dummyAx; } -},{"../../lib":709,"../../plots/cartesian/axes":748,"../heatmap/calc":928}],900:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../heatmap/calc":940}],912:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -159990,7 +161660,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../plots/plots":811,"./end_plus":904,"./make_color_map":908}],901:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../plots/plots":823,"./end_plus":916,"./make_color_map":920}],913:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160030,7 +161700,7 @@ module.exports.CHOOSESADDLE = { // substitute to be used up later? module.exports.SADDLEREMAINDER = {1: 4, 2: 8, 4: 1, 7: 13, 8: 2, 11: 14, 13: 7, 14: 11}; -},{}],902:[function(require,module,exports){ +},{}],914:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160062,7 +161732,7 @@ module.exports = function handleContourDefaults(traceIn, traceOut, coerce) { if(autoContour || !contourSize) coerce('ncontours'); }; -},{"../../lib":709,"./attributes":898}],903:[function(require,module,exports){ +},{"../../lib":721,"./attributes":910}],915:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160101,7 +161771,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":709,"../heatmap/has_columns":934,"../heatmap/xyz_defaults":942,"./attributes":898,"./contours_defaults":902,"./style_defaults":912}],904:[function(require,module,exports){ +},{"../../lib":721,"../heatmap/has_columns":946,"../heatmap/xyz_defaults":954,"./attributes":910,"./contours_defaults":914,"./style_defaults":924}],916:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160121,7 +161791,7 @@ module.exports = function endPlus(contours) { return contours.end + contours.size / 1e6; }; -},{}],905:[function(require,module,exports){ +},{}],917:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160396,7 +162066,7 @@ function getInterpPx(pi, loc, step) { } } -},{"../../lib":709,"./constants":901}],906:[function(require,module,exports){ +},{"../../lib":721,"./constants":913}],918:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160415,7 +162085,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return heatmapHoverPoints(pointData, xval, yval, hovermode, true); }; -},{"../heatmap/hover":935}],907:[function(require,module,exports){ +},{"../heatmap/hover":947}],919:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160447,7 +162117,7 @@ Contour.meta = { module.exports = Contour; -},{"../../plots/cartesian":758,"./attributes":898,"./calc":899,"./colorbar":900,"./defaults":903,"./hover":906,"./plot":910,"./style":911}],908:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":910,"./calc":911,"./colorbar":912,"./defaults":915,"./hover":918,"./plot":922,"./style":923}],920:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160531,7 +162201,7 @@ module.exports = function makeColorMap(trace) { }); }; -},{"../../components/colorscale":604,"./end_plus":904,"d3":118}],909:[function(require,module,exports){ +},{"../../components/colorscale":614,"./end_plus":916,"d3":120}],921:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160623,7 +162293,7 @@ function getMarchingIndex(val, corners) { return (mi === 15) ? 0 : mi; } -},{"./constants":901}],910:[function(require,module,exports){ +},{"./constants":913}],922:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -160987,7 +162657,7 @@ function makeClipMask(cd0) { return z; } -},{"../../components/drawing":614,"../../lib":709,"../heatmap/plot":940,"./end_plus":904,"./find_all_paths":905,"./make_crossings":909,"d3":118}],911:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"../heatmap/plot":952,"./end_plus":916,"./find_all_paths":917,"./make_crossings":921,"d3":120}],923:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161049,7 +162719,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":614,"../heatmap/style":941,"./make_color_map":908,"d3":118}],912:[function(require,module,exports){ +},{"../../components/drawing":624,"../heatmap/style":953,"./make_color_map":920,"d3":120}],924:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161085,7 +162755,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, layout, } }; -},{"../../components/colorscale/defaults":599}],913:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609}],925:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161225,7 +162895,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../heatmap/attributes":927,"../scatter/attributes":1008,"./constants":916}],914:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../heatmap/attributes":939,"../scatter/attributes":1022,"./constants":928}],926:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161441,7 +163111,7 @@ function heatmappishCalc(gd, trace) { return [cd0]; } -},{"../../components/colorscale/calc":596,"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"../carpet/lookup_carpetid":882,"../heatmap/clean_2d_array":929,"../heatmap/convert_column_xyz":931,"../heatmap/find_empties":933,"../heatmap/has_columns":934,"../heatmap/interp2d":937,"../heatmap/make_bound_array":938,"../heatmap/max_row_length":939,"./defaults":920}],915:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"../carpet/lookup_carpetid":894,"../heatmap/clean_2d_array":941,"../heatmap/convert_column_xyz":943,"../heatmap/find_empties":945,"../heatmap/has_columns":946,"../heatmap/interp2d":949,"../heatmap/make_bound_array":950,"../heatmap/max_row_length":951,"./defaults":932}],927:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161511,7 +163181,7 @@ module.exports = function(pathinfo, operation, perimeter, trace) { } }; -},{}],916:[function(require,module,exports){ +},{}],928:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161528,7 +163198,7 @@ module.exports = { SET_OPS: ['{}', '}{'] }; -},{}],917:[function(require,module,exports){ +},{}],929:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161616,7 +163286,7 @@ function makeInequalitySettings(operation) { }; } -},{"./constants":916,"fast-isnumeric":127}],918:[function(require,module,exports){ +},{"./constants":928,"fast-isnumeric":129}],930:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161677,7 +163347,7 @@ module.exports = function(coerce, contours) { contours.size = map.size; }; -},{"./constraint_mapping":917,"fast-isnumeric":127}],919:[function(require,module,exports){ +},{"./constraint_mapping":929,"fast-isnumeric":129}],931:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161766,7 +163436,7 @@ module.exports = function(pathinfo, operation) { } }; -},{"../../lib":709}],920:[function(require,module,exports){ +},{"../../lib":721}],932:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161920,7 +163590,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../lib":709,"../../plots/attributes":746,"../contour/style_defaults":912,"../heatmap/xyz_defaults":942,"../scatter/fillcolor_defaults":1015,"./attributes":913,"./constraint_value_defaults":918}],921:[function(require,module,exports){ +},{"../../components/color":600,"../../lib":721,"../../plots/attributes":758,"../contour/style_defaults":924,"../heatmap/xyz_defaults":954,"../scatter/fillcolor_defaults":1029,"./attributes":925,"./constraint_value_defaults":930}],933:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -161969,7 +163639,7 @@ module.exports = function emptyPathinfo(contours, plotinfo, cd0) { return pathinfo; }; -},{"../../lib":709}],922:[function(require,module,exports){ +},{"../../lib":721}],934:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162000,7 +163670,7 @@ ContourCarpet.meta = { module.exports = ContourCarpet; -},{"../../plots/cartesian":758,"../contour/colorbar":900,"./attributes":913,"./calc":914,"./defaults":920,"./plot":925,"./style":926}],923:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../contour/colorbar":912,"./attributes":925,"./calc":926,"./defaults":932,"./plot":937,"./style":938}],935:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162136,7 +163806,7 @@ module.exports = function joinAllPaths(trace, pi, perimeter, ab2p, carpet, carpe return fullpath; }; -},{"../../components/drawing":614,"../../lib":709,"../carpet/axis_aligned_line":865}],924:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"../carpet/axis_aligned_line":877}],936:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162173,7 +163843,7 @@ module.exports = function mapPathinfo(pathinfo, map) { } }; -},{}],925:[function(require,module,exports){ +},{}],937:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162409,7 +164079,7 @@ function makeFills(trace, plotgroup, xa, ya, pathinfo, perimeter, ab2p, carpet, }); } -},{"../../components/drawing":614,"../carpet/lookup_carpetid":882,"../carpet/makepath":883,"../carpet/map_1d_array":884,"../contour/find_all_paths":905,"../contour/make_crossings":909,"./close_boundaries":915,"./convert_to_constraints":919,"./empty_pathinfo":921,"./join_all_paths":923,"./map_pathinfo":924,"d3":118}],926:[function(require,module,exports){ +},{"../../components/drawing":624,"../carpet/lookup_carpetid":894,"../carpet/makepath":895,"../carpet/map_1d_array":896,"../contour/find_all_paths":917,"../contour/make_crossings":921,"./close_boundaries":927,"./convert_to_constraints":931,"./empty_pathinfo":933,"./join_all_paths":935,"./map_pathinfo":936,"d3":120}],938:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162474,7 +164144,7 @@ module.exports = function style(gd) { heatmapStyle(gd); }; -},{"../../components/drawing":614,"../contour/make_color_map":908,"../heatmap/style":941,"d3":118}],927:[function(require,module,exports){ +},{"../../components/drawing":624,"../contour/make_color_map":920,"../heatmap/style":953,"d3":120}],939:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162558,7 +164228,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../scatter/attributes":1008}],928:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../scatter/attributes":1022}],940:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162618,10 +164288,15 @@ module.exports = function calc(gd, trace) { z = binned.z; } else { - if(hasColumns(trace)) convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + if(hasColumns(trace)) { + convertColumnData(trace, xa, ya, 'x', 'y', ['z']); + x = trace.x; + y = trace.y; + } else { + x = trace.x ? xa.makeCalcdata(trace, 'x') : []; + y = trace.y ? ya.makeCalcdata(trace, 'y') : []; + } - x = trace.x ? xa.makeCalcdata(trace, 'x') : []; - y = trace.y ? ya.makeCalcdata(trace, 'y') : []; x0 = trace.x0 || 0; dx = trace.dx || 1; y0 = trace.y0 || 0; @@ -162700,7 +164375,7 @@ module.exports = function calc(gd, trace) { return [cd0]; }; -},{"../../components/colorscale/calc":596,"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"../histogram2d/calc":956,"./clean_2d_array":929,"./convert_column_xyz":931,"./find_empties":933,"./has_columns":934,"./interp2d":937,"./make_bound_array":938,"./max_row_length":939}],929:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"../histogram2d/calc":968,"./clean_2d_array":941,"./convert_column_xyz":943,"./find_empties":945,"./has_columns":946,"./interp2d":949,"./make_bound_array":950,"./max_row_length":951}],941:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162745,7 +164420,7 @@ module.exports = function clean2dArray(zOld, transpose) { return zNew; }; -},{"fast-isnumeric":127}],930:[function(require,module,exports){ +},{"fast-isnumeric":129}],942:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162796,7 +164471,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],931:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],943:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162877,7 +164552,7 @@ module.exports = function convertColumnData(trace, ax1, ax2, var1Name, var2Name, if(hasColumnText) trace.text = text; }; -},{"../../constants/numerical":690,"../../lib":709}],932:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721}],944:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -162922,7 +164597,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'z'}); }; -},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":927,"./has_columns":934,"./xyz_defaults":942}],933:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":939,"./has_columns":946,"./xyz_defaults":954}],945:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163028,7 +164703,7 @@ module.exports = function findEmpties(z) { return empties.sort(function(a, b) { return b[2] - a[2]; }); }; -},{"./max_row_length":939}],934:[function(require,module,exports){ +},{"./max_row_length":951}],946:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163044,7 +164719,7 @@ module.exports = function(trace) { return !Array.isArray(trace.z[0]); }; -},{}],935:[function(require,module,exports){ +},{}],947:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163161,7 +164836,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode, contour) })]; }; -},{"../../components/fx":631,"../../lib":709}],936:[function(require,module,exports){ +},{"../../components/fx":641,"../../lib":721}],948:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163193,7 +164868,7 @@ Heatmap.meta = { module.exports = Heatmap; -},{"../../plots/cartesian":758,"./attributes":927,"./calc":928,"./colorbar":930,"./defaults":932,"./hover":935,"./plot":940,"./style":941}],937:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./attributes":939,"./calc":940,"./colorbar":942,"./defaults":944,"./hover":947,"./plot":952,"./style":953}],949:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163325,7 +165000,7 @@ function iterateInterp2d(z, emptyPoints, overshoot) { return maxFractionalChange; } -},{"../../lib":709}],938:[function(require,module,exports){ +},{"../../lib":721}],950:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163407,7 +165082,7 @@ module.exports = function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, return arrayOut; }; -},{"../../registry":826}],939:[function(require,module,exports){ +},{"../../registry":838}],951:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163429,7 +165104,7 @@ module.exports = function maxRowLength(z) { return len; }; -},{}],940:[function(require,module,exports){ +},{}],952:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163898,7 +165573,7 @@ function plotOne(gd, plotinfo, cd) { image3.exit().remove(); } -},{"../../components/colorscale":604,"../../constants/xmlns_namespaces":692,"../../lib":709,"../../registry":826,"./max_row_length":939,"tinycolor2":526}],941:[function(require,module,exports){ +},{"../../components/colorscale":614,"../../constants/xmlns_namespaces":704,"../../lib":721,"../../registry":838,"./max_row_length":951,"tinycolor2":530}],953:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -163919,7 +165594,7 @@ module.exports = function style(gd) { }); }; -},{"d3":118}],942:[function(require,module,exports){ +},{"d3":120}],954:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164014,7 +165689,7 @@ function isValidZ(z) { return (allRowsAreArrays && oneRowIsFilled && hasOneNumber); } -},{"../../registry":826,"./has_columns":934,"fast-isnumeric":127}],943:[function(require,module,exports){ +},{"../../registry":838,"./has_columns":946,"fast-isnumeric":129}],955:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164056,7 +165731,7 @@ extendFlat( module.exports = attrs; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../heatmap/attributes":927}],944:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../heatmap/attributes":939}],956:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164196,7 +165871,7 @@ function createHeatmap(scene, fullTrace, calcTrace) { module.exports = createHeatmap; -},{"../../lib/str2rgbarray":727,"../../plots/cartesian/axes":748,"gl-heatmap2d":161}],945:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"../../plots/cartesian/axes":760,"gl-heatmap2d":164}],957:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164227,7 +165902,7 @@ HeatmapGl.meta = { module.exports = HeatmapGl; -},{"../../plots/gl2d":788,"../heatmap/calc":928,"../heatmap/colorbar":930,"../heatmap/defaults":932,"./attributes":943,"./convert":944}],946:[function(require,module,exports){ +},{"../../plots/gl2d":800,"../heatmap/calc":940,"../heatmap/colorbar":942,"../heatmap/defaults":944,"./attributes":955,"./convert":956}],958:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164357,7 +166032,7 @@ function makeBinsAttr(axLetter) { }; } -},{"../bar/attributes":836}],947:[function(require,module,exports){ +},{"../bar/attributes":848}],959:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164383,7 +166058,7 @@ module.exports = function doAvg(size, counts) { return total; }; -},{}],948:[function(require,module,exports){ +},{}],960:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164416,7 +166091,7 @@ module.exports = function handleBinDefaults(traceIn, traceOut, coerce, binDirect return traceOut; }; -},{}],949:[function(require,module,exports){ +},{}],961:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164492,7 +166167,7 @@ module.exports = { } }; -},{"fast-isnumeric":127}],950:[function(require,module,exports){ +},{"fast-isnumeric":129}],962:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164723,7 +166398,7 @@ function cdf(size, direction, currentbin) { } } -},{"../../lib":709,"../../plots/cartesian/axes":748,"../bar/arrays_to_calcdata":835,"./average":947,"./bin_functions":949,"./clean_bins":951,"./norm_functions":954,"fast-isnumeric":127}],951:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../bar/arrays_to_calcdata":847,"./average":959,"./bin_functions":961,"./clean_bins":963,"./norm_functions":966,"fast-isnumeric":129}],963:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164800,7 +166475,7 @@ module.exports = function cleanBins(trace, ax, binDirection) { if(!trace[autoBinAttr]) delete trace['nbins' + binDirection]; }; -},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],952:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],964:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164862,7 +166537,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, Color.defaultLine, {axis: 'x', inherit: 'y'}); }; -},{"../../components/color":590,"../../components/errorbars/defaults":619,"../../lib":709,"../../registry":826,"../bar/style_defaults":847,"./attributes":946,"./bin_defaults":948}],953:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars/defaults":629,"../../lib":721,"../../registry":838,"../bar/style_defaults":859,"./attributes":958,"./bin_defaults":960}],965:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164911,7 +166586,7 @@ Histogram.meta = { module.exports = Histogram; -},{"../../plots/cartesian":758,"../bar/hover":839,"../bar/layout_attributes":841,"../bar/layout_defaults":842,"../bar/plot":843,"../bar/set_positions":844,"../bar/style":846,"../scatter/colorbar":1011,"./attributes":946,"./calc":950,"./defaults":952}],954:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../bar/hover":851,"../bar/layout_attributes":853,"../bar/layout_defaults":854,"../bar/plot":855,"../bar/set_positions":856,"../bar/style":858,"../scatter/colorbar":1025,"./attributes":958,"./calc":962,"./defaults":964}],966:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164946,7 +166621,7 @@ module.exports = { } }; -},{}],955:[function(require,module,exports){ +},{}],967:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -164998,7 +166673,7 @@ module.exports = extendFlat({}, { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../heatmap/attributes":927,"../histogram/attributes":946}],956:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../heatmap/attributes":939,"../histogram/attributes":958}],968:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165201,7 +166876,7 @@ module.exports = function calc(gd, trace) { }; }; -},{"../../lib":709,"../../plots/cartesian/axes":748,"../histogram/average":947,"../histogram/bin_functions":949,"../histogram/clean_bins":951,"../histogram/norm_functions":954}],957:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../histogram/average":959,"../histogram/bin_functions":961,"../histogram/clean_bins":963,"../histogram/norm_functions":966}],969:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165239,7 +166914,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout ); }; -},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":955,"./sample_defaults":959}],958:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":967,"./sample_defaults":971}],970:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165272,7 +166947,7 @@ Histogram2D.meta = { module.exports = Histogram2D; -},{"../../plots/cartesian":758,"../heatmap/calc":928,"../heatmap/colorbar":930,"../heatmap/hover":935,"../heatmap/plot":940,"../heatmap/style":941,"./attributes":955,"./defaults":957}],959:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../heatmap/calc":940,"../heatmap/colorbar":942,"../heatmap/hover":947,"../heatmap/plot":952,"../heatmap/style":953,"./attributes":967,"./defaults":969}],971:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165312,7 +166987,7 @@ module.exports = function handleSampleDefaults(traceIn, traceOut, coerce, layout handleBinDefaults(traceIn, traceOut, coerce, binDirections); }; -},{"../../registry":826,"../histogram/bin_defaults":948}],960:[function(require,module,exports){ +},{"../../registry":838,"../histogram/bin_defaults":960}],972:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165357,7 +167032,7 @@ module.exports = extendFlat({}, { { colorbar: colorbarAttrs } ); -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../contour/attributes":898,"../histogram2d/attributes":955}],961:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../contour/attributes":910,"../histogram2d/attributes":967}],973:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165387,7 +167062,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout handleStyleDefaults(traceIn, traceOut, coerce, layout); }; -},{"../../lib":709,"../contour/contours_defaults":902,"../contour/style_defaults":912,"../histogram2d/sample_defaults":959,"./attributes":960}],962:[function(require,module,exports){ +},{"../../lib":721,"../contour/contours_defaults":914,"../contour/style_defaults":924,"../histogram2d/sample_defaults":971,"./attributes":972}],974:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165420,7 +167095,7 @@ Histogram2dContour.meta = { module.exports = Histogram2dContour; -},{"../../plots/cartesian":758,"../contour/calc":899,"../contour/colorbar":900,"../contour/hover":906,"../contour/plot":910,"../contour/style":911,"./attributes":960,"./defaults":961}],963:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../contour/calc":911,"../contour/colorbar":912,"../contour/hover":918,"../contour/plot":922,"../contour/style":923,"./attributes":972,"./defaults":973}],975:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165523,8 +167198,12 @@ module.exports = { width: extendFlat({}, surfaceAtts.contours.x.width) }, + cauto: colorscaleAttrs.zauto, + cmin: colorscaleAttrs.zmin, + cmax: colorscaleAttrs.zmax, colorscale: colorscaleAttrs.colorscale, reversescale: colorscaleAttrs.reversescale, + autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}), showscale: colorscaleAttrs.showscale, colorbar: colorbarAttrs, @@ -165553,7 +167232,76 @@ module.exports = { }, surfaceAtts.lighting) }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../surface/attributes":1071}],964:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../surface/attributes":1087}],976:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 colorscaleCalc = require('../../components/colorscale/calc'); + +module.exports = function calc(gd, trace) { + if(trace.intensity) { + colorscaleCalc(trace, trace.intensity, '', 'c'); + } +}; + +},{"../../components/colorscale/calc":606}],977:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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'); +var Plots = require('../../plots/plots'); +var Colorscale = require('../../components/colorscale'); +var drawColorbar = require('../../components/colorbar/draw'); + +module.exports = function colorbar(gd, cd) { + var trace = cd[0].trace, + cbId = 'cb' + trace.uid, + cmin = trace.cmin, + cmax = trace.cmax, + vals = trace.intensity || []; + + if(!isNumeric(cmin)) cmin = Lib.aggNums(Math.min, null, vals); + if(!isNumeric(cmax)) cmax = Lib.aggNums(Math.max, null, vals); + + gd._fullLayout._infolayer.selectAll('.' + cbId).remove(); + + if(!trace.showscale) { + Plots.autoMargin(gd, cbId); + return; + } + + var cb = cd[0].t.cb = drawColorbar(gd, cbId); + var sclFunc = Colorscale.makeColorScaleFunc( + Colorscale.extractScale( + trace.colorscale, + cmin, + cmax + ), + { noNumericCheck: true } + ); + + cb.fillcolor(sclFunc) + .filllevels({start: cmin, end: cmax, size: (cmax - cmin) / 254}) + .options(trace.colorbar)(); +}; + +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],978:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165680,6 +167428,7 @@ proto.update = function(data) { if(data.intensity) { this.color = '#fff'; config.vertexIntensity = data.intensity; + config.vertexIntensityBounds = [data.cmin, data.cmax]; config.colormap = parseColorScale(data.colorscale); } else if(data.vertexcolor) { @@ -165716,7 +167465,7 @@ function createMesh3DTrace(scene, data) { module.exports = createMesh3DTrace; -},{"../../lib/str2rgbarray":727,"alpha-shape":41,"convex-hull":99,"delaunay-triangulate":119,"gl-mesh3d":200,"tinycolor2":526}],965:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"alpha-shape":41,"convex-hull":101,"delaunay-triangulate":121,"gl-mesh3d":203,"tinycolor2":530}],979:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165730,10 +167479,9 @@ module.exports = createMesh3DTrace; var Registry = require('../../registry'); var Lib = require('../../lib'); -var colorbarDefaults = require('../../components/colorbar/defaults'); +var colorscaleDefaults = require('../../components/colorscale/defaults'); var attributes = require('./attributes'); - module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); @@ -165796,28 +167544,17 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if('intensity' in traceIn) { coerce('intensity'); - coerce('showscale', true); - } - else { + colorscaleDefaults(traceIn, traceOut, layout, coerce, {prefix: '', cLetter: 'c'}); + } else { traceOut.showscale = false; if('facecolor' in traceIn) coerce('facecolor'); else if('vertexcolor' in traceIn) coerce('vertexcolor'); else coerce('color', defaultColor); } - - if(traceOut.reversescale) { - traceOut.colorscale = traceOut.colorscale.map(function(si) { - return [1 - si[0], si[1]]; - }).reverse(); - } - - if(traceOut.showscale) { - colorbarDefaults(traceIn, traceOut, layout); - } }; -},{"../../components/colorbar/defaults":592,"../../lib":709,"../../registry":826,"./attributes":963}],966:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"../../registry":838,"./attributes":975}],980:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165833,7 +167570,8 @@ var Mesh3D = {}; Mesh3D.attributes = require('./attributes'); Mesh3D.supplyDefaults = require('./defaults'); -Mesh3D.colorbar = require('../heatmap/colorbar'); +Mesh3D.calc = require('./calc'); +Mesh3D.colorbar = require('./colorbar'); Mesh3D.plot = require('./convert'); Mesh3D.moduleType = 'trace'; @@ -165846,7 +167584,7 @@ Mesh3D.meta = { module.exports = Mesh3D; -},{"../../plots/gl3d":791,"../heatmap/colorbar":930,"./attributes":963,"./convert":964,"./defaults":965}],967:[function(require,module,exports){ +},{"../../plots/gl3d":803,"./attributes":975,"./calc":976,"./colorbar":977,"./convert":978,"./defaults":979}],981:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -165954,7 +167692,7 @@ module.exports = { } }; -},{"../../components/drawing/attributes":613,"../../lib":709,"../scatter/attributes":1008}],968:[function(require,module,exports){ +},{"../../components/drawing/attributes":623,"../../lib":721,"../scatter/attributes":1022}],982:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166003,7 +167741,7 @@ function handleDirection(traceIn, traceOut, coerce, direction) { coerce(direction + '.line.dash', traceOut.line.dash); } -},{"../../lib":709,"./attributes":967,"./direction_defaults":969,"./helpers":970,"./ohlc_defaults":972}],969:[function(require,module,exports){ +},{"../../lib":721,"./attributes":981,"./direction_defaults":983,"./helpers":984,"./ohlc_defaults":986}],983:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166029,7 +167767,7 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir coerce(direction + '.name', nameDflt); }; -},{}],970:[function(require,module,exports){ +},{}],984:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166041,6 +167779,8 @@ module.exports = function handleDirectionDefaults(traceIn, traceOut, coerce, dir 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); // This routine gets called during the trace supply-defaults step. @@ -166127,14 +167867,38 @@ exports.makeTransform = function(traceIn, state, direction) { }; exports.getFilterFn = function(direction) { - switch(direction) { - case 'increasing': - return function(o, c) { return o <= c; }; + return new _getFilterFn(direction); +}; + +function _getFilterFn(direction) { + // we're optimists - before we have any changing data, assume increasing + var isPrevIncreasing = true; + var cPrev = null; - case 'decreasing': - return function(o, c) { return o > c; }; + function _isIncreasing(o, c) { + if(o === c) { + if(c > cPrev) { + isPrevIncreasing = true; // increasing + } else if(c < cPrev) { + isPrevIncreasing = false; // decreasing + } + // else isPrevIncreasing is not changed + } + else isPrevIncreasing = (o < c); + cPrev = c; + return isPrevIncreasing; } -}; + + function isIncreasing(o, c) { + return isNumeric(o) && isNumeric(c) && _isIncreasing(+o, +c); + } + + function isDecreasing(o, c) { + return isNumeric(o) && isNumeric(c) && !_isIncreasing(+o, +c); + } + + return direction === 'increasing' ? isIncreasing : isDecreasing; +} exports.addRangeSlider = function(data, layout) { var hasOneVisibleTrace = false; @@ -166152,7 +167916,7 @@ exports.addRangeSlider = function(data, layout) { } }; -},{"../../lib":709}],971:[function(require,module,exports){ +},{"../../lib":721,"fast-isnumeric":129}],985:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166182,7 +167946,7 @@ module.exports = { register(require('../scatter')); register(require('./transform')); -},{"../../plot_api/register":738,"../../plots/cartesian":758,"../scatter":1018,"./attributes":967,"./defaults":968,"./transform":973}],972:[function(require,module,exports){ +},{"../../plot_api/register":750,"../../plots/cartesian":770,"../scatter":1032,"./attributes":981,"./defaults":982,"./transform":987}],986:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166224,7 +167988,7 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { return len; }; -},{"../../registry":826}],973:[function(require,module,exports){ +},{"../../registry":838}],987:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166236,6 +168000,8 @@ module.exports = function handleOHLC(traceIn, traceOut, coerce, layout) { 'use strict'; +var isNumeric = require('fast-isnumeric'); + var Lib = require('../../lib'); var helpers = require('./helpers'); var Axes = require('../../plots/cartesian/axes'); @@ -166422,7 +168188,7 @@ exports.calcTransform = function calcTransform(gd, trace, opts) { }; for(var i = 0; i < len; i++) { - if(filterFn(open[i], close[i])) { + if(filterFn(open[i], close[i]) && isNumeric(high[i]) && isNumeric(low[i])) { appendX(i); appendY(open[i], high[i], low[i], close[i]); appendText(i, open[i], high[i], low[i], close[i]); @@ -166483,7 +168249,7 @@ function convertTickWidth(gd, xa, trace) { return minDiff * tickWidth; } -},{"../../lib":709,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_ids":751,"./helpers":970}],974:[function(require,module,exports){ +},{"../../lib":721,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_ids":763,"./helpers":984,"fast-isnumeric":129}],988:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166623,7 +168389,7 @@ module.exports = { ) }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/colorscale/scales":608,"../../lib/extend":701,"../../plots/cartesian/layout_attributes":759,"../../plots/font_attributes":772}],975:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/colorscale/scales":618,"../../lib/extend":713,"../../plots/cartesian/layout_attributes":771,"../../plots/font_attributes":784}],989:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166699,7 +168465,7 @@ exports.toSVG = function(gd) { }, 60); }; -},{"../../constants/xmlns_namespaces":692,"../../plots/plots":811,"./constants":978,"./plot":983,"d3":118}],976:[function(require,module,exports){ +},{"../../constants/xmlns_namespaces":704,"../../plots/plots":823,"./constants":992,"./plot":997,"d3":120}],990:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166730,7 +168496,7 @@ module.exports = function calc(gd, trace) { }]; }; -},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"../../lib":709}],977:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"../../lib":721}],991:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166784,7 +168550,7 @@ module.exports = function colorbar(gd, cd) { .options(line.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],978:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],992:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166821,7 +168587,7 @@ module.exports = { } }; -},{}],979:[function(require,module,exports){ +},{}],993:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166934,7 +168700,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout Lib.coerceFont(coerce, 'rangefont', fontDflt); }; -},{"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603,"../../lib":709,"./attributes":974,"./constants":978}],980:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613,"../../lib":721,"./attributes":988,"./constants":992}],994:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -166963,7 +168729,7 @@ Parcoords.meta = { module.exports = Parcoords; -},{"./attributes":974,"./base_plot":975,"./calc":976,"./colorbar":977,"./defaults":979,"./plot":983}],981:[function(require,module,exports){ +},{"./attributes":988,"./base_plot":989,"./calc":990,"./colorbar":991,"./defaults":993,"./plot":997}],995:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -167388,7 +169154,7 @@ module.exports = function(canvasGL, lines, canvasWidth, canvasHeight, initialDim }; }; -},{"./constants":978,"regl":491}],982:[function(require,module,exports){ +},{"./constants":992,"regl":495}],996:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168164,7 +169930,7 @@ module.exports = function(root, svg, styledData, layout, callbacks) { return tweakables; }; -},{"../../components/drawing":614,"../../lib":709,"./constants":978,"./lines":981,"d3":118}],983:[function(require,module,exports){ +},{"../../components/drawing":624,"../../lib":721,"./constants":992,"./lines":995,"d3":120}],997:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168284,7 +170050,7 @@ module.exports = function plot(gd, cdparcoords) { }); }; -},{"./parcoords":982}],984:[function(require,module,exports){ +},{"./parcoords":996}],998:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168477,7 +170243,7 @@ module.exports = { } }; -},{"../../components/color/attributes":589,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/font_attributes":772}],985:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/font_attributes":784}],999:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168524,7 +170290,7 @@ function getCdModule(calcdata, _module) { return cdModule; } -},{"../../registry":826}],986:[function(require,module,exports){ +},{"../../registry":838}],1000:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168676,7 +170442,7 @@ function nextDefaultColor(index) { return pieDefaultColors[index % pieDefaultColors.length]; } -},{"../../components/color":590,"./helpers":988,"fast-isnumeric":127,"tinycolor2":526}],987:[function(require,module,exports){ +},{"../../components/color":600,"./helpers":1002,"fast-isnumeric":129,"tinycolor2":530}],1001:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168726,8 +170492,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout var textInfo = coerce('textinfo', Array.isArray(textData) ? 'text+percent' : 'percent'); coerce('hovertext'); - coerce('hoverinfo', (layout._dataLength === 1) ? 'label+text+value+percent' : undefined); - if(textInfo && textInfo !== 'none') { var textPosition = coerce('textposition'), hasBoth = Array.isArray(textPosition) || textPosition === 'auto', @@ -168761,7 +170525,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout coerce('pull'); }; -},{"../../lib":709,"./attributes":984}],988:[function(require,module,exports){ +},{"../../lib":721,"./attributes":998}],1002:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168790,7 +170554,7 @@ exports.formatPieValue = function formatPieValue(v, separators) { return Lib.numSeparate(vRounded, separators); }; -},{"../../lib":709}],989:[function(require,module,exports){ +},{"../../lib":721}],1003:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168822,7 +170586,7 @@ Pie.meta = { module.exports = Pie; -},{"./attributes":984,"./base_plot":985,"./calc":986,"./defaults":987,"./layout_attributes":990,"./layout_defaults":991,"./plot":992,"./style":993,"./style_one":994}],990:[function(require,module,exports){ +},{"./attributes":998,"./base_plot":999,"./calc":1000,"./defaults":1001,"./layout_attributes":1004,"./layout_defaults":1005,"./plot":1006,"./style":1007,"./style_one":1008}],1004:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168842,7 +170606,7 @@ module.exports = { hiddenlabels: {valType: 'data_array'} }; -},{}],991:[function(require,module,exports){ +},{}],1005:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168864,7 +170628,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut) { coerce('hiddenlabels'); }; -},{"../../lib":709,"./layout_attributes":990}],992:[function(require,module,exports){ +},{"../../lib":721,"./layout_attributes":1004}],1006:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -168956,9 +170720,9 @@ module.exports = function plot(gd, cdpie) { evt.originalEvent = d3.event; // in case fullLayout or fullData has changed without a replot - var fullLayout2 = gd._fullLayout, - trace2 = gd._fullData[trace.index], - hoverinfo = trace2.hoverinfo; + var fullLayout2 = gd._fullLayout; + var trace2 = gd._fullData[trace.index]; + var hoverinfo = Fx.castHoverinfo(trace2, fullLayout2, pt.i); if(hoverinfo === 'all') hoverinfo = 'label+text+value+percent+name'; @@ -168991,8 +170755,6 @@ module.exports = function plot(gd, cdpie) { if(hoverinfo.indexOf('value') !== -1) thisText.push(helpers.formatPieValue(pt.v, separators)); if(hoverinfo.indexOf('percent') !== -1) thisText.push(helpers.formatPiePercent(pt.v / cd0.vTotal, separators)); - var hoverLabelOpts = trace2.hoverlabel; - Fx.loneHover({ x0: hoverCenterX - rInscribed * cd0.r, x1: hoverCenterX + rInscribed * cd0.r, @@ -169000,14 +170762,15 @@ module.exports = function plot(gd, cdpie) { text: thisText.join('
'), name: hoverinfo.indexOf('name') !== -1 ? trace2.name : undefined, idealAlign: pt.pxmid[0] < 0 ? 'left' : 'right', - color: pt.hbg || hoverLabelOpts.bgcolor || pt.color, - borderColor: pt.hbc || hoverLabelOpts.bordercolor, - fontFamily: pt.htf || hoverLabelOpts.font.family, - fontSize: pt.hts || hoverLabelOpts.font.size, - fontColor: pt.htc || hoverLabelOpts.font.color + color: Fx.castHoverOption(trace, pt.i, 'bgcolor') || pt.color, + borderColor: Fx.castHoverOption(trace, pt.i, 'bordercolor'), + fontFamily: Fx.castHoverOption(trace, pt.i, 'font.family'), + fontSize: Fx.castHoverOption(trace, pt.i, 'font.size'), + fontColor: Fx.castHoverOption(trace, pt.i, 'font.color') }, { container: fullLayout2._hoverlayer.node(), - outerContainer: fullLayout2._paper.node() + outerContainer: fullLayout2._paper.node(), + gd: gd }); Fx.hover(gd, evt, 'pie'); @@ -169119,15 +170882,11 @@ module.exports = function plot(gd, cdpie) { .attr({ 'class': 'slicetext', transform: '', - 'data-bb': '', - 'text-anchor': 'middle', - x: 0, - y: 0 + 'text-anchor': 'middle' }) .call(Drawing.font, textPosition === 'outside' ? trace.outsidetextfont : trace.insidetextfont) - .call(svgTextUtils.convertToTspans); - sliceText.selectAll('tspan.line').attr({x: 0, y: 0}); + .call(svgTextUtils.convertToTspans, gd); // position the text relative to the slice // TODO: so far this only accounts for flat @@ -169142,7 +170901,6 @@ module.exports = function plot(gd, cdpie) { sliceText.call(Drawing.font, trace.outsidetextfont); if(trace.outsidetextfont.family !== trace.insidetextfont.family || trace.outsidetextfont.size !== trace.insidetextfont.size) { - sliceText.attr({'data-bb': ''}); textBB = Drawing.bBox(sliceText.node()); } transform = transformOutsideText(textBB, pt); @@ -169578,7 +171336,7 @@ function maxExtent(tilt, tiltAxisFraction, depth) { 2 * Math.sqrt(1 - sinTilt * sinTilt * tiltAxisFraction * tiltAxisFraction)); } -},{"../../components/color":590,"../../components/drawing":614,"../../components/fx":631,"../../lib/svg_text_utils":728,"./helpers":988,"d3":118}],993:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../components/fx":641,"../../lib/svg_text_utils":740,"./helpers":1002,"d3":120}],1007:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -169607,7 +171365,7 @@ module.exports = function style(gd) { }); }; -},{"./style_one":994,"d3":118}],994:[function(require,module,exports){ +},{"./style_one":1008,"d3":120}],1008:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -169632,7 +171390,7 @@ module.exports = function styleOne(s, pt, trace) { .call(Color.stroke, lineColor); }; -},{"../../components/color":590}],995:[function(require,module,exports){ +},{"../../components/color":600}],1009:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -169721,7 +171479,7 @@ module.exports = { } }; -},{"../scattergl/attributes":1052}],996:[function(require,module,exports){ +},{"../scattergl/attributes":1066}],1010:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -169952,7 +171710,7 @@ function createPointcloud(scene, data) { module.exports = createPointcloud; -},{"../../lib/str2rgbarray":727,"../scatter/get_trace_color":1016,"gl-pointcloud2d":225}],997:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"../scatter/get_trace_color":1030,"gl-pointcloud2d":228}],1011:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -169997,7 +171755,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor) { coerce('marker.border.arearatio'); }; -},{"../../lib":709,"./attributes":995}],998:[function(require,module,exports){ +},{"../../lib":721,"./attributes":1009}],1012:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170027,7 +171785,7 @@ pointcloud.meta = { module.exports = pointcloud; -},{"../../plots/gl2d":788,"../scatter3d/calc":1032,"./attributes":995,"./convert":996,"./defaults":997}],999:[function(require,module,exports){ +},{"../../plots/gl2d":800,"../scatter3d/calc":1046,"./attributes":1009,"./convert":1010,"./defaults":1011}],1013:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170201,7 +171959,7 @@ module.exports = { } }; -},{"../../components/color/attributes":589,"../../components/shapes/attributes":666,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/font_attributes":772}],1000:[function(require,module,exports){ +},{"../../components/color/attributes":599,"../../components/shapes/attributes":676,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/font_attributes":784}],1014:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170233,7 +171991,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout) } }; -},{"../../plots/plots":811,"./plot":1005}],1001:[function(require,module,exports){ +},{"../../plots/plots":823,"./plot":1019}],1015:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170286,7 +172044,7 @@ module.exports = function calc(gd, trace) { }]; }; -},{"../../lib":709,"strongly-connected-components":520}],1002:[function(require,module,exports){ +},{"../../lib":721,"strongly-connected-components":524}],1016:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170305,10 +172063,10 @@ module.exports = { forceIterations: 5, forceTicksPerFrame: 10, duration: 500, - ease: 'linear' + ease: 'cubic-in-out' }; -},{}],1003:[function(require,module,exports){ +},{}],1017:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170326,7 +172084,6 @@ var Color = require('../../components/color'); var tinycolor = require('tinycolor2'); module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout) { - function coerce(attr, dflt) { return Lib.coerce(traceIn, traceOut, attributes, attr, dflt); } @@ -170356,8 +172113,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout 'rgba(0, 0, 0, 0.2)'; })); - coerce('hoverinfo', layout._dataLength === 1 ? 'label+text+value+percent' : undefined); - coerce('domain.x'); coerce('domain.y'); coerce('orientation'); @@ -170377,7 +172132,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../components/color/attributes":589,"../../lib":709,"./attributes":999,"tinycolor2":526}],1004:[function(require,module,exports){ +},{"../../components/color":600,"../../components/color/attributes":599,"../../lib":721,"./attributes":1013,"tinycolor2":530}],1018:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170405,7 +172160,7 @@ Plot.meta = { module.exports = Plot; -},{"./attributes":999,"./base_plot":1000,"./calc":1001,"./defaults":1003,"./plot":1005}],1005:[function(require,module,exports){ +},{"./attributes":1013,"./base_plot":1014,"./calc":1015,"./defaults":1017,"./plot":1019}],1019:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170563,7 +172318,8 @@ module.exports = function plot(gd, calcData) { idealAlign: d3.event.x < hoverCenterX ? 'right' : 'left' }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); makeTranslucent(tooltip, 0.65); @@ -170618,7 +172374,8 @@ module.exports = function plot(gd, calcData) { idealAlign: 'left' }, { container: fullLayout._hoverlayer.node(), - outerContainer: fullLayout._paper.node() + outerContainer: fullLayout._paper.node(), + gd: gd }); makeTranslucent(tooltip, 0.85); @@ -170665,7 +172422,7 @@ module.exports = function plot(gd, calcData) { ); }; -},{"../../components/color":590,"../../components/fx":631,"../../lib":709,"./render":1006,"d3":118}],1006:[function(require,module,exports){ +},{"../../components/color":600,"../../components/fx":641,"../../lib":721,"./render":1020,"d3":120}],1020:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -170783,8 +172540,6 @@ function sankeyModel(layout, d, i) { node = sankeyNodes[n]; node.width = width; node.height = height; - if(node.parallel) node.x = (horizontal ? width : height) * node.parallel; - if(node.perpendicular) node.y = (horizontal ? height : width) * node.perpendicular; } switchToForceFormat(nodes); @@ -170848,9 +172603,7 @@ function nodeModel(uniqueKeys, d, n) { zoneThicknessPad = c.nodePadAcross, zoneLengthPad = d.nodePad / 2, visibleThickness = n.dx + 0.5, - visibleLength = n.dy - 0.5, - zoneThickness = visibleThickness + 2 * zoneThicknessPad, - zoneLength = visibleLength + 2 * zoneLengthPad; + visibleLength = n.dy - 0.5; var basicKey = n.label; var foundKey = uniqueKeys[basicKey]; @@ -170866,15 +172619,15 @@ function nodeModel(uniqueKeys, d, n) { nodeLineWidth: d.nodeLineWidth, textFont: d.textFont, size: d.horizontal ? d.height : d.width, - visibleWidth: Math.ceil(d.horizontal ? visibleThickness : visibleLength), - visibleHeight: Math.ceil(d.horizontal ? visibleLength : visibleThickness), - zoneX: d.horizontal ? -zoneThicknessPad : -zoneLengthPad, - zoneY: d.horizontal ? -zoneLengthPad : -zoneThicknessPad, - zoneWidth: d.horizontal ? zoneThickness : zoneLength, - zoneHeight: d.horizontal ? zoneLength : zoneThickness, + visibleWidth: Math.ceil(visibleThickness), + visibleHeight: Math.ceil(visibleLength), + zoneX: -zoneThicknessPad, + zoneY: -zoneLengthPad, + zoneWidth: visibleThickness + 2 * zoneThicknessPad, + zoneHeight: visibleLength + 2 * zoneLengthPad, labelY: d.horizontal ? n.dy / 2 + 1 : n.dx / 2 + 1, left: n.originalLayer === 1, - sizeAcross: d.horizontal ? d.width : d.height, + sizeAcross: d.width, forceLayouts: d.forceLayouts, horizontal: d.horizontal, darkBackground: tc.getBrightness() <= 128, @@ -170892,15 +172645,13 @@ function nodeModel(uniqueKeys, d, n) { // rendering snippets function crispLinesOnEnd(sankeyNode) { - d3.select(sankeyNode.node().parentElement).style('shape-rendering', 'crispEdges'); + d3.select(sankeyNode.node().parentNode).style('shape-rendering', 'crispEdges'); } function updateNodePositions(sankeyNode) { sankeyNode .attr('transform', function(d) { - return d.horizontal ? - 'translate(' + (d.node.x - 0.5) + ', ' + (d.node.y - d.node.dy / 2 + 0.5) + ')' : - 'translate(' + (d.node.y - d.node.dy / 2 - 0.5) + ', ' + (d.node.x + 0.5) + ')'; + return 'translate(' + (d.node.x - 0.5) + ', ' + (d.node.y - d.node.dy / 2 + 0.5) + ')'; }); } @@ -170913,7 +172664,7 @@ function linkPath(d) { } function updateNodeShapes(sankeyNode) { - d3.select(sankeyNode.node().parentElement).style('shape-rendering', 'optimizeSpeed'); + d3.select(sankeyNode.node().parentNode).style('shape-rendering', 'optimizeSpeed'); sankeyNode.call(updateNodePositions); } @@ -170927,20 +172678,28 @@ function sizeNode(rect) { .attr('height', function(d) {return d.visibleHeight;}); } -function salientEnough(d) { - return d.link.dy > 1 || d.linkLineWidth > 0; +function salientEnough(d) {return d.link.dy > 1 || d.linkLineWidth > 0;} + +function sankeyTransform(d) { + var offset = 'translate(' + d.translateX + ',' + d.translateY + ')'; + return offset + (d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)'); } -function linksTransform(d) { - return d.horizontal ? 'matrix(1,0,0,1,0,0)' : 'matrix(0,1,1,0,0,0)'; +function nodeCentering(d) { + return 'translate(' + (d.horizontal ? 0 : d.labelY) + ' ' + (d.horizontal ? d.labelY : 0) + ')'; } function textGuidePath(d) { return d3.svg.line()([ - [d.horizontal ? (d.left ? -d.sizeAcross : d.visibleWidth + c.nodeTextOffsetHorizontal) : c.nodeTextOffsetHorizontal, d.labelY], - [d.horizontal ? (d.left ? - c.nodeTextOffsetHorizontal : d.sizeAcross) : d.visibleWidth - c.nodeTextOffsetHorizontal, d.labelY] + [d.horizontal ? (d.left ? -d.sizeAcross : d.visibleWidth + c.nodeTextOffsetHorizontal) : c.nodeTextOffsetHorizontal, 0], + [d.horizontal ? (d.left ? - c.nodeTextOffsetHorizontal : d.sizeAcross) : d.visibleHeight - c.nodeTextOffsetHorizontal, 0] ]);} +function sankeyInverseTransform(d) {return d.horizontal ? 'matrix(1 0 0 1 0 0)' : 'matrix(0 1 1 0 0 0)';} +function textFlip(d) {return d.horizontal ? 'scale(1 1)' : 'scale(-1 1)';} +function nodeTextColor(d) {return d.darkBackground && !d.horizontal ? 'rgb(255,255,255)' : 'rgb(0,0,0)';} +function nodeTextOffset(d) {return d.horizontal && d.left ? '100%' : '0%';} + // event handling function attachPointerEvents(selection, sankey, eventSet) { @@ -170979,7 +172738,7 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) { var dragBehavior = d3.behavior.drag() - .origin(function(d) {return d.horizontal ? d.node : {x: d.node.y, y: d.node.x};}) + .origin(function(d) {return d.node;}) .on('dragstart', function(d) { if(d.arrangement === 'fixed') return; @@ -171003,8 +172762,8 @@ function attachDragHandler(sankeyNode, sankeyLink, callbacks) { .on('drag', function(d) { if(d.arrangement === 'fixed') return; - var x = d.horizontal ? d3.event.x : d3.event.y; - var y = d.horizontal ? d3.event.y : d3.event.x; + var x = d3.event.x; + var y = d3.event.y; if(d.arrangement === 'snap') { d.node.x = x; d.node.y = y; @@ -171100,10 +172859,12 @@ module.exports = function(svg, styledData, layout, callbacks) { .style('left', 0) .style('shape-rendering', 'geometricPrecision') .style('pointer-events', 'auto') - .style('box-sizing', 'content-box'); + .style('box-sizing', 'content-box') + .attr('transform', sankeyTransform); - sankey - .attr('transform', function(d) {return 'translate(' + d.translateX + ',' + d.translateY + ')';}); + sankey.transition() + .ease(c.ease).duration(c.duration) + .attr('transform', sankeyTransform); var sankeyLinks = sankey.selectAll('.sankeyLinks') .data(repeat, keyFun); @@ -171111,12 +172872,7 @@ module.exports = function(svg, styledData, layout, callbacks) { sankeyLinks.enter() .append('g') .classed('sankeyLinks', true) - .style('fill', 'none') - .style('transform', linksTransform); - - sankeyLinks.transition() - .ease(c.ease).duration(c.duration) - .style('transform', linksTransform); + .style('fill', 'none'); var sankeyLink = sankeyLinks.selectAll('.sankeyLink') .data(function(d) { @@ -171230,26 +172986,42 @@ module.exports = function(svg, styledData, layout, callbacks) { .attr('width', function(d) {return d.zoneWidth;}) .attr('height', function(d) {return d.zoneHeight;}); - var nodeLabelGuide = sankeyNode.selectAll('.nodeLabelGuide') + var nodeCentered = sankeyNode.selectAll('.nodeCentered') + .data(repeat); + + nodeCentered.enter() + .append('g') + .classed('nodeCentered', true) + .attr('transform', nodeCentering); + + nodeCentered + .transition() + .ease(c.ease).duration(c.duration) + .attr('transform', nodeCentering); + + var nodeLabelGuide = nodeCentered.selectAll('.nodeLabelGuide') .data(repeat); nodeLabelGuide.enter() .append('path') .classed('nodeLabelGuide', true) .attr('id', function(d) {return d.uniqueNodeLabelPathId;}) - .attr('d', textGuidePath); + .attr('d', textGuidePath) + .attr('transform', sankeyInverseTransform); nodeLabelGuide .transition() .ease(c.ease).duration(c.duration) - .attr('d', textGuidePath); + .attr('d', textGuidePath) + .attr('transform', sankeyInverseTransform); - var nodeLabel = sankeyNode.selectAll('.nodeLabel') + var nodeLabel = nodeCentered.selectAll('.nodeLabel') .data(repeat); nodeLabel.enter() .append('text') .classed('nodeLabel', true) + .attr('transform', textFlip) .style('user-select', 'none') .style('cursor', 'default') .style('fill', 'black'); @@ -171260,6 +173032,11 @@ module.exports = function(svg, styledData, layout, callbacks) { }) .each(function(d) {Drawing.font(nodeLabel, d.textFont);}); + nodeLabel + .transition() + .ease(c.ease).duration(c.duration) + .attr('transform', textFlip); + var nodeLabelTextPath = nodeLabel.selectAll('.nodeLabelTextPath') .data(repeat); @@ -171267,16 +173044,22 @@ module.exports = function(svg, styledData, layout, callbacks) { .append('textPath') .classed('nodeLabelTextPath', true) .attr('alignment-baseline', 'middle') - .attr('xlink:href', function(d) {return '#' + d.uniqueNodeLabelPathId;}); + .attr('xlink:href', function(d) {return '#' + d.uniqueNodeLabelPathId;}) + .attr('startOffset', nodeTextOffset) + .style('fill', nodeTextColor); nodeLabelTextPath .text(function(d) {return d.horizontal || d.node.dy > 5 ? d.node.label : '';}) - .attr('startOffset', function(d) {return d.horizontal && d.left ? '100%' : '0%';}) - .style('text-anchor', function(d) {return d.horizontal && d.left ? 'end' : 'start';}) - .style('fill', function(d) {return d.darkBackground && !d.horizontal ? 'white' : 'black';}); + .attr('text-anchor', function(d) {return d.horizontal && d.left ? 'end' : 'start';}); + + nodeLabelTextPath + .transition() + .ease(c.ease).duration(c.duration) + .attr('startOffset', nodeTextOffset) + .style('fill', nodeTextColor); }; -},{"../../components/color":590,"../../components/drawing":614,"../../lib":709,"./constants":1002,"@plotly/d3-sankey":36,"d3":118,"d3-force":114,"tinycolor2":526}],1007:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../lib":721,"./constants":1016,"@plotly/d3-sankey":36,"d3":120,"d3-force":116,"tinycolor2":530}],1021:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171328,7 +173111,7 @@ module.exports = function arraysToCalcdata(cd, trace) { } }; -},{"../../lib":709}],1008:[function(require,module,exports){ +},{"../../lib":721}],1022:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171374,20 +173157,12 @@ module.exports = { dflt: 0, - }, - customdata: { - valType: 'data_array', - }, dy: { valType: 'number', dflt: 1, - }, - ids: { - valType: 'data_array', - }, text: { valType: 'string', @@ -171608,7 +173383,7 @@ module.exports = { error_x: errorBarAttrs }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/drawing":614,"../../components/drawing/attributes":613,"../../components/errorbars/attributes":616,"../../lib/extend":701,"./constants":1013}],1009:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/drawing":624,"../../components/drawing/attributes":623,"../../components/errorbars/attributes":626,"../../lib/extend":713,"./constants":1027}],1023:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171739,7 +173514,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../constants/numerical":690,"../../plots/cartesian/axes":748,"./arrays_to_calcdata":1007,"./colorscale_calc":1012,"./subtypes":1028,"fast-isnumeric":127}],1010:[function(require,module,exports){ +},{"../../constants/numerical":702,"../../plots/cartesian/axes":760,"./arrays_to_calcdata":1021,"./colorscale_calc":1026,"./subtypes":1042,"fast-isnumeric":129}],1024:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171778,7 +173553,7 @@ module.exports = function cleanData(fullData) { } }; -},{}],1011:[function(require,module,exports){ +},{}],1025:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171834,7 +173609,7 @@ module.exports = function colorbar(gd, cd) { .options(marker.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],1012:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],1026:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171867,7 +173642,7 @@ module.exports = function calcMarkerColorscale(trace) { } }; -},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"./subtypes":1028}],1013:[function(require,module,exports){ +},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"./subtypes":1042}],1027:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171883,7 +173658,7 @@ module.exports = { PTS_LINESONLY: 20 }; -},{}],1014:[function(require,module,exports){ +},{}],1028:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -171922,11 +173697,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout return; } - coerce('customdata'); coerce('text'); coerce('hovertext'); coerce('mode', defaultMode); - coerce('ids'); if(subTypes.hasLines(traceOut)) { handleLineDefaults(traceIn, traceOut, defaultColor, layout, coerce); @@ -171965,7 +173738,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":619,"../../lib":709,"./attributes":1008,"./constants":1013,"./fillcolor_defaults":1015,"./line_defaults":1019,"./line_shape_defaults":1021,"./marker_defaults":1024,"./subtypes":1028,"./text_defaults":1029,"./xy_defaults":1030}],1015:[function(require,module,exports){ +},{"../../components/errorbars/defaults":629,"../../lib":721,"./attributes":1022,"./constants":1027,"./fillcolor_defaults":1029,"./line_defaults":1033,"./line_shape_defaults":1035,"./marker_defaults":1038,"./subtypes":1042,"./text_defaults":1043,"./xy_defaults":1044}],1029:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172003,7 +173776,7 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe )); }; -},{"../../components/color":590}],1016:[function(require,module,exports){ +},{"../../components/color":600}],1030:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172056,7 +173829,7 @@ module.exports = function getTraceColor(trace, di) { } }; -},{"../../components/color":590,"./subtypes":1028}],1017:[function(require,module,exports){ +},{"../../components/color":600,"./subtypes":1042}],1031:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172083,11 +173856,12 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { ya = pointData.ya, xpx = xa.c2p(xval), ypx = ya.c2p(yval), - pt = [xpx, ypx]; + pt = [xpx, ypx], + hoveron = trace.hoveron || ''; // look for points to hover on first, then take fills only if we // didn't find a point - if(trace.hoveron.indexOf('points') !== -1) { + if(hoveron.indexOf('points') !== -1) { var dx = function(di) { // scatter points: d.mrc is the calculated marker radius // adjust the distance so if you're inside the marker it @@ -172143,7 +173917,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } // even if hoveron is 'fills', only use it if we have polygons too - if(trace.hoveron.indexOf('fills') !== -1 && trace._polygons) { + if(hoveron.indexOf('fills') !== -1 && trace._polygons) { var polygons = trace._polygons, polygonsIn = [], inside = false, @@ -172227,7 +174001,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { } }; -},{"../../components/color":590,"../../components/errorbars":620,"../../components/fx":631,"../../lib":709,"./get_trace_color":1016}],1018:[function(require,module,exports){ +},{"../../components/color":600,"../../components/errorbars":630,"../../components/fx":641,"../../lib":721,"./get_trace_color":1030}],1032:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172271,7 +174045,7 @@ Scatter.meta = { module.exports = Scatter; -},{"../../plots/cartesian":758,"./arrays_to_calcdata":1007,"./attributes":1008,"./calc":1009,"./clean_data":1010,"./colorbar":1011,"./defaults":1014,"./hover":1017,"./plot":1025,"./select":1026,"./style":1027,"./subtypes":1028}],1019:[function(require,module,exports){ +},{"../../plots/cartesian":770,"./arrays_to_calcdata":1021,"./attributes":1022,"./calc":1023,"./clean_data":1024,"./colorbar":1025,"./defaults":1028,"./hover":1031,"./plot":1039,"./select":1040,"./style":1041,"./subtypes":1042}],1033:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172304,7 +174078,7 @@ module.exports = function lineDefaults(traceIn, traceOut, defaultColor, layout, if(!(opts || {}).noDash) coerce('line.dash'); }; -},{"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603}],1020:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613}],1034:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172477,7 +174251,7 @@ module.exports = function linePoints(d, opts) { return segments; }; -},{"../../constants/numerical":690}],1021:[function(require,module,exports){ +},{"../../constants/numerical":702}],1035:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172496,7 +174270,7 @@ module.exports = function handleLineShapeDefaults(traceIn, traceOut, coerce) { if(shape === 'spline') coerce('line.smoothing'); }; -},{}],1022:[function(require,module,exports){ +},{}],1036:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172537,7 +174311,7 @@ module.exports = function linkTraces(gd, plotinfo, cdscatter) { } }; -},{}],1023:[function(require,module,exports){ +},{}],1037:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172579,7 +174353,7 @@ module.exports = function makeBubbleSizeFn(trace) { }; }; -},{"fast-isnumeric":127}],1024:[function(require,module,exports){ +},{"fast-isnumeric":129}],1038:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172654,7 +174428,7 @@ module.exports = function markerDefaults(traceIn, traceOut, defaultColor, layout } }; -},{"../../components/color":590,"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603,"./subtypes":1028}],1025:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613,"./subtypes":1042}],1039:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -172997,10 +174771,12 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // For the sake of animations, wrap the points around so that // the points on the axes are the first two points. Otherwise // animations get a little crazy if the number of points changes. - transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)); + transition(ownFillEl3).attr('d', 'M' + pt1 + 'L' + pt0 + 'L' + fullpath.substr(1)) + .call(Drawing.singleFillStyle); } else { // fill to self: just join the path to itself - transition(ownFillEl3).attr('d', fullpath + 'Z'); + transition(ownFillEl3).attr('d', fullpath + 'Z') + .call(Drawing.singleFillStyle); } } } @@ -173011,7 +174787,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // contours, we just add the two paths closed on themselves. // This makes strange results if one path is *not* entirely // inside the other, but then that is a strange usage. - transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z'); + transition(tonext).attr('d', fullpath + 'Z' + prevRevpath + 'Z') + .call(Drawing.singleFillStyle); } else { // tonextx/y: for now just connect endpoints with lines. This is @@ -173019,7 +174796,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // y/x, but if they *aren't*, we should ideally do more complicated // things depending on whether the new endpoint projects onto the // existing curve or off the end of it - transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z'); + transition(tonext).attr('d', fullpath + 'L' + prevRevpath.substr(1) + 'Z') + .call(Drawing.singleFillStyle); } trace._polygons = trace._polygons.concat(prevPolygons); } @@ -173076,17 +174854,20 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition var enter = join.enter().append('path') .classed('point', true); - enter.call(Drawing.pointStyle, trace) - .call(Drawing.translatePoints, xa, ya, trace); - if(hasTransition) { - enter.style('opacity', 0).transition() + enter + .call(Drawing.pointStyle, trace, gd) + .call(Drawing.translatePoints, xa, ya, trace) + .style('opacity', 0) + .transition() .style('opacity', 1); } var markerScale = showMarkers && Drawing.tryColorscale(trace.marker, ''); var lineScale = showMarkers && Drawing.tryColorscale(trace.marker, 'line'); + join.order(); + join.each(function(d) { var el = d3.select(this); var sel = transition(el); @@ -173098,6 +174879,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition if(trace.customdata) { el.classed('plotly-customdata', d.data !== null && d.data !== undefined); } + } else { + sel.remove(); } }); @@ -173117,6 +174900,8 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition // it gets converted to mathjax join.enter().append('g').classed('textpoint', true).append('text'); + join.order(); + join.each(function(d) { var g = d3.select(this); var sel = transition(g.select('text')); @@ -173125,7 +174910,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition }); join.selectAll('text') - .call(Drawing.textPointStyle, trace) + .call(Drawing.textPointStyle, trace, gd) .each(function(d) { // This just *has* to be totally custom becuase of SVG text positioning :( @@ -173202,7 +174987,7 @@ function selectMarkers(gd, idx, plotinfo, cdscatter, cdscatterAll) { }); } -},{"../../components/drawing":614,"../../components/errorbars":620,"../../lib":709,"../../lib/polygon":719,"./line_points":1020,"./link_traces":1022,"./subtypes":1028,"d3":118}],1026:[function(require,module,exports){ +},{"../../components/drawing":624,"../../components/errorbars":630,"../../lib":721,"../../lib/polygon":731,"./line_points":1034,"./link_traces":1036,"./subtypes":1042,"d3":120}],1040:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173224,7 +175009,6 @@ module.exports = function selectPoints(searchInfo, polygon) { ya = searchInfo.yaxis, selection = [], trace = cd[0].trace, - curveNumber = trace.index, marker = trace.marker, i, di, @@ -173248,11 +175032,9 @@ module.exports = function selectPoints(searchInfo, polygon) { if(polygon.contains([x, y])) { selection.push({ - curveNumber: curveNumber, pointNumber: i, x: di.x, - y: di.y, - id: di.id + y: di.y }); di.dim = 0; } @@ -173275,7 +175057,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"./subtypes":1028}],1027:[function(require,module,exports){ +},{"./subtypes":1042}],1041:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173306,10 +175088,10 @@ module.exports = function style(gd) { var pts = el.selectAll('path.point'); var trace = d.trace || d[0].trace; - pts.call(Drawing.pointStyle, trace); + pts.call(Drawing.pointStyle, trace, gd); el.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, gd); }); s.selectAll('g.trace path.js-line') @@ -173321,7 +175103,7 @@ module.exports = function style(gd) { s.call(ErrorBars.style); }; -},{"../../components/drawing":614,"../../components/errorbars":620,"d3":118}],1028:[function(require,module,exports){ +},{"../../components/drawing":624,"../../components/errorbars":630,"d3":120}],1042:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173357,7 +175139,7 @@ module.exports = { } }; -},{"../../lib":709}],1029:[function(require,module,exports){ +},{"../../lib":721}],1043:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173378,7 +175160,7 @@ module.exports = function(traceIn, traceOut, layout, coerce) { Lib.coerceFont(coerce, 'textfont', layout.font); }; -},{"../../lib":709}],1030:[function(require,module,exports){ +},{"../../lib":721}],1044:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173428,7 +175210,7 @@ module.exports = function handleXYDefaults(traceIn, traceOut, layout, coerce) { return len; }; -},{"../../registry":826}],1031:[function(require,module,exports){ +},{"../../registry":838}],1045:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173444,7 +175226,7 @@ var colorAttributes = require('../../components/colorscale/color_attributes'); var errorBarAttrs = require('../../components/errorbars/attributes'); var DASHES = require('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl3d_markers'); var extendFlat = require('../../lib/extend').extendFlat; var scatterLineAttrs = scatterAttrs.line, @@ -173573,7 +175355,7 @@ module.exports = { error_z: errorBarAttrs, }; -},{"../../components/colorscale/color_attributes":597,"../../components/errorbars/attributes":616,"../../constants/gl3d_dashes":687,"../../constants/gl_markers":688,"../../lib/extend":701,"../scatter/attributes":1008}],1032:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":607,"../../components/errorbars/attributes":626,"../../constants/gl3d_dashes":699,"../../constants/gl3d_markers":700,"../../lib/extend":713,"../scatter/attributes":1022}],1046:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173602,7 +175384,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012}],1033:[function(require,module,exports){ +},{"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026}],1047:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173673,7 +175455,7 @@ function calculateErrors(data, scaleFactor) { module.exports = calculateErrors; -},{"../../components/errorbars/compute_error":618}],1034:[function(require,module,exports){ +},{"../../components/errorbars/compute_error":628}],1048:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -173696,7 +175478,7 @@ var str2RgbaArray = require('../../lib/str2rgbarray'); var formatColor = require('../../lib/gl_format_color'); var makeBubbleSizeFn = require('../scatter/make_bubble_size_func'); var DASH_PATTERNS = require('../../constants/gl3d_dashes'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl3d_markers'); var calculateError = require('./calc_errors'); @@ -174144,7 +175926,7 @@ function createLineWithMarkers(scene, data) { module.exports = createLineWithMarkers; -},{"../../constants/gl3d_dashes":687,"../../constants/gl_markers":688,"../../lib":709,"../../lib/gl_format_color":706,"../../lib/str2rgbarray":727,"../scatter/make_bubble_size_func":1023,"./calc_errors":1033,"delaunay-triangulate":119,"gl-error3d":157,"gl-line3d":167,"gl-mesh3d":200,"gl-scatter3d":246}],1035:[function(require,module,exports){ +},{"../../constants/gl3d_dashes":699,"../../constants/gl3d_markers":700,"../../lib":721,"../../lib/gl_format_color":718,"../../lib/str2rgbarray":739,"../scatter/make_bubble_size_func":1037,"./calc_errors":1047,"delaunay-triangulate":121,"gl-error3d":159,"gl-line3d":170,"gl-mesh3d":203,"gl-scatter3d":249}],1049:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174234,7 +176016,7 @@ function handleXYZDefaults(traceIn, traceOut, coerce, layout) { return len; } -},{"../../components/errorbars/defaults":619,"../../lib":709,"../../registry":826,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1031}],1036:[function(require,module,exports){ +},{"../../components/errorbars/defaults":629,"../../lib":721,"../../registry":838,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1045}],1050:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174249,7 +176031,7 @@ var Scatter3D = {}; Scatter3D.plot = require('./convert'); Scatter3D.attributes = require('./attributes'); -Scatter3D.markerSymbols = require('../../constants/gl_markers'); +Scatter3D.markerSymbols = require('../../constants/gl3d_markers'); Scatter3D.supplyDefaults = require('./defaults'); Scatter3D.colorbar = require('../scatter/colorbar'); Scatter3D.calc = require('./calc'); @@ -174265,7 +176047,7 @@ Scatter3D.meta = { module.exports = Scatter3D; -},{"../../constants/gl_markers":688,"../../plots/gl3d":791,"../scatter/colorbar":1011,"./attributes":1031,"./calc":1032,"./convert":1034,"./defaults":1035}],1037:[function(require,module,exports){ +},{"../../constants/gl3d_markers":700,"../../plots/gl3d":803,"../scatter/colorbar":1025,"./attributes":1045,"./calc":1046,"./convert":1048,"./defaults":1049}],1051:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174347,12 +176129,12 @@ module.exports = { textfont: scatterAttrs.textfont, textposition: scatterAttrs.textposition, hoverinfo: extendFlat({}, plotAttrs.hoverinfo, { - flags: ['a', 'b', 'c', 'text', 'name'] + flags: ['a', 'b', 'text', 'name'] }), hoveron: scatterAttrs.hoveron, }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1038:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1052:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174428,7 +176210,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":748,"../carpet/lookup_carpetid":882,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"../scatter/subtypes":1028,"fast-isnumeric":127}],1039:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../carpet/lookup_carpetid":894,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"../scatter/subtypes":1042,"fast-isnumeric":129}],1053:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174513,15 +176295,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } - coerce('hoverinfo', (layout._dataLength === 1) ? 'a+b+text' : undefined); - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { dfltHoverOn.push('fills'); } coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":709,"../scatter/constants":1013,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/line_shape_defaults":1021,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1037}],1040:[function(require,module,exports){ +},{"../../lib":721,"../scatter/constants":1027,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/line_shape_defaults":1035,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1051}],1054:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174598,7 +176378,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../scatter/hover":1017}],1041:[function(require,module,exports){ +},{"../scatter/hover":1031}],1055:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174631,7 +176411,7 @@ ScatterCarpet.meta = { module.exports = ScatterCarpet; -},{"../../plots/cartesian":758,"../scatter/colorbar":1011,"./attributes":1037,"./calc":1038,"./defaults":1039,"./hover":1040,"./plot":1042,"./select":1043,"./style":1044}],1042:[function(require,module,exports){ +},{"../../plots/cartesian":770,"../scatter/colorbar":1025,"./attributes":1051,"./calc":1052,"./defaults":1053,"./hover":1054,"./plot":1056,"./select":1057,"./style":1058}],1056:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174675,7 +176455,7 @@ module.exports = function plot(gd, plotinfoproxy, data) { } }; -},{"../../plots/cartesian/axes":748,"../scatter/plot":1025}],1043:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../scatter/plot":1039}],1057:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174710,7 +176490,7 @@ module.exports = function selectPoints(searchInfo, polygon) { return selection; }; -},{"../scatter/select":1026}],1044:[function(require,module,exports){ +},{"../scatter/select":1040}],1058:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174739,7 +176519,7 @@ module.exports = function style(gd) { scatterStyle(gd); }; -},{"../scatter/style":1027}],1045:[function(require,module,exports){ +},{"../scatter/style":1041}],1059:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174834,7 +176614,7 @@ module.exports = { }) }; -},{"../../components/colorscale/color_attributes":597,"../../components/drawing/attributes":613,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1046:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":607,"../../components/drawing/attributes":623,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1060:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174878,7 +176658,7 @@ module.exports = function calc(gd, trace) { return calcTrace; }; -},{"../../constants/numerical":690,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"fast-isnumeric":127}],1047:[function(require,module,exports){ +},{"../../constants/numerical":702,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"fast-isnumeric":129}],1061:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174933,8 +176713,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } - - coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+location+text' : undefined); }; function handleLonLatLocDefaults(traceIn, traceOut, coerce) { @@ -174959,7 +176737,7 @@ function handleLonLatLocDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":709,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1045}],1048:[function(require,module,exports){ +},{"../../lib":721,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1059}],1062:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -174980,7 +176758,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1049:[function(require,module,exports){ +},{}],1063:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175097,7 +176875,7 @@ function getExtraText(trace, pt, axis) { return text.join('
'); } -},{"../../components/fx":631,"../../constants/numerical":690,"../../plots/cartesian/axes":748,"../scatter/get_trace_color":1016,"./attributes":1045}],1050:[function(require,module,exports){ +},{"../../components/fx":641,"../../constants/numerical":702,"../../plots/cartesian/axes":760,"../scatter/get_trace_color":1030,"./attributes":1059}],1064:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175130,7 +176908,7 @@ ScatterGeo.meta = { module.exports = ScatterGeo; -},{"../../plots/geo":776,"../scatter/colorbar":1011,"./attributes":1045,"./calc":1046,"./defaults":1047,"./event_data":1048,"./hover":1049,"./plot":1051}],1051:[function(require,module,exports){ +},{"../../plots/geo":788,"../scatter/colorbar":1025,"./attributes":1059,"./calc":1060,"./defaults":1061,"./event_data":1062,"./hover":1063,"./plot":1065}],1065:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175247,9 +177025,9 @@ function style(geo) { group = d3.select(this); group.selectAll('path.point') - .call(Drawing.pointStyle, trace); + .call(Drawing.pointStyle, trace, geo.graphDiv); group.selectAll('text') - .call(Drawing.textPointStyle, trace); + .call(Drawing.textPointStyle, trace, geo.graphDiv); }); // this part is incompatible with Drawing.lineGroupStyle @@ -175269,7 +177047,7 @@ function style(geo) { }); } -},{"../../components/color":590,"../../components/drawing":614,"../../constants/numerical":690,"../../lib":709,"../../lib/geo_location_utils":704,"../../lib/geojson_utils":705,"../../lib/topojson_utils":730,"../scatter/subtypes":1028,"d3":118}],1052:[function(require,module,exports){ +},{"../../components/color":600,"../../components/drawing":624,"../../constants/numerical":702,"../../lib":721,"../../lib/geo_location_utils":716,"../../lib/geojson_utils":717,"../../lib/topojson_utils":742,"../scatter/subtypes":1042,"d3":120}],1066:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175284,7 +177062,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/color_attributes'); var DASHES = require('../../constants/gl2d_dashes'); -var MARKERS = require('../../constants/gl_markers'); +var MARKERS = require('../../constants/gl2d_markers'); var extendFlat = require('../../lib/extend').extendFlat; var extendDeep = require('../../lib/extend').extendDeep; @@ -175351,7 +177129,52 @@ module.exports = { error_x: scatterAttrs.error_x }; -},{"../../components/colorscale/color_attributes":597,"../../constants/gl2d_dashes":686,"../../constants/gl_markers":688,"../../lib/extend":701,"../scatter/attributes":1008}],1053:[function(require,module,exports){ +},{"../../components/colorscale/color_attributes":607,"../../constants/gl2d_dashes":697,"../../constants/gl2d_markers":698,"../../lib/extend":713,"../scatter/attributes":1022}],1067:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 Axes = require('../../plots/cartesian/axes'); +var arraysToCalcdata = require('../scatter/arrays_to_calcdata'); +var calcColorscales = require('../scatter/colorscale_calc'); + +module.exports = function calc(gd, trace) { + var dragmode = gd._fullLayout.dragmode; + var cd; + + if(dragmode === 'lasso' || dragmode === 'select') { + var xa = Axes.getFromId(gd, trace.xaxis || 'x'); + var ya = Axes.getFromId(gd, trace.yaxis || 'y'); + + var x = xa.makeCalcdata(trace, 'x'); + var y = ya.makeCalcdata(trace, 'y'); + + var serieslen = Math.min(x.length, y.length), i; + + // create the "calculated data" to plot + cd = new Array(serieslen); + + for(i = 0; i < serieslen; i++) { + cd[i] = {x: x[i], y: y[i]}; + } + } else { + cd = [{x: false, y: false, trace: trace, t: {}}]; + arraysToCalcdata(cd, trace); + } + + calcColorscales(trace); + + return cd; +}; + +},{"../../plots/cartesian/axes":760,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026}],1068:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -175379,11 +177202,12 @@ var formatColor = require('../../lib/gl_format_color'); var subTypes = require('../scatter/subtypes'); var makeBubbleSizeFn = require('../scatter/make_bubble_size_func'); var getTraceColor = require('../scatter/get_trace_color'); -var MARKER_SYMBOLS = require('../../constants/gl_markers'); +var MARKER_SYMBOLS = require('../../constants/gl2d_markers'); var DASHES = require('../../constants/gl2d_dashes'); var AXES = ['xaxis', 'yaxis']; - +var DESELECTDIM = 0.2; +var TRANSPARENT = [0, 0, 0, 0]; function LineWithMarkers(scene, uid) { this.scene = scene; @@ -175449,11 +177273,14 @@ function LineWithMarkers(scene, uid) { size: 12, color: [0, 0, 0, 1], borderSize: 1, - borderColor: [0, 0, 0, 1] + borderColor: [0, 0, 0, 1], + snapPoints: true }; + var scatterOptions1 = Lib.extendFlat({}, scatterOptions0, {snapPoints: false}); this.scatter = this.initObject(createScatter, scatterOptions0, 3); this.fancyScatter = this.initObject(createFancyScatter, scatterOptions0, 4); + this.selectScatter = this.initObject(createScatter, scatterOptions1, 5); } var proto = LineWithMarkers.prototype; @@ -175568,7 +177395,7 @@ function _convertArray(convert, data, count) { var convertNumber = convertArray.bind(null, function(x) { return +x; }); var convertColorBase = convertArray.bind(null, str2RGBArray); var convertSymbol = convertArray.bind(null, function(x) { - return MARKER_SYMBOLS[x] || '●'; + return MARKER_SYMBOLS[x] ? x : 'circle'; }); function convertColor(color, opacity, count) { @@ -175605,8 +177432,21 @@ function _convertColor(colors, opacities, count) { return result; } -proto.update = function(options) { +function isSymbolOpen(symbol) { + return symbol.split('-open')[1] === ''; +} +function fillColor(colorIn, colorOut, offsetIn, offsetOut, isDimmed) { + var dim = isDimmed ? DESELECTDIM : 1; + var j; + + for(j = 0; j < 3; j++) { + colorIn[4 * offsetIn + j] = colorOut[4 * offsetOut + j]; + } + colorIn[4 * offsetIn + j] = dim * colorOut[4 * offsetOut + j]; +} + +proto.update = function(options, cdscatter) { if(options.visible !== true) { this.isVisible = false; this.hasLines = false; @@ -175657,6 +177497,11 @@ proto.update = function(options) { // not quite on-par with 'scatter', but close enough for now // does not handle the colorscale case this.color = getTraceColor(options, {}); + + // provide reference for selecting points + if(cdscatter && cdscatter[0] && !cdscatter[0].glTrace) { + cdscatter[0].glTrace = this; + } }; // We'd ideally know that all values are of fast types; sampling gives no certainty but faster @@ -175691,7 +177536,9 @@ proto.updateFast = function(options) { positions = new Float64Array(2 * len), bounds = this.bounds, pId = 0, - ptr = 0; + ptr = 0, + selection = options.selection, + i, selPositions, l; var xx, yy; @@ -175704,7 +177551,7 @@ proto.updateFast = function(options) { // TODO bypass this on modebar +/- zoom if(fastType || isDateTime) { - for(var i = 0; i < len; ++i) { + for(i = 0; i < len; ++i) { xx = x[i]; yy = y[i]; @@ -175714,11 +177561,11 @@ proto.updateFast = function(options) { xx = Lib.dateTime2ms(xx, xcalendar); } - idToIndex[pId++] = i; - positions[ptr++] = xx; positions[ptr++] = yy; + idToIndex[pId++] = i; + bounds[0] = Math.min(bounds[0], xx); bounds[1] = Math.min(bounds[1], yy); bounds[2] = Math.max(bounds[2], xx); @@ -175730,6 +177577,16 @@ proto.updateFast = function(options) { positions = truncate(positions, ptr); this.idToIndex = idToIndex; + // form selected set + if(selection) { + selPositions = new Float64Array(2 * selection.length); + + for(i = 0, l = selection.length; i < l; i++) { + selPositions[i * 2 + 0] = selection[i].x; + selPositions[i * 2 + 1] = selection[i].y; + } + } + this.updateLines(options, positions); this.updateError('X', options); this.updateError('Y', options); @@ -175737,23 +177594,68 @@ proto.updateFast = function(options) { var markerSize; if(this.hasMarkers) { - this.scatter.options.positions = positions; + var markerColor, borderColor, opacity; + + // if we have selPositions array - means we have to render all points transparent, and selected points opaque + if(selPositions) { + this.scatter.options.positions = null; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); + opacity = (options.opacity) * (options.marker.opacity) * DESELECTDIM; + + markerColor[3] *= opacity; + this.scatter.options.color = markerColor; - var markerColor = str2RGBArray(options.marker.color), - borderColor = str2RGBArray(options.marker.line.color), + borderColor[3] *= opacity; + this.scatter.options.borderColor = borderColor; + + markerSize = options.marker.size; + this.scatter.options.size = markerSize; + this.scatter.options.borderSize = options.marker.line.width; + + this.scatter.update(); + this.scatter.options.positions = positions; + + + this.selectScatter.options.positions = selPositions; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); opacity = (options.opacity) * (options.marker.opacity); - markerColor[3] *= opacity; - this.scatter.options.color = markerColor; + markerColor[3] *= opacity; + this.selectScatter.options.color = markerColor; - borderColor[3] *= opacity; - this.scatter.options.borderColor = borderColor; + borderColor[3] *= opacity; + this.selectScatter.options.borderColor = borderColor; - markerSize = options.marker.size; - this.scatter.options.size = markerSize; - this.scatter.options.borderSize = options.marker.line.width; + markerSize = options.marker.size; + this.selectScatter.options.size = markerSize; + this.selectScatter.options.borderSize = options.marker.line.width; + + this.selectScatter.update(); + } + + else { + this.scatter.options.positions = positions; + + markerColor = str2RGBArray(options.marker.color); + borderColor = str2RGBArray(options.marker.line.color); + opacity = (options.opacity) * (options.marker.opacity); + markerColor[3] *= opacity; + this.scatter.options.color = markerColor; + + borderColor[3] *= opacity; + this.scatter.options.borderColor = borderColor; + + markerSize = options.marker.size; + this.scatter.options.size = markerSize; + this.scatter.options.borderSize = options.marker.line.width; + + this.scatter.update(); + } - this.scatter.update(); } else { this.scatter.clear(); @@ -175770,7 +177672,8 @@ proto.updateFancy = function(options) { var scene = this.scene, xaxis = scene.xaxis, yaxis = scene.yaxis, - bounds = this.bounds; + bounds = this.bounds, + selection = options.selection; // makeCalcdata runs d2c (data-to-coordinate) on every point var x = this.pickXData = xaxis.makeCalcdata(options, 'x').slice(); @@ -175795,7 +177698,7 @@ proto.updateFancy = function(options) { var getX = (xaxis.type === 'log') ? xaxis.d2l : function(x) { return x; }; var getY = (yaxis.type === 'log') ? yaxis.d2l : function(y) { return y; }; - var i, j, xx, yy, ex0, ex1, ey0, ey1; + var i, xx, yy, ex0, ex1, ey0, ey1; for(i = 0; i < len; ++i) { this.xData[i] = xx = getX(x[i]); @@ -175831,7 +177734,14 @@ proto.updateFancy = function(options) { this.updateError('X', options, positions, errorsX); this.updateError('Y', options, positions, errorsY); - var sizes; + var sizes, selIds; + + if(selection) { + selIds = {}; + for(i = 0; i < selection.length; i++) { + selIds[selection[i].pointNumber] = true; + } + } if(this.hasMarkers) { this.scatter.options.positions = positions; @@ -175845,32 +177755,65 @@ proto.updateFancy = function(options) { this.scatter.options.colors = new Array(pId * 4); this.scatter.options.borderColors = new Array(pId * 4); - var markerSizeFunc = makeBubbleSizeFn(options), - markerOpts = options.marker, - markerOpacity = markerOpts.opacity, - traceOpacity = options.opacity, - colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len), - glyphs = convertSymbol(markerOpts.symbol, len), - borderWidths = convertNumber(markerOpts.line.width, len), - borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len), - index; + var markerSizeFunc = makeBubbleSizeFn(options); + var markerOpts = options.marker; + var markerOpacity = markerOpts.opacity; + var traceOpacity = options.opacity; + var symbols = convertSymbol(markerOpts.symbol, len); + var colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len); + var borderWidths = convertNumber(markerOpts.line.width, len); + var borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len); + var index, size, symbol, symbolSpec, isOpen, isDimmed, _colors, _borderColors, bw, minBorderWidth; sizes = convertArray(markerSizeFunc, markerOpts.size, len); for(i = 0; i < pId; ++i) { index = idToIndex[i]; - this.scatter.options.sizes[i] = 4.0 * sizes[index]; - this.scatter.options.glyphs[i] = glyphs[index]; - this.scatter.options.borderWidths[i] = 0.5 * borderWidths[index]; + symbol = symbols[index]; + symbolSpec = MARKER_SYMBOLS[symbol]; + isOpen = isSymbolOpen(symbol); + isDimmed = selIds && !selIds[index]; + + if(symbolSpec.noBorder && !isOpen) { + _colors = borderColors; + } else { + _colors = colors; + } + + if(isOpen) { + _borderColors = colors; + } else { + _borderColors = borderColors; + } + + // See https://github.com/plotly/plotly.js/pull/1781#discussion_r121820798 + // for more info on this logic + size = sizes[index]; + bw = borderWidths[index]; + minBorderWidth = (symbolSpec.noBorder || symbolSpec.noFill) ? 0.1 * size : 0; + + this.scatter.options.sizes[i] = 4.0 * size; + this.scatter.options.glyphs[i] = symbolSpec.unicode; + this.scatter.options.borderWidths[i] = 0.5 * ((bw > minBorderWidth) ? bw - minBorderWidth : 0); - for(j = 0; j < 4; ++j) { - this.scatter.options.colors[4 * i + j] = colors[4 * index + j]; - this.scatter.options.borderColors[4 * i + j] = borderColors[4 * index + j]; + if(isOpen && !symbolSpec.noBorder && !symbolSpec.noFill) { + fillColor(this.scatter.options.colors, TRANSPARENT, i, 0); + } else { + fillColor(this.scatter.options.colors, _colors, i, index, isDimmed); } + fillColor(this.scatter.options.borderColors, _borderColors, i, index, isDimmed); } - this.fancyScatter.update(); + // prevent scatter from resnapping points + if(selIds) { + this.scatter.options.positions = null; + this.fancyScatter.update(); + this.scatter.options.positions = positions; + } + else { + this.fancyScatter.update(); + } } else { this.fancyScatter.clear(); @@ -175992,15 +177935,16 @@ proto.dispose = function() { this.fancyScatter.dispose(); }; -function createLineWithMarkers(scene, data) { +function createLineWithMarkers(scene, data, cdscatter) { var plot = new LineWithMarkers(scene, data.uid); - plot.update(data); + plot.update(data, cdscatter); + return plot; } module.exports = createLineWithMarkers; -},{"../../components/errorbars":620,"../../constants/gl2d_dashes":686,"../../constants/gl_markers":688,"../../lib":709,"../../lib/gl_format_color":706,"../../lib/str2rgbarray":727,"../../lib/typed_array_truncate":731,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_autotype":749,"../scatter/get_trace_color":1016,"../scatter/make_bubble_size_func":1023,"../scatter/subtypes":1028,"fast-isnumeric":127,"gl-error2d":155,"gl-line2d":165,"gl-scatter2d":243,"gl-scatter2d-sdf":238}],1054:[function(require,module,exports){ +},{"../../components/errorbars":630,"../../constants/gl2d_dashes":697,"../../constants/gl2d_markers":698,"../../lib":721,"../../lib/gl_format_color":718,"../../lib/str2rgbarray":739,"../../lib/typed_array_truncate":743,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_autotype":761,"../scatter/get_trace_color":1030,"../scatter/make_bubble_size_func":1037,"../scatter/subtypes":1042,"fast-isnumeric":129,"gl-error2d":157,"gl-line2d":168,"gl-scatter2d":246,"gl-scatter2d-sdf":241}],1069:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176057,7 +178001,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'y'}); }; -},{"../../components/errorbars/defaults":619,"../../lib":709,"../scatter/constants":1013,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/xy_defaults":1030,"./attributes":1052}],1055:[function(require,module,exports){ +},{"../../components/errorbars/defaults":629,"../../lib":721,"../scatter/constants":1027,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/xy_defaults":1044,"./attributes":1066}],1070:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176073,10 +178017,12 @@ var ScatterGl = {}; ScatterGl.attributes = require('./attributes'); ScatterGl.supplyDefaults = require('./defaults'); ScatterGl.colorbar = require('../scatter/colorbar'); +ScatterGl.hoverPoints = require('../scatter/hover'); // reuse the Scatter3D 'dummy' calc step so that legends know what to do -ScatterGl.calc = require('../scatter3d/calc'); +ScatterGl.calc = require('./calc'); ScatterGl.plot = require('./convert'); +ScatterGl.selectPoints = require('./select'); ScatterGl.moduleType = 'trace'; ScatterGl.name = 'scattergl'; @@ -176088,7 +178034,69 @@ ScatterGl.meta = { module.exports = ScatterGl; -},{"../../plots/gl2d":788,"../scatter/colorbar":1011,"../scatter3d/calc":1032,"./attributes":1052,"./convert":1053,"./defaults":1054}],1056:[function(require,module,exports){ +},{"../../plots/gl2d":800,"../scatter/colorbar":1025,"../scatter/hover":1031,"./attributes":1066,"./calc":1067,"./convert":1068,"./defaults":1069,"./select":1071}],1071:[function(require,module,exports){ +/** +* Copyright 2012-2017, 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 subtypes = require('../scatter/subtypes'); + +module.exports = function selectPoints(searchInfo, polygon) { + var cd = searchInfo.cd, + xa = searchInfo.xaxis, + ya = searchInfo.yaxis, + selection = [], + trace = cd[0].trace, + i, + di, + x, + y; + + var scattergl = cd[0].glTrace; + var scene = cd[0].glTrace.scene; + + var hasOnlyLines = (!subtypes.hasMarkers(trace) && !subtypes.hasText(trace)); + if(trace.visible !== true || hasOnlyLines) return; + + // filter out points by visible scatter ones + if(polygon === false) { + // clear selection + for(i = 0; i < cd.length; i++) cd[i].dim = 0; + } + else { + for(i = 0; i < cd.length; i++) { + di = cd[i]; + x = xa.c2p(di.x); + y = ya.c2p(di.y); + if(polygon.contains([x, y])) { + selection.push({ + pointNumber: i, + x: di.x, + y: di.y + }); + di.dim = 0; + } + else di.dim = 1; + } + } + + // highlight selected points here + trace.selection = selection; + + scattergl.update(trace, cd); + scene.glplot.setDirty(); + + return selection; +}; + +},{"../scatter/subtypes":1042}],1072:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176179,7 +178187,7 @@ module.exports = { }), }; -},{"../../components/colorbar/attributes":591,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/mapbox/layout_attributes":807,"../scatter/attributes":1008,"../scattergeo/attributes":1045}],1057:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/mapbox/layout_attributes":819,"../scatter/attributes":1022,"../scattergeo/attributes":1059}],1073:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176522,7 +178530,7 @@ function isBADNUM(lonlat) { return lonlat[0] === BADNUM; } -},{"../../components/colorscale":604,"../../constants/numerical":690,"../../lib":709,"../../lib/geojson_utils":705,"../../plots/mapbox/convert_text_opts":804,"../scatter/make_bubble_size_func":1023,"../scatter/subtypes":1028}],1058:[function(require,module,exports){ +},{"../../components/colorscale":614,"../../constants/numerical":702,"../../lib":721,"../../lib/geojson_utils":717,"../../plots/mapbox/convert_text_opts":816,"../scatter/make_bubble_size_func":1037,"../scatter/subtypes":1042}],1074:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176588,8 +178596,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(traceOut.fill !== 'none') { handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce); } - - coerce('hoverinfo', (layout._dataLength === 1) ? 'lon+lat+text' : undefined); }; function handleLonLatDefaults(traceIn, traceOut, coerce) { @@ -176603,7 +178609,7 @@ function handleLonLatDefaults(traceIn, traceOut, coerce) { return len; } -},{"../../lib":709,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1056}],1059:[function(require,module,exports){ +},{"../../lib":721,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1072}],1075:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176623,7 +178629,7 @@ module.exports = function eventData(out, pt) { return out; }; -},{}],1060:[function(require,module,exports){ +},{}],1076:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176726,7 +178732,7 @@ function getExtraText(trace, di) { return text.join('
'); } -},{"../../components/fx":631,"../../constants/numerical":690,"../scatter/get_trace_color":1016}],1061:[function(require,module,exports){ +},{"../../components/fx":641,"../../constants/numerical":702,"../scatter/get_trace_color":1030}],1077:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176759,7 +178765,7 @@ ScatterMapbox.meta = { module.exports = ScatterMapbox; -},{"../../plots/mapbox":805,"../scatter/colorbar":1011,"../scattergeo/calc":1046,"./attributes":1056,"./defaults":1058,"./event_data":1059,"./hover":1060,"./plot":1062}],1062:[function(require,module,exports){ +},{"../../plots/mapbox":817,"../scatter/colorbar":1025,"../scattergeo/calc":1060,"./attributes":1072,"./defaults":1074,"./event_data":1075,"./hover":1076,"./plot":1078}],1078:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176883,7 +178889,7 @@ module.exports = function createScatterMapbox(mapbox, calcTrace) { return scatterMapbox; }; -},{"./convert":1057}],1063:[function(require,module,exports){ +},{"./convert":1073}],1079:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -176973,7 +178979,7 @@ module.exports = { hoveron: scatterAttrs.hoveron, }; -},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/drawing/attributes":613,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1064:[function(require,module,exports){ +},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/drawing/attributes":623,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1080:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177070,7 +179076,7 @@ module.exports = function calc(gd, trace) { return cd; }; -},{"../../plots/cartesian/axes":748,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"../scatter/subtypes":1028,"fast-isnumeric":127}],1065:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"../scatter/subtypes":1042,"fast-isnumeric":129}],1081:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177168,15 +179174,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce); } - coerce('hoverinfo', (layout._dataLength === 1) ? 'a+b+c+text' : undefined); - if(traceOut.fill === 'tonext' || traceOut.fill === 'toself') { dfltHoverOn.push('fills'); } coerce('hoveron', dfltHoverOn.join('+') || 'points'); }; -},{"../../lib":709,"../scatter/constants":1013,"../scatter/fillcolor_defaults":1015,"../scatter/line_defaults":1019,"../scatter/line_shape_defaults":1021,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1063}],1066:[function(require,module,exports){ +},{"../../lib":721,"../scatter/constants":1027,"../scatter/fillcolor_defaults":1029,"../scatter/line_defaults":1033,"../scatter/line_shape_defaults":1035,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1079}],1082:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177247,7 +179251,7 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) { return scatterPointData; }; -},{"../../plots/cartesian/axes":748,"../scatter/hover":1017}],1067:[function(require,module,exports){ +},{"../../plots/cartesian/axes":760,"../scatter/hover":1031}],1083:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177280,7 +179284,7 @@ ScatterTernary.meta = { module.exports = ScatterTernary; -},{"../../plots/ternary":819,"../scatter/colorbar":1011,"./attributes":1063,"./calc":1064,"./defaults":1065,"./hover":1066,"./plot":1068,"./select":1069,"./style":1070}],1068:[function(require,module,exports){ +},{"../../plots/ternary":831,"../scatter/colorbar":1025,"./attributes":1079,"./calc":1080,"./defaults":1081,"./hover":1082,"./plot":1084,"./select":1085,"./style":1086}],1084:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177316,11 +179320,11 @@ module.exports = function plot(ternary, moduleCalcData) { scatterPlot(ternary.graphDiv, plotinfo, moduleCalcData); }; -},{"../scatter/plot":1025}],1069:[function(require,module,exports){ -arguments[4][1043][0].apply(exports,arguments) -},{"../scatter/select":1026,"dup":1043}],1070:[function(require,module,exports){ -arguments[4][1044][0].apply(exports,arguments) -},{"../scatter/style":1027,"dup":1044}],1071:[function(require,module,exports){ +},{"../scatter/plot":1039}],1085:[function(require,module,exports){ +arguments[4][1057][0].apply(exports,arguments) +},{"../scatter/select":1040,"dup":1057}],1086:[function(require,module,exports){ +arguments[4][1058][0].apply(exports,arguments) +},{"../scatter/style":1041,"dup":1058}],1087:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177425,7 +179429,6 @@ module.exports = { }, - // Todo this block has a structure of colorscale/attributes.js but with colorscale/color_attributes.js names cauto: colorscaleAttrs.zauto, cmin: colorscaleAttrs.zmin, cmax: colorscaleAttrs.zmax, @@ -177540,7 +179543,7 @@ module.exports = { } }; -},{"../../components/color":590,"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701}],1072:[function(require,module,exports){ +},{"../../components/color":600,"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713}],1088:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177564,7 +179567,7 @@ module.exports = function calc(gd, trace) { } }; -},{"../../components/colorscale/calc":596}],1073:[function(require,module,exports){ +},{"../../components/colorscale/calc":606}],1089:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177616,7 +179619,7 @@ module.exports = function colorbar(gd, cd) { .options(trace.colorbar)(); }; -},{"../../components/colorbar/draw":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],1074:[function(require,module,exports){ +},{"../../components/colorbar/draw":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],1090:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -177995,7 +179998,7 @@ function createSurfaceTrace(scene, data) { module.exports = createSurfaceTrace; -},{"../../lib/str2rgbarray":727,"gl-surface3d":261,"ndarray":460,"ndarray-fill":450,"ndarray-homography":452,"ndarray-ops":454,"tinycolor2":526}],1075:[function(require,module,exports){ +},{"../../lib/str2rgbarray":739,"gl-surface3d":264,"ndarray":463,"ndarray-fill":453,"ndarray-homography":455,"ndarray-ops":457,"tinycolor2":530}],1091:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178116,7 +180119,7 @@ function mapLegacy(traceIn, oldAttr, newAttr) { } } -},{"../../components/colorscale/defaults":599,"../../lib":709,"../../registry":826,"./attributes":1071}],1076:[function(require,module,exports){ +},{"../../components/colorscale/defaults":609,"../../lib":721,"../../registry":838,"./attributes":1087}],1092:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178146,7 +180149,7 @@ Surface.meta = { module.exports = Surface; -},{"../../plots/gl3d":791,"./attributes":1071,"./calc":1072,"./colorbar":1073,"./convert":1074,"./defaults":1075}],1077:[function(require,module,exports){ +},{"../../plots/gl3d":803,"./attributes":1087,"./calc":1088,"./colorbar":1089,"./convert":1090,"./defaults":1091}],1093:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178159,7 +180162,6 @@ module.exports = Surface; var Lib = require('../lib'); var Registry = require('../registry'); -var PlotSchema = require('../plot_api/plot_schema'); var Axes = require('../plots/cartesian/axes'); var COMPARISON_OPS = ['=', '!=', '<', '>=', '>', '<=']; @@ -178237,6 +180239,7 @@ exports.calcTransform = function(gd, trace, opts) { var target = opts.target; var len = targetArray.length; var targetCalendar = opts.targetcalendar; + var arrayAttrs = trace._arrayAttrs; // even if you provide targetcalendar, if target is a string and there // is a calendar attribute matching target it will get used instead. @@ -178247,7 +180250,6 @@ exports.calcTransform = function(gd, trace, opts) { var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray); var filterFunc = getFilterFunc(opts, d2c, targetCalendar); - var arrayAttrs = PlotSchema.findArrayAttributes(trace); var originalArrays = {}; function forAllAttrs(fn, index) { @@ -178395,7 +180397,7 @@ function getFilterFunc(opts, d2c, targetCalendar) { } } -},{"../lib":709,"../plot_api/plot_schema":737,"../plots/cartesian/axes":748,"../registry":826}],1078:[function(require,module,exports){ +},{"../lib":721,"../plots/cartesian/axes":760,"../registry":838}],1094:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178424,10 +180426,19 @@ exports.attributes = { dflt: [], }, - style: { - valType: 'any', - dflt: {}, - + styles: { + _isLinkedToArray: 'style', + target: { + valType: 'string', + + + }, + value: { + valType: 'any', + + dflt: {}, + + }, } }; @@ -178456,11 +180467,22 @@ exports.supplyDefaults = function(transformIn) { if(!enabled) return transformOut; coerce('groups'); - coerce('style'); + + var styleIn = transformIn.styles; + var styleOut = transformOut.styles = []; + + if(styleIn) { + for(var i = 0; i < styleIn.length; i++) { + styleOut[i] = {}; + Lib.coerce(styleIn[i], styleOut[i], exports.attributes.styles, 'target'); + Lib.coerce(styleIn[i], styleOut[i], exports.attributes.styles, 'value'); + } + } return transformOut; }; + /** * Apply transform !!! * @@ -178500,6 +180522,7 @@ function pasteArray(newTrace, trace, j, a) { } function transformOne(trace, state) { + var i; var opts = state.transform; var groups = trace.transforms[state.transformIndex].groups; @@ -178513,9 +180536,13 @@ function transformOne(trace, state) { var arrayAttrs = PlotSchema.findArrayAttributes(trace); - var style = opts.style || {}; + var styles = opts.styles || []; + var styleLookup = {}; + for(i = 0; i < styles.length; i++) { + styleLookup[styles[i].target] = styles[i].value; + } - for(var i = 0; i < groupNames.length; i++) { + for(i = 0; i < groupNames.length; i++) { var groupName = groupNames[i]; var newTrace = newData[i] = Lib.extendDeepNoArrays({}, trace); @@ -178530,15 +180557,15 @@ function transformOne(trace, state) { newTrace.name = groupName; - // there's no need to coerce style[groupName] here + // there's no need to coerce styleLookup[groupName] here // as another round of supplyDefaults is done on the transformed traces - newTrace = Lib.extendDeepNoArrays(newTrace, style[groupName] || {}); + newTrace = Lib.extendDeepNoArrays(newTrace, styleLookup[groupName] || {}); } return newData; } -},{"../lib":709,"../plot_api/plot_schema":737}],1079:[function(require,module,exports){ +},{"../lib":721,"../plot_api/plot_schema":749}],1095:[function(require,module,exports){ /** * Copyright 2012-2017, Plotly, Inc. * All rights reserved. @@ -178550,7 +180577,6 @@ function transformOne(trace, state) { 'use strict'; var Lib = require('../lib'); -var PlotSchema = require('../plot_api/plot_schema'); var Axes = require('../plots/cartesian/axes'); exports.moduleType = 'transform'; @@ -178604,7 +180630,7 @@ exports.calcTransform = function(gd, trace, opts) { var target = opts.target; var len = targetArray.length; - var arrayAttrs = PlotSchema.findArrayAttributes(trace); + var arrayAttrs = trace._arrayAttrs; var d2c = Axes.getDataToCoordFunc(gd, trace, target, targetArray); var indices = getIndices(opts, targetArray, d2c); @@ -178658,5 +180684,5 @@ function getSortFunc(opts, d2c) { } } -},{"../lib":709,"../plot_api/plot_schema":737,"../plots/cartesian/axes":748}]},{},[19])(19) +},{"../lib":721,"../plots/cartesian/axes":760}]},{},[19])(19) }); \ No newline at end of file diff --git a/dist/plotly.min.js b/dist/plotly.min.js index b39f44b211f..bf13f997916 100644 --- a/dist/plotly.min.js +++ b/dist/plotly.min.js @@ -1,77 +1,78 @@ /** -* plotly.js v1.27.1 +* plotly.js v1.28.0 * Copyright 2012-2017, 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||t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))u.rotate(o,0,0,-t*n*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,h*(Math.exp(s)-1))}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":35,"mouse-change":445,"mouse-event-offset":446,"mouse-wheel":448,"right-now":494}],35:[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;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n0&&(e.y+=r),a=e.y+e.dy+p;if((r=a-p-m[1])>0)for(a=e.y-=r,n=o-2;n>=0;--n)e=t[n],r=e.y+e.dy+p-a,r>0&&(e.y-=r),a=e.y})}function i(t,e){return t.y-e.y}var a=r.nest().key(function(t){return t.x}).sortKeys(e.ascending).entries(v).map(function(t){return t.values});!function(){var t=e.min(a,function(t){return(m[1]-(t.length-1)*p)/e.sum(t,h)});a.forEach(function(e){e.forEach(function(e,r){e.y=r,e.dy=e.value*t})}),g.forEach(function(e){e.dy=e.value*t})}(),n();for(var o=1;t>0;--t)!function(t){function r(t){return c(t.target)*t.value}a.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var i=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,h);n.y+=(i-c(n))*t}})})}(o*=.99),n(),function(t){function r(t){return c(t.source)*t.value}a.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var i=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,h);n.y+=(i-c(n))*t}})})}(o),n()}function u(){function t(t,e){return t.source.y-e.source.y||t.originalIndex-e.originalIndex}function e(t,e){return t.target.y-e.target.y||t.originalIndex-e.originalIndex}v.forEach(function(r){r.sourceLinks.sort(e),r.targetLinks.sort(t)}),v.forEach(function(t){var e=0,r=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=r,r+=t.dy})})}function c(t){return t.y+t.dy/2}function h(t){return t.value}var f={},d=24,p=8,m=[1,1],v=[],g=[];return f.nodeWidth=function(t){return arguments.length?(d=+t,f):d},f.nodePadding=function(t){return arguments.length?(p=+t,f):p},f.nodes=function(t){return arguments.length?(v=t,f):v},f.links=function(t){return arguments.length?(g=t,f):g},f.size=function(t){return arguments.length?(m=t,f):m},f.layout=function(e){return t(),i(),a(),l(e),u(),f},f.relayout=function(){return u(),f},f.link=function(){function t(t){var r=t.source.x+t.source.dx,i=t.target.x,a=n.interpolateNumber(r,i),o=a(e),s=a(1-e),l=t.source.y+t.sy,u=l+t.dy,c=t.target.y+t.ty,h=c+t.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+c+" "+i+","+c+"L"+i+","+h+"C"+s+","+h+" "+o+","+u+" "+r+","+u+"Z"}var e=.5;return t.curvature=function(r){return arguments.length?(e=+r,t):e},t},f};t.sankey=i,Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-array":110,"d3-collection":111,"d3-interpolate":115}],37:[function(t,e,r){"use strict";function n(t){var e=s.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=a(t,new Float32Array([-1,-1,-1,4,4,-1]));e=o(t,[{buffer:n,type:t.FLOAT,size:2}]),e._triangleBuffer=n,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,a=t("gl-buffer"),o=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":152,"gl-vao":266,"weak-map":551}],38:[function(t,e,r){function n(t,e,r){e="number"==typeof e?e:1,r=r||": ";var n=t.split(/\r?\n/),a=String(n.length+e-1).length;return n.map(function(t,n){var o=n+e,s=String(o).length;return i(o,a-s)+r+t}).join("\n")}var i=t("pad-left");e.exports=n},{"pad-left":466}],39:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),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}()},{}],43:[function(t,e,r){(function(r){"use strict";function n(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i=0;s--)if(l[s]!==u[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!d(t[o],e[o],r,n))return!1;return!0}function v(t,e,r){d(t,e,!0)&&h(t,e,r,"notDeepStrictEqual",v)}function g(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&e.call({},t)===!0}function y(t){var e;try{t()}catch(t){e=t}return e}function b(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=y(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&h(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!t&&x.isError(i),s=!t&&i&&!r;if((o&&a&&g(i,r)||s)&&h(i,r,"Got unwanted exception"+n),t&&i&&r&&!g(i,r)||!t&&i)throw i}var x=t("util/"),_=Object.prototype.hasOwnProperty,w=Array.prototype.slice,M=function(){return"foo"===function(){}.name}(),k=e.exports=f,A=/\s*function\s+([^\(\s]*)\s*/;k.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=c(this),this.generatedMessage=!0);var e=t.stackStartFunction||h;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=s(e),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},x.inherits(k.AssertionError,Error),k.fail=h,k.ok=f,k.equal=function(t,e,r){t!=e&&h(t,e,r,"==",k.equal)},k.notEqual=function(t,e,r){t==e&&h(t,e,r,"!=",k.notEqual)},k.deepEqual=function(t,e,r){d(t,e,!1)||h(t,e,r,"deepEqual",k.deepEqual)},k.deepStrictEqual=function(t,e,r){d(t,e,!0)||h(t,e,r,"deepStrictEqual",k.deepStrictEqual)},k.notDeepEqual=function(t,e,r){d(t,e,!1)&&h(t,e,r,"notDeepEqual",k.notDeepEqual)},k.notDeepStrictEqual=v,k.strictEqual=function(t,e,r){t!==e&&h(t,e,r,"===",k.strictEqual)},k.notStrictEqual=function(t,e,r){t===e&&h(t,e,r,"!==",k.notStrictEqual)},k.throws=function(t,e,r){b(!0,t,e,r)},k.doesNotThrow=function(t,e,r){b(!1,t,e,r)},k.ifError=function(t){if(t)throw t};var T=Object.keys||function(t){var e=[];for(var r in t)_.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":541}],44:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],45:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.ushln(h):h<0&&(c=c.ushln(-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":48,"./is-rat":50,"./lib/is-bn":54,"./lib/num-to-bn":55,"./lib/rationalize":56,"./lib/str-to-bn":57}],50:[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":54}],51:[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":64}],52:[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 a=0;a20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":63,"double-bits":120}],54:[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":64}],55:[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)).ushln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":64,"double-bits":120}],56:[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":51,"./num-to-bn":55}],57:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":64}],58:[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":56}],59:[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":51}],60:[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":56}],61:[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.abs().divmod(r.abs()),o=n.div,s=i(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,h=i(l.ushln(c).divRound(r));return u*(s+h*Math.pow(2,-c))}var f=r.bitLength()-l.bitLength()+53,h=i(l.ushln(f).divRound(r));return f<1023?u*h*Math.pow(2,-f):(h*=Math.pow(2,-1023),u*h*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":52,"./lib/ctz":53}],62:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],63:[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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return t&=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))<<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))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],64:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(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 s(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 l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,h=67108863&l,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;i=0|t.words[p],a=0|e.words[d],o=i*a+h,c+=o/67108864|0,h=67108863&o}r.words[u]=0|h,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0,i+=o>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}function h(t,e,r){return(new f).mulp(t,e,r)}function f(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function m(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function v(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function g(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),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.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,r=0!==a||o!==this.length-1?_[6-l.length]+l+r:l+r,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=M[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var f=h.modn(c).toString(t);h=h.idivn(c),r=h.isZero()?f+r:_[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,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>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],g=8191&v,y=v>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,k=w>>>13,A=0|o[5],T=8191&A,S=A>>>13,E=0|o[6],L=8191&E,C=E>>>13,z=0|o[7],D=8191&z,I=z>>>13,P=0|o[8],O=8191&P,j=P>>>13,F=0|o[9],R=8191&F,N=F>>>13,B=0|s[0],U=8191&B,V=B>>>13,q=0|s[1],H=8191&q,G=q>>>13,Y=0|s[2],X=8191&Y,W=Y>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,ft=ct>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,U),i=Math.imul(h,V),i=i+Math.imul(f,U)|0,a=Math.imul(f,V);var vt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,U),i=Math.imul(p,V),i=i+Math.imul(m,U)|0,a=Math.imul(m,V),n=n+Math.imul(h,H)|0,i=i+Math.imul(h,G)|0,i=i+Math.imul(f,H)|0,a=a+Math.imul(f,G)|0;var gt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,U),i=Math.imul(g,V),i=i+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,H)|0,i=i+Math.imul(p,G)|0,i=i+Math.imul(m,H)|0,a=a+Math.imul(m,G)|0,n=n+Math.imul(h,X)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(f,X)|0,a=a+Math.imul(f,W)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=Math.imul(x,V),i=i+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(g,H)|0,i=i+Math.imul(g,G)|0,i=i+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,X)|0,i=i+Math.imul(p,W)|0,i=i+Math.imul(m,X)|0,a=a+Math.imul(m,W)|0,n=n+Math.imul(h,J)|0,i=i+Math.imul(h,K)|0,i=i+Math.imul(f,J)|0,a=a+Math.imul(f,K)|0;var bt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=Math.imul(M,V),i=i+Math.imul(k,U)|0,a=Math.imul(k,V),n=n+Math.imul(x,H)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(g,X)|0,i=i+Math.imul(g,W)|0,i=i+Math.imul(y,X)|0,a=a+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=i+Math.imul(p,K)|0,i=i+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(f,$)|0,a=a+Math.imul(f,tt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=Math.imul(T,V),i=i+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(M,H)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(k,H)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(x,X)|0,i=i+Math.imul(x,W)|0,i=i+Math.imul(_,X)|0,a=a+Math.imul(_,W)|0,n=n+Math.imul(g,J)|0,i=i+Math.imul(g,K)|0,i=i+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(f,rt)|0,a=a+Math.imul(f,nt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=Math.imul(L,V),i=i+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(T,H)|0,i=i+Math.imul(T,G)|0,i=i+Math.imul(S,H)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(M,X)|0,i=i+Math.imul(M,W)|0,i=i+Math.imul(k,X)|0,a=a+Math.imul(k,W)|0,n=n+Math.imul(x,J)|0,i=i+Math.imul(x,K)|0,i=i+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(g,$)|0,i=i+Math.imul(g,tt)|0,i=i+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(m,rt)|0,a=a+Math.imul(m,nt)|0,n=n+Math.imul(h,at)|0,i=i+Math.imul(h,ot)|0,i=i+Math.imul(f,at)|0,a=a+Math.imul(f,ot)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(D,U),i=Math.imul(D,V),i=i+Math.imul(I,U)|0,a=Math.imul(I,V),n=n+Math.imul(L,H)|0,i=i+Math.imul(L,G)|0,i=i+Math.imul(C,H)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(T,X)|0,i=i+Math.imul(T,W)|0,i=i+Math.imul(S,X)|0,a=a+Math.imul(S,W)|0,n=n+Math.imul(M,J)|0,i=i+Math.imul(M,K)|0,i=i+Math.imul(k,J)|0,a=a+Math.imul(k,K)|0,n=n+Math.imul(x,$)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(g,rt)|0,i=i+Math.imul(g,nt)|0,i=i+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0,n=n+Math.imul(h,lt)|0,i=i+Math.imul(h,ut)|0,i=i+Math.imul(f,lt)|0,a=a+Math.imul(f,ut)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,U),i=Math.imul(O,V),i=i+Math.imul(j,U)|0,a=Math.imul(j,V),n=n+Math.imul(D,H)|0,i=i+Math.imul(D,G)|0,i=i+Math.imul(I,H)|0,a=a+Math.imul(I,G)|0,n=n+Math.imul(L,X)|0,i=i+Math.imul(L,W)|0,i=i+Math.imul(C,X)|0,a=a+Math.imul(C,W)|0,n=n+Math.imul(T,J)|0,i=i+Math.imul(T,K)|0,i=i+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(M,$)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(g,at)|0,i=i+Math.imul(g,ot)|0,i=i+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(m,lt)|0,a=a+Math.imul(m,ut)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,ft)|0,i=i+Math.imul(f,ht)|0,a=a+Math.imul(f,ft)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(R,U),i=Math.imul(R,V),i=i+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(O,H)|0,i=i+Math.imul(O,G)|0,i=i+Math.imul(j,H)|0,a=a+Math.imul(j,G)|0,n=n+Math.imul(D,X)|0,i=i+Math.imul(D,W)|0,i=i+Math.imul(I,X)|0,a=a+Math.imul(I,W)|0,n=n+Math.imul(L,J)|0,i=i+Math.imul(L,K)|0,i=i+Math.imul(C,J)|0,a=a+Math.imul(C,K)|0,n=n+Math.imul(T,$)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(S,$)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(k,rt)|0,a=a+Math.imul(k,nt)|0,n=n+Math.imul(x,at)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(g,lt)|0,i=i+Math.imul(g,ut)|0,i=i+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,ft)|0,i=i+Math.imul(m,ht)|0,a=a+Math.imul(m,ft)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,mt)|0,i=i+Math.imul(f,pt)|0,a=a+Math.imul(f,mt)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(R,H),i=Math.imul(R,G),i=i+Math.imul(N,H)|0,a=Math.imul(N,G),n=n+Math.imul(O,X)|0,i=i+Math.imul(O,W)|0,i=i+Math.imul(j,X)|0,a=a+Math.imul(j,W)|0,n=n+Math.imul(D,J)|0,i=i+Math.imul(D,K)|0,i=i+Math.imul(I,J)|0,a=a+Math.imul(I,K)|0,n=n+Math.imul(L,$)|0,i=i+Math.imul(L,tt)|0,i=i+Math.imul(C,$)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(M,at)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(g,ht)|0,i=i+Math.imul(g,ft)|0,i=i+Math.imul(y,ht)|0,a=a+Math.imul(y,ft)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,mt)|0,i=i+Math.imul(m,pt)|0,a=a+Math.imul(m,mt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(R,X),i=Math.imul(R,W),i=i+Math.imul(N,X)|0,a=Math.imul(N,W),n=n+Math.imul(O,J)|0,i=i+Math.imul(O,K)|0,i=i+Math.imul(j,J)|0,a=a+Math.imul(j,K)|0,n=n+Math.imul(D,$)|0,i=i+Math.imul(D,tt)|0,i=i+Math.imul(I,$)|0,a=a+Math.imul(I,tt)|0,n=n+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,i=i+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(T,at)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(k,lt)|0,a=a+Math.imul(k,ut)|0,n=n+Math.imul(x,ht)|0,i=i+Math.imul(x,ft)|0,i=i+Math.imul(_,ht)|0,a=a+Math.imul(_,ft)|0,n=n+Math.imul(g,pt)|0,i=i+Math.imul(g,mt)|0,i=i+Math.imul(y,pt)|0,a=a+Math.imul(y,mt)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(R,J),i=Math.imul(R,K),i=i+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(O,$)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(j,$)|0,a=a+Math.imul(j,tt)|0,n=n+Math.imul(D,rt)|0,i=i+Math.imul(D,nt)|0,i=i+Math.imul(I,rt)|0,a=a+Math.imul(I,nt)|0,n=n+Math.imul(L,at)|0,i=i+Math.imul(L,ot)|0,i=i+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(M,ht)|0,i=i+Math.imul(M,ft)|0,i=i+Math.imul(k,ht)|0,a=a+Math.imul(k,ft)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,mt)|0,i=i+Math.imul(_,pt)|0,a=a+Math.imul(_,mt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(R,$),i=Math.imul(R,tt),i=i+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(j,rt)|0,a=a+Math.imul(j,nt)|0,n=n+Math.imul(D,at)|0,i=i+Math.imul(D,ot)|0,i=i+Math.imul(I,at)|0,a=a+Math.imul(I,ot)|0,n=n+Math.imul(L,lt)|0,i=i+Math.imul(L,ut)|0,i=i+Math.imul(C,lt)|0,a=a+Math.imul(C,ut)|0,n=n+Math.imul(T,ht)|0,i=i+Math.imul(T,ft)|0,i=i+Math.imul(S,ht)|0,a=a+Math.imul(S,ft)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,mt)|0,i=i+Math.imul(k,pt)|0,a=a+Math.imul(k,mt)|0;var Lt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(R,rt),i=Math.imul(R,nt),i=i+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(O,at)|0,i=i+Math.imul(O,ot)|0,i=i+Math.imul(j,at)|0,a=a+Math.imul(j,ot)|0,n=n+Math.imul(D,lt)|0,i=i+Math.imul(D,ut)|0,i=i+Math.imul(I,lt)|0,a=a+Math.imul(I,ut)|0,n=n+Math.imul(L,ht)|0,i=i+Math.imul(L,ft)|0,i=i+Math.imul(C,ht)|0,a=a+Math.imul(C,ft)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,mt)|0,i=i+Math.imul(S,pt)|0,a=a+Math.imul(S,mt)|0;var Ct=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(R,at),i=Math.imul(R,ot),i=i+Math.imul(N,at)|0,a=Math.imul(N,ot),n=n+Math.imul(O,lt)|0,i=i+Math.imul(O,ut)|0,i=i+Math.imul(j,lt)|0,a=a+Math.imul(j,ut)|0,n=n+Math.imul(D,ht)|0,i=i+Math.imul(D,ft)|0,i=i+Math.imul(I,ht)|0,a=a+Math.imul(I,ft)|0,n=n+Math.imul(L,pt)|0,i=i+Math.imul(L,mt)|0,i=i+Math.imul(C,pt)|0,a=a+Math.imul(C,mt)|0;var zt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(R,lt),i=Math.imul(R,ut),i=i+Math.imul(N,lt)|0,a=Math.imul(N,ut),n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,ft)|0,i=i+Math.imul(j,ht)|0,a=a+Math.imul(j,ft)|0,n=n+Math.imul(D,pt)|0,i=i+Math.imul(D,mt)|0,i=i+Math.imul(I,pt)|0,a=a+Math.imul(I,mt)|0;var Dt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(R,ht),i=Math.imul(R,ft),i=i+Math.imul(N,ht)|0,a=Math.imul(N,ft), -n=n+Math.imul(O,pt)|0,i=i+Math.imul(O,mt)|0,i=i+Math.imul(j,pt)|0,a=a+Math.imul(j,mt)|0;var It=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(R,pt),i=Math.imul(R,mt),i=i+Math.imul(N,pt)|0,a=Math.imul(N,mt);var Pt=(u+n|0)+((8191&i)<<13)|0;return u=(a+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l[0]=vt,l[1]=gt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=kt,l[9]=At,l[10]=Tt,l[11]=St,l[12]=Et,l[13]=Lt,l[14]=Ct,l[15]=zt,l[16]=Dt,l[17]=It,l[18]=Pt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(k=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?k(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):h(this,t,e)},f.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},f.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=l(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);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)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var h=0|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()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(s===-1),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){s=new a(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;h--){var f=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=f)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(h)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var f;return f=0===e.cmpn(1)?i:o,f.cmpn(0)<0&&f.iadd(t),f},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return this.cmpn(t)===-1},a.prototype.lt=function(t){return this.cmp(t)===-1},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new y(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var A={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},i(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(A[t])return A[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new m;else if("p192"===t)e=new v;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new g}return A[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var m=d,v=0;0!==m.cmp(s);v++)m=m.redSqr();n(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new b(t)},i(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],65:[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))>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),m=h.mallocInt32(o);o=i(e,s,p,m),o>0&&(f.init(a+o),l=1===s?f.sweepBipartite(s,r,0,a,u,c,0,o,p,m):d(s,r,n,a,u,c,o,p,m),h.free(p),h.free(m))}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":68,"./lib/sweep":72,"typedarray-pool":533}],67:[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="+m+","+b+"="+u+"*"+m+";j<"+v+";++j,"+b+"+="+u+"){var y0="+g+"["+o+"+"+b+"],"+(r?"y1="+g+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+v+"-"+m+"){"),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("");return new Function(s)()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",m="bs",v="be",g="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,h,f,d,m,v,g,y];r.partial=i(!1),r.full=i(!0)},{}],68:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(A*r);S.length0;){z-=1;var I=z*A,P=S[I],O=S[I+1],j=S[I+2],F=S[I+3],R=S[I+4],N=S[I+5],B=z*T,U=E[B],V=E[B+1],q=1&N,H=!!(16&N),G=l,Y=u,X=m,W=L;if(q&&(G=m,Y=L,X=l,W=u),!(2&N&&(j=_(t,P,O,j,G,Y,V),O>=j)||4&N&&(O=w(t,P,O,j,G,Y,U))>=j)){var Z=j-O,J=R-F;if(H){if(t*Z*(Z+J)=p0)&&!(p1>=hi)",["p0","p1"]),x=m("lo===p0",["p0"]),_=m("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=b?(d=y,p=b):g>=_?(d=v,p=g):(d=x,p=_):b>=_?(d=y,p=b):_>=g?(d=v,p=g):(d=x,p=_);for(var w=f*(c-1),M=f*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"},{}],71:[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,v=m-n,g=m+n,y=d,b=v,x=m,_=g,w=p,M=t+1,k=e-1,A=0;u(y,b,r)&&(A=y,y=b,b=A),u(_,w,r)&&(A=_,_=w,w=A),u(y,x,r)&&(A=y,y=x,x=A),u(b,x,r)&&(A=b,b=x,x=A),u(y,_,r)&&(A=y,y=_,_=A),u(x,_,r)&&(A=x,x=_,_=A),u(b,w,r)&&(A=b,b=w,w=A),u(b,x,r)&&(A=b,b=x,x=A),u(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*b],S=r[2*b+1],E=r[2*_],L=r[2*_+1],C=2*y,z=2*x,D=2*w,I=2*d,P=2*m,O=2*p,j=0;j<2;++j){var F=r[C+j],R=r[z+j],N=r[D+j];r[I+j]=F,r[P+j]=R,r[O+j]=N}o(v,t,r),o(g,e,r);for(var B=M;B<=k;++B)if(c(B,T,S,r))B!==M&&a(B,M,r),++M;else if(!c(B,E,L,r))for(;;){if(c(k,E,L,r)){c(k,T,S,r)?(s(B,M,k,r),++M,--k):(a(B,k,r),--k);break}if(--k>>1;f(x,S);for(var E=0,L=0,M=0;M=d)C=C-d|0,i(v,g,L--,C);else if(C>=0)i(p,m,E--,C);else if(C<=-d){C=-C-d|0;for(var z=0;z>>1;f(x,E);for(var L=0,C=0,z=0,k=0;k>1==x[2*k+3]>>1&&(I=2,k+=1),D<0){for(var P=-(D>>1)-1,O=0;O>1)-1;0===I?i(p,m,L--,P):1===I?i(v,g,C--,P):2===I&&i(y,b,z--,P)}}}function l(t,e,r,n,o,s,l,u,c,h,v,g){var y=0,b=2*t,_=e,w=e+t,M=1,k=1;n?k=d:M=d;for(var A=o;A>>1;f(x,L);for(var C=0,A=0;A=d?(D=!n,T-=d):(D=!!n,T-=1),D)a(p,m,C++,T);else{var I=g[T],P=b*T,O=v[P+e+1],j=v[P+e+1+t];t:for(var F=0;F>>1;f(x,M);for(var k=0,y=0;y=d)p[k++]=b-d;else{b-=1;var T=c[b],S=m*b,E=u[S+e+1],L=u[S+e+1+t];t:for(var C=0;C=0;--C)if(p[C]===b){for(var P=C+1;PZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?h(t,e,r):"string"==typeof t?u(t,e):f(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(t,e),a=n(r),o=a.write(t,e);return o!==r&&(a=a.slice(0,o)),a}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),i=0;i=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),i.alloc(+t)}function m(t,e){if(i.isBuffer(t))return t.length;if(G(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 B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function v(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 z(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function b(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&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}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)>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)>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)>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 E(n)}function E(t){var e=t.length;if(e<=J)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 P(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function O(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 e=+e,r>>>=0,i||O(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function F(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function R(t){if(t=t.trim().replace(K,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function N(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(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=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function q(t){return X.toByteArray(R(t))}function H(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function Y(t){return t!==t}var X=t("base64-js"),W=t("ieee754");r.Buffer=i,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return l(t)},i.allocUnsafeSlow=function(t){return l(t)},i.isBuffer=function(t){return null!=t&&t._isBuffer===!0},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,a){if(!i.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===a&&(a=this.length),e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||I(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.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},i.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},i.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),W.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),W.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),W.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),W.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){P(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){P(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(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},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return F(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return F(this,t,e,!1,r)},i.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)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)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;al?l:o+16383));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":80,"robust-in-sphere":498}],77:[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 m=f[3*d+p];m>=0&&0===u[m]&&(h[3*d+p]?l.push(m):(s.push(m),u[m]=i))}}}var v=l;l=s,s=v,l.length=0,i=-i}var g=o(c,u,e);return r?g.concat(n.boundary):g}var l=t("binary-search-bounds");e.exports=s,n.prototype.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]g[0]&&l.push(new i(g,d,v,h),new i(d,g,m,h))}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=[],h=0,_=l.length;h<_;++h){var w=l[h],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===v?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,m=1,v=2;e.exports=h},{"binary-search-bounds":80,"robust-orientation":500}],79:[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){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],81:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],85:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var m=e[o],v=m[0],g=m[1],y=t[v],M=t[g];if((y[0]-M[0]||y[1]-M[1])<0){var A=v;v=g,g=A}m[0]=v;var T,S=m[1]=p[1];for(i&&(T=m[2]);a>0&&n[a-1][0]===o;){var p=n[--a],E=p[1];i?e.push([S,E,T]):e.push([S,E]),S=E}i?e.push([S,g,T]):e.push([S,g])}return s}function u(t,e,r){for(var i=e.length,a=new v(i),o=[],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 m(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":89,"is-plain-obj":290}],91:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":93}],93:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],94:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],95:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,h,f,d,p,m,v,g,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!l[f])throw Error(f+" not a supported colorscale");h=s(l[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=s(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(v=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:s(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),v[0]<0&&(v[0]=0),v[1]<0&&(v[0]=0),v[0]>1&&(v[0]=1),v[1]>1&&(v[0]=1),y=0;y=0&&r[3]<=1||(r[3]=v[0]+(v[1]-v[0])*g);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);return c===n(t,e,i)?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);return h>0?s>0&&a(t,e,i)>0?1:-1:h<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":500,"robust-product":501,"robust-sum":505,signum:507,"two-sum":532}],97:[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],m=e[1],v=e[2],g=e[3];return c+h+f+d-(p+m+v+g)||a(c,h,f,d)-a(p,m,v,g,p)||a(c+h,c+f,c+d,h+f,h+d,f+d)-a(p+m,p+v,p+g,m+v,m+g,v+g)||a(c+h+f,c+h+d,c+f+d,h+f+d)-a(p+m+v,p+m+g,p+v+g,m+v+g);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},{}],101:[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":39,"incremental-convex-hull":284}],103:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],104:[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]),m=o(h[2]),v=m<=.5?m*(p+1):m+p-m*p,g=2*m-v;return[n(255*s(g,v,d+1/3)),n(255*s(g,v,d)),n(255*s(g,v,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){}},{}],105:[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},{}],106:[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":108}],107:[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&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),S=a(v);S3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var E=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",S,s(c)].join("");return new Function(["function ",E,"(",b.join(","),"){",x.join("\n"),"} return ",E].join(""))()}var u=t("uniq");e.exports=l},{uniq:535}],108:[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;c=0?(a>=k?10:a>=A?5:a>=T?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=k?10:a>=A?5:a>=T?2:1)}function i(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=k?i*=10:a>=A?i*=5:a>=T&&(i*=2),ee?1:t>=e?0:0/0},s=function(t){return 1===t.length&&(t=e(t)),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},l=s(o),u=l.right,c=l.left,h=function(t,e){null==e&&(e=r);for(var n=0,i=t.length-1,a=t[0],o=new Array(i<0?0:i);nt?1:e>=t?0:0/0},p=function(t){return null===t?0/0:+t},m=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o1)return l/(a-1)},v=function(t,e){var r=m(t,e);return r?Math.sqrt(r):r},g=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++lf;)d.pop(),--p;var m,v=new Array(p+1);for(a=0;a<=p;++a)m=v[a]=[],m.x0=a>0?d[a-1]:h,m.x1=a=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},z=function(t,e,r){return t=x.call(t,p).sort(o),Math.ceil((r-e)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))},D=function(t,e,r){return Math.ceil((r-e)/(3.5*v(t)*Math.pow(t.length,-1/3)))},I=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},P=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r},F=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},R=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},N=function(t,e){if(r=t.length){var r,n,i=0,a=0,s=t[a];for(null==e&&(e=o);++i=c.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,u,h,f=-1,d=e.length,p=c[n++],m=r(),v=i();++fc.length)return t;var n,i=h[r-1];return null!=l&&r>=c.length?n=t.entries():(n=[],t.each(function(t,i){n.push({key:i,values:e(t,r)})})),null!=i?n.sort(function(t,e){return i(t.key,e.key)}):n}var s,l,u,c=[],h=[];return u={object:function(e){return t(e,0,n,i)},map:function(e){return t(e,0,a,o)},entries:function(r){return e(t(r,0,a,o),0)},key:function(t){return c.push(t),u},sortKeys:function(t){return h[c.length-1]=t,u},sortValues:function(t){return s=t,u},rollup:function(t){return l=t,u}}},c=r.prototype;s.prototype=l.prototype={constructor:s,has:c.has,add:function(t){return t+="",this["$"+t]=t,this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};var h=function(t){var e=[];for(var r in t)e.push(r);return e},f=function(t){var e=[];for(var r in t)e.push(t[r]);return e},d=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e};t.nest=u,t.set=l,t.map=r,t.keys=h,t.values=f,t.entries=d,Object.defineProperty(t,"__esModule",{value:!0})})},{}],112:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function r(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=z.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=D.exec(t))?i(parseInt(e[1],16)):(e=I.exec(t))?new l(e[1],e[2],e[3],1):(e=P.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=O.exec(t))?a(e[1],e[2],e[3],e[4]):(e=j.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=F.exec(t))?u(e[1],e[2]/100,e[3]/100,1):(e=R.exec(t))?u(e[1],e[2]/100,e[3]/100,e[4]):N.hasOwnProperty(t)?i(N[t]):"transparent"===t?new l(0/0,0/0,0/0,0):null}function i(t){return new l(t>>16&255,t>>8&255,255&t,1)}function a(t,e,r,n){return n<=0&&(t=e=r=0/0),new l(t,e,r,n)}function o(t){return t instanceof r||(t=n(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function s(t,e,r,n){return 1===arguments.length?o(t):new l(t,e,r,null==n?1:n)}function l(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function u(t,e,r,n){return n<=0?t=e=r=0/0:r<=0||r>=1?t=e=0/0:e<=0&&(t=0/0),new f(t,e,r,n)}function c(t){if(t instanceof f)return new f(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new f;if(t instanceof f)return t;t=t.rgb();var e=t.r/255,i=t.g/255,a=t.b/255,o=Math.min(e,i,a),s=Math.max(e,i,a),l=0/0,u=s-o,c=(s+o)/2;return u?(l=e===s?(i-a)/u+6*(i0&&c<1?0:l,new f(l,u,c,t.opacity)}function h(t,e,r,n){return 1===arguments.length?c(t):new f(t,e,r,null==n?1:n)}function f(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function d(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function p(t){if(t instanceof v)return new v(t.l,t.a,t.b,t.opacity);if(t instanceof M){var e=t.h*B;return new v(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var r=x(t.r),n=x(t.g),i=x(t.b),a=g((.4124564*r+.3575761*n+.1804375*i)/V),s=g((.2126729*r+.7151522*n+.072175*i)/q);return new v(116*s-16,500*(a-s),200*(s-g((.0193339*r+.119192*n+.9503041*i)/H)),t.opacity)}function m(t,e,r,n){return 1===arguments.length?p(t):new v(t,e,r,null==n?1:n)}function v(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function g(t){return t>W?Math.pow(t,1/3):t/X+G}function y(t){return t>Y?t*t*t:X*(t-G)}function b(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _(t){if(t instanceof M)return new M(t.h,t.c,t.l,t.opacity);t instanceof v||(t=p(t));var e=Math.atan2(t.b,t.a)*U;return new M(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function w(t,e,r,n){return 1===arguments.length?_(t):new M(t,e,r,null==n?1:n)}function M(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function k(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(rt*n+tt*e-et*r)/(rt+tt-et),a=n-i,s=($*(r-i)-K*a)/Q,u=Math.sqrt(s*s+a*a)/($*i*(1-i)),c=u?Math.atan2(s,a)*U-120:0/0;return new T(c<0?c+360:c,u,i,t.opacity)}function A(t,e,r,n){return 1===arguments.length?k(t):new T(t,e,r,null==n?1:n)}function T(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}var S=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t},E="\\s*([+-]?\\d+)\\s*",L="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",C="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",z=/^#([0-9a-f]{3})$/,D=/^#([0-9a-f]{6})$/,I=new RegExp("^rgb\\("+[E,E,E]+"\\)$"),P=new RegExp("^rgb\\("+[C,C,C]+"\\)$"),O=new RegExp("^rgba\\("+[E,E,E,L]+"\\)$"),j=new RegExp("^rgba\\("+[C,C,C,L]+"\\)$"),F=new RegExp("^hsl\\("+[L,C,C]+"\\)$"),R=new RegExp("^hsla\\("+[L,C,C,L]+"\\)$"),N={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};S(r,n,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),S(l,s,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),S(f,h,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new f(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new f(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new l(d(t>=240?t-240:t+120,i,n),d(t,i,n),d(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var B=Math.PI/180,U=180/Math.PI,V=.95047,q=1,H=1.08883,G=4/29,Y=6/29,X=3*Y*Y,W=Y*Y*Y;S(v,m,e(r,{brighter:function(t){return new v(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new v(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=q*y(t),e=V*y(e),r=H*y(r),new l(b(3.2404542*e-1.5371385*t-.4985314*r),b(-.969266*e+1.8760108*t+.041556*r),b(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),S(M,w,e(r,{brighter:function(t){return new M(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new M(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return p(this).rgb()}}));var Z=-.14861,J=1.78277,K=-.29227,Q=-.90649,$=1.97294,tt=$*Q,et=$*J,rt=J*K-Q*Z;S(T,A,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new T(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new T(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*B,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new l(255*(e+r*(Z*n+J*i)),255*(e+r*(K*n+Q*i)),255*(e+r*($*n)),this.opacity)}})),t.color=n,t.rgb=s,t.hsl=h,t.lab=m,t.hcl=w,t.cubehelix=A,Object.defineProperty(t,"__esModule",{value:!0})})},{}],113:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){for(var t,e=0,n=arguments.length,i={};e=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}function i(t,e){for(var r,n=0,i=t.length;n0)for(var r,n,i=new Array(r),a=0;af+s||np+s||ih.index){var l=f-a.x-a.vx,c=p-a.y-a.vy,g=l*l+c*c;gt.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e1?(null==e?p.remove(t):p.set(t,s(e)),l):p.get(t)},find:function(e,r,n){var i,a,o,s,l,u=0,c=t.length;for(null==n?n=1/0:n*=n,u=0;u1?(y.on(t,e),l):y.on(t)}}},b=function(){function t(t){var r,l=a.length,h=e.quadtree(a,u,c).visitAfter(n);for(s=t,r=0;r=m)){(t.data!==o||t.next)&&(0===i&&(i=d(),c+=i*i),0===a&&(a=d(),c+=a*a),c180||r<-180?r-360*Math.round(r/360):r):S(isNaN(t)?e:t)}function o(t){return 1==(t=+t)?s:function(e,r){return r-e?i(e,r,t):S(isNaN(e)?r:e)}}function s(t,e){var r=e-t;return r?n(t,r):S(isNaN(t)?e:t)}function l(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;n180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:I(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}function s(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:I(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}function l(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:I(t,r)},{i:s-2,x:I(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}return function(e,r){var n=[],i=[];return e=t(e),r=t(r),a(e.translateX,e.translateY,r.translateX,r.translateY,n,i),o(e.rotate,r.rotate,n,i),s(e.skewX,r.skewX,n,i),l(e.scaleX,e.scaleY,r.scaleX,r.scaleY,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=ia&&(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:I(r,n)})),a=j.lastIndex;return a=(a=(m+g)/2))?m=a:g=a,(c=r>=(o=(v+y)/2))?v=o:y=o,i=d,!(d=d[h=c<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&r===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(a=(m+g)/2))?m=a:g=a,(c=r>=(o=(v+y)/2))?v=o:y=o}while((h=c<<1|u)==(f=(l>=o)<<1|s>=a));return i[f]=d,i[h]=p,t}function r(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),u=1/0,c=1/0,h=-1/0,f=-1/0;for(n=0;nh&&(h=i),af&&(f=a));for(ht||t>i||n>e||e>a))return this;var o,s,l=i-r,u=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,a=n+l,t>i||e>a);break;case 1:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,a=n+l,r>t||e>a);break;case 2:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,n=a-l,t>i||n>e);break;case 3:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,n=a-l,r>t||n>e)}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},h=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},f=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},d=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},p=function(t,e,r){var n,i,a,o,s,l,u,c=this._x0,h=this._y0,f=this._x1,p=this._y1,m=[],v=this._root;for(v&&m.push(new d(v,c,h,f,p)),null==r?r=1/0:(c=t-r,h=e-r,f=t+r,p=e+r,r*=r);l=m.pop();)if(!(!(v=l.node)||(i=l.x0)>f||(a=l.y0)>p||(o=l.x1)=y)<<1|t>=g)&&(l=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=l)}else{var b=t-+this._x.call(null,v.data),x=e-+this._y.call(null,v.data),_=b*b+x*x;if(_=(s=(p+v)/2))?p=s:v=s,(c=o>=(l=(m+g)/2))?m=l:g=l,e=d,!(d=d[h=c<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[f]=d:this._root=d),this):(this._root=i,this)},v=function(){return this._root},g=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},y=function(t){var e,r,n,i,a,o,s=[],l=this._root;for(l&&s.push(new d(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,i=e.y0,a=e.x1,o=e.y1)&&l.length){var u=(n+a)/2,c=(i+o)/2;(r=l[3])&&s.push(new d(r,u,c,a,o)),(r=l[2])&&s.push(new d(r,n,c,u,o)),(r=l[1])&&s.push(new d(r,u,i,a,c)),(r=l[0])&&s.push(new d(r,n,i,u,c))}return this},b=function(t){var e,r=[],n=[];for(this._root&&r.push(new d(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var i=e.node;if(i.length){var a,o=e.x0,s=e.y0,l=e.x1,u=e.y1,c=(o+l)/2,h=(s+u)/2;(a=i[0])&&r.push(new d(a,o,s,c,h)),(a=i[1])&&r.push(new d(a,c,s,l,h)),(a=i[2])&&r.push(new d(a,o,h,c,u)),(a=i[3])&&r.push(new d(a,c,h,l,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},x=function(t){return arguments.length?(this._x=t,this):this._x},_=function(t){return arguments.length?(this._y=t,this):this._y},w=o.prototype=s.prototype;w.copy=function(){var t,e,r=new s(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=l(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=l(e));return r},w.add=u,w.addAll=r,w.cover=c,w.data=h,w.extent=f,w.find=p,w.remove=m,w.removeAll=n,w.root=v,w.size=g,w.visit=y,w.visitAfter=b,w.x=x,w.y=_,t.quadtree=o,Object.defineProperty(t,"__esModule",{value:!0})})},{}],117:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){return g||(x(r),g=b.now()+y)}function r(){g=0}function n(){this._call=this._time=this._next=null}function i(t,e,r){var i=new n;return i.restart(t,e,r),i}function a(){e(),++f;for(var t,r=c;r;)(t=g-r._time)>=0&&r._call.call(null,t),r=r._next;--f}function o(){g=(v=b.now())+y,f=d=0;try{a()}finally{f=0,l(),g=0}}function s(){var t=b.now(),e=t-v;e>m&&(y-=e,v=t)}function l(){for(var t,e,r=c,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:c=e);h=t,u(n)}function u(t){if(!f){d&&(d=clearTimeout(d));var e=t-g;e>24?(t<1/0&&(d=setTimeout(o,e)),p&&(p=clearInterval(p))):(p||(v=g,p=setInterval(s,m)),f=1,x(o))}}var c,h,f=0,d=0,p=0,m=1e3,v=0,g=0,y=0,b="object"==typeof performance&&performance.now?performance:Date,x="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};n.prototype=i.prototype={constructor:n,restart:function(t,r,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?e():+n)+(null==r?0:+r),this._next||h===this||(h?h._next=this:c=this,h=this),this._call=t,this._time=n,u()},stop:function(){this._call&&(this._call=null,this._time=1/0,u())}};var _=function(t,e,r){var i=new n;return e=null==e?0:+e,i.restart(function(r){i.stop(),t(r+e)},e,r),i},w=function(t,r,i){var a=new n,o=r;return null==r?(a.restart(t,r,i),a):(r=+r,i=null==i?e():+i,a.restart(function e(n){n+=o,a.restart(e,o+=r,i),t(n)},r,i),a)};t.now=e,t.timer=i,t.timerFlush=a,t.timeout=_,t.interval=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],118:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return te?1:t>=e?0:0/0}function a(t){return null===t?0/0:+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 m(t){return(t=f(t))in this._&&delete this._[t]}function v(){var t=[];for(var e in this._)t.push(d(e));return t}function g(){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=Mo.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=J),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 J(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==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 Q(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(jo<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();jo=!(o.f||o.e),r.remove()}}return jo?(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 $(){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,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 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?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 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):At((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)*Qo,n=vt(n)*$o,a=vt(a)*ts,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 mt(t,e,r){return t>0?new ht(Math.atan2(r,e)*Ho,Math.sqrt(e*e+r*r),t):new ht(0/0,0/0,t)}function vt(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function gt(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):Mt(""+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 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(St(i[0]),St(i[1]),St(i[2]))}return(a=ns.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 At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=gt((.4124564*t+.3575761*e+.1804375*r)/Qo),i=gt((.2126729*t+.7151522*e+.072175*r)/$o);return dt(116*i-16,500*(n-i),200*(i-gt((.0193339*t+.119192*e+.9503041*r)/ts)))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function St(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Et(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),Ct(e,r,t,n)}}function Ct(t,e,r,n){function i(){var t,e=l.status;if(!e&&Dt(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(zt(n))}function zt(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 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 as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Pt)),a}function Pt(){var t=Ot(),e=jt()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Pt,e)),os=0):(os=1,ls(Pt))}function Ot(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function jt(){for(var t,e=is,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)}:x;return function(t){var r=cs.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,m="",v="",g=!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,v="%",d="f";break;case"p":p=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":g=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],v=i[1]),"r"!=d||f||(d="g"),null!=f&&("g"==d?f=Math.max(1,Math.min(21,f)):"e"!=d&&"f"!=d||(f=Math.max(0,Math.min(20,f)))),d=hs.get(d)||Bt;var b=u&&h;return function(t){var r=v;if(g&&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+v}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=a(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),A=k"===o?A+i+t:"^"===o?A.substring(0,k>>=1)+i+t+A.substring(k):i+(b?t:A+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(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=L[o in ms?e.charAt(s++):o])||(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){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=S.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=A.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,E.c.toString(),e,n)}function l(t,e,n){return r(t,E.x.toString(),e,n)}function u(t,e,n){return r(t,E.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 h=t.dateTime,f=t.date,d=t.time,p=t.periods,m=t.days,v=t.shortDays,g=t.months,y=t.shortMonths;e.utc=function(t){function r(t){try{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Yt(m),_=Xt(m),w=Yt(v),M=Xt(v),k=Yt(g),A=Xt(g),T=Yt(y),S=Xt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var E={a:function(t){return v[t.getDay()]},A:function(t){return m[t.getDay()]},b:function(t){return y[t.getMonth()]},B:function(t){return g[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+fs.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(fs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(fs.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:Jt,x:l,X:u,y:Qt,Y:Kt,Z:$t,"%":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){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){vs.lastIndex=0;var n=vs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){vs.lastIndex=0;var n=vs.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){gs.lastIndex=0;var n=gs.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);Ms.add(Math.atan2(f,h)),n=t,i=l,a=u}var e,r,n,i,a;ks.point=function(o,s){ks.point=t,n=(e=o)*qo,i=Math.cos(s=(r=s)*qo/2+No/4),a=Math.sin(s)},ks.lineEnd=function(){t(e,r)}}function ge(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 Me(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((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 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(je))}var d,p,m,v=e(a),g=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(g,p);d.length?(_||(a.polygonStart(),_=!0),De(d,Re,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=Fe(),x=e(b),_=!1;return y}}function je(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 Re(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=0/0,n=0/0,i=0/0;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?No:-No,l=xo(a-r);xo(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&&(xo(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(xo(t[0]-e[0])>Fo){var a=t[0]=0?1:-1,M=w*_,k=M>No,A=p*b;if(Ms.add(Math.atan2(A*w*Math.sin(M),m*x+A*Math.cos(M))),a+=k?_+w*Bo:_,k^f>=r^g>=r){var T=be(ge(h),ge(t));we(T);var S=be(i,T);we(S);var E=(k^_>=0?-1:1)*nt(S[2]);(n>E||n===E&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!v++)break;f=g,p=b,m=x,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],m=e(h,f),v=o?m?0:i(h,f):m?i(h+(h<0?No:-No),f):0;if(!r&&(u=l=m)&&t.lineStart(),m!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Fo,p[1]+=Fo,m=e(p[0],p[1]))),m!==l)c=0,m?(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^m){var g;v&a||!(g=n(p,r,!0))||(c=0,o?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!m||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=m,a=v},lineEnd:function(){l&&t.lineEnd(),r=null},clean:function(){return c|(u&&l)<<1}}}function n(t,e,r){var n=ge(t),i=ge(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 h=a*l/c,f=-a*u/c,d=be(o,s),p=_e(o,h);xe(p,_e(s,f));var m=d,v=ye(p,m),g=ye(m,m),y=v*v-g*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(m,(-v-b)/g);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],k=t[1],A=e[1];M0^x[1]<(xo(x[0]-w)No^(w<=x[0]&&x[0]<=M)){var L=_e(m,(-v+b)/g);return xe(L,p),[x,Me(L)]}}}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=xo(a)>Fo;return Oe(e,r,vr(t,6*qo),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,m=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/=m,m<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=n-u,m||!(a<0)){if(a/=m,m<0){if(a>d)return;a>f&&(f=a)}else if(m>0){if(a0&&(i.a={x:l+f*p,y:u+f*m}),d<1&&(i.b={x:l+d*p,y:u+d*m}),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,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,v&&v.push(g=[]),k=!0,M=!1,_=w=0/0}function d(){m&&(p(y,b),x&&M&&S.rejoin(),m.push(S.buffer())),L.point=h,M&&s.lineEnd()}function p(t,e){t=Math.max(-Rs,Math.min(Rs,t)),e=Math.max(-Rs,Math.min(Rs,e));var r=c(t,e);if(v&&g.push([t,e]),k)y=t,b=e,x=r,k=!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}};E(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),A=!1):r&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=r}var m,v,g,y,b,x,_,w,M,k,A,T=s,S=Fe(),E=He(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=S,m=[],v=[],A=!0},polygonEnd:function(){s=T,m=uo.merge(m);var e=l([t,n]),r=A&&e,i=m.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&De(m,a,e,u,s),s.polygonEnd()),m=v=g=null}};return L}}function Ye(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 Xe(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){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tqs&&(qs=t),eHs&&(Hs=e)}function Je(){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 Qe(t,e){Ss+=t,Es+=e,++Ls}function $e(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Cs+=o*(e+t)/2,zs+=o*(r+n)/2,Ds+=o,Qe(e=t,r=n)}var e,r;Xs.point=function(n,i){Xs.point=t,Qe(e=n,r=i)}}function tr(){Xs.point=Qe}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Cs+=o*(n+t)/2,zs+=o*(i+e)/2,Ds+=o,o=i*t-n*e,Is+=o*(n+t),Ps+=o*(i+e),Os+=3*o,Qe(n=t,i=e)}var e,r,n,i;Xs.point=function(a,o){Xs.point=t,Qe(e=n=a,r=i=o)},Xs.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(){b=0/0,k.point=a,e.lineStart()}function a(r,n){var a=ge([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=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(h=t,f=e),d=b,p=x,m=_,v=w,g=M,k.point=a}function c(){i(b,x,y,_,w,M,d,p,h,m,v,g,s,e),k.lineEnd=o,o()}var h,f,d,p,m,v,g,y,b,x,_,w,M,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,h,f,d,p,m,v,g){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*a&&v--){var _=s+d,w=l+p,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=xo(xo(M)-1)a||xo((y*C+b*z)/x-.5)>.3||s*d+l*p+u*m0&&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[0]*Ho,t[1]*Ho]}function n(){s=Ce(o=fr(g,y,b),a);var t=a(m,v);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,m=0,v=0,g=0,y=0,b=0,_=Fs,w=x,M=null,k=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,Fs):qe((M=+t)*qo),i()):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]):x,i()):k},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?(m=t[0]%360*qo,v=t[1]%360*qo,n()):[m*Ho,v*Ho]},e.rotate=function(t){return arguments.length?(g=t[0]%360*qo,y=t[1]%360*qo,b=t.length>2?t[2]%360*qo:0,n()):[g*Ho,y*Ho,b*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?Ce(pr(t),mr(e,r)):pr(t):e||r?mr(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 mr(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=gr(r,i),a=gr(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):Sr}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 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 jr(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 Rr(t){var e=sl.pop()||new Fr;return e.site=t,e}function Nr(t){Zr(t),il.remove(t),sl.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&&xo(r-l.circle.x)Fo)s=s.L;else{if(!((i=a-qr(s,o))>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=Rr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=Rr(e.site),il.insert(l,r),l.edge=r.edge=$r(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=$r(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,m=p.x-c,v=p.y-h,g=2*(f*v-d*m),y=f*f+d*d,b=m*m+v*v,x={x:(v*y-d*b)/g+c,y:(f*b-m*y)/g+h};en(r.edge,u,p,x),l.edge=$r(u,t,null,x),r.edge=$r(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,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],m=nl,v=m.length;v--;)if((a=m[v])&&a.prepare())for(s=a.edges,l=s.length,o=0;oFo||xo(i-r)>Fo)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-h)Fo?{x:h,y:xo(e-h)Fo?{x:xo(r-p)Fo?{x:f,y:xo(e-f)Fo?{x:xo(r-d)=-Ro)){var d=l*l+u*u,p=c*c+h*h,m=(h*d-u*p)/f,v=(l*p-c*d)/f,h=v+s,g=ll.pop()||new Xr;g.arc=t,g.site=i,g.x=m+o,g.y=h+Math.sqrt(m*m+v*v),g.cy=h,t.circle=g;for(var y=null,b=ol._;b;)if(g.y=s)return;if(f>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(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=x,M=r>=_,k=M<<1|w,A=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=hl.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 An(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function Sn(t){return t*t*t}function En(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 Cn(t){return 1-Math.cos(t*Vo)}function zn(t){return Math.pow(2,10*(t-1))}function Dn(t){return 1-Math.sqrt(1-t*t)}function In(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 Pn(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 jn(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 Rn(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:bn(t,e)})):e&&r.push(Hn(r)+"rotate("+e+")")}function Xn(t,e,r,n){t!==e?n.push({i:r.push(Hn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Hn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Hn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Hn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Yn(t.rotate,e.rotate,r,n),Xn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,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 Mi(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Ai(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 Si(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 Ei(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],Di(n,i,a),e(a),Ai(n,a),n._pack_prev=a,Ai(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 Ri(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?Ji:Xi,l=n?Kn:Jn;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 $i(t,e),i()},a.copy=function(){return Ki(t,e,r,n)},i()}function Qi(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function $i(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=cs.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:Al);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 kl;arguments.length<2?r=kl:"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,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,m=(h+d)/2,v=f-c,g=d-h,y=v*v+g*g,b=r-n,x=c*d-f*h,_=(g<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*g-v*_)/y,M=(-x*v-g*_)/y,k=(x*g+v*_)/y,A=(-x*v+g*_)/y,T=w-p,S=M-m,E=k-p,L=A-m;return T*T+S*S>E*E+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}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=Et(r),p=Et(n);++h1?t.join("L"):t+"Z"}function Ma(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 Aa(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 m.event&&m.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}),m=p[n];m||(l=i.time,u=It(a,0,l),m=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(Jl,i);return a==Jl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Jl[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)},Qi(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,mo=po.setAttribute,vo=po.setAttributeNS,go=this.CSSStyleDeclaration.prototype,yo=go.setProperty;po.setAttribute=function(t,e){mo.call(this,t,e+"")},po.setAttributeNS=function(t,e,r){vo.call(this,t,e,r+"")},go.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:0/0},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=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=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,f,d=-1,p=o.length,m=a[s++],v=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 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,Ao={}.__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)},So=function(t,e){return e.querySelectorAll(t)},Eo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Eo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},So=Sizzle,Eo=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=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),zo.hasOwnProperty(r)?{space:zo[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(D(e,t[e]));return this}return this.each(D(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(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),M&&M.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 h(){function t(){s=1,a(uo.mouse(i),f),u(o)}function r(){h.on(D,null).on(I,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,h=uo.select(n(i)).on(D,t).on(I,r),f=e(uo.mouse(i)),d=K(i);Bl.call(i),l(o)}function f(){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],h=l[1],f=c[0]-h[0],d=c[1]-h[1];g=f*f+d*d}}function n(){var t,e,r,n,o=uo.touches(p);Bl.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,hs=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))))}}),fs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;fs.year=Vt(function(t){return t=fs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),fs.years=fs.year.range,fs.years.utc=fs.year.utc.range,fs.day=Vt(function(t){var e=new ds(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}),fs.days=fs.day.range,fs.days.utc=fs.day.utc.range,fs.dayOfYear=function(t){var e=fs.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=fs[t]=Vt(function(t){return(t=fs.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=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});fs[t+"s"]=r.range,fs[t+"s"].utc=r.utc.range,fs[t+"OfYear"]=function(t){var r=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)}}),fs.week=fs.sunday,fs.weeks=fs.sunday.range,fs.weeks.utc=fs.sunday.utc.range,fs.weekOfYear=fs.sundayOfYear;var ms={"-":"",_:" ",0:"0"},vs=/^\s*\d+/,gs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Ht(t)}};var ys=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=ys.numberFormat,uo.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,bs),fe(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 he;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={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=ge([e*qo,r*qo]);if(g){var i=be(g,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*Ho*u,v=xo(l)>180;if(v^(u*pd&&(d=y)}else if(m=(m+360)%360-180,v^(u*pd&&(d=r);v?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);g=n,p=e}function r(){_.point=e}function n(){x[0]=c,x[1]=f,_.point=t,g=null}function i(t,r){if(g){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else m=t,v=r;ks.point(t,r),e(t,r)}function a(){ks.lineStart()}function o(){i(m,v),ks.lineEnd(),xo(y)>Fo&&(c=-(f=180)),x[0]=c,x[1]=f,g=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),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=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],f=i[1])}return b=x=null,1/0===c||1/0===h?[[0/0,0/0],[0/0,0/0]]:[[c,h],[f,d]]}}(),uo.geo.centroid=function(t){As=Ts=Ss=Es=Ls=Cs=zs=Ds=Is=Ps=Os=0,uo.geo.stream(t,js);var e=Is,r=Ps,n=Os,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 Ns,Bs,Us,Vs,qs,Hs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=We},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Ns+=xo(Bs/2)}},Ys={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Xs={point:Qe,lineStart:$e,lineEnd:tr,polygonStart:function(){Xs.lineStart=er},polygonEnd:function(){Xs.point=Qe,Xs.lineStart=$e,Xs.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 Ns=0,uo.geo.stream(t,i(Gs)),Ns},t.centroid=function(t){return Ss=Es=Ls=Cs=zs=Ds=Is=Ps=Os=0,uo.geo.stream(t,i(Xs)),Os?[Is/Os,Ps/Os]:Ds?[Cs/Ds,zs/Ds]:Ls?[Ss/Ls,Es/Ls]:[0/0,0/0]},t.bounds=function(t){return qs=Hs=-(Us=Vs=1/0),uo.geo.stream(t,i(Ys)),[[Us,Vs],[qs,Hs]]},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 Je: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=vr((e=+n)*qo,i*qo),t):e},t.precision=function(n){return arguments.length?(r=vr(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/v)*v,i,v).map(f).concat(uo.range(Math.ceil(u/g)*g,l,g).map(d)).concat(uo.range(Math.ceil(n/p)*p,r,p).filter(function(t){return xo(t%v)>Fo}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return xo(t%g)>Fo}).map(h))}var r,n,i,a,o,s,l,u,c,h,f,d,p=10,m=p,v=90,g=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?(v=+e[0],g=+e[1],t):[v,g]},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=yr(s,o,90),h=br(n,r,y),f=yr(u,l,90),d=br(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=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]*qo,t[1]*qo,e[0]*qo,e[1]*qo)},uo.geo.length=function(t){return Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Js=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Js)}).raw=Js;var Ks=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Ks)}).raw=Ks,(uo.geo.conicConformal=function(){return Ye(Ar)}).raw=Ar, -(uo.geo.conicEquidistant=function(){return Ye(Tr)}).raw=Tr;var Qs=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Qs)}).raw=Qs,Sr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Er(Sr)}).raw=Sr;var $s=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr($s)}).raw=$s;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Er(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=Et(r),a=Et(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]]:[]).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=Cr,i=zr,a=n,o=i,s=ul;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=r.site,o=r.edges.sort(Yr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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,m,v,g,y,b=Et(s),x=Et(l);if(null!=e)m=e,v=r,g=n,y=i;else if(g=y=-(m=v=1/0),h=[],f=[],p=t.length,o)for(d=0;dg&&(g=c.x),c.y>y&&(y=c.y),h.push(c.x),f.push(c.y);else for(d=0;dg&&(g=_),w>y&&(y=w),h.push(_),f.push(w)}var M=g-m,k=y-v;M>k?y=v+M:g=m+k;var A=pn();if(A.add=function(t){a(A,t,+b(t,++d),+x(t,d),m,v,g,y)},A.visit=function(t){mn(t,A,m,v,g,y)},A.find=function(t){return vn(A,t[0],t[1],m,v,g,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||fl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=jn,uo.interpolateHsl=Fn,uo.interpolateLab=Rn,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: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=0/0,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=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=Et(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Et(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,Ei),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,Ei),li(s,function(t){t.r-=h})}return zi(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),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,m=h;si(h,function(t){t.xp.x&&(p=t),t.depth>m.depth&&(m=t)});var v=s(d,p)/2-d.x,g=l[0]/(p.x+s(p,d)/2+v),y=l[1]/(m.depth||1);si(h,function(t){t.x=(t.x+v)*g,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&&(ji(Ri(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&&!Pi(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=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=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=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=f[l-1]),c.area+=o.area,"squarify"!==d||(s=n(c,m))<=p?(f.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 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,m,v,g,y,b,x,_,w,M,k,A,T=0,S=0,E=[];if((g=(+l.apply(this,arguments)||0)/2)&&(v=a===Cl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(S*=-1),u&&(S=nt(v/u*Math.sin(g))),t&&(T=nt(v/t*Math.sin(g)))),u){y=u*Math.cos(c+S),b=u*Math.sin(c+S),x=u*Math.cos(h-S),_=u*Math.sin(h-S);var L=Math.abs(h-c-2*S)<=No?0:1;if(S&&ba(y,b,x,_)===d^L){var C=(c+h)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),k=t*Math.cos(c+T),A=t*Math.sin(c+T);var z=Math.abs(c-h+2*T)<=No?0:1;if(T&&ba(w,M,k,A)===1-d^z){var D=(c+h)/2;w=t*Math.cos(D),M=t*Math.sin(D),k=A=null}}else w=M=0;if(f>Fo&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=tNo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=Ha,l=va,u=ga;return t.radius=function(e){return arguments.length?(s=Et(e),t):s},t.source=function(e){return arguments.length?(a=Et(e),t):a},t.target=function(e){return arguments.length?(o=Et(e),t):o},t.startAngle=function(e){return arguments.length?(l=Et(e),t):l},t.endAngle=function(e){return arguments.length?(u=Et(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=Et(r),t):e},t.target=function(e){return arguments.length?(r=Et(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(Ya(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Ol.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Xa;return t.type=function(r){return arguments.length?(e=Et(r),t):e},t.size=function(e){return arguments.length?(r=Et(e),t):r},t};var Ol=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/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=Ol.keys();var jl=Math.sqrt(3),Fl=Math.tan(30*qo);Lo.transition=function(t){for(var e,r,n=Rl||++Vl,i=to(t),a=[],o=Nl||{time:Date.now(),ease:En,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||(b=null,z[0]-=h[1],z[1]-=f[1],L=2),T())}function m(){32==uo.event.keyCode&&2==L&&(z[0]+=h[1],z[1]+=f[1],L=0,T())}function v(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(uo.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),z[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){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:73}],121:[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},{}],122:[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,m,v;if(n&&(s=h(t,e,s,r)),t.length>80*r){u=f=t[0],c=d=t[1];for(var g=r;gf&&(f=p),m>d&&(d=m);v=Math.max(f-u,d-c)}return o(s,l,r,u,c,v),l}function i(t,e,r,n,i){var a,o;if(i===z(t,e,r,n)>0)for(a=e;a=e;a-=n)o=E(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.next)return null;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&m(t,n,i,h);for(var d,p,v=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,v=p.next;else if((t=p)===v){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(b(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=g(s,l,e,r,n),f=g(u,c,e,r,n),d=t.nextZ;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&b(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&&b(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)&&A(i,a)&&A(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&&x(l,u)){var c=S(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&&b(ar.x)&&A(n,t)&&(r=n,f=l),n=n.next;return r}function m(t,e,r,n){var i=t;do{null===i.z&&(i.z=g(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,v(i)}function v(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 g(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 x(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!k(t,e)&&A(t,e)&&A(e,t)&&T(t,e)}function _(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function 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 k(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 A(t,e){return _(t.prev,t,t.next)<0?_(t,e,t.next)>=0&&_(t,t.prev,e)>=0:_(t,e,t.prev)<0||_(t,t.next,e)<0}function T(t,e){var r=t,n=!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 S(t,e){var r=new C(t.i,t.x,t.y),n=new C(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 E(t,e,r,n){var i=new C(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 C(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 z(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}},{}],123:[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){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],126:[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},{}],127:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],128:[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];return t.length<=1?"any"===e?"false":"true":"("+("=="===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")+")"}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"]},{}],129:[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=(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":62,"cubic-hermite":105}],130:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),a=t.family||"monospace",o=t.shape||[512,512],s=t.step||[32,32],l=t.size||16,u=t.chars||[32,126],c=Math.floor((s[0]-l)/2),h=t.radius||1.5*c,f=new i(l,c,h,0,a),d=t.align||!0;if("number"==typeof l&&(l+="px"),Array.isArray(u)){if(2===u.length&&"number"==typeof u[0]&&"number"==typeof u[1]){var p=[];for(e=u[0],r=0;e<=u[1];e++)p[r++]=String.fromCharCode(e);u=p}}else u=String(u).split("");o=o.slice(),n.width=o[0],n.height=o[1];var m=n.getContext("2d");m.fillStyle="#000",m.fillRect(0,0,n.width,n.height),m.font=l+" "+a,m.textBaseline="middle";var v=0,g=0,y=Math.min(u.length,Math.floor(o[0]/s[0])*Math.ceil(o[1]/s[1])),b=f.ctx.textAlign,x=f.buffer;for(f.ctx.textAlign="center",f.buffer=f.size/2,e=0;e0){s=r;break}if(s)break}for(r=o;r--;){for(n=r*a*4,e=0;e0){l=r;break}if(l)break}return s-.5*(s+(o-l))}(_)),m.putImageData(_,v,g-w),v+=s[0],v>o[0]-s[0]&&(v=0,g+=s[1])}return f.ctx.textAlign=b,f.buffer=x,n}var i=t("tiny-sdf");e.exports=n},{"tiny-sdf":525}],131:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}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=g);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=g,r._color=g,s._color=g,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=g,n._color=g,e._color=g,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===g){if(r._color===v)return r._color=g,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=g,n._color=g,e._color=g,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===g){if(r._color===v)return r._color=g,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 m(t){return new s(t||p,null)}e.exports=m;var v=0,g=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 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===g||i._color===g)break;var d=l[h-2];if(d.left===f)if(f.left===i){var p=d.right;if(!p||p._color!==v){if(d._color=v,d.left=f.right,f._color=g,f.right=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var m=l[h-3];m.left===d?m.left=f:m.right=f}break}f._color=g,d.right=a(g,p),d._color=v,h-=1}else{var p=d.right;if(!p||p._color!==v){if(f.right=i.left,d._color=v,d.left=i.right,i._color=g,i.left=f,i.right=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var m=l[h-3];m.left===d?m.left=i:m.right=i}break}f._color=g,d.right=a(g,p),d._color=v,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==v){if(d._color=v,d.right=f.left,f._color=g,f.left=d,l[h-2]=f,l[h-1]=i,o(d),o(f),h>=3){var m=l[h-3];m.right===d?m.right=f:m.left=f}break}f._color=g,d.left=a(g,p),d._color=v,h-=1}else{var p=d.left;if(!p||p._color!==v){if(f.left=i.right,d._color=v,d.right=i.left,i._color=g,i.right=f,i.left=d,l[h-2]=i,l[h-1]=f,o(d),o(f),o(i),h>=3){var m=l[h-3];m.right===d?m.right=i:m.left=i}break}f._color=g,d.left=a(g,p),d._color=v,h-=1}}return l[0]._color=g,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 b=h.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new h(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var 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}})},{}],132:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],133:[function(t,e,r){function n(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r0){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":133}],135:[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(m);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?(x.push(i(u,p,e),i(u,p,r)),a||(x=o(s,x,v,g,y))):d>=e&&x.push(i(u,p,e)):f>r?dr&&(x.push(i(u,p,r)),a||(x=o(s,x,v,g,y))));u=m[b-1],f=u[n],f>=e&&f<=r&&x.push(u),h=x[x.length-1],a&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),o(s,x,v,g,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":137}],136:[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"),b=this.tiles[y]=p(t,g,r,n,x,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,T,S,E,L=.5*d.buffer/d.extent,C=.5-L,z=.5+L,D=1+L;M=k=A=T=null,S=f(t,g,r-L,r+z,0,o,b.min[0],b.max[0]),E=f(t,g,r+C,r+D,0,o,b.min[0],b.max[0]),S&&(M=f(S,g,n-L,n+z,1,s,b.min[1],b.max[1]),k=f(S,g,n+C,n+D,1,s,b.min[1],b.max[1])),E&&(A=f(E,g,n-L,n+z,1,s,b.min[1],b.max[1]),T=f(E,g,n+C,n+D,1,s,b.min[1],b.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(h.push(M||[],e+1,2*r,2*n),h.push(k||[],e+1,2*r,2*n+1),h.push(A||[],e+1,2*r+1,2*n),h.push(T||[],e+1,2*r+1,2*n+1))}else i&&(v=e)}return v},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 m=this.splitTile(c.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var v=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},{}],140:[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){o(t)<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 m=a("labels");a("labelFont")&&(m=!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&&(m||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 m=[new a,new a,new a],v=[0,0,0],g={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||g;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,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=m,k=0;k<3;++k)o(m[k],k,this.bounds,u,c);for(var e=this.gl,T=v,k=0;k<3;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var k=0;k<3;++k){var S=[0,0,0];c[k]>0?S[k]=s[1][k]:S[k]=s[0][k];for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.gridEnable[L]&&this._lines.drawGrid(L,C,this.bounds,S,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(L,C,this.bounds,S,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var k=0;k<3;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var z=n(y,A[k].primalMinor),D=n(b,A[k].mirrorMinor),I=this.lineTickLength,E=0;E<3;++E){var P=M/r[5*E];z[E]*=I[E]*P,D[E]*=I[E]*P}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,z,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,D,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var k=0;k<3;++k){for(var O=A[k].primalMinor,j=n(x,A[k].primalOffset),E=0;E<3;++E)this.lineTickEnable[k]&&(j[E]+=M*O[E]*Math.max(this.lineTickLength[E],0)/r[5*E]);if(this.tickEnable[k]){for(var E=0;E<3;++E)j[E]+=M*O[E]*this.tickPad[E]/r[5*E];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],j,this.tickColor[k])}if(this.labelEnable[k]){for(var E=0;E<3;++E)j[E]+=M*O[E]*this.labelPad[E]/r[5*E];j[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],j,this.labelColor[k])}}},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":145,"./lib/cube.js":146,"./lib/lines.js":147,"./lib/text.js":149,"./lib/ticks.js":150}],145:[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 m=-1;m<=1;m+=2)h[c]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var v=u;u=c,c=v}var g=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=o(t,[{buffer:g,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:g,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,g,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":148,"gl-buffer":152,"gl-vao":266}],146:[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;eS&&(_|=1<S&&(_|=1<f[m][1]&&(O=m));for(var j=-1,m=0;m<3;++m){var F=O^1<f[R][0]&&(R=F)}}var N=v;N[0]=N[1]=N[2]=0,N[o.log2(j^O)]=O&j,N[o.log2(O^R)]=O&R;var B=7^R;B===_||B===P?(B=7^j,N[o.log2(R^B)]=B&R):N[o.log2(j^B)]=B&j;for(var U=g,V=_,k=0;k<3;++k)U[k]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":250}],149:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),h=s(t,[{buffer:c,size:3}]),f=u(t);f.attributes.position.location=0;var d=new n(t,f,c,h);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},h=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var f=n.prototype,d=[0,0];f.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},f.update=function(t,e,r,n,a){function o(t,e,r,n){var a=h[r];a||(a=h[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,f=0,d=c.length;f=0;--m){var v=u[p[m]];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],f=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),f[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=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&&void 0!==t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,f,e):i(this.gl,this.type,this.length,this.usage,f.subarray(0,t.length),e),l.free(f)}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:460,"ndarray-ops":454,"typedarray-pool":533}],153:[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"}},{}],154:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":153}],155:[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],m=s[3]-s[1],v=h[2]-h[0],g=h[3]-h[1],y=2*p/v,b=2*m/g,x=(s[0]-h[0]-.5*v)/p,_=(s[1]-h[1]-.5*g)/m;t[0]=y,t[1]=b,e[0]=y-t[0],e[1]=b-t[1],r[0]=x,r[1]=_,n[0]=x-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*=_),S<0?S*=w:S>0&&(S*=M),v[b++]=f*(r-p+T),v[b++]=d*(n-m+S),v[b++]=o*A[2]+(l+o)*A[4],v[b++]=o*A[3]+(l+o)*A[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 m=h.slice();m[u]+=d[1][u],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,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":158,"gl-buffer":152,"gl-vao":266}],158:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"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}","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}",null,[{name:"position",type:"vec3"},{name:"offset",type:"vec3"},{name:"color",type:"vec4"}])}},{"gl-shader":250}],159:[function(t,e,r){"use strict";function n(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}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 g=r.getExtension("WEBGL_depth_texture");g?d?t.depth=s(r,u,c,g.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))<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,m,v,g,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 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}}),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*d&255;this.pickOffset=r,i.bind();var p=i.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),h.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]]}},h.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,h=this.bounds,d=h[0]=r[0],p=h[1]=n[0],m=h[2]=r[r.length-1],v=h[3]=n[n.length-1],g=1/(m-d),y=1/(v-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(f.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),M=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),A=s.mallocUint32(_),T=0,S=0;S2&&!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)}}}}(),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 m=t.positions;this.data=m;var v=this.bounds;v[0]=v[1]=1/0,v[2]=v[3]=-1/0;var g=this.numPoints=m.length>>>1;if(0!==g){for(e=0;e1;){var A=--n;a=m[2*n],o=m[2*n+1];var T=A-1,S=m[2*T],E=m[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(S)||isNaN(E))){k+=1,a=(a-v[0])/(v[2]-v[0]),o=(o-v[1])/(v[3]-v[1]),S=(S-v[0])/(v[2]-v[0]),E=(E-v[1])/(v[3]-v[1]);var L=S-a,C=E-o,z=A|1<<24,D=A-1,I=A,P=A-1|1<<24;y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=D,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=I,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=E,y[--w]=S,_[--M]=I,_[--M]=P,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=I,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=D,y[--w]=C,y[--w]=L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=D}}for(e=0;e FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",null,a)}},{"gl-shader":250}],167:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=m(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=v(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=l(e),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]),h=0;h<1024;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new o(e,r,n,i,a,f);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),m=p.createShader,v=p.createPickShader,g=[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||g,view:t.view||g,projection:t.projection||g,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||g,view:t.view||g,projection:t.projection||g,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,m=[[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}m[0][r]=Math.min(m[0][r],g[r],y[r]),m[1][r]=Math.max(m[1][r],g[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 M=h;if(h+=n(g,y),v){for(r=0;r<2;++r)l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,v=!1}l.push(g[0],g[1],g[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],g[0],g[1],g[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],g[0],g[1],g[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],g[0],g[1],g[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=m,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var k=t.dashes,A=k.slice();for(A.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,m=a*c,v=o*c,g=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+v))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+v))*_,t[6]=(m+g)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-g)*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,m=o*c,v=o*h,g=s*h,y=l*u,b=l*c,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],A=i[1],T=i[2];return t[0]=(1-(m+g))*_,t[1]=(d+x)*_,t[2]=(p-b)*_,t[3]=0,t[4]=(d-x)*w,t[5]=(1-(f+g))*w,t[6]=(v+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(v-y)*M,t[10]=(1-(f+m))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*A+t[8]*T),t[13]=r[1]+A-(t[1]*k+t[5]*A+t[9]*T),t[14]=r[2]+T-(t[2]*k+t[6]*A+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,m=a*o,v=a*s,g=a*l;return t[0]=1-h-p,t[1]=c+g,t[2]=f-v,t[3]=0,t[4]=c-g,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=f+v,t[9]=d-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,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,m,v=e[0],g=e[1],y=e[2],b=a[0],x=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(v-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],m=r[2],v=r[3];return a=u*d+c*p+h*m+f*v,a<0&&(a=-a,d=-d,p=-p,m=-m,v=-v),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*m,t[3]=s*f+l*v,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":189,"./mat3.js":192,"./vec3.js":196,"./vec4.js":197}],195:[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":189}],197:[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;v+=m[c]}return Math.abs(v-1)>.001?null:[h,o(t,m),m]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:45,"polytope-closest-point/lib/closest_point_2d.js":478}],199:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],200:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,m,v,g,y,b,x,_,w,M,k,A,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=v,this.edgeUVs=g,this.edgeIds=m,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=x,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,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=w({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 _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},P.isTransparent=function(){return this.opacity<1},P.pickSlots=1,P.setPickBase=function(t){this.pickId=t},P.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=k.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()}},P.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()}},P.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[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n],a.uniforms.angle=g[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(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,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*m[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=v[n+2],a.uniforms.angle=g[n+2],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n+2]&&M&&(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,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],m=l[u],v=l[u+2],g=v-m,y=s[u],b=s[u+2],x=b-y;e[u]=2*f/p*g/x,t[u]=2*(c-d)/p*g/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)],h=[-1/0],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;w[b]=S}var E=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,E))},e.exports=a},{"./lib/GLError":208,"./lib/create-attributes":209,"./lib/create-uniforms":210,"./lib/reflect":211,"./lib/runtime-reflect":212,"./lib/shader-cache":213}],208:[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},{}],209:[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":208}],210:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(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;parseInt(n)+""===n?a+="["+n+"]":a+="."+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 m=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(m,e[1],m,e[3],d[p],f[p]):o.drawLine(e[0],m,e[2],m,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(!w&&G.autoResize){var t=M.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",N=!0}}}function r(){for(var t=O.length,e=R.length,r=0;r0&&0===F[e-1];)F.pop(),R.pop().dispose()}function s(){if(G.contextLost)return!0;A.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=O.length,e=R.length,r=0;rS.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":217,"gl-buffer":152,"gl-shader":218,"typedarray-pool":533}],226:[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],m=r[2],v=r[3];return a=u*d+c*p+h*m+f*v,a<0&&(a=-a,d=-d,p=-p,m=-m,v=-v),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*m,t[3]=s*f+l*v,t}e.exports=n},{}],227:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],228:[function(t,e,r){arguments[4][80][0].apply(r,arguments)},{dup:80}],229:[function(t,e,r){arguments[4][207][0].apply(r,arguments)},{"./lib/GLError":230,"./lib/create-attributes":231,"./lib/create-uniforms":232,"./lib/reflect":233,"./lib/runtime-reflect":234,"./lib/shader-cache":235,dup:207}],230:[function(t,e,r){arguments[4][208][0].apply(r,arguments)},{dup:208}],231:[function(t,e,r){arguments[4][209][0].apply(r,arguments)},{"./GLError":230,dup:209}],232:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{"./GLError":230,"./reflect":233,dup:210}],233:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],234:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{dup:212}],235:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":230,dup:213,"gl-format-compiler-error":160,"weakmap-shim":554}],236:[function(t,e,r){"use strict";function n(t,e,r,n,a){a<=4*f?i(0,a-1,t,e,r,n):h(0,a-1,t,e,r,n)}function i(t,e,r,n,i,a){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=i[o],h=a[o],f=o;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],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 m=(e-t+1)/6|0,v=t+m,g=e-m,y=t+e>>1,b=y-m,x=y+m,_=v,w=b,M=y,k=x,A=g,T=t+1,S=e-1,E=0;u(_,w,r,n,d,p)&&(E=_,_=w,w=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E),u(_,M,r,n,d,p)&&(E=_,_=M,M=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(_,k,r,n,d,p)&&(E=_,_=k,k=E),u(M,k,r,n,d,p)&&(E=M,M=k,k=E),u(w,A,r,n,d,p)&&(E=w,w=A,A=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E);var L=r[w],C=n[2*w],z=n[2*w+1],D=d[w],I=p[w],P=r[k],O=n[2*k],j=n[2*k+1],F=d[k],R=p[k],N=_,B=M,U=A,V=v,q=y,H=g,G=r[N],Y=r[B],X=r[U];r[V]=G,r[q]=Y,r[H]=X;for(var W=0;W<2;++W){var Z=n[2*N+W],J=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=J,n[2*H+W]=K}var Q=d[N],$=d[B],tt=d[U];d[V]=Q,d[q]=$,d[H]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=S;++it)if(c(it,L,C,z,D,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,O,j,F,r,n,d))for(;;){if(c(S,P,O,j,F,r,n,d)){c(S,L,C,z,D,r,n,d)?(s(it,T,S,r,n,d,p),++T,--S):(a(it,S,r,n,d,p),--S);break}if(--S=Math.max(.9*d,32)){var b=u+s>>>1;l(v,g,h,f,b,c+1),f=b}l(v,g,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)*g,t[2*_+1]=(t[2*_+1]-h)*y;var A=x[_];A!==M&&(w.push(new i(b*Math.pow(.5,A),_+1,k-(_+1))),k=_+1,M=A)}return w.push(new i(b*Math.pow(.5,A+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":236,"typedarray-pool":533}],238:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=h(this.plot.gl,this.charCanvas),this.charStep=400,this.snapThreshold=1e4,this.paletteTexture=h(this.plot.gl,[256,1])}function i(t,e){var r=t.gl,i=a(r,l.vertex,l.fragment),s=a(r,l.pickVertex,l.pickFragment),u=o(r),c=o(r),h=o(r),f=o(r),d=o(r),p=new n(t,i,s,u,c,h,f,d);return p.update(e),t.addObject(p),p}e.exports=i;var a=t("gl-shader"),o=t("gl-buffer"),s=t("typedarray-pool"),l=t("./lib/shaders"),u=t("snap-points-2d"),c=t("font-atlas-sdf"),h=t("gl-texture2d"),f=t("color-id"),d=t("ndarray"),p=t("clamp"),m=t("binary-search-bounds"),v=n.prototype;!function(){function t(){var t=this.plot,u=t.viewBox,c=t.dataBox,h=t.pixelRatio,f=c[2]-c[0],d=c[3]-c[1],p=2/f,m=2/d,v=-c[0]-.5*f,g=-c[1]-.5*d;i[0]=p,a[0]=p-i[0],i[1]=m,a[1]=m-i[1],o[0]=v,s[0]=v-o[0],o[1]=g,s[1]=g-o[1];var y=u[2]-u[0],b=u[3]-u[1];e=Math.min(f/y,d/b),l[0]=2*h/y,l[1]=2*h/b,r=c[0],n=c[2]}var e,r,n,i=new Float32Array([0,0]),a=new Float32Array([0,0]),o=new Float32Array([0,0]),s=new Float32Array([0,0]),l=[0,0],u=[0,0,0,0];v.drawPick=function(l){var c=void 0!==l,h=this.plot,f=this.pointCount,d=f>this.snapThreshold;if(!f)return l;t.call(this);var p=h.gl,v=c?this.pickShader:this.shader,g=p.isEnabled(p.BLEND);if(v.bind(),c){this.pickOffset=l;for(var y=0;y<4;++y)u[y]=l>>8*y&255;v.uniforms.pickOffset=u,this.idBuffer.bind(),v.attributes.id.pointer(p.UNSIGNED_BYTE,!1)}else p.blendFuncSeparate(p.SRC_ALPHA,p.ONE_MINUS_SRC_ALPHA,p.ONE,p.ONE_MINUS_SRC_ALPHA),p.blendColor(0,0,0,1),g||p.enable(p.BLEND),this.colorBuffer.bind(),v.attributes.color.pointer(p.UNSIGNED_BYTE,!1),this.charBuffer.bind(),v.attributes.char.pointer(p.UNSIGNED_BYTE,!1),v.uniforms.chars=this.charTexture.bind(0),v.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],v.uniforms.charsStep=this.charStep,v.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),v.attributes.size.pointer(p.FLOAT,!1,8,0),c||v.attributes.border.pointer(p.FLOAT,!1,8,4),this.positionBuffer.bind(),v.attributes.positionHi.pointer(p.FLOAT,!1,16,0),v.attributes.positionLo.pointer(p.FLOAT,!1,16,8),v.uniforms.pixelRatio=h.pixelRatio,v.uniforms.scaleHi=i,v.uniforms.scaleLo=a,v.uniforms.translateHi=o,v.uniforms.translateLo=s,v.uniforms.viewBox=h.viewBox;var b=this.scales;if(d)for(var x=b.length-1;x>=0;x--){var _=b[x];if(!(_.pixelSize&&_.pixelSize<1.25*e&&x>1)){var w=_.offset,M=_.count+w,k=m.ge(this.xCoords,r,w,M-1),A=m.lt(this.xCoords,n,k,M-1)+1;A>k&&p.drawArrays(p.POINTS,k,A-k)}}else p.drawArrays(p.POINTS,0,f);if(c)return l+f;g?p.blendFunc(p.ONE,p.ONE_MINUS_SRC_ALPHA):p.disable(p.BLEND)}}(),v.draw=v.drawPick,v.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]]}},v.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],i=t.sizes||[],a=t.borderWidths||[],o=t.borderColors||[],l=this.plot.gl;this.points=e;var h=this.points.length/2,m=s.mallocInt32(h),v=s.mallocFloat32(2*h),g=s.mallocFloat64(2*h);g.set(this.points),this.pointCount=h;var y=h>this.snapThreshold;y&&(this.scales=u(g,m,v));for(var b=s.mallocFloat32(4*h),x=s.mallocFloat32(2*h),_=s.mallocUint8(2*h),w=s.mallocUint32(h),M=s.mallocUint8(2*h),k={},A=[],T=[],S=[],E=0,L=h,C=0;EO&&(O=i[E]);var j=this.charStep;this.charStep=p(Math.ceil(4*O),128,768);var F=Object.keys(I),R=this.charStep,N=Math.floor(R/2),B=l.getParameter(l.MAX_TEXTURE_SIZE),U=B/R*(B/R),V=Math.min(B,R*F.length),q=Math.min(B,R*Math.ceil(R*F.length/B)),H=Math.floor(V/R);F.length>U&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==F+""&&this.charStep==j||(this.charCanvas=c({canvas:this.charCanvas,family:"sans-serif",size:N,shape:[V,q],step:[R,R],chars:F,align:!0}),this.chars=F);for(var E=0;E>>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,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,l.bind(),n.attributes.pickId.pointer(g.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());for(var D=this.xCoords,I=(x[0]-u[0]-S*c*y)/_,P=(x[2]-u[0]+S*c*y)/_,O=!0,j=i.length-1;j>=0;j--){var F=i[j];if(!(F.pixelSize1)){var R=F.offset,N=F.count+R,B=s.ge(D,I,R,N-1),U=s.lt(D,P,B,N-1)+1;U>B&&g.drawArrays(g.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":239,"binary-search-bounds":240,"gl-buffer":152,"gl-shader":250,"snap-points-2d":242,"typedarray-pool":533}],244:[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(j[1])){var F=O;O=j,j=F,F=I,I=P,P=F;var R=z;z=D,D=R}O[0]<0&&(I[z]=-1),j[1]>0&&(P[D]=-1);for(var N=0,B=0,C=0;C<4;++C)N+=Math.pow(p[4*z+C],2),B+=Math.pow(p[4*D+C],2);I[z]/=Math.sqrt(N),P[D]/=Math.sqrt(B),d.axes[0]=I,d.axes[1]=P,d.fragClipBounds[0]=u(E,b[0],_,-1e8),d.fragClipBounds[1]=u(E,b[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,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=D,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=m(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),v=new o(e,r,n,i,u,c,h,f,d,a,s,l);return v.update(t),v}var p=t("gl-buffer"),m=t("gl-vao"),v=t("typedarray-pool"),g=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],M=[0,0,0],k=[0,0,0],A=[0,0,0,1],T=[0,0,0,1],S=x.slice(),E=[0,0,0],L=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],z=[1e8,1e8,1e8],D=[C,z];_.draw=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){f(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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,m=0,g=n.length;t:for(var y=0;y0&&(z[0]=-a[0]*(1+A[0][0]));for(var q=M.cells,H=M.positions,_=0;_0){var g=r*c;o.drawBox(h-g,f-g,d+g,f+g,a),o.drawBox(h-g,p-g,d+g,p+g,a),o.drawBox(h-g,f-g,h+g,p+g,a),o.drawBox(d-g,f-g,d+g,p+g,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":247,"gl-buffer":152,"gl-shader":250}],249:[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){return new i(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}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 k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;_[w]=S}var E=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,E))},e.exports=a},{"./lib/GLError":251,"./lib/create-attributes":252,"./lib/create-uniforms":253,"./lib/reflect":254,"./lib/runtime-reflect":255,"./lib/shader-cache":256}],251:[function(t,e,r){arguments[4][208][0].apply(r,arguments)},{dup:208}],252:[function(t,e,r){arguments[4][209][0].apply(r,arguments)},{"./GLError":251,dup:209}],253:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{"./GLError":251,"./reflect":254,dup:210}],254:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],255:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{dup:212}],256:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":251,dup:213,"gl-format-compiler-error":160,"weakmap-shim":554}],257:[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)}},{}],258:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"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","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}",null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":250}],259:[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":258,"gl-buffer":152,"gl-vao":266}],260:[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":250}],261:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=x([y({colormap:t,nshades:j,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.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=[0/0,0/0,0/0],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=[_(g.mallocFloat(1024),[0,0]),_(g.mallocFloat(1024),[0,0]),_(g.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||R,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||I,n.view=t.view||I,n.projection=t.projection||I,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=k(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),k(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 R=[0,0,0],N={showSurface:!1,showContour:!1,projections:[I.slice(),I.slice(),I.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:I,view:I,projection:I,inverseModel:I.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=I.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:I,view:I,projection:I,inverseModel:I,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||I,r.view=t.view||I,r.projection=t.projection||I,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,m=s+f,v=h*d,g=0;g<3;++g)u[g]+=this._field[g].get(p,m)*v;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=A.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],g=0;g<3;++g)r.dataCoordinate[g]=this._field[g].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&&(g.freeFloat(this._field[2].data),this._field[2].data=g.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&&(g.freeFloat(this._field[o].data),this._field[o].data=g.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 m=_(p.data,a);m.stride[o]=p.stride[0],m.stride[1^o]=0,l(this._field[o],m)}}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();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=g.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");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}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 g=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),h===a&&d)0===l.offset&&l.data.length===g?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+g)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+g));else{var b;b=a===t.FLOAT?v.mallocFloat32(g):v.mallocUint8(g);var _=p(b,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):m.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,g)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,g)),a===t.FLOAT?v.freeFloat32(b):v.freeUint8(b)}}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,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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 g=[n[2],n[2]*n[0],1];f=v.malloc(d,r);var y=p(f,n,g,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?m.assign(y,e):x(y,e),h=f.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,h),a||v.free(f),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(g||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],r=i(e)?e:e.raw;if(r)return h(t,r,0|e.width,0|e.height,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"),m=t("ndarray-ops"),v=t("typedarray-pool");e.exports=d;var g=null,y=null,b=null,x=function(t,e){m.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&&g.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&&g.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;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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:460,"ndarray-ops":454,"typedarray-pool":533}],263:[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},{}],272:[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},{}],273:[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)},{}],274:[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 z(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,R):(U.push(O),j=O,R+1)}function D(){return"."===O?(U.push(O),B=v,j=O,R+1):/[eE]/.test(O)?(U.push(O),B=v,j=O,R+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),j=O,R+1):/[^\d]/.test(O)?(e(U.join("")),B=u,R):(U.push(O),j=O,R+1)}function I(){return"f"===O&&(U.push(O),j=O,R+=1),/[eE]/.test(O)?(U.push(O),j=O,R+1):"-"===O&&/[eE]/.test(j)?(U.push(O),j=O,R+1):/[^\d]/.test(O)?(e(U.join("")),B=u,R):(U.push(O),j=O,R+1)}function P(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=J.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:g,e(U.join("")),B=u,R}return U.push(O),j=O,R+1}var O,j,F,R=0,N=0,B=u,U=[],V=[],q=1,H=0,G=0,Y=!1,X=!1,W="";t=t||{};var Z=o,J=i;return"300 es"===t.version&&(Z=l,J=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,m=4,v=5,g=6,y=7,b=8,x=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":277,"./lib/builtins-300es":276,"./lib/literals":279,"./lib/literals-300es":278,"./lib/operators":280}],276:[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":277}],277:[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"]},{}],278:[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":279}],279:[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"]},{}],280:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],281:[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":275}],282:[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?0/0:1/0*(d?-1:1);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,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||1/0===e?(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*m}},{}],284:[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(),m=0;m<=i;++m)m===c&&(p[m]=-1);var v=p[0];p[0]=p[1],p[1]=v;var g=new n(p,new Array(i+1),!0);f[c]=g,d[c]=g}d[i+1]=h;for(var c=0;c<=i;++c)for(var p=f[c].vertices,y=f[c].adjacent,m=0;m<=i;++m){var b=p[m];if(b<0)y[m]=h;else for(var x=0;x<=i;++x)f[x].vertices.indexOf(b)<0&&(y[m]=f[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,h=0;h<=r;++h){var f=c[h];i[h]=f<0?e: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,m=d.indexOf(r);if(!(m<0))for(var v=0;v<=o;++v)if(v!==m){var g=p[v];if(g.boundary&&!(g.lastVisited>=r)){var y=g.vertices;if(g.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,g.boundary=!1,u.push(g),h.push(g),g.lastVisited=r;continue}g.lastVisited=-r}var w=g.adjacent,M=d.slice(),k=p.slice(),A=new n(M,k,!0);c.push(A);var T=w.indexOf(e);if(!(T<0)){w[T]=A,k[m]=g,M[v]=-1,k[v]=e,p[v]=A,A.flip();for(var x=0;x<=o;++x){var S=M[x];if(!(S<0||S===r)){for(var E=new Array(o-1),L=0,C=0;C<=o;++C){var z=M[C];z<0||C===x||(E[L++]=z)}f.push(new i(E,A,x))}}}}}}f.sort(a);for(var v=0;v+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":500,"simplicial-complex":511}],285:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.mid=t,this.left=e,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(e?e.count:0)+(r?r.count:0)+n.length}function i(t,e){t.mid=e.mid,t.left=e.left,t.right=e.right,t.leftPoints=e.leftPoints,t.rightPoints=e.rightPoints,t.count=e.count}function 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=g.ge(this.leftPoints,t,f),n=g.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,a=this.left;a.right;)n=a,a=a.right;if(n===this)a.right=this.right;else{var o=this.left,r=this.right;n.count-=a.count,n.right=a.left,a.left=o,a.right=r}i(this,a),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 o=g.ge(this.leftPoints,t,f);othis.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)},x.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 _=m.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":62}],286:[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 m=Math.floor((d+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[m]);var v=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(m-1),u.push(v)),(0===h?i>=s:a>=l)&&(u.push(m+1),u.push(f),u.push(v))}}return c}e.exports=n},{}],293:[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);i(t,e,r,Math.max(n,Math.floor(r-u*h/l+f)),Math.min(o,Math.floor(r+(l-u)*h/l+f)),s)}var d=e[2*r+s],p=n,m=o;for(a(t,e,n,r),e[2*o+s]>d&&a(t,e,n,o);pd;)m--}e[2*n+s]===d?a(t,e,n,m):(m++,a(t,e,m,o)),m<=r&&(n=m+1),r<=m&&(o=m-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},{}],294:[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),m=e[2*p],v=e[2*p+1];i(m,v,r,n)<=u&&l.push(t[p]);var g=(c+1)%2;(0===c?r-a<=m:n-a<=v)&&(s.push(f),s.push(p-1),s.push(g)),(0===c?r+a>=m:n+a>=v)&&(s.push(p+1),s.push(h),s.push(g))}}return l}function i(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=n},{}],295:[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={},m=[],v=0;v=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:468}],297:[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:541}],298:[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":297,"../util/extend":298,"../util/get_type":299,"./validate_array":302,"./validate_boolean":303,"./validate_color":304,"./validate_constants":305,"./validate_enum":306,"./validate_filter":307,"./validate_function":308,"./validate_layer":310,"./validate_number":312,"./validate_object":313,"./validate_source":315,"./validate_string":316}],302:[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 a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var o=[];for(var s in r)"@"!==s[0]&&o.push(new n(e+"."+s,r[s],'constants must start with "@"'));return o}},{"../error/validation_error":297,"../util/get_type":299}],306:[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":297,"../util/unbundle_jsonlint":300}],307:[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":297,"../util/get_type":299,"./validate":301,"./validate_array":302,"./validate_number":312,"./validate_object":313}],309:[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":297,"./validate_string":316}],310:[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 m=0;ma.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":297,"../util/get_type":299}],313:[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["*"]),m=s[d]||s["*"];p||m?c=c.concat((m||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":297,"../util/get_type":299,"./validate":301}],314:[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":297,"./validate":301}],315:[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')];switch(i(e.type)){case"vector":case"raster":var u=[];if(u=u.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var c in e)["type","url","tileSize"].indexOf(c)<0&&u.push(new n(r+"."+c,e[c],'a source with a "url" property may not include a "%s" property',c));return u;case"geojson":return a({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":297,"../util/unbundle_jsonlint":300,"./validate_enum":306,"./validate_object":313}],316:[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":297,"../util/get_type":299}],317:[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":318,"./validate/validate":301,"./validate/validate_constants":305,"./validate/validate_filter":307,"./validate/validate_glyphs_url":309,"./validate/validate_layer":310,"./validate/validate_layout_property":311,"./validate/validate_paint_property":314,"./validate/validate_source":315}],318:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":319}],319:[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"}}}},{}],320:[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)}void 0!==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}},{}],321:[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":435}],322:[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;x[w]=m[_]*v}}},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":433,"../util/util":435,"./array_group":321,"./bucket/circle_bucket":323,"./bucket/fill_bucket":324,"./bucket/line_bucket":325,"./bucket/symbol_bucket":326,"./buffer_group":328,assert:43,"feature-filter":128}],323:[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":435,"../bucket":322,"../load_geometry":330}],324:[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");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,500),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,15),r=0;r2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=s/(512*this.overscaling)*15,u=t[0],c=t[a-1],h=u.equals(c);if(this.prepareArrayGroup("line",10*a),2!==a||!h){this.distance=0;var f,d,p,m,v,g,y,b=r,x=h?"butt":r,_=!0;this.e1=this.e2=this.e3=-1,h&&(f=t[a-2],v=u.sub(f)._unit()._perp());for(var w=0;w0){var S=f.dist(d);if(S>2*o){var E=f.sub(f.sub(d)._mult(o/S)._round());this.distance+=E.dist(d),this.addCurrentVertex(E,this.distance,m.mult(1),0,0,!1),d=E}}var L=d&&p,C=L?e:p?b:x;if(L&&"round"===C&&(An&&(C="bevel"),"bevel"===C&&(A>2&&(C="flipbevel"),A100)M=v.clone();else{var z=m.x*v.y-m.y*v.x>0?-1:1,D=A*m.add(v).mag()/m.sub(v).mag();M._perp()._mult(D*z)}this.addCurrentVertex(f,this.distance,M,0,0,!1),this.addCurrentVertex(f,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var I=m.x*v.y-m.y*v.x>0,P=-Math.sqrt(A*A-1);if(I?(y=0,g=P):(g=0,y=P),_||this.addCurrentVertex(f,this.distance,m,g,y,!1),"fakeround"===C){for(var O,j=Math.floor(8*(.5-(k-.5))),F=0;F=0;R--)O=m.mult((R+1)/(j+1))._add(v)._unit(),this.addPieSliceVertex(f,this.distance,O,I)}p&&this.addCurrentVertex(f,this.distance,v,-g,-y,!1)}else"butt"===C?(_||this.addCurrentVertex(f,this.distance,m,0,0,!1),p&&this.addCurrentVertex(f,this.distance,v,0,0,!1)):"square"===C?(_||(this.addCurrentVertex(f,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(f,this.distance,v,-1,-1,!1)):"round"===C&&(_||(this.addCurrentVertex(f,this.distance,m,0,0,!1),this.addCurrentVertex(f,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(f,this.distance,v,-1,-1,!0),this.addCurrentVertex(f,this.distance,v,0,0,!1)));if(T&&w2*o){var B=f.add(p.sub(f)._mult(o/N)._round());this.distance+=B.dist(f),this.addCurrentVertex(B,this.distance,v.mult(1),0,0,!1),f=B}}_=!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],c=l.layoutVertexArray,h=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(c,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&h.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(c,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&h.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>u/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":435,"../bucket":322,"../load_geometry":330}],326:[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"),m=t("../../util/util"),v=t("../load_geometry"),g=t("../../symbol/collision_feature"),y=h.shapeText,b=h.shapeIcon,x=c.getGlyphQuads,_=c.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,n.prototype=m.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"}]),k=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: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"}])}},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*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,g=24*a["text-letter-spacing"],x=[24*a["text-offset"][0],24*a["text-offset"][1]],_=this.fontstack=a["text-font"].join(","),M=[],k=0;kw||L.y<0||L.y>w);if(!d||C){var z=C||x;this.addSymbolInstance(L,T,e,r,this.layer,z,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,u,m,y,h,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 v=p.tl,g=p.tr,y=p.bl,b=p.br,x=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 k=Math.round(p.glyphAngle/(2*Math.PI)*256),A=i(c,_.x,_.y,v.x,v.y,x.x,x.y,w,M,f,k);i(c,_.x,_.y,g.x,g.y,x.x+x.w,x.y,w,M,f,k),i(c,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,f,k),i(c,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,f,k),u.emplaceBack(A,A+1,A+2),u.emplaceBack(A+1,A+2,A+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rn.MAX_QUADS&&m.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),A>n.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(I,P,O,j,k,A,T,S,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":384,"../../symbol/clip_line":386,"../../symbol/collision_feature":388,"../../symbol/get_anchors":390,"../../symbol/mergelines":393,"../../symbol/quads":394,"../../symbol/resolve_text":395,"../../symbol/shaping":396,"../../util/token":434,"../../util/util":435,"../bucket":322,"../load_geometry":330,"point-geometry":476}],327:[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":435,"./bucket":322,assert:43}],331:[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}}},{}],332:[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":435}],333:[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":332}],334:[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){ -return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*(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=[t.x,t.y,0,1],r=[t.x,t.y,1,1];f.transformMat4(e,e,this.pixelMatrixInverse),f.transformMat4(r,r,this.pixelMatrixInverse);var n=e[3],i=r[3],a=e[0]/n,s=r[0]/i,u=e[1]/n,c=r[1]/i,h=e[2]/n,d=r[2]/i,p=h===d?0:(0-h)/(d-h),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(a,s,p)/m,l(u,c,p)/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,m=u.x/2;p-mn&&(s=n-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),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)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":322,"../source/tile_coord":362,"../util/interpolate":429,"../util/util":435,"./coordinate":331,"./lng_lat":332,"gl-matrix":188,"point-geometry":476}],335:[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&x,65535&_)}s.uniformMatrix4fv(n.u_matrix,!1,t.transform.calculatePosMatrix(g)),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":356,"./create_uniform_pragmas":337}],339:[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":356}],343:[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,m,v,g,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),b=h.height/2*Math.tan(h._pitch),x=(y+b)/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"]),m=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,m.y),s.uniform1f(d.u_mix,_.t),s.uniform1f(d.u_extra,x),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f);else if(w){if(v=t.spriteAtlas.getPosition(w.from,!0),g=t.spriteAtlas.getPosition(w.to,!0),!v||!g)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,v.tl),s.uniform2fv(d.u_pattern_br_a,v.br),s.uniform2fv(d.u_pattern_tl_b,g.tl),s.uniform2fv(d.u_pattern_br_b,g.br),s.uniform1f(d.u_fade,w.t),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),s.uniform1f(d.u_extra,x),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,x),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":433,"../util/util":435}],345:[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,m){for(var v=0;vthis.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;this.opacities[r]=r<=t?this.changeOpacities[r]+i: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))}},{}],347:[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;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o0?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);e.blendColor(1/8,1/8,1/8,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":322,"../data/buffer":327,"../source/pixels_to_tile_units":356,"../source/source_cache":360,"../util/browser":419,"../util/struct_array":433,"../util/util":435,"./create_uniform_pragmas":337,"./draw_background":338,"./draw_circle":339,"./draw_debug":341,"./draw_fill":342,"./draw_line":343,"./draw_raster":344,"./draw_symbol":345,"./frame_history":346,"./painter/use_program":349,"./vertex_array_object":350,"gl-matrix":188}],349:[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":322,"../util/evented":427,"../util/util":435,"resolve-url":493}],352:[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){if(r)return e(r);this._geoJSONIndexes[t.source]=n,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":418,"../util/util":435,"./geojson_wrapper":353,"./vector_tile_worker_source":364,"geojson-rewind":134,"geojson-vt":138,supercluster:521,"vt-pbf":548}],353:[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;this._cache.setMaxSize(Math.floor(5*n))},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[g]=!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 b=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&&g[1].y>=0){for(var y=[],b=0;b=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)<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":427,"../util/mapbox":432,"../util/util":435,"./load_tilejson":355}],364:[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":418,"./worker_tile":367,pbf:470,"vector-tile":542}],365:[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=new h;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new f(e.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":322,"../data/buffer":327,"../geo/lng_lat":332,"../render/draw_raster":344,"../render/vertex_array_object":350,"../util/ajax":418,"../util/evented":427,"../util/util":435,"./tile_coord":362,"point-geometry":476}],366:[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--)b(E,P[e]);x()}}function b(t,e){if(e.populateArrays(A,R,F),"symbol"!==e.type)for(var r=0;r=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(k=c.create({layer:w,index:z++,childLayers:e[D],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:S.encode(w.sourceLayer||"_geojsonTileLayer")}),k.createFilter(),L[w.id]=k,t.layers&&(M=w.sourceLayer,C[M]=C[M]||{},C[M][w.id]=k)));if(t.layers)for(M in C)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])&&g(w,C[M]);else g(t,L);var I=[],P=this.symbolBuckets=[],O=[];T.bucketLayerIDs={};for(var j in L)k=L[j],0!==k.features.length&&(T.bucketLayerIDs[k.index]=k.childLayers.map(s),I.push(k),"symbol"===k.type?P.push(k):O.push(k));var F={},R={},N=0;if(P.length>0){for(_=P.length-1;_>=0;_--)P[_].updateIcons(F),P[_].updateFont(R);for(var B in R)R[B]=Object.keys(R[B]).map(Number);F=Object.keys(F),r.send("get glyphs",{uid:this.uid,stacks:R},function(t,e){R=e,y(t)}),F.length?r.send("get icons",{icons:F},function(t,e){F=e,y(t)}):y()}for(_=O.length-1;_>=0;_--)b(this,O[_]);if(0===P.length)return x()},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":322,"../data/feature_index":329,"../symbol/collision_box":387,"../symbol/collision_tile":389,"../symbol/symbol_instances":398,"../symbol/symbol_quads":399,"../util/dictionary_coder":425,"../util/util":435}],368:[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})}},{}],369:[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){if(t)return void this.fire("error",{error:t});this.data=e,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":418,"../util/browser":419,"../util/evented":427,"../util/mapbox":432}],370:[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":435,"./style_function":373,csscolorparser:104}],371:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new m,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(!v.emitErrors(this,v(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"),m=t("./animation_loop"),v=t("./validate_style"),g=t("../source/source"),y=t("../source/query_features"),b=t("../source/source_cache"),x=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&&this._handleErrors(v.source,"sources."+t,e)?this:(e=new b(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(v.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(v.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);return i.setPaintProperty(e,r,n),!(r&&_.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property)&&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:1,t:n}}}var a=t("./style_function"),o=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":435,"./parse_color":370,"./style_function":373}],373:[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":295}],374:[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;n.create=function(e,r){return new({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")}[(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,"-transition"))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,"-transition")?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){return this._paintTransitions[t].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<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},{}],386:[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":476}],387:[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":433,"../util/util":435,"point-geometry":476}],388:[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 m=f-h,v=p-d;if(m>0)if(m=Math.max(10*s,m),c){var g=e[r.segment+1].sub(e[r.segment])._unit()._mult(v),y=[r.sub(g),r.add(g)];this._addLineCollisionBoxes(t,y,r,0,v,m,n,i,a)}else this._addLineCollisionBoxes(t,e,r,r.segment,v,m,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,m=h;do{if(--p<0)return f;m-=e[p].dist(d),d=e[p]}while(m>-i/2);for(var v=e[p].dist(e[p+1]),g=0;g=e.length)return f;v=e[p].dist(e[p+1])}var b=y-m,x=e[p],_=e[p+1],w=_.sub(x)._unit()._mult(b)._add(x)._round(),M=Math.max(Math.abs(y-h)-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 f}},{}],389:[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();r.emplaceBack(0,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(a,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-32767,0,32767,0,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,a,-32767,0,32767,0,32767,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),k=new i(u.x2,u.y1).matMult(w),A=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,k.x,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=u.maxScale}else _=u;for(var S=0;S=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]),m=0;m=a&&(o[y][b]=!0,s.push(d[v]))}}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&&A=0&&T=0&&g+d<=p){var S=new o(A,T,M,b)._round();n&&!s(t,S,u,n,l)||y.push(S)}}v+=w}return h||y.length||c||(y=i(t,v/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":384,"../util/interpolate":429,"./check_max_angle":385}],391:[function(t,e,r){"use strict";function n(){this.width=o,this.height=o,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=128;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=o+2,u=s+2;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var h=this.data,f=r.bitmap,d=0;d=2048||e>=2048)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=4,this.height*=4,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 x=g[c+1].x;v=Math.max(x,v);for(var _=c+1;_<=y;_++)g[_].y+=r,g[_].x-=x;if(o){var w=c;h[g[c].codePoint]&&w--,s(g,e,p,w,o)}p=c+1,c=null,d+=x,m++}f[b.codePoint]&&(c=y)}var M=g[g.length-1],k=M.x+e[M.codePoint].advance;v=Math.max(v,k);var A=(m+1)*r;s(g,e,p,g.length-1,o),l(g,o,i,a,v,r,m,u),t.top+=-a*A,t.bottom=t.top+A,t.left+=-i*v,t.right=t.left+v}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,g("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){n.mousePos(b,t).equals(_)&&g("click",t)}function m(t){g("dblclick",t),t.preventDefault()}function v(t){x=t,t.preventDefault()}function g(e,r){var i=n.mousePos(b,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var a=n.touchPos(b,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 b=t.getCanvasContainer(),x=null,_=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();b.addEventListener("mouseout",r,!1),b.addEventListener("mousedown",o,!1),b.addEventListener("mouseup",s,!1),b.addEventListener("mousemove",l,!1),b.addEventListener("touchstart",u,!1),b.addEventListener("touchend",h,!1),b.addEventListener("touchmove",c,!1),b.addEventListener("touchcancel",f,!1),b.addEventListener("click",p,!1),b.addEventListener("dblclick",m,!1),b.addEventListener("contextmenu",v,!1)}},{"../util/dom":421,"./handler/box_zoom":406,"./handler/dblclick_zoom":407,"./handler/drag_pan":408,"./handler/drag_rotate":409,"./handler/keyboard":410,"./handler/scroll_zoom":411,"./handler/touch_zoom_rotate":412,"point-geometry":476}],401:[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&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var b=c.zoomScale(v-f),x=c.point,_="center"in t?c.project(m).sub(h.div(b)):x,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/b,T=_.sub(x).mag();if("minZoom"in t){var S=n.clamp(Math.min(t.minZoom,f,v),c.minZoom,c.maxZoom),E=k/c.zoomScale(S-f);M=Math.sqrt(E/T*2)}var L=M*M,C=r(0),z=function(t){return s(C)/s(C+M*t)},D=function(t){return k*((s(C)*u(C+M*t)-a(C))/L)/T},I=(r(1)-C)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var P=A=0)return!1;return!0}),e.join(" | ")},n.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e=this._container=a.create("div","mapboxgl-ctrl-attrib",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)),e},_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":421,"../../util/util":435,"./control":403}],403:[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":427,"../../util/util":435}],404:[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=this._container=o.create("div","mapboxgl-ctrl-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),e):e},_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":419,"../../util/dom":421,"../../util/util":435,"./control":403}],405:[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":421,"../../util/util":435,"./control":403}],406:[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":333,"../../util/dom":421,"../../util/util":435}],407:[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)}}},{}],408:[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=a.bezier(0,0,.3,1);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]),s=(n[0]-i[0])/1e3;if(0===s||n[1].equals(i[1]))return void e();var l=a.mult(.3/s),u=l.mag();u>1400&&(u=1400,l._unit()._mult(u));var c=u/750,h=l.mult(-c/2);this._map.panBy(h,{duration:1e3*c,easing:o,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;return"mousemove"===t.type?t.buttons&!1:0!==t.button},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":421,"../../util/util":435}],409:[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=o.bezier(0,0,.25,1);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);e.mag()<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)180&&(d=180);var p=d/180;u+=h*d*(p/2),Math.abs(e._normalizeBearing(u,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();t.length>0&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":421,"../../util/util":435,"point-geometry":476}],410:[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;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()-2},r):(t.preventDefault(),e.panBy([-80,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+2},r):(t.preventDefault(),e.panBy([80,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+5},r):(t.preventDefault(),e.panBy([0,-80],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-5,0)},r):(t.preventDefault(),e.panBy([0,80],r))}}}}},{}],411:[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":419,"../../util/dom":421,"../../util/util":435}],412:[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=a.bezier(0,0,.15,1);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 c=Math.abs(1-o)>.15;Math.abs(s)>4?this._gestureIntent="rotate":c&&(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]),s=r.transform.scaleZoom(this._startScale*i[1]),l=a-s,u=(n[0]-i[0])/1e3,c=n[2];if(0===u||a===s)return void r.snapToNorth({},{originalEvent:t});var h=.15*l/u;Math.abs(h)>2.5&&(h=h>0?2.5:-2.5);var f=1e3*Math.abs(h/(12*.15)),d=a+h*f/2e3;d<0&&(d=0),r.easeTo({zoom:d,duration:f,easing:o,around:r.unproject(c)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>2&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":421,"../../util/util":435}],413:[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":435}],414:[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"),m=t("./bind_handlers"),v=t("./camera"),g=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),b=t("point-geometry"),x=t("./control/attribution"),_={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:20,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)},w=e.exports=function(t){if(t=a.extend({},_,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)),void 0!==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 x(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(w.prototype,l),a.extend(w.prototype,v.prototype),a.extend(w.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 b(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new b(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new b(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?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=20)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 20, inclusive")},project:function(t){return this.transform.locationPoint(g.convert(t))},unproject:function(t){return this.transform.pointLocation(b.convert(t))},queryRenderedFeatures:function(){var t,e={};return 2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length&&function(t){return t instanceof b||Array.isArray(t)}(arguments[0])?t=arguments[0]:1===arguments.length&&(e=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(t),e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[b.convert([0,0]),b.convert([this.transform.width,this.transform.height])]);var e;if(t instanceof b||"number"==typeof t[0])e=[b.convert(t)];else{var r=[b.convert(t[0]),b.convert(t[1])];e=[r[0],new b(r[1].x,r[0].y),r[1],new b(r[0].x,r[1].y),r[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?(this.style=t instanceof c?t: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});if(!t)return void this.fire("error",{error:new Error("Failed to initialize WebGL")});this.painter=new f(t,this.transform)},_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),void 0!==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(w.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":332,"../geo/lng_lat_bounds":333,"../geo/transform":334,"../render/painter":348,"../style/animation_loop":368,"../style/style":371,"../util/browser":419,"../util/canvas":420,"../util/dom":421,"../util/evented":427,"../util/util":435,"./bind_handlers":400,"./camera":401,"./control/attribution":402,"./hash":413,"point-geometry":476}],415:[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":332,"../util/dom":421,"point-geometry":476}],416:[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))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":332,"../util/dom":421,"../util/evented":427,"../util/util":435}],417:[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(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if(void 0!==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)}},{}],418:[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":320}],420:[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":435,"mapbox-gl-supported":320}],421:[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}},{}],431:[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}},{}],432:[function(t,e,r){"use strict";function n(t,e,r){if(!(r=r||o.ACCESS_TOKEN)&&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){return"mapbox:"!==l.parse(t).protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox://"+r.pathname.split("/")[1]+"/{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;if("mapbox:"!==l.parse(e).protocol)return t;var i=s.supportsWebp?".webp":"$1",o=s.devicePixelRatio>=2||512===r?"@2x":"";return l.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,o+i),query:a(n.query)})}},{"./browser":419,"./config":424,"./util":435,url:537}],433:[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(v[n])return v[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,g=["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 m),g.indexOf(r.type)<0&&g.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":331,unitbezier:536}],436:[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}}},{}],437:[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:["#USER","/"],_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"}},{}],438:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;iv[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":440,"gl-mat4/clone":170,"gl-mat4/create":171,"gl-mat4/determinant":172,"gl-mat4/invert":176,"gl-mat4/transpose":186,"gl-vec3/cross":267,"gl-vec3/dot":268,"gl-vec3/length":269,"gl-vec3/normalize":271}],440:[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}},{}],441:[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":172,"gl-vec3/lerp":270,"mat4-decompose":439,"mat4-recompose":442,"quat-slerp":481}],442:[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":171,"gl-mat4/fromRotationTranslation":174,"gl-mat4/identity":175,"gl-mat4/multiply":178,"gl-mat4/scale":184,"gl-mat4/translate":185}],443:[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){return t=t||{},new n(t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}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 m=n.prototype;m.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 m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[9],d(m,m);var v=this.computedInverse;s(v,n);var g=this.computedEye,y=v[15];g[0]=v[12]/y,g[1]=v[13]/y,g[2]=v[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=g[u]-n[2+4*u]*x}},m.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":500}],445:[function(t,e,r){"use strict";function n(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==v.alt,v.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==v.shift,v.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==v.control,v.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==v.meta,v.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!==d||a!==p||o!==m||r(n))&&(d=0|t,p=a||0,m=o||0,e&&e(d,p,m,v))}function a(t){n(0,t)}function o(){(d||p||m||v.shift||v.alt||v.meta||v.control)&&(p=m=0,d=0,v.shift=v.alt=v.control=v.meta=!1,e&&e(0,0,0,v))}function s(t){r(t)&&e&&e(d,p,m,v)}function l(t){0===i.buttons(t)?n(0,t):n(d,t)}function u(t){n(d|i.buttons(t),t)}function c(t){n(d&~i.buttons(t),t)}function h(){g||(g=!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)))}function f(){g&&(g=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",u),t.removeEventListener("mouseup",c),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))}e||(e=t,t=window);var d=0,p=0,m=0,v={shift:!1,alt:!1,control:!1,meta:!1},g=!1;h();var y={element:t};return Object.defineProperties(y,{enabled:{get:function(){return g},set:function(t){t?h():f()},enumerable:!0},buttons:{get:function(){return d},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return m},enumerable:!0},mods:{get:function(){return v},enumerable:!0}}),y}e.exports=n;var i=t("mouse-event")},{"mouse-event":447}],446:[function(t,e,r){function n(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var n=t.clientX||0,a=t.clientY||0,o=i(e);return r[0]=n-o.left,r[1]=a-o.top,r}function i(t){return t===window||t===document||t===document.body?a:t.getBoundingClientRect()}var a={left:0,top:0};e.exports=n},{}],447:[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&m)x.push(w+"["+T+"+"+v(_)+"]");x.push(g(0));for(var _=0;_0){",f(x[t]),"=1;"),P(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),N.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)Y.push(o(x[U]));N.push(A+"=("+Y.join("*")+")|0",M+"=mallocUint32("+A+")",w+"=mallocUint32("+A+")",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 b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",M="P",k="N",A="Q",T="X",S="T"},{"typedarray-pool":533}],450:[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":109}],451:[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"),o.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.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?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),m=s.slice();e[l]<0?(p[c]="s["+c+"]-2",m[c]="0"):(p[c]="s["+c+"]-1",m[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",m.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",m.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}(p)}}a.push("return dst;};return gradient");for(var m=["diff","zero"],v=[h,f],o=1;o<=i;++o)m.push("grad"+o),v.push(n(o));m.push(a.join(""));var g=Function.apply(void 0,m),r=g.apply(void 0,v);return l[e]=r,r}function a(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?o(e.dimension,r):o(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n>",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":106}],455:[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":456,ndarray:460}],456:[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":106}],457:[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&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++A;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"+ ++A;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 m(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 g(t,e){m(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",++A,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].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)),k=n(e),A=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 S=[],E=1;E1?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){"),m("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{"),g("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){"),m("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){"),m("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&&k){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,k[0],k[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",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&&(m>0?l.push(["e",d,"=s",d,"-e",m,"*n",m,",f",d,"=",h[d],"-f",m,"*n",m].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),m=d)}r.push("var "+l.join(","));var g=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",u,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n")),b=a(t,e);return y(b,o(t,e,b))}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":533}],458:[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":457}],459:[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":109,"ndarray-linear-interpolate":453}],460:[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+"]"}),m=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(",")+","+m.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(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":120}],462:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa)for(var x=i[u],_=1/Math.sqrt(v*y),b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(g[w]*m[M]-g[M]*m[w])}}for(var o=0;oa)for(var _=1/Math.sqrt(k),b=0;b<3;++b)x[b]*=_;else for(var b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(var u=0;u<3;++u)f[u]*=d;i[o]=f}return i}},{}],463:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=n(t),u=1;u0){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},{}],465:[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 m=a[2],v=a[6],g=a[10],y=m*o+v*s+g*l,b=m*c+v*h+g*f;m-=y*o+b*c,v-=y*s+b*h,g-=y*l+b*f;var x=n(m,v,g);m/=x,v/=x,g/=x;var _=c*e+o*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+i),this.radius.set(t,Math.log(k))},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],m=o[10],v=e*s+r*c,g=e*l+r*h,y=e*u+r*f,b=-(p*y-m*g),x=-(m*v-d*y),_=-(d*g-p*v),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var k=this.computedRotation,A=k[0],T=k[1],S=k[2],E=k[3],L=A*w+E*b+T*_-S*x,C=T*w+E*x+S*b-A*_,z=S*w+E*_+A*x-T*b,D=E*w-A*b-T*x-S*_;if(a){b=d,x=p,_=m;var I=Math.sin(a)/n(b,x,_);b*=I,x*=I,_*=I,w=Math.cos(e),L=L*w+D*b+C*_-z*x,C=C*w+D*x+z*b-L*_,z=z*w+D*_+L*x-C*b,D=D*w-L*b-C*x-z*_}var P=i(L,C,z,D);P>1e-6?(L/=P,C/=P,z/=P,D/=P):(L=C=z=0,D=1),this.rotation.set(t,L,C,z,D)},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":464,"filtered-vector":129,"gl-mat4/fromQuat":173,"gl-mat4/invert":176,"gl-mat4/lookAt":177}],466:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":492}],467:[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}},{}],468:[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)+4294967296*this.buf.readUInt32LE(this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+4294967296*this.buf.readInt32LE(this.pos+4);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)return void a(t,this);this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=v.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,m,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":469}],471:[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||[];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":286,"typedarray-pool":533}],473:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var h=0;h<2;++h)for(var f=s[h][n],d=0;d0&&(o=p,l=m,u=h)}return a?l:(o&&r(o,u),l)}for(var a=0|e.length,o=t.length,s=[new Array(a),new Array(a)],l=0;l0;){var d=(s[0][l].length,function(t,a){var o=s[a][t][0],l=[t];r(o,a);for(var u=o[1^a];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],h=t,f=l[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;l.push(t),u=n(c,h)}return l}(l,h));!function(t,e){return e[1]===e[e.length-1]}(f,d)?(f.length>0&&c.push(f),f=d):f.push.apply(f,d)}f.length>0&&c.push(f)}return c}e.exports=n;var i=t("compare-angle")},{"compare-angle":96}],474:[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=D[U];h(V,function(t,e){return t-e});var q,H=V.length,G=B[U];if(0===G){var T=g[U];q=[T]}for(var v=0;v=0)&&(B[Y]=1^G,N.push(Y),0===G)){var T=g[Y];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":474,"edges-to-adjacency-list":123,"planar-dual":473,"point-in-big-polygon":477,"robust-sum":505,"two-product":531,uniq:535}],476:[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}},{}],477:[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?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p)):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(_<0)_=0,f>=0?(x=0,y=p):-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p}else{var M,k,A,T;x<0?(M=c+f,k=h+d,k>M?(A=k-M,T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(x=0,k<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):_<0?(M=c+d,k=u+f,k>M?(A=k-M,T=u-2*c+h,A>=T?(_=1,x=0,y=h+2*d+p):(_=A/T,x=1-_,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(_=0,k<=0?(x=1,y=u+2*f+p):f>=0?(x=0,y=p):(x=-f/u,y=f*x+p))):(A=h+d-c-f,A<=0?(x=0,_=1,y=h+2*d+p):(T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)))}for(var S=1-x-_,l=0;l1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(I,"."),n+o(t.split("."),e).join(".")}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?j(t/S):t>>1,t+=j(t/e);t>O*A>>1;n+=M)t=j(t/O);return j(n+(O+1)*t/(t+T))}function d(t){var e,r,n,i,o,s,l,h,d,p,m=[],v=t.length,g=0,y=L,b=E;for(r=t.lastIndexOf(C),r<0&&(r=0),n=0;n=128&&a("not-basic"),m.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=v&&a("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>j((w-g)/s))&&a("overflow"),g+=h*s,d=l<=b?k:l>=b+A?A:l-b,!(hj(w/p)&&a("overflow"),s*=p;e=m.length+1,b=f(g-o,e,0==o),j(g/e)>w-y&&a("overflow"),y+=j(g/e),g%=e,m.splice(g++,0,y)}return u(m)}function p(t){var e,r,n,i,o,s,u,c,d,p,m,v,g,y,b,x=[];for(t=l(t),v=t.length,e=L,r=0,o=E,s=0;s=e&&mj((w-r)/g)&&a("overflow"),r+=(u-e)*g,e=u,s=0;sw&&a("overflow"),m==e){for(c=r,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,j=Math.floor,F=String.fromCharCode;if(x={version:"1.4.1",ucs2:{decode:l,encode:u},decode:d,encode:p,toASCII:v,toUnicode:m},"function"==typeof t&&"object"==typeof t.amd&&t.amd)t("punycode",function(){return x});else if(g&&y)if(r.exports==g)y.exports=x;else for(_ in x)x.hasOwnProperty(_)&&(g[_]=x[_]);else i.punycode=x}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],481:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":226}],482:[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;t=t.split(e);var s=1e3;a&&"number"==typeof a.maxKeys&&(s=a.maxKeys);var l=t.length;s>0&&l>s&&(l=s);for(var u=0;u=0?(c=p.substr(0,m),h=p.substr(m+1)):(c=p,h=""),f=decodeURIComponent(c),d=decodeURIComponent(h),n(o,f)?i(o[f])?o[f].push(d):o[f]=[o[f],d]:o[f]=d}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],483:[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);n(t,e,Math.max(r,Math.floor(e-u*h/l+f)),Math.min(o,Math.floor(e+(l-u)*h/l+f)),s)}var d=t[e],p=r,m=o;for(i(t,r,e),s(t[o],d)>0&&i(t,r,o);p0;)m--}0===s(t[r],d)?i(t,r,m):(m++,i(t,m,o)),m<=e&&(r=m+1),e<=m&&(o=m-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},{}],486:[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":81,"compare-cell":97,"compare-oriented-cell":98}],491:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?r.exports=i():"function"==typeof t&&t.amd?t(i):e.createREGL=i()}(this,function(){"use strict";function t(t){return"undefined"!=typeof btoa?btoa(t):"base64:"+t}function e(t){var e=new Error("(regl) "+t);throw console.error(e),e}function r(t,r){t||e(r)}function n(t){return t?": "+t:""}function i(t,r,i){t in r||e("unknown parameter ("+t+")"+n(i)+". possible values: "+Object.keys(r).join())}function a(t,r){Qt(t)||e("invalid parameter type"+n(r)+". must be a typed array")}function o(t,r,i){typeof t!==r&&e("invalid parameter type"+n(i)+". expected "+r+", got "+typeof t)}function s(t,r){t>=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")}function l(t,r,i){r.indexOf(t)<0&&e("invalid value"+n(i)+". must be one of: "+r)}function u(t){Object.keys(t).forEach(function(t){te.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+te)})}function c(t,e){for(t+="";t.length0&&e.push(new d("unknown",0,t))}}),e}function y(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}function b(t,e,n,i,a){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(e),s=i===t.FRAGMENT_SHADER?"fragment":"vertex";T(n,"string",s+" shader source must be a string",a);var l=v(n,a),u=g(o);y(l,u),Object.keys(l).forEach(function(t){function e(t,e){n.push(t),i.push(e||"")}var r=l[t];if(r.hasErrors){var n=[""],i=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var i=n.message,a=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(i);if(a){var o=a[1];switch(i=a[2],o){case"assign":o="="}r=Math.max(t.line.indexOf(o,r),0)}else r=0;e(c("| ",6)),e(c("^^^",r+3)+"\n","font-weight:bold"),e(c("| ",6)),e(i+"\n","font-weight:bold")}),e(c("| ",6)+"\n")}else e(c(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(i[0]=n.join("%c"),console.log.apply(console,i)):console.log(n.join(""))}}),r.raise("Error compiling "+s+" shader, "+l[0].name)}}function x(t,e,n,i,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=v(n,a),l=v(i,a),u='Error linking program with vertex shader, "'+l[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+o),r.raise(u)}}function _(t){t._commandRef=p()}function w(t,e,r,n){function i(t){return t?n.id(t):0}function a(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}_(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var o=t._uniformSet={};a(o,e.static),a(o,e.dynamic);var s=t._attributeSet={};a(s,r.static),a(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function M(t,r){var n=m();e(t+" in command "+(r||p())+("unknown"===n?"":" called from "+n))}function k(t,e,r){t||M(e,r||p())}function A(t,e,r,i){t in e||M("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),i||p())}function T(t,e,r,i){typeof t!==e&&M("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,i||p())}function S(t){t()}function E(t,e,r){t.texture?l(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):l(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}function L(t,e){return t===ue||t===le||t===ce?2:t===he?4:fe[t]*e}function C(t){return!(t&t-1||!t)}function z(t,e,n){var i,a=e.width,o=e.height,s=e.channels;r(a>0&&a<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ee&&t.wrapT===ee||r(C(a)&&C(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==a&&1!==o&&r(t.minFilter!==ne&&t.minFilter!==ae&&t.minFilter!==ie&&t.minFilter!==oe,"min filter requires mipmap"):(r(C(a)&&C(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(a<<1)-1,"missing or incomplete mipmap data")),e.type===se&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===re&&t.magFilter===re,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(i=0;i<16;++i)if(l[i]){var u=a>>i,c=o>>i;r(e.mipmask&1<0&&a<=i.maxTextureSize&&o>0&&o<=i.maxTextureSize,"invalid texture shape"),r(a===o,"cube map must be square"),r(e.wrapS===ee&&e.wrapT===ee,"wrap mode not supported by cube map");for(var l=0;l>h,p=o>>h;r(u.mipmask&1<1&&e===r&&('"'===e||"'"===e))return['"'+P(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return O(t.substr(0,n.index)).concat(O(n[1])).concat(O(t.substr(n.index+n[0].length)));var i=t.split(".");if(1===i.length)return['"'+P(t)+'"'];for(var a=[],o=0;o0,"invalid pixel ratio"))):de.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!i){if(!n){de("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=U(r||document.body,h,u);if(!d)return null;n=d.canvas,f=d.onDestroy}i=V(n,o)}return i?{gl:i,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:u,profile:c,onDone:h,onDestroy:f}:(f(),h("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function W(t,e){function r(e){de.type(e,"string","extension name must be string");var r,i=e.toLowerCase();try{r=n[i]=t.getExtension(i)}catch(t){}return!!r}for(var n={},i=0;i65535)<<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)|t>>1}function $(t){var e=K(t),r=Ee[Q(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function tt(t){Ee[Q(t.byteLength)>>2].push(t)}function et(t,e){var r=null;switch(t){case _e:r=new Int8Array($(e),0,e);break;case we:r=new Uint8Array($(e),0,e);break;case Me:r=new Int16Array($(2*e),0,e);break;case ke:r=new Uint16Array($(2*e),0,e);break;case Ae:r=new Int32Array($(4*e),0,e);break;case Te:r=new Uint32Array($(4*e),0,e);break;case Se:r=new Float32Array($(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r}function rt(t){tt(t.buffer)}function nt(t,e,r){for(var n=0;n0){var l;if(Array.isArray(e[0])){s=Pe(e);for(var u=1,c=1;c0)if("number"==typeof t[0]){var i=Le.allocType(p.dtype,t.length);ct(i,t),h(i,n),Le.freeType(i)}else if(Array.isArray(t[0])||Qt(t[0])){r=Pe(t);var a=Ie(t,r,p.dtype);h(a,n),Le.freeType(a)}else de.raise("invalid buffer data")}else if(Qt(t))h(t,n);else if(Z(t)){r=t.shape;var o=t.stride,s=0,l=0,u=0,f=0;1===r.length?(s=r[0],l=1,u=o[0],f=0):2===r.length?(s=r[0],l=r[1],u=o[0],f=o[1]):de.raise("invalid shape");var d=Array.isArray(t.data)?p.dtype:ut(t.data),m=Le.allocType(d,s*l);ht(m,t.data,s,l,u,f,t.offset),h(m,n),Le.freeType(m)}else de.raise("invalid data for buffer subdata");return c}e.bufferCount++;var p=new n(a);return f[p.id]=p,o||c(i),c._reglType="buffer",c._buffer=p,c.subdata=d,r.profile&&(c.stats=p.stats),c.destroy=function(){l(p)},c}function c(){xe(f).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}var h=0,f={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){l(this)};var d=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(f).forEach(function(e){t+=f[e].stats.size}),t}),{create:u,createStream:i,destroyStream:a,clear:function(){xe(f).forEach(l),d.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:c,_initBuffer:s}}function dt(t,e,r,n){function i(t){this.id=h++,c[this.id]=this,this.buffer=t,this.primType=qe,this.vertCount=0,this.type=0}function a(t){var e=d.pop();return e||(e=new i(r.create(null,Je,!0,!1)._buffer)),s(e,t,Ke,-1,-1,0,0),e}function o(t){d.push(t)}function s(n,i,a,o,s,l,u){if(n.buffer.bind(),i){var c=u;u||Qt(i)&&(!Z(i)||Qt(i.data))||(c=e.oes_element_index_uint?Ze:Xe),r._initBuffer(n.buffer,i,a,c,3)}else t.bufferData(Je,l,a),n.buffer.dtype=h||Ge,n.buffer.usage=a,n.buffer.dimension=3,n.buffer.byteLength=l;var h=u;if(!u){switch(n.buffer.dtype){case Ge:case He:h=Ge;break;case Xe:case Ye:h=Xe;break;case Ze:case We:h=Ze;break;default:de.raise("unsupported type for element array")}n.buffer.dtype=h}n.type=h,de(h!==Ze||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var f=s;f<0&&(f=n.buffer.byteLength,h===Xe?f>>=1:h===Ze&&(f>>=2)),n.vertCount=f;var d=o;if(o<0){d=qe;var p=n.buffer.dimension;1===p&&(d=Ue),2===p&&(d=Ve),3===p&&(d=qe)}n.primType=d}function l(t){n.elementsCount--,de(null!==t.buffer,"must not double destroy elements"),delete c[t.id],t.buffer.destroy(),t.buffer=null}function u(t,e){function a(t){if(t)if("number"==typeof t)o(t),u.primType=qe,u.vertCount=0|t,u.type=Ge;else{var e=null,r=Qe,n=-1,i=-1,l=0,c=0;Array.isArray(t)||Qt(t)||Z(t)?e=t:(de.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,de(Array.isArray(e)||Qt(e)||Z(e),"invalid data for element buffer")),"usage"in t&&(de.parameter(t.usage,De,"invalid element buffer usage"),r=De[t.usage]),"primitive"in t&&(de.parameter(t.primitive,Be,"invalid element buffer primitive"),n=Be[t.primitive]),"count"in t&&(de("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),i=0|t.count),"type"in t&&(de.parameter(t.type,f,"invalid buffer type"),c=f[t.type]),"length"in t?l=0|t.length:(l=i,c===Xe||c===Ye?l*=2:c!==Ze&&c!==We||(l*=4))),s(u,e,r,n,i,l,c)}else o(),u.primType=qe,u.vertCount=0,u.type=Ge;return a}var o=r.create(null,Je,!0),u=new i(o._buffer);return n.elementsCount++,a(t),a._reglType="elements",a._elements=u,a.subdata=function(t,e){return o.subdata(t,e),a},a.destroy=function(){l(u)},a}var c={},h=0,f={uint8:Ge,uint16:Xe};e.oes_element_index_uint&&(f.uint32=Ze),i.prototype.bind=function(){this.buffer.bind()};var d=[];return{create:u,createStream:a,destroyStream:o,getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){xe(c).forEach(l)}}}function pt(t){for(var e=Le.allocType(er,t.length),r=0;r>>31<<15,a=(n<<1>>>24)-127,o=n>>13&1023;if(a<-24)e[r]=i;else if(a<-14){var s=-14-a;e[r]=i+(o+1024>>s)}else e[r]=a>15?i+31744:i+(a+15<<10)+o}return e}function mt(t){return Array.isArray(t)||Qt(t)}function vt(t){return"[object "+t+"]"}function gt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function yt(t){return!!Array.isArray(t)&&!(0===t.length||!mt(t[0]))}function bt(t){return Object.prototype.toString.call(t)}function xt(t){return bt(t)===dn}function _t(t){return bt(t)===pn}function wt(t){return bt(t)===mn}function Mt(t){return bt(t)===vn}function kt(t){if(!t)return!1;var e=bt(t);return gn.indexOf(e)>=0||(gt(t)||yt(t)||Z(t))}function At(t){return 0|Kt[Object.prototype.toString.call(t)]}function Tt(t,e){var r=e.length;switch(t.type){case Or:case jr:case Fr:case Rr:var n=Le.allocType(t.type,r);n.set(e),t.data=n;break;case wr:t.data=pt(e);break;default:de.raise("unsupported texture type, must specify a typed array")}}function St(t,e){return Le.allocType(t.type===wr?Rr:t.type,e)}function Et(t,e){t.type===wr?(t.data=pt(e),Le.freeType(e)):t.data=e}function Lt(t,e,r,n,i,a){for(var o=t.width,s=t.height,l=t.channels,u=o*s*l,c=St(t,u),h=0,f=0;f=1;)s+=o*l*l,l/=2;return s}return o*r*n}function zt(t,e,r,n,i,a,o){function s(){this.internalformat=or,this.format=or,this.type=Or,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function u(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(de.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(de.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(de.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(de.parameter(n.colorSpace,R,"invalid colorSpace"),t.colorSpace=R[n.colorSpace]),"type"in n){var i=n.type;de(e.oes_texture_float||!("float"===i||"float32"===i),"you must enable the OES_texture_float extension in order to use floating point textures."),de(e.oes_texture_half_float||!("half float"===i||"float16"===i),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),de(e.webgl_depth_texture||!("uint16"===i||"uint32"===i||"depth stencil"===i),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(i,N,"invalid texture type"),t.type=N[i]}var a=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(de(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),a=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],de(s>0&&s<=4,"invalid number of channels"),l=!0),de(a>=0&&a<=r.maxTextureSize,"invalid width"),de(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(a=o=n.radius,de(a>=0&&a<=r.maxTextureSize,"invalid radius")),"width"in n&&(a=n.width,de(a>=0&&a<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,de(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,de(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|a,t.height=0|o,t.channels=0|s;var u=!1;if("format"in n){var c=n.format;de(e.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(c,B,"invalid texture format");var h=t.internalformat=B[c];t.format=J[h],c in N&&("type"in n||(t.type=N[c])),c in U&&(t.compressed=!0),u=!0}!l&&u?t.channels=fn[t.format]:l&&!u?t.channels!==hn[t.format]&&(t.format=t.internalformat=hn[t.channels]):u&&l&&de(t.channels===fn[t.format],"number of channels inconsistent with specified format")}}function c(e){t.pixelStorei(an,e.flipY),t.pixelStorei(on,e.premultiplyAlpha),t.pixelStorei(sn,e.colorSpace),t.pixelStorei(nn,e.unpackAlignment)}function h(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function f(t,e){var n=null;if(kt(e)?n=e:e&&(de.type(e,"object","invalid pixel data type"),u(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),kt(e.data)&&(n=e.data)),de(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){de(!n,"can not specify copy and data field for the same texture");var a=i.viewportWidth,o=i.viewportHeight;t.width=t.width||a-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,de(t.xOffset>=0&&t.xOffset=0&&t.yOffset0&&t.width<=a&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(Qt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Or||(t.type=At(n));else if(gt(n))t.channels=t.channels||4,Tt(t,n),t.alignment=1,t.needsFree=!0;else if(Z(n)){var s=n.data;Array.isArray(s)||t.type!==Or||(t.type=At(s));var l,c,h,f,d,p,m=n.shape,v=n.stride;3===m.length?(h=m[2],p=v[2]):(de(2===m.length,"invalid ndarray pixel data, must be 2 or 3D"),h=1,p=1),l=m[0],c=m[1],f=v[0],d=v[1],t.alignment=1,t.width=l,t.height=c,t.channels=h,t.format=t.internalformat=hn[h],t.needsFree=!0,Lt(t,s,f,d,p,n.offset)}else if(xt(n)||_t(n))xt(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(wt(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(Mt(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(yt(n)){var g=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=mt(n[0][0])?b||n[0][0].length:b||1;for(var x=Ce.shape(n),_=1,w=0;w=0,"oes_texture_float extension not enabled"):t.type===wr&&de(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,i){var a=e.element,o=e.data,s=e.internalformat,l=e.format,u=e.type,h=e.width,f=e.height;c(e),a?t.texImage2D(r,i,l,l,u,a):e.compressed?t.compressedTexImage2D(r,i,s,h,f,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,i,l,e.xOffset,e.yOffset,h,f,0)):t.texImage2D(r,i,l,h,f,0,l,u,o)}function p(e,r,i,a,o){var s=e.element,l=e.data,u=e.internalformat,h=e.format,f=e.type,d=e.width,p=e.height;c(e),s?t.texSubImage2D(r,o,i,a,h,f,s):e.compressed?t.compressedTexSubImage2D(r,o,i,a,u,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,i,a,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,i,a,d,p,h,f,l)}function m(){return K.pop()||new h}function v(t){t.needsFree&&Le.freeType(t.data),h.call(t),K.push(t)}function g(){s.call(this),this.genMipmaps=!1,this.mipmapHint=$r,this.mipmask=0,this.images=Array(16)}function y(t,e,r){var n=t.images[0]=m();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function b(t,e){var r=null;if(kt(e))r=t.images[0]=m(),l(r,t),f(r,e),t.mipmask=1;else if(u(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,i=0;i>=i,r.height>>=i,f(r,n[i]),t.mipmask|=1<=0&&(t.genMipmaps=!0)}if("mag"in e){var i=e.mag;de.parameter(i,j),t.magFilter=j[i]}var a=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(de.parameter(s,O),a=o=O[s]):Array.isArray(s)&&(de.parameter(s[0],O),de.parameter(s[1],O),a=O[s[0]],o=O[s[1]])}else{if("wrapS"in e){var l=e.wrapS;de.parameter(l,O),a=O[l]}if("wrapT"in e){var u=e.wrapT;de.parameter(u,O),o=O[u]}}if(t.wrapS=a,t.wrapT=o,"anisotropic"in e){var c=e.anisotropic;de("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var h=!1;switch(typeof e.mipmap){case"string":de.parameter(e.mipmap,P,"invalid mipmap hint"),t.mipmapHint=P[e.mipmap],t.genMipmaps=!0,h=!0;break;case"boolean":h=t.genMipmaps=e.mipmap;break;case"object":de(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,h=!0;break;default:de.raise("invalid mipmap type")}!h||"min"in e||(t.minFilter=Wr)}}function A(r,n){t.texParameteri(n,Gr,r.minFilter),t.texParameteri(n,Hr,r.magFilter),t.texParameteri(n,Nr,r.wrapS),t.texParameteri(n,Br,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,rn,r.anisotropic),r.genMipmaps&&(t.hint(Qr,r.mipmapHint),t.generateMipmap(n))}function T(e){s.call(this),this.mipmask=0,this.internalformat=or,this.id=$++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new M,o.profile&&(this.stats={size:0})}function S(e){t.activeTexture(un),t.bindTexture(e.target,e.texture)}function E(){var e=rt[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(nr,null)}function L(e){var r=e.texture;de(r,"must not double destroy texture");var n=e.unit,i=e.target;n>=0&&(t.activeTexture(un+n),t.bindTexture(i,null),rt[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete tt[e.id],a.textureCount--}function C(e,n){function i(t,e){var n=c.texInfo;M.call(n);var a=_();return"number"==typeof t?"number"==typeof e?y(a,0|t,0|e):y(a,0|t,0|t):t?(de.type(t,"object","invalid arguments to regl.texture"),k(n,t),b(a,t)):y(a,1,1),n.genMipmaps&&(a.mipmask=(a.width<<1)-1),c.mipmask=a.mipmask,l(c,a),de.texture2D(n,a,r),c.internalformat=a.internalformat,i.width=a.width,i.height=a.height,S(c),x(a,nr),A(n,nr),E(),w(a),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,a.width,a.height,n.genMipmaps,!1)),i.format=H[c.internalformat],i.type=G[c.type],i.mag=Y[n.magFilter],i.min=X[n.minFilter],i.wrapS=W[n.wrapS],i.wrapT=W[n.wrapT],i}function s(t,e,r,n){de(!!t,"must specify image data");var a=0|e,o=0|r,s=0|n,u=m();return l(u,c),u.width=0,u.height=0,f(u,t),u.width=u.width||(c.width>>s)-a,u.height=u.height||(c.height>>s)-o,de(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(a>=0&&o>=0&&a+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),de(c.mipmask&1<>s;++s)t.texImage2D(nr,s,c.format,n>>s,a>>s,0,c.format,c.type,null);return E(),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,n,a,!1,!1)),i}var c=new T(nr);return tt[c.id]=c,a.textureCount++,i(e,n),i.subimage=s,i.resize=u,i._reglType="texture2d",i._texture=c,o.profile&&(i.stats=c.stats),i.destroy=function(){c.decRef()},i}function z(e,n,i,s,c,h){function d(t,e,n,i,a,s){var c,h=C.texInfo;for(M.call(h),c=0;c<6;++c)z[c]=_();if("number"!=typeof t&&t)if("object"==typeof t)if(e)b(z[0],t),b(z[1],e),b(z[2],n),b(z[3],i),b(z[4],a),b(z[5],s);else if(k(h,t),u(C,t),"faces"in t){var f=t.faces;for(de(Array.isArray(f)&&6===f.length,"cube faces must be a length 6 array"),c=0;c<6;++c)de("object"==typeof f[c]&&!!f[c],"invalid input for cube map face"),l(z[c],C),b(z[c],f[c])}else for(c=0;c<6;++c)b(z[c],t);else de.raise("invalid arguments to cube map");else{var p=0|t||1;for(c=0;c<6;++c)y(z[c],p,p)}for(l(C,z[0]),h.genMipmaps?C.mipmask=(z[0].width<<1)-1:C.mipmask=z[0].mipmask,de.textureCube(C,h,z,r),C.internalformat=z[0].internalformat,d.width=z[0].width,d.height=z[0].height,S(C),c=0;c<6;++c)x(z[c],ar+c);for(A(h,ir),E(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,h.genMipmaps,!0)),d.format=H[C.internalformat],d.type=G[C.type],d.mag=Y[h.magFilter],d.min=X[h.minFilter],d.wrapS=W[h.wrapS],d.wrapT=W[h.wrapT],c=0;c<6;++c)w(z[c]);return d}function g(t,e,r,n,i){de(!!e,"must specify image data"),de("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var a=0|r,o=0|n,s=0|i,u=m();return l(u,C),u.width=0,u.height=0,f(u,e),u.width=u.width||(C.width>>s)-a,u.height=u.height||(C.height>>s)-o,de(C.type===u.type&&C.format===u.format&&C.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(a>=0&&o>=0&&a+u.width<=C.width&&o+u.height<=C.height,"texture.subimage write out of bounds"),de(C.mipmask&1<>i;++i)t.texImage2D(ar+n,i,C.format,r>>i,r>>i,0,C.format,C.type,null);return E(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,!1,!0)),d}}var C=new T(ir);tt[C.id]=C,a.cubeCount++;var z=new Array(6);return d(e,n,i,s,c,h),d.subimage=g,d.resize=L,d._reglType="textureCube",d._texture=C,o.profile&&(d.stats=C.stats),d.destroy=function(){C.decRef()},d}function D(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(ar+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);A(e.texInfo,e.target)})}var P={"don't care":$r,"dont care":$r,nice:en,fast:tn},O={repeat:Ur,clamp:Vr,mirror:qr},j={nearest:Yr,linear:Xr},F=$t({mipmap:Kr,"nearest mipmap nearest":Wr,"linear mipmap nearest":Zr,"nearest mipmap linear":Jr,"linear mipmap linear":Kr},j),R={none:0,browser:ln},N={uint8:Or,rgba4:pr,rgb565:vr,"rgb5 a1":mr},B={alpha:sr,luminance:ur,"luminance alpha":cr,rgb:lr,rgba:or,rgba4:hr,"rgb5 a1":fr,rgb565:dr},U={};e.ext_srgb&&(B.srgb=xr,B.srgba=_r),e.oes_texture_float&&(N.float32=N.float=Rr),e.oes_texture_half_float&&(N.float16=N["half float"]=wr),e.webgl_depth_texture&&($t(B,{depth:yr,"depth stencil":br}),$t(N,{uint16:jr,uint32:Fr,"depth stencil":gr})),e.webgl_compressed_texture_s3tc&&$t(U,{"rgb s3tc dxt1":Mr,"rgba s3tc dxt1":kr,"rgba s3tc dxt3":Ar,"rgba s3tc dxt5":Tr}),e.webgl_compressed_texture_atc&&$t(U,{"rgb atc":Sr,"rgba atc explicit alpha":Er,"rgba atc interpolated alpha":Lr}),e.webgl_compressed_texture_pvrtc&&$t(U,{"rgb pvrtc 4bppv1":Cr,"rgb pvrtc 2bppv1":zr,"rgba pvrtc 4bppv1":Dr,"rgba pvrtc 2bppv1":Ir}),e.webgl_compressed_texture_etc1&&(U["rgb etc1"]=Pr);var V=Array.prototype.slice.call(t.getParameter(rr));Object.keys(U).forEach(function(t){var e=U[t];V.indexOf(e)>=0&&(B[t]=e)});var q=Object.keys(B);r.textureFormats=q;var H=[];Object.keys(B).forEach(function(t){var e=B[t];H[e]=t});var G=[];Object.keys(N).forEach(function(t){var e=N[t];G[e]=t});var Y=[];Object.keys(j).forEach(function(t){var e=j[t];Y[e]=t});var X=[];Object.keys(F).forEach(function(t){var e=F[t];X[e]=t});var W=[];Object.keys(O).forEach(function(t){var e=O[t];W[e]=t});var J=q.reduce(function(t,e){var r=B[e];return r===ur||r===sr||r===ur||r===cr||r===yr||r===br?t[r]=r:r===fr||e.indexOf("rgba")>=0?t[r]=or:t[r]=lr,t},{}),K=[],Q=[],$=0,tt={},et=r.maxTextureUnits,rt=Array(et).map(function(){return null});return $t(T.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;i.unit=-1}rt[n]=e,r=n;break}r>=et&&de.raise("insufficient number of texture units"),o.profile&&a.maxTextureUnits=Sn&&e=2,"invalid shape for framebuffer"),u=D[0],d=D[1]}else"radius"in z&&(u=d=z.radius),"width"in z&&(u=z.width),"height"in z&&(d=z.height);("color"in z||"colors"in z)&&(y=z.color||z.colors,Array.isArray(y)&&de(1===y.length||o,"multiple render targets not supported")),y||("colorCount"in z&&(T=0|z.colorCount,de(T>0,"invalid color buffer count")),"colorTexture"in z&&(b=!!z.colorTexture,x="rgba4"),"colorType"in z&&(A=z.colorType,b?(de(e.oes_texture_float||!("float"===A||"float32"===A),"you must enable OES_texture_float in order to use floating point framebuffer objects"),de(e.oes_texture_half_float||!("half float"===A||"float16"===A),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===A||"float16"===A?(de(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==A&&"float32"!==A||(de(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),de.oneOf(A,k,"invalid color type")),"colorFormat"in z&&(x=z.colorFormat,w.indexOf(x)>=0?b=!0:M.indexOf(x)>=0?b=!1:b?de.oneOf(z.colorFormat,w,"invalid color format for texture"):de.oneOf(z.colorFormat,M,"invalid color format for renderbuffer"))),("depthTexture"in z||"depthStencilTexture"in z)&&(C=!(!z.depthTexture&&!z.depthStencilTexture),de(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in z&&("boolean"==typeof z.depth?p=z.depth:(S=z.depth,v=!1)),"stencil"in z&&("boolean"==typeof z.stencil?v=z.stencil:(E=z.stencil,p=!1)),"depthStencil"in z&&("boolean"==typeof z.depthStencil?p=v=z.depthStencil:(L=z.depthStencil,p=!1,v=!1))}else u=d=1;var I=null,P=null,O=null,j=null;if(Array.isArray(y))I=y.map(c);else if(y)I=[c(y)];else for(I=new Array(T),a=0;a=0||I[a].renderbuffer&&Bn.indexOf(I[a].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+a+" is invalid"),I[a]&&I[a].texture){var R=On[I[a].texture._texture.format]*jn[I[a].texture._texture.type];null===F?F=R:de(F===R,"all color attachments much have the same number of bits per pixel.")}return l(P,u,d),de(!P||P.texture&&P.texture._texture.format===In||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Fn,"invalid depth attachment for framebuffer object"),l(O,u,d),de(!O||O.renderbuffer&&O.renderbuffer._renderbuffer.format===Rn,"invalid stencil attachment for framebuffer object"),l(j,u,d),de(!j||j.texture&&j.texture._texture.format===Nn||j.renderbuffer&&j.renderbuffer._renderbuffer.format===Nn,"invalid depth-stencil attachment for framebuffer object"),m(s),s.width=u,s.height=d,s.colorAttachments=I,s.depthAttachment=P,s.stencilAttachment=O,s.depthStencilAttachment=j,i.color=I.map(f),i.depth=f(P),i.stencil=f(O),i.depthStencil=f(j),i.width=s.width,i.height=s.height,g(s),i}function o(t,e){de(_.next!==s,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===s.width&&n===s.height)return i;for(var a=s.colorAttachments,o=0;o=2,"invalid shape for framebuffer"),de(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&de(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(u=d.color||d.colors,Array.isArray(u)&&de(1===u.length||a,"multiple render targets not supported")),u||("colorCount"in d&&(f=0|d.colorCount,de(f>0,"invalid color buffer count")),"colorType"in d&&(de.oneOf(d.colorType,k,"invalid color type"),h=d.colorType),"colorFormat"in d&&(c=d.colorFormat,de.oneOf(d.colorFormat,w,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var m;if(u)if(Array.isArray(u))for(m=[],r=0;r0&&(s.depth=o[0].depth,s.stencil=o[0].stencil,s.depthStencil=o[0].depthStencil),o[r]?o[r](s):o[r]=y(s)}return $t(i,{width:l,height:l,color:m})}function a(t){var e,n=0|t;if(de(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===i.width)return i;var a=i.color;for(e=0;e1)for(var m=0;mt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);xe(c).forEach(e),c={},xe(h).forEach(e),h={},d.forEach(function(e){t.deleteProgram(e.program)}),d.length=0,f={},r.shaderCount=0},program:function(t,e,n){de.command(t>=0,"missing vertex shader",n),de.command(e>=0,"missing fragment shader",n);var i=f[e];i||(i=f[e]={});var a=i[t];return a||(a=new s(e,t),r.shaderCount++,l(a,n),i[t]=a,d.push(a)),a},restore:u,shader:o,frag:-1,vert:-1}}function Ft(t,e,r,n,i,a){function o(o){var s;null===e.next?(de(i.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Wn):(de(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,a.oes_texture_float?de(s===Wn||s===Jn,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):de(s===Wn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,u=0,c=n.framebufferWidth,h=n.framebufferHeight,f=null;Qt(o)?f=o:o&&(de.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,u=0|o.y,de(l>=0&&l=0&&u0&&c+l<=n.framebufferWidth,"invalid width for read pixels"),de(h>0&&h+u<=n.framebufferHeight,"invalid height for read pixels"),r();var d=c*h*4;return f||(s===Wn?f=new Uint8Array(d):s===Jn&&(f=f||new Float32Array(d))),de.isTypedArray(f,"data buffer for regl.read() must be a typedarray"),de(f.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(Zn,4),t.readPixels(l,u,c,h,Xn,s,f),f}function s(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}function l(t){return t&&"framebuffer"in t?s(t):o(t)}return l}function Rt(t){return Array.prototype.slice.call(t)}function Nt(t){return Rt(t).join("")}function Bt(){function t(t){for(var e=0;e0&&(r.push(t,"="),r.push.apply(r,Rt(arguments)),r.push(";")),t}var r=[],n=[];return $t(t,{def:e,toString:function(){return Nt([n.length>0?"var "+n+";":"",Nt(r)])}})}function r(){function t(t,e){n(t,e,"=",r.def(t,e),";")}var r=e(),n=e(),i=r.toString,a=n.toString;return $t(function(){r.apply(r,Rt(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,i){t(e,n),r(e,n,"=",i,";")},toString:function(){return i()+a()}})}function n(){var t=Nt(arguments),e=r(),n=r(),i=e.toString,a=n.toString;return $t(e,{then:function(){return e.apply(e,Rt(arguments)),this},else:function(){return n.apply(n,Rt(arguments)),this},toString:function(){var e=a();return e&&(e="else{"+e+"}"),Nt(["if(",t,"){",i(),"}",e])}})}function i(t,e){function n(){var t="a"+i.length;return i.push(t),t}var i=[];e=e||0;for(var a=0;a=1,n>=2,e)}if(r===ai){var i=t.data;return new qt(i.thisDep,i.contextDep,i.propDep,e)}return new qt(r===ii,r===ni,r===ri,e)}function Xt(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p){function m(t){return t.replace(".","_")}function v(t,e,r){var n=m(t);et.push(t),tt[n]=$[n]=!!r,rt[n]=e}function g(t,e,r){var n=m(t);et.push(t),Array.isArray(r)?($[n]=r.slice(),tt[n]=r.slice()):$[n]=tt[n]=r,nt[n]=e}function y(){var t=Bt(),r=t.link,n=t.global;t.id=ot++,t.batchId="0";var i=r(it),a=t.shared={props:"a0"};Object.keys(it).forEach(function(t){a[t]=n.def(i,".",t)}),de.optional(function(){t.CHECK=r(de),t.commandStr=de.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},at.invalidBlendCombinations=Ua});var o=t.next={},s=t.current={};Object.keys(nt).forEach(function(t){Array.isArray($[t])&&(o[t]=n.def(a.next,".",t),s[t]=n.def(a.current,".",t))});var l=t.constants={};Object.keys(at).forEach(function(t){l[t]=n.def(JSON.stringify(at[t]))}),t.invoke=function(e,n){switch(n.type){case ei:var i=["this",a.context,a.props,t.batchId];return e.def(r(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case ri:return e.def(a.props,n.data);case ni:return e.def(a.context,n.data);case ii:return e.def("this",n.data);case ai:return n.data.append(t,e),n.data.ref}},t.attribCache={};var c={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in c)return c[n];var i=u.scope[n];return i||(i=u.scope[n]=new W),c[n]=r(i)},t}function b(t){var e,r=t.static,n=t.dynamic;if(Ii in r){var i=!!r[Ii];e=Gt(function(t,e){return i}),e.enable=i}else if(Ii in n){var a=n[Ii];e=Yt(a,function(t,e){return t.invoke(e,a)})}return e}function x(t,e){var r=t.static,n=t.dynamic;if(Pi in r){var i=r[Pi];return i?(i=s.getFramebuffer(i),de.command(i,"invalid framebuffer object"),Gt(function(t,e){var r=t.link(i),n=t.shared;e.set(n.framebuffer,".next",r);var a=n.context;return e.set(a,"."+Vi,r+".width"),e.set(a,"."+qi,r+".height"),r})):Gt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Vi,n+"."+Yi),e.set(n,"."+qi,n+"."+Xi),"null"})}if(Pi in n){var a=n[Pi];return Yt(a,function(t,e){var r=t.invoke(e,a),n=t.shared,i=n.framebuffer,o=e.def(i,".getFramebuffer(",r,")");de.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(i,".next",o);var s=n.context;return e.set(s,"."+Vi,o+"?"+o+".width:"+s+"."+Yi),e.set(s,"."+qi,o+"?"+o+".height:"+s+"."+Xi),o})}return null}function _(t,e,r){function n(t){if(t in i){var n=i[t];de.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,u=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,de.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,de.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new qt(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,i=o;"width"in n||(i=e.def(r,".",Vi,"-",u));var a=s;return"height"in n||(a=e.def(r,".",qi,"-",c)),[u,c,i,a]})}if(t in a){var h=a[t],f=Yt(h,function(e,r){var n=e.invoke(r,h);de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var i=e.shared.context,a=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",i,".",Vi,"-",a,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",i,".",qi,"-",o,")");return de.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[a,o,s,l]});return e&&(f.thisDep=f.thisDep||e.thisDep,f.contextDep=f.contextDep||e.contextDep,f.propDep=f.propDep||e.propDep),f}return e?new qt(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Vi),e.def(r,".",qi)]}):null}var i=t.static,a=t.dynamic,o=n(Di);if(o){var s=o;o=new qt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+Hi,r[2]),e.set(n,"."+Gi,r[3]),r})}return{viewport:o,scissor_box:n(zi)}}function w(t){function r(t){if(t in i){var r=e.id(i[t]);de.optional(function(){c.shader(Ha[t],r,de.guessCommand())});var n=Gt(function(){return r});return n.id=r,n}if(t in a){var o=a[t];return Yt(o,function(e,r){var n=e.invoke(r,o),i=r.def(e.shared.strings,".id(",n,")");return de.optional(function(){r(e.shared.shader,".shader(",Ha[t],",",i,",",e.command,");")}),i})}return null}var n,i=t.static,a=t.dynamic,o=r(ji),s=r(Oi),l=null;return Ht(o)&&Ht(s)?(l=c.program(s.id,o.id),n=Gt(function(t,e){return t.link(l)})):n=new qt(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",ji);var i;i=s?s.append(t,e):e.def(n,".",Oi);var a=n+".program("+i+","+r;return de.optional(function(){a+=","+t.command}),e.def(a+")")}),{frag:o,vert:s,progVar:n,program:l}}function M(t,e){function r(t,r){if(t in n){var a=0|n[t];return de.command(!r||a>=0,"invalid "+t,e.commandStr),Gt(function(t,e){return r&&(t.OFFSET=a),a})}if(t in i){var s=i[t];return Yt(s,function(e,n){var i=e.invoke(n,s);return r&&(e.OFFSET=i,de.optional(function(){e.assert(n,i+">=0","invalid "+t)})),i})}return r&&o?Gt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,i=t.dynamic,o=function(){if(Fi in n){var t=n[Fi];Ut(t)?t=a.getElements(a.create(t,!0)):t&&(t=a.getElements(t),de.command(t,"invalid elements",e.commandStr));var r=Gt(function(e,r){if(t){var n=e.link(t) -;return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Fi in i){var o=i[Fi];return Yt(o,function(t,e){var r=t.shared,n=r.isBufferArgs,i=r.elements,a=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",a,")"),u=t.cond(l).then(s,"=",i,".createStream(",a,");").else(s,"=",i,".getElements(",a,");");return de.optional(function(){t.assert(u.else,"!"+a+"||"+s,"invalid elements")}),e.entry(u),e.exit(t.cond(l).then(i,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(Bi,!0);return{elements:o,primitive:function(){if(Ri in n){var t=n[Ri];return de.commandParameter(t,Be,"invalid primitve",e.commandStr),Gt(function(e,r){return Be[t]})}if(Ri in i){var r=i[Ri];return Yt(r,function(t,e){var n=t.constants.primTypes,i=t.invoke(e,r);return de.optional(function(){t.assert(e,i+" in "+n,"invalid primitive, must be one of "+Object.keys(Be))}),e.def(n,"[",i,"]")})}return o?Ht(o)?Gt(o.value?function(t,e){return e.def(t.ELEMENTS,".primType")}:function(){return Aa}):new qt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Aa)}):null}(),count:function(){if(Ni in n){var t=0|n[Ni];return de.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),Gt(function(){return t})}if(Ni in i){var r=i[Ni];return Yt(r,function(t,e){var n=t.invoke(e,r);return de.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(Ht(o)){if(o)return s?new qt(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return de.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):Gt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var a=Gt(function(){return-1});return de.optional(function(){a.MISSING=!0}),a}var l=new qt(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return de.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Ui,!1),offset:s}}function k(t,e){var r=t.static,i=t.dynamic,a={};return et.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);a[s]=Gt(function(){return o})}else if(t in i){var l=i[t];a[s]=Yt(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=m(t);switch(t){case vi:case si:case oi:case Ai:case hi:case Ci:case xi:case wi:case Mi:case pi:return o(function(r){return de.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return de.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case fi:return o(function(r){return de.commandParameter(r,Va,"invalid "+t,e.commandStr),Va[r]},function(e,r,n){var i=e.constants.compareFuncs;return de.optional(function(){e.assert(r,n+" in "+i,"invalid "+t+", must be one of "+Object.keys(Va))}),r.def(i,"[",n,"]")});case di:return o(function(t){return de.command(mt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case ci:return o(function(t){de.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,a="dstAlpha"in t?t.dstAlpha:t.dst;return de.commandParameter(r,Ba,s+".srcRGB",e.commandStr),de.commandParameter(n,Ba,s+".srcAlpha",e.commandStr),de.commandParameter(i,Ba,s+".dstRGB",e.commandStr),de.commandParameter(a,Ba,s+".dstAlpha",e.commandStr),de.command(Ua.indexOf(r+", "+i)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+i+")",e.commandStr),[Ba[r],Ba[i],Ba[n],Ba[a]]},function(e,r,n){function i(i,o){var s=r.def('"',i,o,'" in ',n,"?",n,".",i,o,":",n,".",i);return de.optional(function(){e.assert(r,s+" in "+a,"invalid "+t+"."+i+o+", must be one of "+Object.keys(Ba))}),s}var a=e.constants.blendFuncs;de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=i("src","RGB"),s=i("dst","RGB");de.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(a,"[",o,"]"),u=r.def(a,"[",i("src","Alpha"),"]");return[l,r.def(a,"[",s,"]"),u,r.def(a,"[",i("dst","Alpha"),"]")]});case ui:return o(function(r){return"string"==typeof r?(de.commandParameter(r,Z,"invalid "+t,e.commandStr),[Z[r],Z[r]]):"object"==typeof r?(de.commandParameter(r.rgb,Z,t+".rgb",e.commandStr),de.commandParameter(r.alpha,Z,t+".alpha",e.commandStr),[Z[r.rgb],Z[r.alpha]]):void de.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var i=e.constants.blendEquations,a=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return de.optional(function(){function r(t,r,n){e.assert(t,n+" in "+i,"invalid "+r+", must be one of "+Object.keys(Z))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(a,"=",o,"=",i,"[",n,"];"),s.else(a,"=",i,"[",n,".rgb];",o,"=",i,"[",n,".alpha];"),r(s),[a,o]});case li:return o(function(t){return de.command(mt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),J(4,function(e){return+t[e]})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),J(4,function(t){return e.def("+",r,"[",t,"]")})});case Ti:return o(function(t){return de.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Si:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",i=r.ref||0,a="mask"in r?r.mask:-1;return de.commandParameter(n,Va,t+".cmp",e.commandStr),de.commandType(i,"number",t+".ref",e.commandStr),de.commandType(a,"number",t+".mask",e.commandStr),[Va[n],i,a]},function(t,e,r){var n=t.constants.compareFuncs;return de.optional(function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(r+"&&typeof ",r,'==="object"'),i('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ia),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case Ei:case Li:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",i=r.zfail||"keep",a=r.zpass||"keep";return de.commandParameter(n,qa,t+".fail",e.commandStr),de.commandParameter(i,qa,t+".zfail",e.commandStr),de.commandParameter(a,qa,t+".zpass",e.commandStr),[t===Li?Sa:Ta,qa[n],qa[i],qa[a]]},function(e,r,n){function i(i){return de.optional(function(){e.assert(r,'!("'+i+'" in '+n+")||("+n+"."+i+" in "+a+")","invalid "+t+"."+i+", must be one of "+Object.keys(qa))}),r.def('"',i,'" in ',n,"?",a,"[",n,".",i,"]:",Ia)}var a=e.constants.stencilOps;return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Li?Sa:Ta,i("fail"),i("zfail"),i("zpass")]});case _i:return o(function(t){de.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return de.commandType(r,"number",s+".factor",e.commandStr),de.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case gi:return o(function(t){var r=0;return"front"===t?r=Ta:"back"===t&&(r=Sa),de.command(!!r,s,e.commandStr),r},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Ta,":",Sa)});case bi:return o(function(t){return de.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case yi:return o(function(t){return de.commandParameter(t,Ga,s,e.commandStr),Ga[t]},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Ea+":"+La)});case mi:return o(function(t){return de.command(mt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),J(4,function(t){return"!!"+r+"["+t+"]"})});case ki:return o(function(t){de.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return de.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return de.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),a}function A(t,e){var r=t.static,n=t.dynamic,i={};return Object.keys(r).forEach(function(t){var n,a=r[t];if("number"==typeof a||"boolean"==typeof a)n=Gt(function(){return a});else if("function"==typeof a){var o=a._reglType;"texture2d"===o||"textureCube"===o?n=Gt(function(t){return t.link(a)}):"framebuffer"===o||"framebufferCube"===o?(de.command(a.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=Gt(function(t){return t.link(a.color[0])})):de.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else mt(a)?n=Gt(function(e){return e.global.def("[",J(a.length,function(r){return de.command("number"==typeof a[r]||"boolean"==typeof a[r],"invalid uniform "+t,e.commandStr),a[r]}),"]")}):de.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=a,i[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];i[t]=Yt(e,function(t,r){return t.invoke(r,e)})}),i}function T(t,r){var n=t.static,a=t.dynamic,o={};return Object.keys(n).forEach(function(t){var a=n[t],s=e.id(t),l=new W;if(Ut(a))l.state=$n,l.buffer=i.getBuffer(i.create(a,Zi,!1,!0)),l.type=0;else{var u=i.getBuffer(a);if(u)l.state=$n,l.buffer=u,l.type=0;else if(de.command("object"==typeof a&&a,"invalid data for attribute "+t,r.commandStr),a.constant){var c=a.constant;l.buffer="null",l.state=ti,"number"==typeof c?l.x=c:(de.command(mt(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,r.commandStr),Kn.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',r.commandStr);var f=0|a.stride;de.command(f>=0&&f<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|a.size;de.command(!("size"in a)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!a.normalized,m=0;"type"in a&&(de.commandParameter(a.type,ze,"invalid type for attribute "+t,r.commandStr),m=ze[a.type]);var v=0|a.divisor;"divisor"in a&&(de.command(0===v||K,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),de.command(v>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),de.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(a).forEach(function(r){de.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=u,l.state=$n,l.size=d,l.normalized=p,l.type=m||u.dtype,l.offset=h,l.stride=f,l.divisor=v}}o[t]=Gt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(a).forEach(function(t){function e(e,n){function i(t){n(u[t],"=",a,".",t,"|0;")}var a=e.invoke(n,r),o=e.shared,s=o.isBufferArgs,l=o.buffer;de.optional(function(){e.assert(n,a+"&&(typeof "+a+'==="object"||typeof '+a+'==="function")&&('+s+"("+a+")||"+l+".getBuffer("+a+")||"+l+".getBuffer("+a+".buffer)||"+s+"("+a+'.buffer)||("constant" in '+a+"&&(typeof "+a+'.constant==="number"||'+o.isArrayLike+"("+a+".constant))))",'invalid dynamic attribute "'+t+'"')});var u={isStream:n.def(!1)},c=new W;c.state=$n,Object.keys(c).forEach(function(t){u[t]=n.def(""+c[t])});var h=u.buffer,f=u.type;return n("if(",s,"(",a,")){",u.isStream,"=true;",h,"=",l,".createStream(",Zi,",",a,");",f,"=",h,".dtype;","}else{",h,"=",l,".getBuffer(",a,");","if(",h,"){",f,"=",h,".dtype;",'}else if("constant" in ',a,"){",u.state,"=",ti,";","if(typeof "+a+'.constant === "number"){',u[Kn[0]],"=",a,".constant;",Kn.slice(1).map(function(t){return u[t]}).join("="),"=0;","}else{",Kn.map(function(t,e){return u[t]+"="+a+".constant.length>="+e+"?"+a+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",a,".buffer)){",h,"=",l,".createStream(",Zi,",",a,".buffer);","}else{",h,"=",l,".getBuffer(",a,".buffer);","}",f,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",h,".dtype;",u.normalized,"=!!",a,".normalized;"),i("size"),i("offset"),i("stride"),i("divisor"),n("}}"),n.exit("if(",u.isStream,"){",l,".destroyStream(",h,");","}"),u}var r=a[t];o[t]=Yt(r,e)}),o}function S(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=Gt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=Yt(e,function(t,r){return t.invoke(r,e)})}),n}function E(t,e,r,n,i){function a(t){var e=u[t];e&&(h[t]=e)}var o=t.static,s=t.dynamic;de.optional(function(){function t(t){Object.keys(t).forEach(function(t){de.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',i.commandStr)})}var e=[Pi,Oi,ji,Fi,Ri,Bi,Ni,Ui,Ii].concat(et);t(o),t(s)});var l=x(t,i),u=_(t,l,i),c=M(t,i),h=k(t,i),f=w(t,i);a(Di),a(m(zi));var d=Object.keys(h).length>0,p={framebuffer:l,draw:c,shader:f,state:h,dirty:d};return p.profile=b(t,i),p.uniforms=A(r,i),p.attributes=T(e,i),p.context=S(n,i),p}function L(t,e,r){var n=t.shared,i=n.context,a=t.scope();Object.keys(r).forEach(function(n){e.save(i,"."+n);var o=r[n];a(i,".",n,"=",o.append(t,e),";")}),e(a)}function C(t,e,r,n){var i,a=t.shared,o=a.gl,s=a.framebuffer;Q&&(i=e.def(a.extensions,".webgl_draw_buffers"));var l,u=t.constants,c=u.drawBuffer,h=u.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",Ra,",",l,".framebuffer);"),Q&&e(i,".drawBuffersWEBGL(",c,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",Ra,",null);"),Q&&e(i,".drawBuffersWEBGL(",h,");"),e("}",s,".cur=",l,";"),n||e("}")}function z(t,e,r){var n=t.shared,i=n.gl,a=t.current,o=t.next,s=n.current,l=n.next,u=t.cond(s,".dirty");et.forEach(function(e){var n=m(e);if(!(n in r.state)){var c,h;if(n in o){c=o[n],h=a[n];var f=J($[n].length,function(t){return u.def(c,"[",t,"]")});u(t.cond(f.map(function(t,e){return t+"!=="+h+"["+e+"]"}).join("||")).then(i,".",nt[n],"(",f,");",f.map(function(t,e){return h+"["+e+"]="+t}).join(";"),";"))}else{c=u.def(l,".",n);var d=t.cond(c,"!==",s,".",n);u(d),n in rt?d(t.cond(c).then(i,".enable(",rt[n],");").else(i,".disable(",rt[n],");"),s,".",n,"=",c,";"):d(i,".",nt[n],"(",c,");",s,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&u(s,".dirty=false;"),e(u)}function D(t,e,r,n){var i=t.shared,a=t.current,o=i.current,s=i.gl;Vt(Object.keys(r)).forEach(function(i){var l=r[i];if(!n||n(l)){var u=l.append(t,e);if(rt[i]){var c=rt[i];Ht(l)?u?e(s,".enable(",c,");"):e(s,".disable(",c,");"):e(t.cond(u).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(o,".",i,"=",u,";")}else if(mt(u)){var h=a[i];e(s,".",nt[i],"(",u,");",u.map(function(t,e){return h+"["+e+"]="+t}).join(";"),";")}else e(s,".",nt[i],"(",u,");",o,".",i,"=",u,";")}})}function I(t,e){K&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function P(t,e,r,n,i){function a(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){u=e.def(),t(u,"=",a(),";"),"string"==typeof i?t(p,".count+=",i,";"):t(p,".count++;"),d&&(n?(c=e.def(),t(c,"=",v,".getNumPendingQueries();")):t(v,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",a(),"-",u,";"),d&&(n?t(v,".pushScopeStats(",c,",",v,".getNumPendingQueries(),",p,");"):t(v,".endQuery();"))}function l(t){var r=e.def(m,".profile");e(m,".profile=",t,";"),e.exit(m,".profile=",r,";")}var u,c,h,f=t.shared,p=t.stats,m=f.current,v=f.timer,g=r.profile;if(g){if(Ht(g))return void(g.enable?(o(e),s(e.exit),l("true")):l("false"));h=g.append(t,e),l(h)}else h=e.def(m,".profile");var y=t.block();o(y),e("if(",h,"){",y,"}");var b=t.block();s(b),e.exit("if(",h,"){",b,"}")}function O(t,e,r,n,i){function a(t){switch(t){case ua:case da:case ga:return 2;case ca:case pa:case ya:return 3;case ha:case ma:case ba:return 4;default:return 1}}function o(r,n,i){function a(){e("if(!",c,".buffer){",l,".enableVertexAttribArray(",u,");}");var r,a=i.type;if(r=i.size?e.def(i.size,"||",n):n,e("if(",c,".type!==",a,"||",c,".size!==",r,"||",p.map(function(t){return c+"."+t+"!=="+i[t]}).join("||"),"){",l,".bindBuffer(",Zi,",",f,".buffer);",l,".vertexAttribPointer(",[u,r,a,i.normalized,i.stride,i.offset],");",c,".type=",a,";",c,".size=",r,";",p.map(function(t){return c+"."+t+"="+i[t]+";"}).join(""),"}"),K){var o=i.divisor;e("if(",c,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,o],");",c,".divisor=",o,";}")}}function o(){e("if(",c,".buffer){",l,".disableVertexAttribArray(",u,");","}if(",Kn.map(function(t,e){return c+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",u,",",d,");",Kn.map(function(t,e){return c+"."+t+"="+d[e]+";"}).join(""),"}")}var l=s.gl,u=e.def(r,".location"),c=e.def(s.attributes,"[",u,"]"),h=i.state,f=i.buffer,d=[i.x,i.y,i.z,i.w],p=["buffer","normalized","offset","stride"];h===$n?a():h===ti?o():(e("if(",h,"===",$n,"){"),a(),e("}else{"),o(),e("}"))}var s=t.shared;n.forEach(function(n){var s,l=n.name,u=r.attributes[l];if(u){if(!i(u))return;s=u.append(t,e)}else{if(!i(Ya))return;var c=t.scopeAttrib(l);de.optional(function(){t.assert(e,c+".state","missing attribute "+l)}),s={},Object.keys(new W).forEach(function(t){s[t]=e.def(c,".",t)})}o(t.link(n),a(n.info.type),s)})}function j(t,r,n,i,a){for(var o,s=t.shared,l=s.gl,u=0;u1?J(_,function(t){return c+"["+t+"]"}):c);r(");")}}function F(t,e,r,n){function i(i){var a=c[i];return a?a.contextDep&&n.contextDynamic||a.propDep?a.append(t,r):a.append(t,e):e.def(u,".",i)}function a(){function t(){r(v,".drawElementsInstancedANGLE(",[f,p,g,d+"<<(("+g+"-"+Qn+")>>1)",m],");")}function e(){r(v,".drawArraysInstancedANGLE(",[f,d,p,m],");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[f,p,g,d+"<<(("+g+"-"+Qn+")>>1)"]+");")}function e(){r(l+".drawArrays("+[f,d,p]+");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,h=function(){var i,a=c.elements,o=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(o=r),i=a.append(t,o)):i=o.def(u,".",Fi),i&&o("if("+i+")"+l+".bindBuffer("+Ji+","+i+".buffer.buffer);"),i}(),f=i(Ri),d=i(Bi),p=function(){var i,a=c.count,o=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(o=r),i=a.append(t,o),de.optional(function(){a.MISSING&&t.assert(e,"false","missing vertex count"),a.DYNAMIC&&t.assert(o,i+">=0","missing vertex count")})):(i=o.def(u,".",Ni),de.optional(function(){t.assert(o,i+">=0","missing vertex count")})),i}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var m,v;K&&(m=i(Ui),v=t.instancing);var g=h+".type",y=c.elements&&Ht(c.elements);K&&("number"!=typeof m||m>=0)?"string"==typeof m?(r("if(",m,">0){"),a(),r("}else if(",m,"<0){"),o(),r("}")):a():o()}function R(t,e,r,n,i){var a=y(),o=a.proc("body",i);return de.optional(function(){a.commandStr=e.commandStr,a.command=a.link(e.commandStr)}),K&&(a.instancing=o.def(a.shared.extensions,".angle_instanced_arrays")),t(a,o,r,n),a.compile().body}function N(t,e,r,n){I(t,e),O(t,e,r,n.attributes,function(){return!0}),j(t,e,r,n.uniforms,function(){return!0}),F(t,e,e,r)}function B(t,e){var r=t.proc("draw",1);I(t,r),L(t,r,e.context),C(t,r,e.framebuffer),z(t,r,e),D(t,r,e.state),P(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)N(t,r,e,e.shader.program);else{var i=t.global.def("{}"),a=r.def(n,".id"),o=r.def(i,"[",a,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",i,"[",a,"]=",t.link(function(r){return R(N,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function U(t,e,r,n){function i(){return!0}t.batchId="a1",I(t,e),O(t,e,r,n.attributes,i),j(t,e,r,n.uniforms,i),F(t,e,e,r)}function V(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}I(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();if(e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&L(t,c,r.context),r.needsFramebuffer&&C(t,c,r.framebuffer),D(t,c,r.state,i),r.profile&&i(r.profile)&&P(t,c,r,!1,!0),n)O(t,u,r,n.attributes,a),O(t,c,r,n.attributes,i),j(t,u,r,n.uniforms,a),j(t,c,r,n.uniforms,i),F(t,u,c,r);else{var h=t.global.def("{}"),f=r.shader.progVar.append(t,c),d=c.def(f,".id"),p=c.def(h,"[",d,"]");c(t.shared.gl,".useProgram(",f,".program);","if(!",p,"){",p,"=",h,"[",d,"]=",t.link(function(e){return R(U,t,r,e,2)}),"(",f,");}",p,".call(this,a0[",s,"],",s,");")}}function q(t,e){function r(t){return t.contextDep&&i||t.propDep}var n=t.proc("batch",2);t.batchId="0",I(t,n);var i=!1,a=!0;Object.keys(e.context).forEach(function(t){i=i||e.context[t].propDep}),i||(L(t,n,e.context),a=!1);var o=e.framebuffer,s=!1;o?(o.propDep?i=s=!0:o.contextDep&&i&&(s=!0),s||C(t,n,o)):C(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(i=!0),z(t,n,e),D(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||P(t,n,e,!1,"a1"),e.contextDep=i,e.needsContext=a,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&i||l.propDep)V(t,n,e,null);else{var u=l.append(t,n);if(n(t.shared.gl,".useProgram(",u,".program);"),e.shader.program)V(t,n,e,e.shader.program);else{var c=t.global.def("{}"),h=n.def(u,".id"),f=n.def(c,"[",h,"]");n(t.cond(f).then(f,".call(this,a0,a1);").else(f,"=",c,"[",h,"]=",t.link(function(r){return R(V,t,e,r,2)}),"(",u,");",f,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}function H(t,r){function n(e){var n=r.shader[e];n&&i.set(a.shader,"."+e,n.append(t,i))}var i=t.proc("scope",3);t.batchId="a2";var a=t.shared,o=a.current;L(t,i,r.context),r.framebuffer&&r.framebuffer.append(t,i),Vt(Object.keys(r.state)).forEach(function(e){var n=r.state[e],o=n.append(t,i);mt(o)?o.forEach(function(r,n){i.set(t.next[e],"["+n+"]",r)}):i.set(a.next,"."+e,o)}),P(t,i,r,!0,!0),[Fi,Bi,Ni,Ui,Ri].forEach(function(e){var n=r.draw[e];n&&i.set(a.draw,"."+e,""+n.append(t,i))}),Object.keys(r.uniforms).forEach(function(n){i.set(a.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,i))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,i),a=t.scopeAttrib(e);Object.keys(new W).forEach(function(t){i.set(a,"."+t,n[t])})}),n(Oi),n(ji),Object.keys(r.state).length>0&&(i(o,".dirty=true;"),i.exit(o,".dirty=true;")),i("a1(",t.shared.context,",a0,",t.batchId,");")}function G(t){if("object"==typeof t&&!mt(t)){for(var e=Object.keys(t),r=0;r=0;--t){var r=H[t];r&&r(E,null,0)}g.flush(),k&&k.update()}function r(){!J&&H.length>0&&(J=ge.next(e))}function n(){J&&(ge.cancel(e),J=null)}function i(t){t.preventDefault(),b=!0,n(),G.forEach(function(t){t()})}function a(t){g.getError(),b=!1,x.restore(),O.restore(),D.restore(),j.restore(),F.restore(),R.restore(),k&&k.restore(),N.procs.refresh(),r(),Y.forEach(function(t){t()})}function o(){H.length=0,n(),q&&(q.removeEventListener(eo,i),q.removeEventListener(ro,a)),O.clear(),R.clear(),F.clear(),j.clear(),I.clear(), -D.clear(),k&&k.clear(),Z.forEach(function(t){t()})}function s(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var i=t[n];ve.isDynamic(i)?r[n]=ve.unbox(i,n):e[n]=i}),{dynamic:r,static:e}}function r(t){for(;d.length0)return h.call(this,r(0|t),0|t)}else{if(!Array.isArray(t))return c.call(this,t);if(t.length)return h.call(this,t,t.length)}}de(!!t,"invalid args to regl({...})"),de.type(t,"object","invalid args to regl({...})");var i=e(t.context||{}),a=e(t.uniforms||{}),o=e(t.attributes||{}),s=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=$t({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),l={gpuTime:0,cpuTime:0,count:0},u=N.compile(s,o,a,i,l),c=u.draw,h=u.batch,f=u.scope,d=[];return $t(n,{stats:l})}function l(t,e){var r=0;N.procs.poll();var n=e.color;n&&(g.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=Ka),"depth"in e&&(g.clearDepth(+e.depth),r|=Qa),"stencil"in e&&(g.clearStencil(0|e.stencil),r|=$a),de(!!r,"called regl.clear with no buffer specified"),g.clear(r)}function u(t){if(de("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)K($t({framebuffer:t.framebuffer.faces[e]},t),l);else K(t,l);else l(null,t)}function c(t){function e(){function e(){var t=Zt(H,e);H[t]=H[H.length-1],H.length-=1,H.length<=0&&n()}var r=Zt(H,t);de(r>=0,"cannot cancel a frame twice"),H[r]=e}return de.type(t,"function","regl.frame() callback must be a function"),H.push(t),r(),{cancel:e}}function h(){var t=V.viewport,e=V.scissor_box;t[0]=t[1]=e[0]=e[1]=0,E.viewportWidth=E.framebufferWidth=E.drawingBufferWidth=t[2]=e[2]=g.drawingBufferWidth,E.viewportHeight=E.framebufferHeight=E.drawingBufferHeight=t[3]=e[3]=g.drawingBufferHeight}function f(){E.tick+=1,E.time=p(),h(),N.procs.poll()}function d(){h(),N.procs.refresh(),k&&k.update()}function p(){return(ye()-A)/1e3}function m(t,e){de.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return c(e);case"lost":r=G;break;case"restore":r=Y;break;case"destroy":r=Z;break;default:de.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:U,destroy:o,_gl:g,_refresh:d,poll:function(){f(),k&&k.update()},now:p,stats:w});return v.onDone(null,Q),Q}var Kt={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Qt=function(t){return Object.prototype.toString.call(t)in Kt},$t=function(t,e){for(var r=Object.keys(e),n=0;n=2,"invalid renderbuffer shape"),a=0|d[0],o=0|d[1]}else"radius"in f&&(a=o=0|f.radius),"width"in f&&(a=0|f.width),"height"in f&&(o=0|f.height);"format"in f&&(de.parameter(f.format,u,"invalid renderbuffer format"),l=u[f.format])}else"number"==typeof e?(a=0|e,o="number"==typeof n?0|n:a):e?de.raise("invalid arguments to renderbuffer constructor"):a=o=1;if(de(a>0&&o>0&&a<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),a!==h.width||o!==h.height||l!==h.format)return s.width=h.width=a,s.height=h.height=o,h.format=l,t.bindRenderbuffer(xn,h.renderbuffer),t.renderbufferStorage(xn,l,a,o),i.profile&&(h.stats.size=Dt(h.format,h.width,h.height)),s.format=c[h.format],s}function l(e,n){var a=0|e,o=0|n||a;return a===h.width&&o===h.height?s:(de(a>0&&o>0&&a<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=h.width=a,s.height=h.height=o,t.bindRenderbuffer(xn,h.renderbuffer),t.renderbufferStorage(xn,h.format,a,o),i.profile&&(h.stats.size=Dt(h.format,h.width,h.height)),s)}var h=new a(t.createRenderbuffer());return f[h.id]=h,n.renderbufferCount++,s(e,o),s.resize=l,s._reglType="renderbuffer",s._renderbuffer=h,i.profile&&(s.stats=h.stats),s.destroy=function(){h.decRef()},s}function l(){xe(f).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(xn,e.renderbuffer),t.renderbufferStorage(xn,e.format,e.width,e.height)}),t.bindRenderbuffer(xn,null)}var u={rgba4:_n,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(u.srgba=35907),e.ext_color_buffer_half_float&&(u.rgba16f=34842,u.rgb16f=34843),e.webgl_color_buffer_float&&(u.rgba32f=34836);var c=[];Object.keys(u).forEach(function(t){var e=u[t];c[e]=t});var h=0,f={};return a.prototype.decRef=function(){--this.refCount<=0&&o(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(f).forEach(function(e){t+=f[e].stats.size}),t}),{create:s,clear:function(){xe(f).forEach(o)},restore:l}},kn=36160,An=36161,Tn=3553,Sn=34069,En=36064,Ln=36096,Cn=36128,zn=33306,Dn=36053,In=6402,Pn=[6408],On=[];On[6408]=4;var jn=[];jn[5121]=1,jn[5126]=4,jn[36193]=2;var Fn=33189,Rn=36168,Nn=34041,Bn=[32854,32855,36194,35907,34842,34843,34836],Un={};Un[Dn]="complete",Un[36054]="incomplete attachment",Un[36057]="incomplete dimensions",Un[36055]="incomplete, missing attachment",Un[36061]="unsupported";var Vn=5126,qn=35632,Hn=35633,Gn=35718,Yn=35721,Xn=6408,Wn=5121,Zn=3333,Jn=5126,Kn="xyzw".split(""),Qn=5121,$n=1,ti=2,ei=0,ri=1,ni=2,ii=3,ai=4,oi="dither",si="blend.enable",li="blend.color",ui="blend.equation",ci="blend.func",hi="depth.enable",fi="depth.func",di="depth.range",pi="depth.mask",mi="colorMask",vi="cull.enable",gi="cull.face",yi="frontFace",bi="lineWidth",xi="polygonOffset.enable",_i="polygonOffset.offset",wi="sample.alpha",Mi="sample.enable",ki="sample.coverage",Ai="stencil.enable",Ti="stencil.mask",Si="stencil.func",Ei="stencil.opFront",Li="stencil.opBack",Ci="scissor.enable",zi="scissor.box",Di="viewport",Ii="profile",Pi="framebuffer",Oi="vert",ji="frag",Fi="elements",Ri="primitive",Ni="count",Bi="offset",Ui="instances",Vi=Pi+"Width",qi=Pi+"Height",Hi=Di+"Width",Gi=Di+"Height",Yi="drawingBufferWidth",Xi="drawingBufferHeight",Wi=[ci,ui,Si,Ei,Li,ki,Di,zi,_i],Zi=34962,Ji=34963,Ki=3553,Qi=34067,$i=2884,ta=3042,ea=3024,ra=2960,na=2929,ia=3089,aa=32823,oa=32926,sa=32928,la=5126,ua=35664,ca=35665,ha=35666,fa=5124,da=35667,pa=35668,ma=35669,va=35670,ga=35671,ya=35672,ba=35673,xa=35674,_a=35675,wa=35676,Ma=35678,ka=35680,Aa=4,Ta=1028,Sa=1029,Ea=2304,La=2305,Ca=32775,za=32776,Da=519,Ia=7680,Pa=0,Oa=1,ja=32774,Fa=513,Ra=36160,Na=36064,Ba={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Ua=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Va={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},qa={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Ha={frag:35632,vert:35633},Ga={cw:Ea,ccw:La},Ya=new qt(!1,!1,!1,function(){}),Xa=34918,Wa=34919,Za=35007,Ja=function(t,e){function r(){return f.pop()||h.createQueryEXT()}function n(t){f.push(t)}function i(t){var e=r();h.beginQueryEXT(Za,e),d.push(e),u(d.length-1,d.length,t)}function a(){h.endQueryEXT(Za)}function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}function s(){return p.pop()||new o}function l(t){p.push(t)}function u(t,e,r){var n=s();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,m.push(n)}function c(){var t,e,r=d.length;if(0!==r){g.length=Math.max(g.length,r+1),v.length=Math.max(v.length,r+1),v[0]=0,g[0]=0;var i=0;for(t=0,e=0;e=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},{}],493:[function(e,r,n){!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 s=new Function("det",r.join(""));return s(t<6?o[t]:o)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}var o=t("robust-determinant"),s=6,l=[i,a];!function(){for(;l.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=3.3306690738754716e-16*n;return o>=s||o<=-s?o:m(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,m=o*s,g=i*u,y=i*l,b=a*s,x=c*(d-p)+h*(m-g)+f*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(m)+Math.abs(g))*Math.abs(h)+(Math.abs(y)+Math.abs(b))*Math.abs(f),w=7.771561172376103e-16*_;return x>w||-x>w?x:v(t,e,r,n)}];!function(){for(;g.length<=p;)g.push(l(g.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&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":500}],504:[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),m=-e[h],v=f(m);p=i?(a=d,(c+=1)=i?(a=d,(c+=1)0){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})},{}],507:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],508:[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":65,"reduce-simplicial-complex":490}],509:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--n){n0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}(i[s]),l.push("break;");l.push("}}")}return l.push("}return R;};return getContour",t,"d"),new Function("pool",l.join(""))(a)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var a=t("typedarray-pool"),o=t("marching-simplex-table"),s={}},{"marching-simplex-table":438,"typedarray-pool":533}],511:[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 h(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[m],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){if(e0){var t=k[0];return a(0,T-1),T-=1,u(0),t}return-1}function f(t,e){var r=k[t];return y[r]===e?t:(y[r]=-1/0,c(t),h(),y[r]=e,T+=1,c(T-1))}function d(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 p=e.length,m=t.length,v=new Array(p),g=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var S=h();if(S<0||y[S]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=v[t],r=g[t];v[r]>=0&&(v[r]=e),g[e]>=0&&(g[e]=r),A[e]>=0&&f(A[e],i(e)),A[r]>=0&&f(A[r],i(r))}}(S)}for(var E=[],x=0;x=0&&r>=0&&e!==r){var n=A[e],i=A[r];n!==i&&L.push([n,i])}}),o.unique(o.normalize(L)),{positions:E,edges:L}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":500,"simplicial-complex":513}],516:[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":500}],517:[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":516,"binary-search-bounds":62,"functional-red-black-tree":131,"robust-orientation":500}],518:[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":497,"robust-sum":505}],519:[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,m="",v=[],g=!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])||g&&!u[3]?y="":(y=g?"+":"-",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):"",v[v.length]=u[5]?y+n+c:"0"===h?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)};void 0!==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)},{}],520:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=new Array(e),n=new Array(e),i=new Array(e),a=new Array(e),o=new Array(e),s=new Array(e),l=0;l0;){e=f[f.length-1];var d=t[e];if(a[e]=0&&s[e].push(o[m])}a[e]=p}else{if(n[e]===r[e]){for(var v=[],g=[],y=0,p=l.length-1;p>=0;--p){var b=l[p];if(i[b]=!1,v.push(b),g.push(s[b]),y+=s[b].length,o[b]=c.length,b===e){l.length=p;break}}c.push(v);for(var x=new Array(y),p=0;p=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return d(d({},t.properties),{cluster:!0,cluster_id:t.id,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 m(t){return t.y}var v=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,initial:function(){return{}},map:function(t){return t}},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(o);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=v(n,p,m,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]=v(n,p,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],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),m=new Array(r),v=new Array(r),g=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(A="+"+v[x]+"*c");var T=p[x].length/y*.5,S=.5+g[x]/y*.5;k.push("d"+x+"-"+S+"-"+T+"*("+p[x].join("+")+A+")/("+m[x].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var E=[],u=0;u<1<0&&(f+=.02);for(var p=new Float32Array(h),m=0,v=-.5*f,d=0;d=0?1.2:1))}function i(t,e,r,n,i,o,s){for(var l=0;l.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=H(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 A(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){C(t)&&(t="100%");var n=z(t);return t=q(r,H(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function E(t){return q(1,H(0,t))}function L(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&t.indexOf(".")!=-1&&1===parseFloat(t)}function z(t){return"string"==typeof t&&t.indexOf("%")!=-1}function D(t){return 1==t.length?"0"+t:""+t}function I(t){return t<=1&&(t=100*t+"%"),t}function P(t){return e.round(255*parseFloat(t)).toString(16)}function O(t){return L(t)/255}function j(t){return!!W.CSS_UNIT.exec(t)}function F(t){t=t.replace(N,"").replace(B,"").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=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:L(r[1]),g:L(r[2]),b:L(r[3]),a:O(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),a:O(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.hex3.exec(t))&&{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),format:e?"name":"hex"}}function R(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}var N=/^\s+/,B=/\s+$/,U=0,V=e.round,q=e.min,H=e.max,G=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=T(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 h(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*S(this._r,255))+"%",g:V(100*S(this._g,255))+"%",b:V(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*S(this._r,255))+"%, "+V(100*S(this._g,255))+"%, "+V(100*S(this._b,255))+"%)":"rgba("+V(100*S(this._r,255))+"%, "+V(100*S(this._g,255))+"%, "+V(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(X[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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(g,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(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(A,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)&&(r[i]="a"===i?t[i]:I(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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100;return n({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})},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=R(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"},X=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(Y),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],527:[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":467}],528:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==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))},m=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 m=d(r,p)/s,v=d(i,p)/s;u=Math.acos(m),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"),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],m=this.computedAngle[1],v=Math.cos(p),g=Math.sin(p),y=Math.cos(m),b=Math.sin(m),x=this.computedCenter,_=v*y,w=g*y,M=b,k=-v*b,A=-g*b,T=y,S=this.computedEye,E=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];E[4*o+1]=k*r[o]+A*c[o]+T*e[o],E[4*o+2]=L,E[4*o+3]=0}var C=E[1],z=E[5],D=E[9],I=E[2],P=E[6],O=E[10],j=z*O-D*P,F=D*I-C*O,R=C*P-z*I,N=n(j,F,R);j/=N,F/=N,R/=N,E[0]=j,E[4]=F,E[8]=R;for(var o=0;o<3;++o)S[o]=x[o]+E[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=E[o+4*B]*S[B];E[12+o]=-l}E[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var m=[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;m[0]=i[2],m[1]=i[6],m[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,m);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 m=c*e+o*r,v=h*e+s*r,g=f*e+l*r;this.center.move(t,m,v,g);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),m=Math.max(f,d,p);f===m?(l=l<0?-1:1,c=h=0):p===m?(h=h<0?-1:1,l=c=0):(c=c<0?-1:1,l=h=0)}else{var v=n(l,c,h);l/=v,c/=v,h/=v}var g=e[s],y=e[s+4],b=e[s+8],x=g*l+y*c+b*h;g-=l*x,y-=c*x,b-=h*x;var _=n(g,y,b);g/=_,y/=_,b/=_;var w=c*b-h*y,M=h*g-l*b,k=l*y-c*g,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,H,G,Y),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,g,y,b);var T,S;if(2===o){var E=e[1],L=e[5],C=e[9],z=E*g+L*y+C*b,D=E*w+L*M+C*k;T=j<0?-Math.PI/2:Math.PI/2,S=Math.atan2(D,z)}else{var I=e[2],P=e[6],O=e[10],j=I*l+P*c+O*h,F=I*g+P*y+O*b,R=I*w+P*M+O*k;T=Math.asin(i(j)),S=Math.atan2(R,F)}this.angle.jump(t,S,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,Y=V[14]/q,X=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*X,G-B*X,Y-U*X)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.lookAt=function(t,e,r,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,m=p[0],v=p[1],g=p[2],y=o*m+s*v+l*g;m-=y*o,v-=y*s,g-=y*l;var b=n(m,v,g);if(!(b<.01&&(m=s*f-l*h,v=l*c-o*f,g=o*h-s*c,(b=n(m,v,g))<1e-6))){m/=b,v/=b,g/=b,this.up.set(t,o,s,l),this.right.set(t,m,v,g),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*g-l*v,_=l*m-o*g,w=o*v-s*m,M=n(x,_,w);x/=M,_/=M,w/=M;var k=o*c+s*h+l*f,A=m*c+v*h+g*f,T=x*c+_*h+w*f,S=Math.asin(i(k)),E=Math.atan2(T,A),L=this.angle._state,C=L[L.length-1],z=L[L.length-2];C%=2*Math.PI;var D=Math.abs(C+2*Math.PI-E),I=Math.abs(C-E),P=Math.abs(C-2*Math.PI-E);D0?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 m(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function v(t){return new DataView(o(t),0,t)}function g(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"),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,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 m(t);case"buffer":return g(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=h,r.mallocInt32=f,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=m,r.mallocDataView=v,r.mallocBuffer=g,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":63,buffer:73,dup:121}],534:[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))}},{}],537:[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),m=["'"].concat(p),v=["%","/","?",";","#"].concat(m),g=["/","?","#"],y={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=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?z+="x":z+=C[D];if(!z.match(/^[+a-z0-9A-Z_-]{0,63}$/)){var P=E.slice(0,M),O=E.slice(M+1),j=C.match(/^([+a-z0-9A-Z_-]{0,63})(.*)$/);j&&(P.push(j[1]),O.unshift(j[2])),O.length&&(o="/"+O.join(".")+o),this.hostname=P.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),S||(this.hostname=l.toASCII(this.hostname));var F=this.port?":"+this.port:"",R=this.hostname||"";this.host=R+F,this.href+=this.host,S&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!y[d])for(var M=0,L=m.length;M0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.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(!M.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=M.slice(-1)[0],S=(r.host||t.host||M.length>1)&&("."===T||".."===T)||""===T,E=0,L=M.length;L>=0;L--)T=M[L],"."===T?M.splice(L,1):".."===T?(M.splice(L,1),E++):E&&(M.splice(L,1),E--);if(!_&&!w)for(;E--;E)M.unshift("..");!_||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),S&&"/"!==M.join("/").substr(-1)&&M.push("");var C=""===M[0]||M[0]&&"/"===M[0].charAt(0);if(k){r.hostname=r.host=C?"":M.length?M.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return _=_||r.host&&M.length,_&&!C&&M.unshift(""),M.length?r.pathname=M.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":538,punycode:480,querystring:484}],538:[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}}},{}],539:[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}},{}],540:[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}},{}],541:[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]),m(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 b(i)||(i=l(t,i,n)),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(T(e)){var v=e.name?": "+e.name:"";return t.stylize("[Function"+v+"]","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 g="",y=!1,x=["{","}"];if(p(e)&&(y=!0,x=["[","]"]),T(e)){g=" [Function"+(e.name?": "+e.name:"")+"]"}if(w(e)&&(g=" "+RegExp.prototype.toString.call(e)),k(e)&&(g=" "+Date.prototype.toUTCString.call(e)),A(e)&&(g=" "+c(e)),0===o.length&&(!y||0==e.length))return x[0]+g+x[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var _;return _=y?h(t,e,n,m,o):o.map(function(r){return f(t,e,n,m,r,y)}),t.seen.pop(),d(_,g,x)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):v(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;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>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 m(t){return"boolean"==typeof t}function v(t){return null===t}function g(t){return null==t}function y(t){return"number"==typeof t}function b(t){return"string"==typeof t}function x(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===E(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===E(t)}function A(t){return M(t)&&("[object Error]"===E(t)||t instanceof Error)}function T(t){return"function"==typeof t}function S(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function E(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function C(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),P[t.getMonth()],e].join(" ")}function z(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.format=function(t){if(!b(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":544}],546:[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":547}],547:[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))<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,h=!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(h)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___");h=!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)}}()},{}],552:[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":553}],553:[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},{}],554:[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){return t(e).value=r,this},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":552}],555:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":143}],556:[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){v[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];v[n]||r(n)}}for(var s,l=Object.keys(a),u=0,c=l.length;u=1888&&t<=2111))throw new Error("Solar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Solar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=31))throw new Error("Solar day outside range 1 - 31");i={year:t,month:e,day:r},a=n||{}}var o=p[i.year-p[0]],s=i.year<<9|i.month<<5|i.day;a.year=s>=o?i.year:i.year-1,o=p[a.year-p[0]];var l,u=o>>9&4095,c=o>>5&15,h=31&o,f=new Date(u,c-1,h),m=new Date(i.year,i.month-1,i.day);l=Math.round((m-f)/864e5);var v,g=d[a.year-d[0]];for(v=0;v<13;v++){var y=g&1<<12-v?30:29;if(l>13;return!b||v=1888&&t<=2111))throw new Error("Lunar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Lunar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=30))throw new Error("Lunar day outside range 1 - 30");var s;"object"==typeof n?(s=!1,a=n):(s=!!n,a=i||{}),o={year:t,month:e,day:r,isIntercalary:s}}var l;l=o.day-1;var u,c=d[o.year-d[0]],h=c>>13;u=h?o.month>h?o.month:o.isIntercalary?o.month:o.month-1:o.month-1;for(var f=0;f>9&4095,g=m>>5&15,y=31&m,b=new Date(v,g-1,y+l);return a.year=b.getFullYear(),a.month=1+b.getMonth(),a.day=b.getDate(),a}var o=t("../main"),s=t("object-assign"),l=o.instance();n.prototype=new o.baseCalendar,s(n.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if("string"==typeof t){var r=t.match(c);return r?r[0]:""}var n=this._validateYear(t),i=t.month(),a=""+this.toChineseMonth(n,i);return e&&a.length<2&&(a="0"+a),this.isIntercalaryMonth(n,i)&&(a+="i"),a},monthNames:function(t){if("string"==typeof t){var e=t.match(h);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=this.toChineseMonth(r,n),a=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"][i-1];return this.isIntercalaryMonth(r,n)&&(a="\u95f0"+a),a},monthNamesShort:function(t){if("string"==typeof t){var e=t.match(f);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=this.toChineseMonth(r,n),a=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"][i-1];return this.isIntercalaryMonth(r,n)&&(a="\u95f0"+a),a},parseMonth:function(t,e){t=this._validateYear(t);var r,n=parseInt(e);if(isNaN(n))"\u95f0"===e[0]&&(r=!0,e=e.substring(1)),"\u6708"===e[e.length-1]&&(e=e.substring(0,e.length-1)),n=1+["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(e);else{var i=e[e.length-1] -;r="i"===i||"I"===i}return this.toMonthIndex(t,n,r)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,e){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw e.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(t,e,r){var n=this.intercalaryMonth(t);if(r&&e!==n||e<1||e>12)throw o.local.invalidMonth.replace(/\{0\}/,this.local.name);return n?!r&&e<=n?e-1:e:e-1},toChineseMonth:function(t,e){t.year&&(t=t.year(),e=t.month());var r=this.intercalaryMonth(t),n=r?12:11;if(e<0||e>n)throw o.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e>13},isIntercalaryMonth:function(t,e){t.year&&(t=t.year(),e=t.month());var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(t,e,r){var n,i=this._validateYear(t,o.local.invalidyear),a=p[i-p[0]],s=a>>9&4095,u=a>>5&15,c=31&a;n=l.newDate(s,u,c),n.add(4-(n.dayOfWeek()||7),"d");var h=this.toJD(t,e,r)-n.toJD();return 1+Math.floor(h/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){t.year&&(e=t.month(),t=t.year()),t=this._validateYear(t);var r=d[t-d[0]];if(e>(r>>13?12:11))throw o.local.invalidMonth.replace(/\{0\}/,this.local.name);return r&1<<12-e?30:29},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,s,r,o.local.invalidDate);t=this._validateYear(n.year()),e=n.month(),r=n.day();var i=this.isIntercalaryMonth(t,e),s=this.toChineseMonth(t,e),u=a(t,s,r,i);return l.toJD(u.year,u.month,u.day)},fromJD:function(t){var e=l.fromJD(t),r=i(e.year(),e.month(),e.day()),n=this.toMonthIndex(r.year,r.month,r.isIntercalary);return this.newDate(r.year,n,r.day)},fromString:function(t){var e=t.match(u),r=this._validateYear(+e[1]),n=+e[2],i=!!e[3],a=this.toMonthIndex(r,n,i),o=+e[4];return this.newDate(r,a,o)},add:function(t,e,r){var i=t.year(),a=t.month(),o=this.isIntercalaryMonth(i,a),s=this.toChineseMonth(i,a),l=Object.getPrototypeOf(n.prototype).add.call(this,t,e,r);if("y"===r){var u=l.year(),c=l.month(),h=this.isIntercalaryMonth(u,s),f=o&&h?this.toMonthIndex(u,s,!0):this.toMonthIndex(u,s,!1);f!==c&&l.month(f)}return l}});var u=/^\s*(-?\d\d\d\d|\d\d)[-\/](\d?\d)([iI]?)[-\/](\d?\d)/m,c=/^\d?\d[iI]?/m,h=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?\u6708/m,f=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?/m;o.calendars.chinese=n;var d=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548],p=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904]},{"../main":573,"object-assign":463}],560:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Coptic",jdEpoch:1825029.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=e.year()+(e.year()<0?1:0);return t%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear||i.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),t<0&&t++,n.day()+30*(n.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,i=e-30*(n-1)+1;return this.newDate(r,n,i)}}),i.calendars.coptic=n},{"../main":573,"object-assign":463}],561:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Discworld",jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),!1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),13},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),400},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/8)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(t,e,r){return(this._validate(t,e,r,i.local.invalidDate).day()+1)%8},weekDay:function(t,e,r){var n=this.dayOfWeek(t,e,r);return n>=2&&n<=6},extraInfo:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return{century:o[Math.floor((n.year()-1)/100)+1]||""}},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year()+(n.year()<0?1:0),e=n.month(),(r=n.day())+(e>1?16:0)+(e>2?32*(e-2):0)+400*(t-1)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1;var e=Math.floor(t/400)+1;t-=400*(e-1),t+=t>15?16:0;var r=Math.floor(t/32)+1,n=t-32*(r-1)+1;return this.newDate(e<=0?e-1:e,r,n)}});var o={20:"Fruitbat",21:"Anchovy"};i.calendars.discworld=n},{"../main":573,"object-assign":463}],562:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=e.year()+(e.year()<0?1:0);return t%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear||i.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),t<0&&t++,n.day()+30*(n.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,i=e-30*(n-1)+1;return this.newDate(r,n,i)}}),i.calendars.ethiopian=n},{"../main":573,"object-assign":463}],563:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}var a=t("../main"),o=t("object-assign");n.prototype=new a.baseCalendar,o(n.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,a.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return t=t<0?t+1:t,i(7*t+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,a.local.invalidYear),this._leapYear(t.year?t.year():t)?13:12},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return t=this._validate(t,this.minMonth,this.minDay,a.local.invalidYear).year(),this.toJD(t===-1?1:t+1,7,1)-this.toJD(t,7,1)},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,a.local.invalidMonth),12===e&&this.leapYear(t)?30:8===e&&5===i(this.daysInYear(t),10)?30:9===e&&3===i(this.daysInYear(t),10)?29:this.daysPerMonth[e-1]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},extraInfo:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);return{yearType:(this.leapYear(n)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(n)%10-3]}},toJD:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var i=t<=0?t+1:t,o=this.jdEpoch+this._delay1(i)+this._delay2(i)+r+1;if(e<7){for(var s=7;s<=this.monthsInYear(t);s++)o+=this.daysInMonth(t,s);for(var s=1;s=this.toJD(e===-1?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),a.calendars.hebrew=n},{"../main":573,"object-assign":463}],564:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){return(11*this._validate(t,this.minMonth,this.minDay,i.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),e=n.month(),r=n.day(),t=t<=0?t+1:t,r+Math.ceil(29.5*(e-1))+354*(t-1)+Math.floor((3+11*t)/30)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=Math.floor((30*(t-this.jdEpoch)+10646)/10631);e=e<=0?e-1:e;var r=Math.min(12,Math.ceil((t-29-this.toJD(e,1,1))/29.5)+1),n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),i.calendars.islamic=n},{"../main":573,"object-assign":463}],565:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=e.year()<0?e.year()+1:e.year();return t%4==0},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),e=n.month(),r=n.day(),t<0&&t++,e<=2&&(t--,e+=12),Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r-1524.5},fromJD:function(t){var e=Math.floor(t+.5),r=e+1524,n=Math.floor((r-122.1)/365.25),i=Math.floor(365.25*n),a=Math.floor((r-i)/30.6001),o=a-Math.floor(a<14?1:13),s=n-Math.floor(o>2?4716:4715),l=r-i-Math.floor(30.6001*a);return s<=0&&s--,this.newDate(s,o,l)}}),i.calendars.julian=n},{"../main":573,"object-assign":463}],566:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}function a(t,e){return i(t-1,e)+1}var o=t("../main"),s=t("object-assign");n.prototype=new o.baseCalendar,s(n.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,o.local.invalidYear).year();var e=Math.floor(t/400);return t%=400,t+=t<0?400:0,e+"."+Math.floor(t/20)+"."+t%20},forYear:function(t){if(t=t.split("."),t.length<3)throw"Invalid Mayan year";for(var e=0,r=0;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,o.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate),!0},extraInfo:function(t,e,r){var n=this._validate(t,e,r,o.local.invalidDate),i=n.toJD(),a=this._toHaab(i),s=this._toTzolkin(i);return{haabMonthName:this.local.haabMonths[a[0]-1],haabMonth:a[0],haabDay:a[1],tzolkinDayName:this.local.tzolkinMonths[s[0]-1],tzolkinDay:s[0],tzolkinTrecena:s[1]}},_toHaab:function(t){t-=this.jdEpoch;var e=i(t+8+340,365);return[Math.floor(e/20)+1,i(e,20)]},_toTzolkin:function(t){return t-=this.jdEpoch,[a(t+20,20),a(t+4,13)]},toJD:function(t,e,r){var n=this._validate(t,e,r,o.local.invalidDate);return n.day()+20*n.month()+360*n.year()+this.jdEpoch},fromJD:function(t){t=Math.floor(t)+.5-this.jdEpoch;var e=Math.floor(t/360);t%=360,t+=t<0?360:0;var r=Math.floor(t/20),n=t%20;return this.newDate(e,r,n)}}),o.calendars.mayan=n},{"../main":573,"object-assign":463}],567:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar;var o=i.instance("gregorian");a(n.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear||i.regionalOptions[""].invalidYear);return o.leapYear(e.year()+(e.year()<1?1:0)+1469)},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidMonth),t=n.year();t<0&&t++;for(var a=n.day(),s=1;s=this.toJD(e+1,1,1);)e++;for(var r=t-Math.floor(this.toJD(e,1,1)+.5)+1,n=1;r>this.daysInMonth(e,n);)r-=this.daysInMonth(e,n),n++;return this.newDate(e,n,r)}}),i.calendars.nanakshahi=n},{"../main":573,"object-assign":463}],568:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){if(t=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear).year(),void 0===this.NEPALI_CALENDAR_DATA[t])return this.daysPerYear;for(var e=0,r=this.minMonth;r<=12;r++)e+=this.NEPALI_CALENDAR_DATA[t][r];return e},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,i.local.invalidMonth),void 0===this.NEPALI_CALENDAR_DATA[t]?this.daysPerMonth[e-1]:this.NEPALI_CALENDAR_DATA[t][e]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var a=i.instance(),o=0,s=e,l=t;this._createMissingCalendarData(t);var u=t-(s>9||9===s&&r>=this.NEPALI_CALENDAR_DATA[l][0]?56:57);for(9!==e&&(o=r,s--);9!==s;)s<=0&&(s=12,l--),o+=this.NEPALI_CALENDAR_DATA[l][s],s--;return 9===e?(o+=r-this.NEPALI_CALENDAR_DATA[l][0])<0&&(o+=a.daysInYear(u)):o+=this.NEPALI_CALENDAR_DATA[l][9]-this.NEPALI_CALENDAR_DATA[l][0],a.newDate(u,1,1).add(o,"d").toJD()},fromJD:function(t){var e=i.instance(),r=e.fromJD(t),n=r.year(),a=r.dayOfYear(),o=n+56;this._createMissingCalendarData(o);for(var s=9,l=this.NEPALI_CALENDAR_DATA[o][0],u=this.NEPALI_CALENDAR_DATA[o][s]-l+1;a>u;)s++,s>12&&(s=1,o++),u+=this.NEPALI_CALENDAR_DATA[o][s];var c=this.NEPALI_CALENDAR_DATA[o][s]-(u-a);return this.newDate(o,s,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,a.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var o=t-(t>=0?474:473),s=474+i(o,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*s-110)/2816)+365*(s-1)+1029983*Math.floor(o/2820)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=t-this.toJD(475,1,1),r=Math.floor(e/1029983),n=i(e,1029983),a=2820;if(1029982!==n){var o=Math.floor(n/366),s=i(n,366);a=Math.floor((2134*o+2816*s+2815)/1028522)+o+1}var l=a+2820*r+474;l=l<=0?l-1:l;var u=t-this.toJD(l,1,1)+1,c=u<=186?Math.ceil(u/31):Math.ceil((u-6)/30),h=t-this.toJD(l,c,1)+1;return this.newDate(l,c,h)}}),a.calendars.persian=n,a.calendars.jalali=n},{"../main":573,"object-assign":463}],570:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();n.prototype=new i.baseCalendar,a(n.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(e.year());return o.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(n.year());return o.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),t=this._t2gYear(n.year());return o.toJD(t,n.month(),n.day())},fromJD:function(t){var e=o.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)}}),i.calendars.taiwan=n},{"../main":573,"object-assign":463}],571:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();n.prototype=new i.baseCalendar,a(n.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(e.year());return o.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(n.year());return o.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),t=this._t2gYear(n.year());return o.toJD(t,n.month(),n.day())},fromJD:function(t){var e=o.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)},_g2tYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)}}),i.calendars.thai=n},{"../main":573,"object-assign":463}],572:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear);return 355===this.daysInYear(e.year())},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var e=0,r=1;r<=12;r++)e+=this.daysInMonth(t,r);return e},daysInMonth:function(t,e){for(var r=this._validate(t,e,this.minDay,i.local.invalidMonth),n=r.toJD()-24e5+.5,a=0,s=0;sn)return o[a]-o[a-1];a++}return 30},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),a=12*(n.year()-1)+n.month()-15292;return n.day()+o[a-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;ne);n++)r++;var i=r+15292,a=Math.floor((i-1)/12),s=a+1,l=i-12*a,u=e-o[r-1]+1;return this.newDate(s,l,u)},isValid:function(t,e,r){var n=i.baseCalendar.prototype.isValid.apply(this,arguments);return n&&(t=null!=t.year?t.year:t,n=t>=1276&&t<=1500),n},_validate:function(t,e,r,n){var a=i.baseCalendar.prototype._validate.apply(this,arguments);if(a.year<1276||a.year>1500)throw n.replace(/\{0\}/,this.local.name);return a}}),i.calendars.ummalqura=n;var o=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":573,"object-assign":463}],573:[function(t,e,r){function n(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function i(t,e,r,n){if(this._calendar=t,this._year=e,this._month=r,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function a(t,e){return t=""+t,"000000".substring(0,e-t.length)+t}function o(){this.shortYearCutoff="+10"}function s(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}var l=t("object-assign");l(n.prototype,{instance:function(t,e){t=(t||"gregorian").toLowerCase(),e=e||"";var r=this._localCals[t+"-"+e];if(!r&&this.calendars[t]&&(r=new this.calendars[t](e),this._localCals[t+"-"+e]=r),!r)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return r},newDate:function(t,e,r,n,i){return n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,i):n)||this.instance(),n.newDate(t,e,r)},substituteDigits:function(t){return function(e){return(e+"").replace(/[0-9]/g,function(e){return t[e]})}},substituteChineseDigits:function(t,e){return function(r){for(var n="",i=0;r>0;){var a=r%10;n=(0===a?"":t[a]+e[i])+n,i++,r=Math.floor(r/10)}return 0===n.indexOf(t[1]+e[1])&&(n=n.substr(1)),n||t[0]}}}),l(i.prototype,{newDate:function(t,e,r){return this._calendar.newDate(null==t?this:t,e,r)},year:function(t){return 0===arguments.length?this._year:this.set(t,"y")},month:function(t){return 0===arguments.length?this._month:this.set(t,"m")},day:function(t){return 0===arguments.length?this._day:this.set(t,"d")},date:function(t,e,r){if(!this._calendar.isValid(t,e,r))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=e,this._day=r,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,e){return this._calendar.add(this,t,e)},set:function(t,e){return this._calendar.set(this,t,e)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(u.local.differentCalendars||u.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name);var e=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===e?0:e<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(this.year()<0?"-":"")+a(Math.abs(this.year()),4)+"-"+a(this.month(),2)+"-"+a(this.day(),2)}}),l(o.prototype,{_validateLevel:0,newDate:function(t,e,r){return null==t?this.today():(t.year&&(this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate),r=t.day(),e=t.month(),t=t.year()),new i(this,t,e,r))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+a(Math.abs(e.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear),12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return(r.month()+this.monthsInYear(r)-this.firstMonth)%this.monthsInYear(r)+this.minMonth},fromMonthOfYear:function(t,e){var r=(e+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth),r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){return this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate),{}},add:function(t,e,r){return this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){if(this._validateLevel++,"d"===r||"w"===r){var n=t.toJD()+e*("w"===r?this.daysInWeek():1),i=t.calendar().fromJD(n);return this._validateLevel--,[i.year(),i.month(),i.day()]}try{var a=t.year()+("y"===r?e:0),o=t.monthOfYear()+("m"===r?e:0),i=t.day();"y"===r?(t.month()!==this.fromMonthOfYear(a,o)&&(o=this.newDate(a,t.month(),this.minDay).monthOfYear()),o=Math.min(o,this.monthsInYear(a)),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o)))):"m"===r&&(!function(t){for(;oe-1+t.minMonth;)a++,o-=e,e=t.monthsInYear(a)}(this),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o))));var s=[a,this.fromMonthOfYear(a,o),i];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var i={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],a=r<0?-1:1;e=this._add(t,r*i[0]+a*i[1],i[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),i="m"===r?e:t.month(),a="d"===r?e:t.day();return"y"!==r&&"m"!==r||(a=Math.min(a,this.daysInMonth(n,i))),t.date(n,i,a)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var i=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),u=i-(l>2.5?4716:4715);return u<=0&&u--,this.newDate(u,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate),i=new Date(n.year(),n.month()-1,n.day());return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(0),i.setHours(i.getHours()>12?i.getHours()+2:0),i},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var u=e.exports=new n;u.cdate=i,u.baseCalendar=o,u.calendars.gregorian=s},{"object-assign":463}],574:[function(t,e,r){var n=t("object-assign"),i=t("./main");n(i.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),i.local=i.regionalOptions[""],n(i.cdate.prototype,{formatDate:function(t,e){return"string"!=typeof t&&(e=t,t=""),this._calendar.formatDate(t||"",this,e)}}),n(i.baseCalendar.prototype,{UNIX_EPOCH:i.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:i.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,e,r){if("string"!=typeof t&&(r=e,e=t,t=""),!e)return"";if(e.calendar()!==this)throw i.local.invalidFormat||i.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat,r=r||{};for(var n=r.dayNamesShort||this.local.dayNamesShort,a=r.dayNames||this.local.dayNames,o=r.monthNumbers||this.local.monthNumbers,s=r.monthNamesShort||this.local.monthNamesShort,l=r.monthNames||this.local.monthNames,u=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;v+n1}),c=function(t,e,r,n){var i=""+e;if(u(t,n))for(;i.length1},b=function(t,r){var n=y(t,r),a=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],o=new RegExp("^-?\\d{1,"+a+"}"),s=e.substring(M).match(o);if(!s)throw(i.local.missingNumberAt||i.regionalOptions[""].missingNumberAt).replace(/\{0\}/,M);return M+=s[0].length,parseInt(s[0],10)},x=this,_=function(t,r,n,a){for(var o=y(t,a)?n:r,s=0;s-1){d=1,p=m;for(var T=this.daysInMonth(f,d);p>T;T=this.daysInMonth(f,d))d++,p-=T}return h>-1?this.fromJD(h):this.newDate(f,d,p)},determineDate:function(t,e,r,n,i){r&&"object"!=typeof r&&(i=n,n=r,r=null),"string"!=typeof n&&(i=n,n="");var a=this;return e=e?e.newDate():null,t=null==t?e:"string"==typeof t?function(t){try{return a.parseDate(n,t,i)}catch(t){}t=t.toLowerCase();for(var e=(t.match(/^c/)&&r?r.newDate():null)||a.today(),o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,s=o.exec(t);s;)e.add(parseInt(s[1],10),s[2]||"d"),s=o.exec(t);return e}(t):"number"==typeof t?isNaN(t)||1/0===t||t===-1/0?e:a.today().add(t,"d"):a.newDate(t)}})},{"./main":573,"object-assign":463}],575:[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":106}],576:[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":575}],577:[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),h=u("clicktoshow");if(!c&&!h)return e;u("opacity");var f=u("bgcolor"),d=u("bordercolor"),p=i.opacity(d);u("borderpad");var m=u("borderwidth"),v=u("showarrow");u("text",v?" ":"new text"),u("textangle"),n.coerceFont(u,"font",r.font),u("width"),u("align"),u("height")&&u("valign");for(var g=["x","y"],y=[-10,-30],b={_fullLayout:r},x=0;x<2;x++){var _=g[x],w=a.coerceRef(t,e,b,_,"","paper");if(a.coercePosition(e,b,u,w,_,.5),v){var M="a"+_,k=a.coerceRef(t,e,b,M,"pixel");"pixel"!==k&&k!==w&&(k=e[M]="pixel");var A="pixel"===k?y[x]:.4;a.coercePosition(e,b,u,k,M,A)}u(_+"anchor"),u(_+"shift")}if(n.noneOrAll(t,e,["x","y"]),v&&(u("arrowcolor",p?e.bordercolor:i.defaultLine),u("arrowhead"),u("arrowsize"),u("arrowwidth",2*(p&&m||1)),u("standoff"),n.noneOrAll(t,e,["ax","ay"])),h){var T=u("xclick"),S=u("yclick");e._xclick=void 0===T?e.x:T,e._yclick=void 0===S?e.y:S}var E=u("hovertext"),L=r.hoverlabel||{};if(E){var C=u("hoverlabel.bgcolor",L.bgcolor||(i.opacity(f)?i.rgb(f):i.defaultLine)),z=u("hoverlabel.bordercolor",L.bordercolor||i.contrast(C));n.coerceFont(u,"hoverlabel.font",{family:L.font.family,size:L.font.size,color:L.font.color||z})}return u("captureevents",!!E),e}},{"../../lib":709,"../../plots/cartesian/axes":748,"../color":590,"./attributes":579}],578:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],579:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},i,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":701,"../../plots/cartesian/constants":753,"../../plots/font_attributes":772,"./arrow_paths":578}],580:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;i.filterVisible(e.annotations).forEach(function(e){var r,n,i=a.getFromId(t,e.xref),o=a.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;i&&i.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(a.expand(i,[i.r2c(e.x)],{ppadplus:r,ppadminus:n}),a.expand(i,[i.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):a.expand(i,[i.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(a.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),a.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):a.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(a.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return i.syncOrAsync([o,n],t)}}},{"../../lib":709,"../../plots/cartesian/axes":748,"./draw":584}],581:[function(t,e,r){"use strict";function n(t,e){var r=a(t,e);return r.on.length>0||r.explicitOff.length>0}function i(t,e){var r,n=a(t,e),i=n.on,s=n.off.concat(n.explicitOff),l={};if(i.length||s.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var n=j.selectAll("a");if(1===n.size()&&n.text()===j.text()){E.insert("a",":first-child").attr({"xlink:xlink:href":n.attr("xlink:href"),"xlink:xlink:show":n.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(D.node())}j.selectAll("tspan.line").attr({y:0,x:0});var i=E.select(".annotation-math-group"),d=!i.empty(),p=f.bBox((d?i:j).node()),b=p.width,C=p.height,O=x.width||b,F=x.height||C,R=Math.round(O+2*z),N=Math.round(F+2*z);x._w=O,x._h=F;var B=!1;if(["x","y"].forEach(function(e){var n,i,a,o,s,h=x[e+"ref"]||e,f=x["a"+e+"ref"],d=c.getFromId(t,h),p=(A+("x"===e?0:-90))*Math.PI/180,m=R*Math.cos(p),v=N*Math.sin(p),g=Math.abs(m)+Math.abs(v),b=x[e+"anchor"],_=x[e+"shift"]*("x"===e?1:-1),w=k[e];if(d){var M=d.r2fraction(x[e]);if((t._dragging||!d.autorange)&&(M<0||M>1)&&(f===h?((M=d.r2fraction(x["a"+e]))<0||M>1)&&(B=!0):B=!0,B))return;n=d._offset+d.r2p(x[e]),o=.5}else"x"===e?(a=x[e],n=y.l+y.w*a):(a=1-x[e],n=y.t+y.h*a),o=x.showarrow?.5:a;if(x.showarrow){w.head=n;var T=x["a"+e];s=m*r(.5,x.xanchor)-v*r(.5,x.yanchor),f===h?(w.tail=d._offset+d.r2p(T),i=s):(w.tail=n+T,i=s+T),w.text=w.tail+s;var S=l["x"===e?"width":"height"];if("paper"===h&&(w.head=u.constrain(w.head,1,S-1)),"pixel"===f){var E=-Math.max(w.tail-3,w.text),L=Math.min(w.tail+3,w.text)-S;E>0?(w.tail+=E,w.text+=E):L>0&&(w.tail-=L,w.text-=L)}w.tail+=_,w.head+=_}else s=g*r(o,b),i=s,w.text=n+s;w.text+=_,s+=_,i+=_,x["_"+e+"padplus"]=g/2+i,x["_"+e+"padminus"]=g/2-i,x["_"+e+"size"]=g,x["_"+e+"shift"]=s}),B)return void E.remove();var U=0,V=0;if("left"!==x.align&&(U=(O-b)*("center"===x.align?.5:1)),"top"!==x.valign&&(V=(F-C)*("middle"===x.valign?.5:1)),d)i.select("svg").attr({x:z+U-1,y:z+V}).call(f.setClipUrl,I?_:null);else{var q=z+V-p.top,H=z+U-p.left;j.attr({x:H,y:q}).call(f.setClipUrl,I?_:null),j.selectAll("tspan.line").attr({y:q,x:H})}P.select("rect").call(f.setRect,z,z,O,F),D.call(f.setRect,L/2,L/2,R-L,N-L),E.call(f.setTranslate,Math.round(k.x.text-R/2),Math.round(k.y.text-N/2)),S.attr({transform:"rotate("+A+","+k.x.text+","+k.y.text+")"});var G="annotations["+e+"]",Y=function(r,n){o.select(t).selectAll('.annotation-arrow-g[data-index="'+e+'"]').remove();var i=k.x.head,l=k.y.head,c=k.x.tail+r,d=k.y.tail+n,p=k.x.text+r,m=k.y.text+n,b=u.rotationXYMatrix(A,p,m),_=u.apply2DTransform(b),L=u.apply2DTransform2(b),C=+D.attr("width"),z=+D.attr("height"),I=p-.5*C,P=I+C,O=m-.5*z,j=O+z,F=[[I,O,I,j],[I,j,P,j],[P,j,P,O],[P,O,I,O]].map(L);if(!F.reduce(function(t,e){return t^!!a(i,l,i+1e6,l+1e6,e[0],e[1],e[2],e[3])},!1)){F.forEach(function(t){var e=a(c,d,i,l,t[0],t[1],t[2],t[3]);e&&(c=e.x,d=e.y)});var R=x.arrowwidth,N=x.arrowcolor,B=T.append("g").style({opacity:h.opacity(N)}).classed("annotation-arrow-g",!0).attr("data-index",String(e)),U=B.append("path").attr("d","M"+c+","+d+"L"+i+","+l).style("stroke-width",R+"px").call(h.stroke,h.rgb(N));if(g(U,x.arrowhead,"end",x.arrowsize,x.standoff),t._context.editable&&U.node().parentNode){var V=i,q=l;if(x.standoff){var H=Math.sqrt(Math.pow(i-c,2)+Math.pow(l-d,2));V+=x.standoff*(c-i)/H,q+=x.standoff*(d-l)/H}var Y,X,W,Z=B.append("path").classed("annotation",!0).classed("anndrag",!0).attr({"data-index":String(e),d:"M3,3H-3V-3H3ZM0,0L"+(c-V)+","+(d-q),transform:"translate("+V+","+q+")"}).style("stroke-width",R+6+"px").call(h.stroke,"rgba(0,0,0,0)").call(h.fill,"rgba(0,0,0,0)");v.init({element:Z.node(),prepFn:function(){var t=f.getTranslate(E);X=t.x,W=t.y,Y={},w&&w.autorange&&(Y[w._name+".autorange"]=!0),M&&M.autorange&&(Y[M._name+".autorange"]=!0)},moveFn:function(t,e){var r=_(X,W),n=r[0]+t,i=r[1]+e;E.call(f.setTranslate,n,i),Y[G+".x"]=w?w.p2r(w.r2p(x.x)+t):x.x+t/y.w,Y[G+".y"]=M?M.p2r(M.r2p(x.y)+e):x.y-e/y.h,x.axref===x.xref&&(Y[G+".ax"]=w.p2r(w.r2p(x.ax)+t)),x.ayref===x.yref&&(Y[G+".ay"]=M.p2r(M.r2p(x.ay)+e)),B.attr("transform","translate("+t+","+e+")"),S.attr({transform:"rotate("+A+","+n+","+i+")"})},doneFn:function(e){if(e){s.relayout(t,Y);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(x.showarrow&&Y(0,0),t._context.editable){var X,W;v.init({element:E.node(),prepFn:function(){W=S.attr("transform"),X={}},moveFn:function(t,e){var r="pointer";if(x.showarrow)x.axref===x.xref?X[G+".ax"]=w.p2r(w.r2p(x.ax)+t):X[G+".ax"]=x.ax+t,x.ayref===x.yref?X[G+".ay"]=M.p2r(M.r2p(x.ay)+e):X[G+".ay"]=x.ay+e,Y(t,e);else{if(w)X[G+".x"]=x.x+t/w._m;else{var n=x._xsize/y.w,i=x.x+(x._xshift-x.xshift)/y.w-n/2;X[G+".x"]=v.align(i+t/y.w,n,0,1,x.xanchor)}if(M)X[G+".y"]=x.y+e/M._m;else{var a=x._ysize/y.h,o=x.y-(x._yshift+x.yshift)/y.h-a/2;X[G+".y"]=v.align(o-e/y.h,a,0,1,x.yanchor)}w&&M||(r=v.getCursor(w?.5:X[G+".x"],M?.5:X[G+".y"],x.xanchor,x.yanchor))}S.attr({transform:"translate("+t+","+e+")"+W}),m(E,r)},doneFn:function(e){if(m(E),e){s.relayout(t,X);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var i=t.layout,l=t._fullLayout,y=t._fullLayout._size;l._infolayer.selectAll('.annotation[data-index="'+e+'"]').remove();var b=(i.annotations||[])[e],x=l.annotations[e],_="clip"+l._uid+"_ann"+e;if(!b||x.visible===!1)return void o.selectAll("#"+_).remove();var w=c.getFromId(t,x.xref),M=c.getFromId(t,x.yref),k={x:{},y:{}},A=+x.textangle||0,T=l._infolayer.append("g").classed("annotation",!0).attr("data-index",String(e)).style("opacity",x.opacity),S=T.append("g").classed("annotation-text-g",!0).attr("data-index",String(e)),E=S.append("g").style("pointer-events",x.captureevents?"all":null).call(m,"default").on("click",function(){t._dragging=!1,t.emit("plotly_clickannotation",{index:e,annotation:b,fullAnnotation:x,event:o.event})});x.hovertext&&E.on("mouseover",function(){var e=x.hoverlabel,r=e.font,n=this.getBoundingClientRect(),i=t.getBoundingClientRect();d.loneHover({x0:n.left-i.left,x1:n.right-i.left,y:(n.top+n.bottom)/2-i.top,text:x.hovertext,color:e.bgcolor,borderColor:e.bordercolor,fontFamily:r.family,fontSize:r.size,fontColor:r.color},{container:l._hoverlayer.node(),outerContainer:l._paper.node()})}).on("mouseout",function(){d.loneUnhover(l._hoverlayer.node())});var L=x.borderwidth,C=x.borderpad,z=L+C,D=E.append("rect").attr("class","bg").style("stroke-width",L+"px").call(h.stroke,x.bordercolor).call(h.fill,x.bgcolor),I=x.width||x.height,P=l._defs.select(".clips").selectAll("#"+_).data(I?[0]:[]);P.enter().append("clipPath").classed("annclip",!0).attr("id",_).append("rect"),P.exit().remove();var O=x.font,j=E.append("text").classed("annotation",!0).attr("data-unformatted",x.text).text(x.text);t._context.editable?j.call(p.makeEditable,E).call(r).on("edit",function(n){x.text=n,this.attr({"data-unformatted":x.text}),this.call(r);var i={};i["annotations["+e+"].text"]=x.text,w&&w.autorange&&(i[w._name+".autorange"]=!0),M&&M.autorange&&(i[M._name+".autorange"]=!0),s.relayout(t,i)}):j.call(r)}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 m=(u*d-c*f)/p,v=(u*h-l*f)/p;return v<0||v>1||m<0||m>1?null:{x:t+l*m,y:e+h*m}}var o=t("d3"),s=t("../../plotly"),l=t("../../plots/plots"),u=t("../../lib"),c=t("../../plots/cartesian/axes"),h=t("../color"),f=t("../drawing"),d=t("../fx"),p=t("../../lib/svg_text_utils"),m=t("../../lib/setcursor"),v=t("../dragelement"),g=t("./draw_arrow_head");e.exports={draw:n,drawOne:i}},{"../../lib":709,"../../lib/setcursor":724,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/cartesian/axes":748,"../../plots/plots":811,"../color":590,"../dragelement":611,"../drawing":614,"../fx":631,"./draw_arrow_head":585,d3:118}],585:[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,u){function c(){t.style("stroke-dasharray","0px,100px")}function h(r,i){d.path&&(e>5&&(i=0),n.select(f.parentElement).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}i(l)||(l=1);var f=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,m,v,g,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||a.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,M=d.backoff*y+u;if("line"===f.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},m={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-m.x,A=p.y-m.y;if(v=Math.atan2(A,k),g=v+Math.PI,M){if(M*M>k*k+A*A)return void c();var T=M*Math.cos(v),S=M*Math.sin(v);_&&(p.x-=T,p.y-=S,t.attr({x1:p.x,y1:p.y})),w&&(m.x+=T,m.y+=S,t.attr({x2:m.x,y2:m.y}))}}else if("path"===f.nodeName){var E=f.getTotalLength(),L="";if(E=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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return i(o).toRgbString()},o.contrast=function(t,e,r){var n=i(t);return 1!==n.getAlpha()&&(n=i(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).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)$.domain[1]-=st/T.h,a[1]*=-1;else{$.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+")"),$.setScale()}}at.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(T.h*(1-$.domain[1]))+")");var h=at.select(".cbfills").selectAll("rect.cbfill").data(C);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?E[0]:(C[e]+C[e-1])/2,e===C.length-1?E[1]:(C[e]+C[e+1])/2].map($.c2p).map(Math.round);e!==C.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=D(t).replace("e-",""),o=i(a).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: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"+X+","+(Math.round($.c2p(t))+_.line.width/2%1)+"h"+B).call(d.lineGroupStyle,_.line.width,z(t),_.line.dash)}),$._axislayer.selectAll("g."+$._id+"tick,path").remove(),$._pos=X+B+(_.outlinewidth||0)/2-("outside"===_.ticks?1:0),$.side="right",c.syncOrAsync([function(){return l.doTicks(t,$,!0)},function(){if(["top","bottom"].indexOf(_.titleside)===-1){var e=$.titlefont.size,r=$._offset+$._length/2,i=T.l+($.position||0)*T.w+("right"===$.side?10+e*($.showticklabels?1:.5):-10-e*($.showticklabels?.5:0));M("h"+$._id+"title",{avoid:{selection:n.select(t).selectAll("g."+$._id+"tick"),side:_.titleside,offsetLeft:T.l,offsetTop:T.t,maxShift:A.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function M(e,r){var n,i=x();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:$,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(),m.draw(t,e,h(a,r||{}))}function k(){var r=B+_.outlinewidth/2+d.bBox($._axislayer.node()).width;if(F=ot.select("text"),F.node()&&!F.classed("js-placeholder")){var n,i=ot.select(".h"+$._id+"title-math-group").node();n=i&&["top","bottom"].indexOf(_.titleside)!==-1?d.bBox(i).width:d.bBox(ot.node()).right-X-T.l,r=Math.max(r,n)}var a=2*_.xpad+r+_.borderwidth+_.outlinewidth/2,s=J-K;at.select(".cbbg").attr({x:X-_.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:X,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 A=t._fullLayout,T=A._size;if("function"!=typeof _.fillcolor&&"function"!=typeof _.line.color)return void A._infolayer.selectAll("g."+e).remove();var S,E=n.extent(("function"==typeof _.fillcolor?_.fillcolor:_.line.color).domain()),L=[],C=[],z="function"==typeof _.line.color?_.line.color:function(){return _.line.color},D="function"==typeof _.fillcolor?_.fillcolor:function(){return _.fillcolor},I=_.levels.end+_.levels.size/100,P=_.levels.size,O=1.001*E[0]-.001*E[1],j=1.001*E[1]-.001*E[0];for(S=_.levels.start;(S-I)*P<0;S+=P)S>O&&SE[0]&&S1){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&&($.tick0=0)}$.dtick=et}$.domain=[Z+Y,Z+q-Y],$.setScale();var at=A._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)+")");$._axislayer=at.select(".cbaxis");var st=0;if(["top","bottom"].indexOf(_.titleside)!==-1){var lt,ut=T.l+(_.x+H)*T.w,ct=$.titlefont.size;lt="top"===_.titleside?(1-(Z+q-Y))*T.h+T.t+3+.75*ct:(1-(Z+Y))*T.h+T.t-3-.25*ct,M($._id+"title",{attributes:{x:ut,y:lt,"text-anchor":"start"}})}var ht=c.syncOrAsync([o.previousPromises,w,o.previousPromises,k],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},x().index)}})}return ht}function x(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=m,s.reversescale&&(m=a(m)),s.colorscale=m)}},{"../../lib":709,"./flip_scale":601,"./scales":608}],597:[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":701,"./attributes":595,"./scales.js":608}],598:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":608}],599:[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,m=h?i.nestedProperty(e,d).get()||{}:e,v=p[f+"min"],g=p[f+"max"],y=p.colorscale;u(h+f+"auto",!(n(v)&&n(g)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],602:[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":598,"./is_valid_scale_array":606,"./scales":608}],603:[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}},{}],610:[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":709}],611:[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=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return t.element.onmousemove=m,v._dragged=!1,v._dragging=!0,c=e.clientX,h=e.clientY,p=e.target,f=(new Date).getTime(),f-v._mouseDownTimey&&(g=Math.max(g-1,1)),t.doneFn&&t.doneFn(v._dragged,g,e),!v._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return i(v),v._dragged=!1,o.pauseEvent(e)}var c,h,f,d,p,m,v=o.getPlotDiv(t.element)||{},g=1,y=l.DBLCLICKDELAY;v._mouseDownTime||(v._mouseDownTime=0),m=t.element.onmousemove,t.setCursor&&(t.element.onmousemove=t.setCursor),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=n},{"../../constants/interactions":689,"../../lib":709,"../../plotly":743,"../../plots/cartesian/constants":753,"./align":609,"./cursor":610,"./unhover":612}],612:[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,i=t._hoverdata;e||(e={}),e.target&&n.triggerHandler(t,"plotly_beforehover",e)===!1||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":700}],613:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],614:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){if(l.traceIs(r,"symbols")){var c=m(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:p.isBubble(r)?c(t.ms):(a.size||6)/2,t.mrc=e;var n=v.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,v.symbolFuncs[i](e)+(n>=200?b:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var h,f,d,g=!1;if(t.so?(d=o.outlierwidth,f=o.outliercolor,h=a.outliercolor):(d=(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)?u.defaultLine:o.color,Array.isArray(a.color)&&(h=u.defaultLine,g=!0),h="mc"in t?t.mcc=n(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(u.stroke,h).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var y=a.gradient,x=t.mgt;if(x?g=!0:x=y&&y.type,x&&"none"!==x){var _=t.mgc;_?g=!0:_=y.color;var w="g"+s._fullLayout._uid+"-"+r.uid;g&&(w+="-"+t.i),e.call(v.gradient,s,w,x,h,_)}else e.call(u.fill,h);d&&e.call(u.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,M/2),c=Math.pow(s*s+l*l,M/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("tinycolor2"),l=t("../../registry"),u=t("../color"),c=t("../colorscale"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../constants/xmlns_namespaces"),p=t("../../traces/scatter/subtypes"),m=t("../../traces/scatter/make_bubble_size_func"),v=e.exports={};v.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(u.fill,n)},v.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},v.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},v.setRect=function(t,e,r,n,i){t.call(v.setPosition,e,r).call(v.setSize,n,i)},v.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);return o(i)&&o(a)&&e.node()?("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0):(e.remove(),!1)},v.translatePoints=function(t,e,r,n){t.each(function(t){var i=a.select(this);v.translatePoint(t,i,e,r,n)})},v.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},v.crispRound=function(t,e,r){return e&&o(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},v.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||"";u.stroke(e,n||a.color),v.dashLine(e,s,o)},v.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(u.stroke,r||i.color).call(v.dashLine,s,o)})},v.dashLine=function(t,e,r){r=+r||0,e=v.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},v.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},v.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=a.select(this);try{r.call(u.fill,e[0].trace.fillcolor)}catch(e){h.error(e,t),r.remove()}})};var g=t("./symbol_defs");v.symbolNames=[],v.symbolFuncs=[],v.symbolNeedLines={},v.symbolNoDot={},v.symbolList=[],Object.keys(g).forEach(function(t){var e=g[t];v.symbolList=v.symbolList.concat([e.n,t,e.n+100,t+"-open"]),v.symbolNames[e.n]=t,v.symbolFuncs[e.n]=e.f,e.needLine&&(v.symbolNeedLines[e.n]=!0),e.noDot?v.symbolNoDot[e.n]=!0:v.symbolList=v.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var y=v.symbolNames.length,b="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";v.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=v.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var x={x1:1,x2:0,y1:0,y2:0},_={x1:0,x2:0,y1:1,y2:0};v.gradient=function(t,e,r,n,i,o){var l=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+i+o],h.identity);l.exit().remove(),l.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=a.select(this);"horizontal"===n?t.attr(x):"vertical"===n&&t.attr(_),t.attr("id",r);var e=s(i),l=s(o);t.append("stop").attr({offset:"0%","stop-color":u.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":u.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},v.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},v.singlePointStyle=function(t,e,r,i,a,o){var s=r.marker;n(t,e,r,i,a,s,s.line,o)},v.pointStyle=function(t,e){if(t.size()){var r=e.marker,n=v.tryColorscale(r,""),i=v.tryColorscale(r,"line"),o=h.getPlotDiv(t.node());t.each(function(t){v.singlePointStyle(t,a.select(this),e,n,i,o)})}},v.tryColorscale=function(t,e){var r=e?h.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?c.makeColorScaleFunc(c.extractScale(n,r.cmin,r.cmax)):h.identity};var w={start:1,end:-1,middle:0,bottom:1,top:-1};v.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(v.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=1.3*((d[0].length||1)-1)+1,m=w[l]*c,g=.75*u+w[s]*c+(w[s]-1)*p*u/2;h.attr("transform","translate("+m+","+g+")"),p>1&&d.attr({x:r.attr("x"),y:r.attr("y")})})};var M=.5;v.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(a.selectAll("[data-bb]").attr("data-bb",null),T=[]),t.setAttribute("data-bb",T.length),T.push(l),h.extendFlat({},l)},v.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},v.getTranslate=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||0,y:+n[1]||0}},v.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||0,r=r||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a+=" translate("+e+", "+r+")",a=a.trim(),t[i]("transform",a),a},v.getScale=function(t){var e=t.attr?"attr":"getAttribute",r=t[e]("transform")||"",n=r.replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+n[0]||1,y:+n[1]||1}},v.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||1,r=r||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a+=" scale("+e+", "+r+")",a=a.trim(),t[i]("transform",a),a},v.setPointGroupScale=function(t,e,r){var n,i,a;return e=e||1,r=r||1,i=1===e&&1===r?"":" scale("+e+","+r+")",a=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(a,""),n+=i,n=n.trim(),this.setAttribute("transform",n)}),i};v.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=a.select(this),i=n.select("text"),o=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(n.attr("transform")||"").match(/translate\([^)]*\)\s*$/);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})},v.measureText=function(t,e,r){var n=t.append("text").text(e).call(v.font,r),i=v.bBox(n.node());return n.remove(),i}},{"../../constants/xmlns_namespaces":692,"../../lib":709,"../../lib/svg_text_utils":728,"../../registry":826,"../../traces/scatter/make_bubble_size_func":1023,"../../traces/scatter/subtypes":1028,"../color":590,"../colorscale":604,"./symbol_defs":615,d3:118,"fast-isnumeric":127,tinycolor2:526}],615:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(t*-.309,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"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:118}],616:[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"}}}},{}],617:[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 m=i.select(this).selectAll("g.errorbar").data(t,e);m.exit().remove(),m.style("opacity",1);var v=m.enter().append("g").classed("errorbar",!0);c&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),m.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 m=d.width;h="M"+(o.x-m)+","+o.yh+"h"+2*m+"m-"+m+",0V"+o.ys,o.noYS||(h+="m-"+m+",0h"+2*m);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",h)}if(f.visible&&a(o.y)&&a(o.xh)&&a(o.xs)){var g=(f.copy_ystyle?d:f).width;h="M"+o.xh+","+(o.y-g)+"v"+2*g+"m0,-"+g+"H"+o.xs,o.noXS||(h+="m0,-"+g+"v"+2*g);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":1028,d3:118,"fast-isnumeric":127}],622:[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":590,d3:118}],623:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},i.family,{arrayOk:!0}),size:n({},i.size,{arrayOk:!0}),color:n({},i.color,{arrayOk:!0})}}}},{"../../lib/extend":701,"../../plots/font_attributes":772}],624:[function(t,e,r){"use strict";function n(t,e,r){Array.isArray(t)&&(e[0][r]=t)}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=0;r=0&&r.indexK.width||Z<0||Z>K.height)return b.unhoverRaw(t,e)}if(I="xval"in e?w.flat(n,e.xval):w.p2c(T,W),P="yval"in e?w.flat(n,e.yval):w.p2c(S,Z),!h(I[0])||!h(P[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var Q=1/0;for(j=0;j1||R.hoverinfo.indexOf("name")!==-1?R.name:void 0,index:!1,distance:Math.min(Q,M.MAXDIST),color:y.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},f[N]&&(H.subplot=f[N]._subplot),G=Y.length,"array"===U){var $=e[j];"pointNumber"in $?(H.index=$.pointNumber,U="closest"):(U="","xval"in $&&(V=$.xval,U="x"),"yval"in $&&(q=$.yval,U=U?"closest":"y"))}else V=I[B],q=P[B];if(R._module&&R._module.hoverPoints){var tt=R._module.hoverPoints(H,V,q,U);if(tt)for(var et,rt=0;rtG&&(Y.splice(0,G),Q=Y[0].distance)}if(0===Y.length)return b.unhoverRaw(t,e);Y.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,it=[];for(O=0;O1,lt=y.combine(f.plot_bgcolor||y.background,f.paper_bgcolor),ut={hovermode:D,rotateLabels:st,bgColor:lt,container:f._hoverlayer,outerContainer:f._paperdiv,commonLabelOpts:f.hoverlabel},ct=i(Y,ut);if(a(Y,st?"xa":"ya"),o(ct,st),e.target&&e.target.tagName){var ht=_.getComponentMethod("annotations","hasClickToShow")(t,it);v(c.select(e.target),ht?"pointer":"")}e.target&&u(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:T,yaxes:S,xvals:I,yvals:P}))}function i(t,e){var r,n,i=e.hovermode,a=e.rotateLabels,o=e.bgColor,s=e.container,l=e.outerContainer,u=e.commonLabelOpts||{},h=e.fontFamily||M.HOVERFONT,f=e.fontSize||M.HOVERFONTSIZE,d=t[0],p=d.xa,v=d.ya,b="y"===i?"yLabel":"xLabel",x=d[b],_=(String(x)||"").split(" ")[0],w=l.node().getBoundingClientRect(),A=w.top,T=w.width,S=w.height,E=d.distance<=M.MAXDIST&&("x"===i||"y"===i);for(r=0;r15&&(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):E&&t[i+"Label"]===x?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 d=e.select("text.nums").call(g.font,t.fontFamily||h,t.fontSize||f,t.fontColor||u).call(g.setPosition,0,0).text(n).attr("data-notex",1).call(m.convertToTspans);d.selectAll("tspan.line").call(g.setPosition,0,0);var p=e.select("text.name"),v=0;r&&r!==n?(p.call(g.font,t.fontFamily||h,t.fontSize||f,l).text(r).call(g.setPosition,0,0).attr("data-notex",1).call(m.convertToTspans),p.selectAll("tspan.line").call(g.setPosition,0,0),v=p.node().getBoundingClientRect().width+2*C):(p.remove(),e.select("rect").remove()),e.select("path").style({fill:l,stroke:u});var b,_,w=d.node().getBoundingClientRect(),M=t.xa._offset+(t.x0+t.x1)/2,z=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),I=Math.abs(t.y1-t.y0),P=w.width+L+C+v;t.ty0=A-w.top,t.bx=w.width+2*C,t.by=w.height+2*C,t.anchor="start",t.txwidth=w.width,t.tx2width=v,t.offset=0,a?(t.pos=M,b=z+I/2+P<=S,_=z-I/2-P>=0,"top"!==t.idealAlign&&b||!_?b?(z+=I/2,t.anchor="start"):t.anchor="middle":(z-=I/2,t.anchor="end")):(t.pos=z,b=M+D/2+P<=T,_=M-D/2-P>=0,"left"!==t.idealAlign&&b||!_?b?(M+=D/2,t.anchor="start"):t.anchor="middle":(M-=D/2,t.anchor="end")),d.attr("text-anchor",t.anchor),v&&p.attr("text-anchor",t.anchor),e.attr("transform","translate("+M+","+z+")"+(a?"rotate("+k+")":""))}),I}function a(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)?T: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===m.pmin&&p.pmax===m.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 v=h[o];for(s=v.length-1;s>=0;s--){var g=v[s],y=t[g.i];y.offset=g.dp,y.del=g.del}}}function o(t,e){t.each(function(t){var r=c.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*(L+C),s=o+a*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-E,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*L+l)+","+(L+u)+"v"+(t.by/2-L)+"h"+n*t.bx+"v-"+t.by+"H"+(n*L+l)+"V"+(u-L)+"Z"),i.call(g.setPosition,o+l,u+t.ty0-t.by/2+C).selectAll("tspan.line").attr({x:i.attr("x"),y:i.attr("y")}),t.tx2width&&(r.select("text.name, text.name tspan.line").call(g.setPosition,s+a*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(g.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(a[r])s=a[r];else if(i[r]){var l=i[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var h=t.trace.hoverinfo;return"all"!==h&&(h=h.split("+"),h.indexOf("x")===-1&&(t.xLabel=void 0),h.indexOf("y")===-1&&(t.yLabel=void 0),h.indexOf("z")===-1&&(t.zLabel=void 0),h.indexOf("text")===-1&&(t.text=void 0),h.indexOf("name")===-1&&(t.name=void 0)),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t}function l(t,e){var r=e.hovermode,n=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,h=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=f.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var m=o.spikemode,v=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=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 c=t("d3"),h=t("fast-isnumeric"),f=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),m=t("../../lib/svg_text_utils"),v=t("../../lib/override_cursor"),g=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),M=t("./constants"),k=M.YANGLE,A=Math.PI*k/180,T=1/Math.sin(A),S=Math.cos(A),E=Math.sin(A),L=M.HOVERARROWSIZE,C=M.HOVERTEXTPAD;r.hover=function(t,e,r){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME)return n(t,e,r),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:a},l=i([r],s);return o(l,s.rotateLabels),l.node()}},{"../../lib":709,"../../lib/events":700,"../../lib/override_cursor":718,"../../lib/svg_text_utils":728,"../../plots/cartesian/axes":748,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"./constants":626,"./helpers":628,d3:118,"fast-isnumeric":127,tinycolor2:526}],630:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i=i||{},r("hoverlabel.bgcolor",i.bgcolor),r("hoverlabel.bordercolor",i.bordercolor),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":709}],631:[function(t,e,r){"use strict";function n(t){var e=o.isD3Selection(t)?t:a.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,r){var n=t.hoverlabel||{},i=o.nestedProperty(n,r).get();return Array.isArray(i)?Array.isArray(e)&&Array.isArray(i[e[0]])?i[e[0]][e[1]]:i[e]:i}var a=t("d3"),o=t("../../lib"),s=t("../dragelement"),l=t("./helpers"),u=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:u},attributes:t("./attributes"),layoutAttributes:u,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:l.getDistanceFunction,getClosest:l.getClosest,inbox:l.inbox,castHoverOption:i,hover:t("./hover").hover,unhover:s.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":709,"../dragelement":611,"./attributes":623,"./calc":624,"./click":625,"./constants":626,"./defaults":627,"./helpers":628,"./hover":629,"./layout_attributes":632,"./layout_defaults":633,"./layout_global_defaults":634,d3:118}],632:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},i.family,{dflt:a.HOVERFONT}),size:n({},i.size,{dflt:a.HOVERFONTSIZE}),color:n({},i.color)}}}},{"../../lib/extend":701,"../../plots/font_attributes":772,"./constants":626}],633:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],641:[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":701,"../../plots/font_attributes":772,"../color/attributes":589}],642:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],643:[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={},m=0,v="normal",g=0;g1)!==!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",v),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":709,"../../plots/layout_attributes":802,"../../registry":826,"./attributes":641,"./helpers":646}],644:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,function(){r.selectAll("tspan.line").attr({x:r.attr("x")}),t.call(o,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr({x:40,y:0,"data-unformatted":u}).style("text-anchor","start").classed("user-select-none",!0).call(v.font,i.legend.font).text(u),e._context.editable&&!s?c.call(y.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;i=o[o.length-1].direction+".name"}else i="name";h.restyle(e,i,t,l)}):c.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(g.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeT&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){a(t,e,n)},T):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,a(t,e,n))}})}function a(t,e,r){if(!e._dragged&&!e._editing){var n,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&A&&e.data&&e._context.showTips?(f.notifier("Double click on legend to isolate individual trace","long"),A=!1):A=!1,p.traceIs(l,"pie")){var d=o.label,m=a.indexOf(d);1===r?m===-1?a.push(d):a.splice(m,1):2===r&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&m===-1&&(a=[])),h.relayout(e,"hiddenlabels",a)}else{var v,g=[],y=[];for(v=0;vtspan"),h=c[0].length||1;r=s*h,n=u.node()&&v.bBox(u.node()).width;var f=s*(.3+(1-h)/2);u.attr("y",f),c.attr("y",f)}r=Math.max(r,16)+3,i.height=r,i.width=n}function s(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=M.isGrouped(i);if(M.isVertical(i))o&&e.each(function(t,e){v.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;v.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];c.select(this).select(".legendtoggle").call(v.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(),u=0,h=l.length;un.width-(n.margin.r+n.margin.l)&&(y=0,p+=m,i.height=i.height+m,m=0),v.setTranslate(this,a+y,5+a+e.height/2+p),i.width+=o+r,i.height=Math.max(i.height,e.height),y+=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];c.select(this).select(".legendtoggle").call(v.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.isCenterAnchor(r)&&(n="center");var i="top";k.isBottomAnchor(r)?i="bottom":k.isMiddleAnchor(r)&&(i="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}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,r=e.legend,n="left";k.isRightAnchor(r)?n="right":k.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"),h=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),m=t("../dragelement"),v=t("../drawing"),g=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("./get_legend_data"),w=t("./style"),M=t("./helpers"),k=t("./anchor_utils"),A=!0,T=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(v.setTranslate,0,e),C.call(v.setRect,N,t,b.scrollBarWidth,b.scrollBarHeight),S.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&_(t.calcdata,y),M=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var S=r._topdefs.selectAll("#"+o).data([0]);S.enter().append("clipPath").attr("id",o).append("rect");var E=A.selectAll("rect.bg").data([0]);E.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),E.call(g.stroke,y.bordercolor),E.call(g.fill,y.bgcolor),E.style("stroke-width",y.borderwidth+"px");var L=A.selectAll("g.scrollbox").data([0]);L.enter().append("g").attr("class","scrollbox");var C=A.selectAll("rect.scrollbar").data([0]);C.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(g.fill,"#808BA4");var z=L.selectAll("g.groups").data(x);z.enter().append("g").attr("class","groups"),z.exit().remove();var D=z.selectAll("g.traces").data(f.identity);D.enter().append("g").attr("class","traces"),D.exit().remove(),D.call(w).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?M.indexOf(t[0].label)!==-1?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(i,t)});var I=0!==A.enter().size();I&&(s(t,z,D),l(t));var P=r.width,O=r.height;s(t,z,D),y.height>O?u(t):l(t);var j=r._size,F=j.l+j.w*y.x,R=j.t+j.h*(1-y.y);k.isRightAnchor(y)?F-=y.width:k.isCenterAnchor(y)&&(F-=y.width/2),k.isBottomAnchor(y)?R-=y.height:k.isMiddleAnchor(y)&&(R-=y.height/2);var N=y.width,B=j.w;N>B?(F=j.l,N=B):(F+N>P&&(F=P-N),F<0&&(F=0),N=Math.min(P-F,y.width));var U=y.height,V=j.h;U>V?(R=j.t,U=V):(R+U>O&&(R=O-U),R<0&&(R=0),U=Math.min(O-R,y.height)),v.setTranslate(A,F,R);var q,H,G=U-b.scrollBarHeight-2*b.scrollBarMargin,Y=y.height-U;if(y.height<=U||t._context.staticPlot)E.attr({width:N-y.borderwidth,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),v.setTranslate(L,0,0),S.select("rect").attr({width:N-2*y.borderwidth,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),L.call(v.setClipUrl,o);else{q=b.scrollBarMargin,H=L.attr("data-scroll")||0,E.attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),S.select("rect").attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-H}),L.call(v.setClipUrl,o),I&&e(q,H),A.on("wheel",null),A.on("wheel",function(){H=f.constrain(L.attr("data-scroll")-c.event.deltaY/G*Y,-Y,0),q=b.scrollBarMargin-H/Y*G,e(q,H),0!==H&&H!==-Y&&c.event.preventDefault()}),C.on(".drag",null),L.on(".drag",null);var X=c.behavior.drag().on("drag",function(){q=f.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),H=-(q-b.scrollBarMargin)/G*Y,e(q,H)});C.call(X),L.call(X)}if(t._context.editable){var W,Z,J,K;A.classed("cursor-move",!0),m.init({element:A.node(),prepFn:function(){var t=v.getTranslate(A);J=t.x,K=t.y},moveFn:function(t,e){var r=J+t,n=K+e;v.setTranslate(A,r,n),W=m.align(r,0,j.l,j.l+j.w,y.xanchor),Z=m.align(n,0,j.t+j.h,j.t,y.yanchor)},doneFn:function(e,n,i){if(e&&void 0!==W&&void 0!==Z)h.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===n?A._clickTimeout=setTimeout(function(){a(o,t,n)},T):2===n&&(A._clickTimeout&&clearTimeout(A._clickTimeout),a(o,t,n)))}}})}}}},{"../../constants/interactions":689,"../../lib":709,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/plots":811,"../../registry":826,"../color":590,"../dragelement":611,"../drawing":614,"./anchor_utils":640,"./constants":642,"./get_legend_data":645,"./helpers":646,"./style":648,d3:118}],645:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))l.indexOf(t)===-1?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var a,o,s={},l=[],u=!1,c={},h=0;for(a=0;ar[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={},m={};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]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),f&&(m.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,m)}var v=l.select(this).select("g.legendpoints"),g=v.selectAll("path.scatterpts").data(s?n:[]);g.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),g.exit().remove(),g.call(h.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(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=l.select(this),i=t[0],a=(i.mlw+1||n.width+1)-1;e.style("stroke-width",a+"px").call(f.fill,i.mc||r.color),a&&e.call(f.stroke,i.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(){var t=e.line.width,r=l.select(this);r.style("stroke-width",t+"px").call(f.fill,e.fillcolor),t&&r.call(f.stroke,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.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var n=r.selectAll("g.legendsymbols").data([t]);n.enter().append("g").classed("legendsymbols",!0),n.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(a).each(o).each(s).each(n).each(i)}},{"../../lib":709,"../../registry":826,"../../traces/pie/style_one":994,"../../traces/scatter/subtypes":1028,"../color":590,"../drawing":614,d3:118}],649:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=f.list(t,null,!0),h="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,v=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(v,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var g=i(s),y=[];return((u||p)&&!g||m)&&(y=["zoom2d","pan2d"]),(u||m)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||g||m||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["toggleSpikelines","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)){var p=i(e,r,l);h("x",p[0]),h("y",p[1]),a.noneOrAll(t,e,["x","y"]),h("xanchor"),h("yanchor"),a.coerceFont(h,"font",r.font);var m=h("bgcolor");h("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),h("bordercolor"),h("borderwidth")}}},{"../../lib":709,"../color":590,"./attributes":653,"./button_attributes":654,"./constants":655}],657:[function(t,e,r){"use strict";function n(t){for(var e=g.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;sY&&n>X&&!t.shiftKey?p.getCursor(i/r,1-a/n):"move";m(e,o),G=o.split("-")[0]}function a(e){N=h.getFromId(t,r.xref),B=h.getFromId(t,r.yref),U=g.getDataToPixel(t,N),V=g.getDataToPixel(t,B,!0),q=g.getPixelToData(t,N),H=g.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(F=r.path,R=a+".path"):(v=U(r.x0),y=V(r.y0),b=U(r.x1),x=V(r.y1),_=a+".x0",w=a+".y0",M=a+".x1",k=a+".y1"),vX&&(d[L]=r[I]=H(u),d[C]=r[P]=H(c)),f-h>Y&&(d[z]=r[O]=q(h),d[D]=r[j]=q(f))}e.attr("d",o(t,r))}var d,v,y,b,x,_,w,M,k,A,T,S,E,L,C,z,D,I,P,O,j,F,R,N,B,U,V,q,H,G,Y=10,X=10,W={setCursor:i,element:e.node(),prepFn:a,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W)}function o(t,e){var r,n,i,a,o=e.type,l=h.getFromId(t,e.xref),u=h.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=g.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(i=g.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=g.decodeDate(n)),u&&"date"===u.type&&(a=g.decodeDate(a)),s(e.path,n,a);var f=n(e.x0),d=n(e.x1),p=a(e.y0),m=a(e.y1);if("line"===o)return"M"+f+","+p+"L"+d+","+m;if("rect"===o)return"M"+f+","+p+"H"+d+"V"+m+"H"+f+"Z";var v=(f+d)/2,y=(p+m)/2,b=Math.abs(v-f),x=Math.abs(y-p),_="A"+b+","+x,w=v+b+","+y;return"M"+w+_+" 0 1,1 "+v+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i],l=t.substr(1).replace(v.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.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,r){return t.replace(v.segmentRE,function(t){var n=0,i=t.charAt(0),a=v.paramIsX[i],o=v.paramIsY[i],s=v.numParams[i];return i+t.substr(1).replace(v.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../dragelement"),m=t("../../lib/setcursor"),v=t("./constants"),g=t("./helpers");e.exports={draw:n,drawOne:i}},{"../../lib":709,"../../lib/setcursor":724,"../../plotly":743,"../../plots/cartesian/axes":748,"../color":590,"../dragelement":611,"../drawing":614,"./constants":668,"./helpers":671}],671:[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}},{}],672:[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":666,"./calc_autorange":667,"./defaults":669,"./draw":670}],673:[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)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",h=u("type",c),f=["x","y"],d=0;d<2;d++){var p=f[d],m={_fullLayout:r},v=i.coerceRef(t,e,m,p,"","paper");if("path"!==h){var g,y,b;"paper"!==v?(g=i.getFromId(m,v),b=o.rangeToShapePosition(g),y=o.shapePositionToRange(g)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],M=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),i.coercePosition(e,m,u,v,x,.25),i.coercePosition(e,m,u,v,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=M}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":709,"../../plots/cartesian/axes":748,"./attributes":666,"./helpers":671}],674:[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":701,"../../plots/animation_attributes":744,"../../plots/font_attributes":772,"../../plots/pad_attributes":810,"./constants":675}],675:[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}},{}],676:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(v,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-E.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=E.currentValueInset,i="left"}a.enter().append("text").classed(E.labelClass,!0).classed("user-select-none",!0).attr("text-anchor",i);var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}return e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(T.convertToTspans),A.setTranslate(a,n,e.currentValueHeight),a}}function l(t,e,r){var n=t.selectAll("rect."+E.gripRectClass).data([0]);n.enter().append("rect").classed(E.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:E.gripWidth,height:E.gripHeight,rx:E.gripRadius,ry:E.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(E.labelClass,!0).classed("user-select-none",!0).attr("text-anchor","middle"),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans),n}function c(t,e){var r=t.selectAll("g."+E.labelsClass).data([0]);r.enter().append("g").classed(E.labelsClass,!0);var n=r.selectAll("g."+E.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(E.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),A.setTranslate(r,g(e,t.fraction),E.tickOffset+e.ticklen+e.labelHeight+E.labelOffset+e.currentValueTotalHeight)})}function h(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&f(t,e,r,a,!0,i)}function f(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(v,r,r.active/(r.steps.length-1),a),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(M.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+E.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);h(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=y(t,w.mouse(i)[0]);h(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+E.tickRectClass).data(e.steps);r.enter().append("rect").classed(E.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=w.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,g(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?E.tickOffset:E.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*E.gripWidth)+","+e.currentValueTotalHeight+")")}}function g(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 b(t,e,r){var n=t.selectAll("rect."+E.railTouchRectClass).data([0]);n.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,E.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+E.railRectClass).data([0]);r.enter().append("rect").classed(E.railRectClass,!0);var n=e.inputAreaLength-2*E.railInset;r.attr({width:n,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,E.railInset,.5*(e.inputAreaWidth-E.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(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+E.groupClassName).data(r,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||f<0){var m={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[b.side];e.attr("transform","translate("+m+")")}}}var m=r.propContainer,v=r.propName,g=r.traceIndex,y=r.dfltName,b=r.avoid||{},x=r.attributes,_=r.transform,w=r.containerGroup,M=t._fullLayout,k=m.titlefont.family,A=m.titlefont.size,T=m.titlefont.color,S=1,E=!1,L=m.title.trim();""===L&&(S=0),L.match(/Click to enter .+ title/)&&(S=.2,E=!0),w||(w=M._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(L).attr("class",e),C.attr({"data-unformatted":L}).call(f);var z="Click to enter "+y+" title";t._context.editable?(L?C.on(".opacity",null):function(){S=0,E=!0,L=z,C.attr({"data-unformatted":L}).text(L).on("mouseover.opacity",function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)})}(),C.call(c.makeEditable).on("edit",function(e){void 0!==g?a.restyle(t,v,e,g):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)})):L&&!L.match(/Click to enter .+ title/)||C.remove(),C.classed("js-placeholder",E)}},{"../../constants/interactions":689,"../../lib":709,"../../lib/svg_text_utils":728,"../../plotly":743,"../../plots/plots":811,"../color":590,"../drawing":614,d3:118,"fast-isnumeric":127}],680:[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",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":701,"../../plots/font_attributes":772,"../../plots/pad_attributes":810,"../color/attributes":589}],681:[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"}},{}],682:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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(a.enter().append("g").classed(E.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+E.headerGroupClassName).data(r,i);c.enter().append("g").classed(E.headerGroupClassName,!0);var h=a.selectAll("g."+E.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(E.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var f=0;fM,T=n.barLength+2*n.barPad,S=n.barWidth+2*n.barPad,E=p,L=v+g;L+S>u&&(L=u-S);var C=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),A?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:L,width:T,height:S}),this._hbarXMin=E+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var z=g>k,D=n.barWidth+2*n.barPad,I=n.barLength+2*n.barPad,P=p+m,O=v;P+D>l&&(P=l-D);var j=this.container.selectAll("rect.scrollbar-vertical").data(z?[0]:[]);j.exit().on(".drag",null).remove(),j.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),z?(this.vbar=j.attr({rx:n.barRadius,ry:n.barRadius,x:P,y:O,width:D,height:I}),this._vbarYMin=O+I/2,this._vbarTranslateMax=k-I):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,R=c-.5,N=z?h+D+.5:h+.5,B=f-.5,U=A?d+S+.5:d+.5,V=s._topdefs.selectAll("#"+F).data(A||z?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",F).append("rect"),A||z?(this._clipRect=V.select("rect").attr({x:Math.floor(R),y:Math.floor(B),width:Math.ceil(N)-Math.floor(R),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,F),this.bg.attr({x:p,y:v,width:m,height:g})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||z){var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(q);var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(H),z&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){ -var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":709,"../color":590,"../drawing":614,d3:118}],686:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],687:[function(t,e,r){"use strict";e.exports={solid:[[],0],dot:[[.5,1],200],dash:[[.5,1],50],longdash:[[.5,1],10],dashdot:[[.5,.625,.875,1],50],longdashdot:[[.5,.7,.8,1],10]}},{}],688:[function(t,e,r){"use strict";e.exports={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"}},{}],689:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300}},{}],690:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6}},{}],691:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc",amp:"&",lt:"<",gt:">",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],692:[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}},{}],693:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.27.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/fx"),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=t("./components/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":586,"./components/fx":631,"./components/images":639,"./components/legend":647,"./components/rangeselector":659,"./components/rangeslider":665,"./components/shapes":672,"./components/sliders":678,"./components/updatemenus":684,"./fonts/mathjax_config":694,"./lib/queue":721,"./plot_api/plot_schema":737,"./plot_api/register":738,"./plot_api/set_plot_config":739,"./plot_api/to_image":741,"./plot_api/validate":742,"./plotly":743,"./snapshot":831,"./snapshot/download":828,"./traces/scatter":1018,d3:118,"es6-promise":124}],694:[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},{}],695:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],696:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM;e.exports=function(t){return"string"==typeof t&&(t=t.replace(/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,"")),n(t)?Number(t):i}},{"../constants/numerical":690,"fast-isnumeric":127}],697:[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;if("string"==typeof t&&t.substr(0,n)===r&&s.test(t.substr(n)))return void e.set(t);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;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function h(t){return t.formatDate("M d, yyyy")}var f=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),v=t("../constants/numerical"),g=v.BADNUM,y=v.ONEDAY,b=v.ONEHOUR,x=v.ONEMIN,_=v.ONESEC,w=v.EPOCHJD,M=t("../registry"),k=f.time.format.utc,A=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var T,S;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=T&&t<=S?t:g;if("string"!=typeof t&&"number"!=typeof t)return g;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m:/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m);if(!s)return g;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),h=Number(s[7]||0),f=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return g;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var v="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,v),c)}else p=m.newDate(l,Number(u),c)}catch(t){return g}return p?(p.toJD()-w)*y+h*b+f*x+d*_:g}l=2===l.length?(Number(l)+2e3-A)%100+A:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,h,f));return k.setUTCFullYear(l),k.getUTCMonth()!==u?g:k.getUTCDate()!==c?g:k.getTime()+d*_},T=r.MIN_MS=r.dateTime2ms("-9999"),S=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==g};var E=90*y,L=3*b,C=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=T&&t<=S))return g;e||(e=0);var i,o,s,l,u,c,h=Math.floor(10*m(t+.05,1)),f=Math.round(t-h/10);if(n(r)){var d=Math.floor(f/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(f))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=T+y&&t<=S-y))return g;var e=Math.floor(10*m(t+.05,1)),r=new Date(Math.round(t-e/10));return a(f.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var z=/%\d?f/g,D=[59,59.9,59.99,59.999,59.9999],I=k("%Y"),P=k("%b %Y"),O=k("%b %-d"),j=k("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,f;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?f=l(p):"m"===r?f=u(p):"d"===r?(a=l(p),f=c(p)):(a=h(p),f=s(t,r))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===r?f=I(m):"m"===r?f=P(m):"d"===r?(a=I(m),f=O(m)):(a=j(m),f=s(t,r))}return f+(a?"\n"+a:"")};var F=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=m(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+F);return l.setUTCMonth(l.getUTCMonth()+e)+i-F},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},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.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||1/0!==c&&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)<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.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":696,"./coerce":697,"./dates":698,"./ensure_array":699,"./extend":701,"./filter_unique":702,"./filter_visible":703,"./identity":708,"./is_array":710,"./is_plain_object":711,"./loggers":712,"./matrix":713,"./mod":714,"./nested_property":715,"./noop":716,"./notifier":717,"./push_unique":720,"./relink_private":722,"./search":723,"./stats":726,"./to_log_range":729,d3:118}],710:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],711:[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}},{}],712:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function h(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"),p=t("./is_plain_object"),m=t("../plot_api/container_array_match");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(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,h,f,d,p,m=n.length,v=n[0][0],g=n[0][1],y=0;for(c=1;cMath.max(h,v)||u>Math.max(f,g)))if(uc||Math.abs(n(o,f))>i)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":690,"./matrix":713}],720:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ra.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":127}],727:[function(t,e,r){"use strict";function n(t){var e=i(t);return e.length?e:[0,0,0,1]}var i=t("color-rgba");e.exports=n},{"color-rgba":91}],728:[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-"+d.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())d.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":"")+(g[n]||"");if("br"===n)return"
";var a,o=e[4];if("a"===n){var s=o&&o.match(T),u=s&&(s[3]||s[4]);if(a="':a+">"}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,f=t("d3"),d=t("../lib"),p=t("../constants/xmlns_namespaces"),m=t("../constants/string_mappings");r.getDOMParser=function(){if(h)return h;if(window.DOMParser)return h=new window.DOMParser;throw new Error("Cannot initialize DOMParser")},f.selection.prototype.appendSVG=function(t){for(var e=['',t,""].join(""),n=r.getDOMParser(),i=n.parseFromString(e,"application/xml"),a=i.documentElement.firstChild;a;)this.node().appendChild(this.node().ownerDocument.importNode(a,!0)),a=a.nextSibling;return i.querySelector("parsererror")?(d.log(i.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?">":t.indexOf("<")!==-1||t.indexOf(">")!==-1?"":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=s.attr("class")+"-math",h.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,h=f.select(s.node().parentNode);if(!h.empty()){var p=s.attr("class")?s.attr("class").split(" ")[0]:"text";p+="-math",h.selectAll("svg."+p).remove(),h.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 v=d.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){h.selectAll("svg."+p).remove(),h.selectAll("g."+p+"-group").remove();var l=i&&i.select("svg");if(!l||!l.node())return r(),void t();var u=h.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"),d=n(l,"height"),m=+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"),g=-v/4;"y"===p[0]?(u.attr({transform:"rotate("+[-90,+s.attr("x"),+s.attr("y")]+") translate("+[-f/2,g-d/2]+")"}),l.attr({x:+s.attr("x"),y:+s.attr("y")})):"l"===p[0]?l.attr({x:s.attr("x"),y:g-d/2}):"a"===p[0]?l.attr({x:0,y:g}):l.attr({x:m,y:+s.attr("y")+g-d/2}),e&&e.call(s,u),t(u)})}))}else r();return t}};var v={sup:'font-size:70%" dy="-0.6em',sub:'font-size:70%" dy="0.3em',b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",br:"",em:"font-style:italic;font-weight:bold"},g={sup:'',sub:''},y=["http:","https:","mailto:"],b=new RegExp("]*)?/?>","g"),x=Object.keys(m.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:m.entityToUnicode[t]}}),_=Object.keys(m.unicodeToEntity).map(function(t){return{regExp:new RegExp(t,"g"),sub:"&"+m.unicodeToEntity[t]+";"}}),w=/(\r\n?|\n)/g,M=/(<[^<>]*>)/,k=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,S=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(b," ")},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]")&&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=d.getPlotDiv(o.node()),e=f.select(t),n=e.select(".svg-container"),a=n.append("div");a.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,n,r)).on("blur",function(){t._editing=!1,o.text(this.textContent).style({opacity:1});var e,r=f.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&f.select(o.node().parentNode).select(e).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 e=this;t._editing=!0,f.select(document).on("mouseup",function(){if(f.event.target===e)return!1;document.activeElement===a.node()&&a.node().blur()})}).on("keyup",function(){27===f.event.which?(t._editing=!1,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,n,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":691,"../constants/xmlns_namespaces":692,"../lib":709,d3:118}],729:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":127}],730:[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":774,"topojson-client":528}],731:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),h=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 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 g=h.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",h);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",h,y),!0;e.set(y)}return!m&&(f(v,g),d(t),!0)}var b,x,_,w,M,k,A,T=Object.keys(r).map(Number).sort(s),S=e.get(),E=S||[],L=n(g,h).get(),C=[],z=-1,D=E.length;for(b=0;bE.length-(A?0:1))o.warn("index out of range",h,_);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",h,_),c(k)?C.push(_):A?("add"===k&&(k={}),E.splice(_,0,k),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",h,_,k),z===-1&&(z=_);else for(x=0;x=0;b--)E.splice(C[b],1),L&&L.splice(C[b],1);if(E.length?S||e.set(E):e.set(null),m)return!1;if(f(v,g),p!==a){var I;if(z===-1)I=T;else{for(D=Math.max(E.length,D),I=[],b=0;b=z);b++)I.push(_);for(b=z;b=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lN.range[0]?[1,2]:[2,1]);else{var V=N.range[0],q=N.range[1];B?(V<=0&&q<=0&&r(j+".autorange",!0),V<=0?V=q/1e6:q<=0&&(q=V/1e6),r(j+".range[0]",Math.log(V)/Math.LN10),r(j+".range[1]",Math.log(q)/Math.LN10)):(r(j+".range[0]",Math.pow(10,V)),r(j+".range[1]",Math.pow(10,q)))}else r(j+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,R,T,r),w.getComponentMethod("images","convertCoords")(t,R,T,r)}else r(j+".autorange",!0)}else if(D.match(I.AX_NAME_PATTERN)){var H=b.nestedProperty(u,k).get(),G=(T||{}).type;G&&"-"!==G||(G="linear"),w.getComponentMethod("annotations","convertCoords")(t,H,G,r),w.getComponentMethod("images","convertCoords")(t,H,G,r)}var Y=C.containerArrayMatch(k);if(Y){a=Y.array,o=Y.index;var X=Y.property,W=b.nestedProperty(l,a),Z=(W||[])[o]||{};if(""===o)k.indexOf("updatemenus")===-1&&(v.docalc=!0);else if(""===X){var J=T;C.isAddVal(T)?x[k]=null:C.isRemoveVal(T)?(x[k]=Z,J=Z):b.warn("unrecognized full object value",e),(n(J,"x")||n(J,"y")&&k.indexOf("updatemenus")===-1)&&(v.docalc=!0)}else!n(Z,"x")&&!n(Z,"y")||b.containsAny(k,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);f[a]||(f[a]={});var K=f[a][o];K||(K=f[a][o]={}),K[X]=T,delete e[k]}else if("reverse"===D)F.range?F.range.reverse():(r(j+".autorange",!0),F.range=[1,0]),R.autorange?v.docalc=!0:v.doplot=!0;else{var Q=String(A.parts[1]||"");0===L.indexOf("scene")?"camera"===A.parts[1]?v.docamera=!0:v.doplot=!0:0===L.indexOf("geo")?v.doplot=!0:0===L.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===k?v.doplot=!0:"margin"===L||"autorange"===Q||"rangemode"===Q||"type"===Q||"domain"===Q||"fixedrange"===Q||"scaleanchor"===Q||"scaleratio"===Q||k.indexOf("calendar")!==-1||k.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||k.indexOf("axis")===-1&&"plot_bgcolor"!==k?"hiddenlabels"===k?v.docalc=!0:L.indexOf("legend")!==-1?v.dolegend=!0:k.indexOf("title")!==-1?v.doticks=!0:L.indexOf("bgcolor")!==-1?v.dolayoutstyle=!0:S>1&&b.containsAny(Q,["tick","exponent","grid","zeroline"])?v.doticks=!0:k.indexOf(".linewidth")!==-1&&k.indexOf("axis")!==-1?v.doticks=v.dolayoutstyle=!0:S>1&&Q.indexOf("line")!==-1?v.dolayoutstyle=!0:S>1&&"mirror"===Q?v.doticks=v.dolayoutstyle=!0:"margin.pad"===k?v.doticks=v.dolayoutstyle=!0:["hovermode","dragmode"].indexOf(k)!==-1||k.indexOf("spike")!==-1?v.domodebar=!0:["height","width","autosize"].indexOf(k)===-1&&(v.doplot=!0):v.doplot=!0,A.set(T)}}}for(a in f){C.applyContainerArrayChanges(t,b.nestedProperty(l,a),f[a],v)||(v.doplot=!0)}var $=u._axisConstraintGroups;for(var tt in _)for(o=0;o<$.length;o++){var et=$[o];if(et[tt]){v.docalc=!0;for(var rt in et)_[rt]||(O.getFromId(t,rt)._constraintShrinkable=!0)}}var nt=u.width,it=u.height;return t.layout.autosize&&M.plotAutoSize(t,t.layout,u),(e.height||e.width||u.width!==nt||u.height!==it)&&(v.docalc=!0),(v.doplot||v.docalc)&&(v.layoutReplot=!0),{flags:v,undoit:x,redoit:g,eventData:b.extendDeep({},g)}}function m(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._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(E.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._bgLayer=r._paper.append("g").classed("bglayer",!0),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),r._geolayer=r._paper.append("g").classed("geolayer",!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._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"),g=t("fast-isnumeric"),y=t("../plotly"),b=t("../lib"),x=t("../lib/events"),_=t("../lib/queue"),w=t("../registry"),M=t("../plots/plots"),k=t("../plots/polar"),A=t("../plots/cartesian/graph_interact"),T=t("../components/drawing"),S=t("../components/errorbars"),E=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),C=t("./manage_arrays"),z=t("./helpers"),D=t("./subroutines"),I=t("../plots/cartesian/constants"),P=t("../plots/cartesian/constraints"),O=t("../plots/cartesian/axis_ids");y.plot=function(t,e,r,n){function o(){if(g)return y.addFrames(t,g)}function s(){for(var e=E._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),!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=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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function h(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,z.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function f(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&h()};e()}function d(t){return Array.isArray(s)?v>=s.length?t.transitionOpts=s[v]:t.transitionOpts=s[0]:t.transitionOpts=s,v++,t}var p,m,v=0,g=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||["string","number"].indexOf(typeof e)!==-1)for(p=0;p0&&kk)&&A.push(m);g=A}}g.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(b.isPlainObject(e[i])){var f=(u[e[i].name]||{}).name,d=e[i].name;f&&d&&"number"==typeof d&&u[f]&&(n++,b.warn('addFrames: overwriting frame "'+u[f].name+'" with a frame whose name of type "number" also equates to "'+f+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h.push({frame:M.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:c+i})}h.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=h[i].frame,"number"==typeof a.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=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),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":614,"../components/errorbars":620,"../constants/xmlns_namespaces":692,"../lib":709,"../lib/events":700,"../lib/queue":721,"../lib/svg_text_utils":728,"../plotly":743,"../plots/cartesian/axis_ids":751,"../plots/cartesian/constants":753,"../plots/cartesian/constraints":755,"../plots/cartesian/graph_interact":757,"../plots/plots":811,"../plots/polar":814,"../registry":826,"./helpers":733,"./manage_arrays":734,"./subroutines":740,d3:118,"fast-isnumeric":127}],736:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],737:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,m),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){f(n,r.schema.traces[t][e],e)})}),n.type=t;var i={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var a={};w(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return w(t,v),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)h(t,r,"xaxis"),h(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;h(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){ -f(t,r.schema.layout[e],e)}):f(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],r=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){f(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},g)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(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)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(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 _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function h(t,e,r){var n=p.nestedProperty(t,r),i=w({},e.layoutAttributes);i[M]=!0,n.set(i)}function f(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),m=t("../plots/attributes"),v=t("../plots/layout_attributes"),g=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,M="_isSubplotObj",k="_isLinkedToArray",A=[M,k,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=M,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED="_deprecated",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]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];A.indexOf(n)===-1&&(e(a,n,t,i),r.isValObject(a)||p.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){if(a=a.slice(0,s).concat([r]),e&&("data_array"===e.valType||e.arrayOk===!0)){var l=n(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}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;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}var i=t("d3"),a=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),h=t("../components/titles"),f=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=a.Axes.list(t);for(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.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(h).then(function(t){r(t)}).catch(function(t){n(t)})})}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":709,"../plotly":743,"../snapshot/cloneplot":827,"../snapshot/helpers":830,"../snapshot/svgtoimg":832,"../snapshot/tosvg":834,"fast-isnumeric":127}],742:[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,v=r.length,g=0;g.3*h||a(n)||a(i))){var f=r.dtick/2;t+=t+f.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=O.tickIncrement(t,"M6","reverse")+1.5*C:a.exactMonths>.8?t=O.tickIncrement(t,"M1","reverse")+15.5*C:t-=C/2;var s=O.tickIncrement(t,r);if(s<=n)return s}return t}function a(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),h=Math.max(s,u),f=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&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>=D&&i<=16||e>=z)t._tickround="M";else if(e>=I&&i<=19||e>=D)t._tickround="S";else{var a=t.l2r(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 l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var i=t._tickround,a=r&&t.hoverformat||t.tickformat;n&&(i=b(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=_.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");l!==-1&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&_.mod(o+.01,1)<.1)if(["e","E","power"].indexOf(t.exponentformat)!==-1){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,_.mod(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 h(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=d(e.x,t,i,n)}function d(t,e,r,n){var i=t<0,a=e._tickround,o=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:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};s(h),a=(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,-a)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+m:"E"===o?t+="E"+m:"power"===o?t+="\xd710"+m+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=H[l/3+5])}return i?"\u2212"+t:t}function p(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},O.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 m=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[m,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,v)]:[m,v]}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(),_.simpleMap(r,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._input;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=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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,m,v=e.length,g=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),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),M=n(r.vpadplus||r.vpad),k=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,a,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),h=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),f=h*_.roundUp(c.minDiff/h,[.9,1.9,4.9,9.9],!0);u=Math.max(f,2*_.stdev(t)/Math.pow(t.length,a?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},O.setConvert(d),O.autoTicks(d,u);var p,m=O.tickIncrement(O.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){m=n(m,t,d,s,l);p=m+(1+Math.floor((l-m)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(m=i(m,t,d.dtick,s,o)),p=m;p<=l;)p=O.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(m,0,o),end:e.c2r(p,0,o),size:d.dtick}},O.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),O.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return a(t);t._tmin=O.tickFirst(t);var i=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=O.tickIncrement(u,t.dtick,i,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),h=0;hE?(e/=E,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,R)):n>L?(e/=L,t.dtick="M"+o(e,1,N)):n>C?(t.dtick=o(e,C,U),t.tick0=_.dateTick0(t.calendar,!0)):n>z?t.dtick=o(e,z,N):n>D?t.dtick=o(e,D,B):n>I?t.dtick=o(e,I,B):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,R))}else if("log"===t.type){t.tick0=0;var i=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var a=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/a,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(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=o(e,r,R));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,n){var i=r?-1:1;if(b(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return _.incrementMonth(t,o,n);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?q:V,l=t+.01*i,u=_.roundUp(_.mod(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=_.simpleMap(t.range,e),n=r[1]1&&e2*i}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,e){return i(t,e)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],750:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),h=t("./category_order_defaults"),f=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,m){function v(r,n){return a.coerce2(t,e,s,r,n)}var g=p.letter,y=p.font||{},b="Click to enter "+(p.title||g.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(f(e,m),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),h(t,e,r),e._initialCategories="category"===_?d(g,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),M=w===t.color?w:y.color;r("title",b),a.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:M}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var k=v("linecolor",w),A=v("linewidth"),T=r("showline",!!k||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var S=v("gridcolor",n(w,p.bgColor,o).toRgbString()),E=v("gridwidth");r("showgrid",p.showGrid||!!S||!!E)||(delete e.gridcolor,delete e.gridwidth);var L=v("zerolinecolor",w),C=v("zerolinewidth");return r("zeroline",p.showGrid||!!L||!!C)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":589,"../../lib":709,"../../registry":826,"./category_order_defaults":752,"./layout_attributes":759,"./ordered_categories":761,"./set_convert":765,"./tick_label_defaults":766,"./tick_mark_defaults":767,"./tick_value_defaults":768,tinycolor2:526}],751:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],753:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],754:[function(t,e,r){"use strict";function n(t,e,r,n){var i,a,s,l,u=n[o(e)].type,c=[];for(a=0;aa*p))for(r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function h(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function f(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function m(t){return["lasso","select"].indexOf(t)!==-1}function v(t,e){return"M"+(t.l-.5)+","+(e-j-.5)+"h-3v"+(2*j+1)+"h3ZM"+(t.r+.5)+","+(e-j-.5)+"h3v"+(2*j+1)+"h-3Z"}function g(t,e){return"M"+(e-j-.5)+","+(t.t-.5)+"v-3h"+(2*j+1)+"v3ZM"+(e-j-.5)+","+(t.b+.5)+"v3h"+(2*j+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,j)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,i,a,o,s,l,u=!1,c={},h={};for(n=0;nj||s>j?(wt="xy",o/nt>s/it?(s=o*it/nt,gt>a?yt.t=gt-s:yt.b=gt+s):(o=s*nt/it,vt>i?yt.l=vt-o:yt.r=vt+o),kt.attr("d",y(yt))):n():!ot||szoom back out","long"),F=!1)}function G(e,r){var n=1===(N+B).length;if(e)J();else if(2!==r||n){if(1===r&&n){var i=N?tt[0]:$[0],o="s"===N||"w"===B?0:1,s=i._name+".range["+o+"]",l=a(i,o),u="left",c="middle";if(i.fixedrange)return;N?(c="n"===N?"top":"bottom","right"===i.side&&(u="right")):"e"===B&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(pt).call(A.makeEditable,null,{immediate:!0,background:ht.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=i.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else Z()}function Y(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=k.simpleMap(t.range,t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||ht._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var n=t.querySelector(".plotly");if(U(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Tt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void k.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=Et.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(B||lt){for(B||(l=.5),a=0;a<$.length;a++)r($[a],l,o);At[2]*=o,At[0]+=At[2]*l*(1/o-1)}if(N||lt){for(N||(u=.5),a=0;ac[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":709,"fast-isnumeric":127}],763:[function(t,e,r){"use strict";e.exports=function(t,e,r){void 0===r&&(r=.5);var n=[t.r2l(t.range[0]),t.r2l(t.range[1])],i=n[0]+(n[1]-n[0])*r,a=(i-n[0])*e;t.range=t._input.range=[t.l2r(i-a),t.l2r(i+a)]}},{}],764:[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,m=i.gd._fullLayout._zoomlayer,v=i.element.getBoundingClientRect(),g=i.plotinfo.xaxis._offset,y=i.plotinfo.yaxis._offset,b=e-v.left,x=r-v.top,_=b,w=x,M="M"+b+","+x,k=i.xaxes[0]._length,A=i.yaxes[0]._length,T=i.xaxes.map(n),S=i.yaxes.map(n),E=i.xaxes.concat(i.yaxes);"lasso"===h&&(p=l([[b,x]],s.BENDPX));var L=m.selectAll("path.select-outline").data([1,2]);L.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+g+", "+y+")").attr("d",M+"Z");var C,z,D,I,P,O=m.append("path").attr("class","zoombox-corners").style({fill:a.background,stroke:a.defaultLine,"stroke-width":1}).attr("transform","translate("+g+", "+y+")").attr("d","M0,0Z"),j=[],F=i.gd,R=[];for(C=0;Cf?d:o(t)?Number(t):d):d}var a=t("d3"),o=t("fast-isnumeric"),s=t("../../lib"),l=s.cleanNumber,u=s.ms2DateTime,c=s.dateTime2ms,h=t("../../constants/numerical"),f=h.FP_SAFE,d=h.BADNUM,p=t("./constants"),m=t("./axis_ids");e.exports=function(t,e){function r(e,r){if(e>0)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*w*Math.abs(n-i))}return d}function h(e,r,n){var i=c(e,n||t.calendar);if(i===d){if(!o(e))return d;i=c(new Date(+e))}return i}function v(e,r,n){return u(e,r,n||t.calendar)}function g(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if("number"==typeof e)return e}function x(e){return o(e)?a.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:i,t.l2c="log"===t.type?n:i,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,["linear","-"].indexOf(t.type)!==-1?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=l,t.c2d=t.c2r=t.l2d=t.l2r=i,t.d2p=t.r2p=function(t){return x(l(t))},t.p2d=t.p2r=_):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(l(t),e)},t.r2d=t.r2c=function(t){return n(l(t))},t.d2c=t.r2l=l,t.c2d=t.l2r=i,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return x(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(t){return x(l(t))},t.p2r=_):"date"===t.type?(t.d2r=t.r2d=s.identity,t.d2c=t.r2c=t.d2l=t.r2l=h,t.c2d=t.c2r=t.l2d=t.l2r=v,t.d2p=t.r2p=function(t,e,r){return x(h(t,0,r))},t.p2d=t.p2r=function(t,e,r){return v(_(t),e,r)}):"category"===t.type&&(t.d2r=t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=g,t.d2l_noadd=b,t.r2l=t.l2r=t.r2c=t.c2r=i,t.d2p=function(t){return x(b(t))},t.p2d=function(t){return g(_(t))},t.r2p=x,t.p2r=_),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,i=s.nestedProperty(t,e).get(),a=(t._id||"x").charAt(0);if(n="date"===t.type?s.dfltRange(t.calendar):"y"===a?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void s.nestedProperty(t,e).set(n);for("date"===t.type&&(i[0]=s.cleanDate(i[0],d,t.calendar),i[1]=s.cleanDate(i[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!s.isDateTime(i[r],t.calendar)){t[e]=n;break}if(t.r2l(i[0])===t.r2l(i[1])){var l=s.constrain(t.r2l(i[0]),s.MIN_MS+1e3,s.MAX_MS-1e3);i[0]=t.l2r(l-1e3),i[1]=t.l2r(l+1e3);break}}else{if(!o(i[r])){if(!o(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-f?i[r]=-f:i[r]>f&&(i[r]=f),i[0]===i[1]){var u=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=u,i[1]+=u}}},t.setScale=function(r){var n=e._size,i=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=m.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var o=r&&t._r?"_r":"range",l=t.calendar;t.cleanRange(o);var u=t.r2l(t[o][0],l),c=t.r2l(t[o][1],l);if("y"===i?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw s.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,i,a,o="date"===t.type&&e[r+"calendar"];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?i.dateTick0(e.calendar):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 m=r("tickvals");void 0===m?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],769:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r){for(i=0;ir.duration?(d(),k=window.cancelAnimationFrame(m)):k=window.requestAnimationFrame(m)}var v=t._fullLayout,g=[],y=function(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=v[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,g.push(s),o[s]=a}return o}(e),b=Object.keys(y),x=function(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}(v,b,y);if(!x.length)return!1;var _;u&&(_=u());var w,M,k,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(k),k=null,p()}),w=Date.now(),k=window.requestAnimationFrame(m),Promise.resolve()}},{"../../components/drawing":614,"../../plotly":743,"../../registry":826,"./axes":748,d3:118}],770:[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 u=i(e,r,n);if(u){if("histogram"===u.type&&n==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=n+"calendar",h=u[c];if(o(u,n)){for(var f,d=a(u),p=[],m=0;m0?".":"")+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;he*Math.PI/180},w.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":590,"../../components/drawing":614,"../../components/fx":631,"../../lib/topojson_utils":730,"../cartesian/axes":748,"../plots":811,"./constants":774,"./projections":782,"./set_scale":783,"./zoom":784,"./zoom_reset":785,d3:118,"topojson-client":528}],776:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/plots");r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,a=i.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var o=0;on^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?z:t<-1?-z:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+z)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>E;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=j(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?j:1/0===e?f:(r.invert=function(r,n){var i=j.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 m(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)>E&&--i>0);return e/2}}function v(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}function g(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=R[i])[0],s=r[1],l=(r=R[++i])[0],u=r[1],c=(r=R[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?z:-z)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function y(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 x(t,e){var r=b(t,e);return[(r[0]+t/z)/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&&_.hasOwnProperty(t.type)?_[t.type]:r)(t,n)};var _={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},w=[],M=[],k={point:function(t,e){w.push([t,e])},result:function(){var t=w.length?w.length<2?{type:"Point",coordinates:w[0]}:{type:"MultiPoint",coordinates:w}:null;return w=[],t}},A={lineStart:n,point:function(t,e){w.push([t,e])},lineEnd:function(){w.length&&(M.push(w),w=[])},result:function(){var t=M.length?M.length<2?{type:"LineString",coordinates:M[0]}:{type:"MultiLineString",coordinates:M}:null;return M=[],t}},T={polygonStart:n,lineStart:n,point:function(t,e){w.push([t,e])},lineEnd:function(){var t=w.length;if(t){do{w.push(w[0].slice())}while(++t<4);M.push(w),w=[]}},polygonEnd:n,result:function(){if(!M.length)return null;var t=[],e=[];return M.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])}),M=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},S={Point:k,MultiPoint:k,LineString:A,MultiLineString:A,Polygon:T,MultiPolygon:T,Sphere:T},E=1e-6,L=E*E,C=Math.PI,z=C/2,D=(Math.sqrt(C),C/180),I=180/C,P=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=[];++aE&&--i>0);return[t/(.8707+(a=n*n)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return P(v)}).raw=v;var R=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];R.forEach(function(t){t[1]*=1.0144}),g.invert=function(t,e){var r=e/z,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=R[a][1],s=R[a+1][1],l=R[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,m=50;do{i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=R[a][1],s=R[a+1][1],l=R[Math.min(19,a+2)][1],n-=(p=(e>=0?z:-z)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*I}while(Math.abs(p)>L&&--m>0);break}}while(--a>=0);var v=R[a][0],g=R[a+1][0],y=R[Math.min(19,a+2)][0];return[t/(g+d*(y-v)/2+d*d*(y-2*g+v)/2),n*D]},(t.geo.robinson=function(){return P(g)}).raw=g,y.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return P(y)}).raw=y,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+E)){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,m=s*s,v=1-p*u*u,g=v?l(h*u)*Math.sqrt(a=1/v):a=0,y=2*g*h*s-t,b=g*c-e,x=a*(p*m+g*h*u*d),_=a*(.5*o*f-2*g*c*s),w=.25*a*(f*s-g*c*p*o),M=a*(d*u+g*m*h),k=_*w-M*x;if(!k)break;var A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>E||Math.abs(T)>E)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return P(b)}).raw=b,x.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),m=p*p,v=1-h*d*d,g=v?l(o*d)*Math.sqrt(a=1/v):a=0,y=.5*(2*g*o*p+r/z)-t,b=.5*(g*s+n)-e,x=.5*a*(h*m+g*o*d*c)+.5/z,_=a*(f*u/4-g*s*p),w=.125*a*(u*p-g*s*h*f),M=.5*a*(c*d+g*m*o)+.5,k=_*w-M*x,A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>E||Math.abs(T)>E)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return P(x)}).raw=x}e.exports=n},{}],783:[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,m=o.range[1]-s,v=n._fullRange[0]+s,g=n._fullRange[1]-s,y=o._fullRange[0]+s,b=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var x=d-f,_=m-p,w=[f+x/2,p+_/2],M=r._rotate;return r._center=[w[0]+M[0],w[1]+M[1]],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,x,_=e.scale(),w=r._translate0,M=i(f,p,d,m),k=i(v,y,g,b);l=a(e,M),o=n(l),x=a(e,k),r._fullScale=n(x),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}}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":774,d3:118}],784:[function(t,e,r){"use strict";function n(t,e){return(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(k)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(A)}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 v.invert(t)}function n(t){var e=v(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(k),l=_.mouse(this),u=v.rotate(),c=v.translate(),h=u,f=r(l)}function o(){if(d=_.mouse(this),n(l))return g.scale(v.scale()),void g.translate(v.translate());v.scale(_.event.scale),v.translate([c[0],_.event.translate[1]]),f?r(d)&&(m=r(d),p=[h[0]+(m[0]-f[0]),u[1],u[2]],v.rotate(p),h=p):(l=d,f=r(l)),t.render()}function s(){_.select(this).style(A)}var l,u,c,h,f,d,p,m,v=t.projection,g=i(v,e),y=2;return g.on("zoomstart",a).on("zoom",o).on("zoomend",s),g}function s(t,e){function r(t){g++||t({type:"zoomstart"})}function n(t){t({type:"zoom"})}function a(t){--g||t({type:"zoomend"})}var o,s=t.projection,d={r:s.rotate(),k:s.scale()},p=i(s,e),m=x(p,"zoomstart","zoom","zoomend"),g=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);var t=_.mouse(this),e=s.rotate(),i=e,a=s.translate(),g=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=v(c(g,p)),b=d.r=f(y,o,i);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=i),s.rotate(b),i=b}}else t=r,o=l(s,t);n(m.of(this,arguments))}),r(m.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),a(m.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,m,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&g(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=b(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=m(e,2,t[0]);n=m(n,1,t[1]),n=m(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 v=180-a-2*f,g=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M;return d(r[0],r[1],a,g)<=d(r[0],r[1],v,y)?[a,g,r[2]]:[v,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 m(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 v(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 g(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;nMath.abs(h)?(u.boxEnd[1]=u.boxStart[1]+Math.abs(c)*w*(Math.sign(h)||1),u.boxEnd[1]f[3]&&(u.boxEnd[1]=f[3],u.boxEnd[0]=u.boxStart[0]+(f[3]-u.boxStart[1])/Math.abs(w))):(u.boxEnd[0]=u.boxStart[0]+Math.abs(h)/w*(Math.sign(c)||1),u.boxEnd[0]f[2]&&(u.boxEnd[0]=f[2],u.boxEnd[1]=u.boxStart[1]+(f[2]-u.boxStart[0])*Math.abs(w)))}}else u.boxEnabled?(c=u.boxStart[0]!==u.boxEnd[0],h=u.boxStart[1]!==u.boxEnd[1],c||h?(c&&(o(0,u.boxStart[0],u.boxEnd[0]),t.xaxis.autorange=!1),h&&(o(1,u.boxStart[1],u.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),u.boxEnabled=!1,u.boxInited=!1):u.boxInited&&(u.boxInited=!1);break;case"pan":u.boxEnabled=!1,u.boxInited=!1,n?(u.panning||(u.dragStart[0]=i,u.dragStart[1]=a),Math.abs(u.dragStart[0]-i)h[d+2]&&(h[d]=-1,h[d+2]=1),f=this[b[d]],f._length=o.viewBox[d+2]-o.viewBox[d],l.doAutoRange(f),f.setScale();var g={_axisConstraintGroups:this.graphDiv._fullLayout._axisConstraintGroups,xaxis:this.xaxis,yaxis:this.yaxis};y({_fullLayout:g}),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},x.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])]},x.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])]},x.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":35,"mouse-change":445,"mouse-wheel":448,"right-now":494}],791:[function(t,e,r){"use strict";var n=t("./scene"),i=t("../plots"),a=t("../../lib"),o=t("../../constants/xmlns_namespaces");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){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl3d"),s=0;s1;o(t,e,r,{type:"gl3d",attributes:s,handleDefaults:n,font:e.font,fullData:r,getDfltFromLayout:a,paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":590,"../../../lib":709,"../../subplot_defaults":818,"./axis_defaults":794,"./layout_attributes":797}],797:[function(t,e,r){"use strict";function n(t,e,r){return{x:{valType:"number",dflt:t},y:{valType:"number",dflt:e},z:{valType:"number",dflt:r}}}var i=t("./axis_attributes"),a=t("../../../lib/extend").extendFlat;e.exports={bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},camera:{up:a(n(0,0,1),{}),center:a(n(0,0,0),{}),eye:a(n(1.25,1.25,1.25),{})},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]}},aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto"},aspectratio:{x:{valType:"number",min:0},y:{valType:"number",min:0},z:{valType:"number",min:0}},xaxis:i,yaxis:i,zaxis:i,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest"},_deprecated:{cameraposition:{valType:"info_array"}}}},{"../../../lib/extend":701,"./axis_attributes":793}],798:[function(t,e,r){"use strict";function n(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}function i(t){var e=new n;return e.merge(t),e}var a=t("../../../lib/str2rgbarray"),o=["xaxis","yaxis","zaxis"];n.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[o[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=a(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=i},{"../../../lib/str2rgbarray":727}],799:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],i=new Array(n.length),a=0;af[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;am[1][a])m[0][a]=-1,m[1][a]=1;else{var x=m[1][a]-m[0][a];m[0][a]-=x/32,m[1][a]+=x/32}}else{var _=c[A[a]].range;m[0][a]=_[0],m[1][a]=_[1]}m[0][a]===m[1][a]&&(m[0][a]-=1,m[1][a]+=1),v[a]=m[1][a]-m[0][a],this.glplot.bounds[0][a]=m[0][a]*d[a],this.glplot.bounds[1][a]=m[1][a]*d[a]}var w=[1,1,1];for(a=0;a<3;++a){l=c[A[a]],u=l.type;var M=y[u];w[a]=Math.pow(M.acc,1/M.count)/d[a]}var k;if("auto"===c.aspectmode)k=Math.max.apply(null,w)/Math.min.apply(null,w)<=4?w:[1,1,1];else if("cube"===c.aspectmode)k=[1,1,1];else if("data"===c.aspectmode)k=w;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var T=c.aspectratio;k=[T.x,T.y,T.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 S=c.domain||null,E=e._size||null;if(S&&E){var L=this.container.style;L.position="absolute",L.left=E.l+S.x[0]*E.w+"px",L.top=E.t+(1-S.y[1])*E.h+"px",L.width=E.w*(S.x[1]-S.x[0])+"px",L.height=E.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.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},k.setCamera=function(t){this.glplot.camera.lookAt.apply(this,l(t))},k.saveCamera=function(t){var e=this.getCamera(),r=p.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;if(void 0===n)i=!0;else for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!function(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]]}(e,n,a,o)){i=!0;break}return i&&r.set(e),i},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":709,"./convert_text_opts":804}],807:[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={_arrayAttrRegexps:[/^mapbox([2-9]|[1-9][0-9]+)?\.layers/],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":590,"../../lib":709,"../../traces/scatter/attributes":1008,"../font_attributes":772}],808:[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"),l=r.select(".js-link-spacer"),u=r.select(".js-sourcelinks");t._context.showSources&&t._context.showSources(t),t._context.showLink&&n(t,o),l.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=s.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).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={},i=t.layout||{},a=t._fullData||[],o=t._fullData=[],s=t.data||[];if(t._transitionData||p.createTransitionData(t),r._initialAutoSizeIsDone){var l=r.width,c=r.height;p.supplyLayoutGlobalDefaults(i,n),i.width||(n.width=l),i.height||(n.height=c)}else{p.supplyLayoutGlobalDefaults(i,n);var h=!i.width||!i.height,f=n.autosize,d=t._context&&t._context.autosizable;h&&(f||d)?p.plotAutoSize(t,i,n):h&&p.sanitizeMargins(t),!f&&h&&(i.width=n.width,i.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=s.length,n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(s,o,i,n),n._has=p._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=a(t._boundingBoxMargins),f=c.left+c.right,d=c.bottom+c.top,m=1-2*s,v=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(m*(v.width-f)),i=Math.round(m*(v.height-d))}else{var g=u?window.getComputedStyle(t):{};n=parseFloat(g.width)||r.width,i=parseFloat(g.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;u.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];n._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),c=e._pushmargin;if(e.margin.autoexpand!==!1){c.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}};for(var h=Object.keys(c),f=0;fv){var k=(g*w+(M-e.width)*v)/(w-v),A=(M*(1-v)+(g-e.width)*(1-w))/(w-v);k>=0&&A>=0&&k+A>i+a&&(i=k,a=A)}}if(l(b)&&c[_].t){var T=c[_].t.val,S=c[_].t.size;if(T>y){var E=(b*T+(S-e.height)*y)/(T-y),L=(S*(1-y)+(b-e.height)*(1-T))/(T-y);E>=0&&L>=0&&E+L>s+o&&(s=E,o=L)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return u.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!h.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):h.isJSDate(t)?h.ms2DateTimeLocal(+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=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(u.layout=a(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=a(l)),"object"===n?u:JSON.stringify(u)},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 u.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var o,s,l=0,c=0,d=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,E=S?h.angularAxis.domain:n.extent(M),L=Math.abs(M[1]-M[0]);A&&!k&&(L=0);var C=E.slice();T&&k&&(C[1]+=L);var z=h.angularAxis.ticksCount||4;z>8&&(z=z/(z/8)+z%8),h.angularAxis.ticksStep&&(z=(C[1]-C[0])/z);var D=h.angularAxis.ticksStep||(C[1]-C[0])/(z*(h.minorTicks+1));w&&(D=Math.max(Math.round(D),1)),C[2]||(C[2]=D);var I=n.range.apply(this,C);if(I=I.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=T?L:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),O=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));e=n.select(O)}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"),R={fill:"none",stroke:h.tickColor},N={"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("+[b,h.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:B,reverseOrder:h.legend.reverseOrder})})();var U=j.node().getBBox();b=Math.min(h.width-U.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],i.range([0,b]),c.layout.radialAxis.domain=i.domain(),j.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else j=e.select(".legend-group").style({display:"none"});e.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var V=[(h.width-(h.margin.left+h.margin.right+2*b+(U?U.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),h.title){var q=e.select("g.title-group text").style(N).text(h.title),H=q.node().getBBox();q.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var G=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(R),Y.attr("r",i),Y.exit().remove()}G.select("circle.outside-circle").attr({r:b}).style(R);var X=e.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var W=n.svg.axis().scale(i).ticks(5).tickSize(5);G.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),G.selectAll(".domain").style(R),G.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(N).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,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=e.select(".angular.axis-group").selectAll("g.angular-tick").data(I),J=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Z.exit().remove(),J.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(R),J.selectAll(".minor").style({stroke:h.minorTickColor}),Z.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(N);var K=Z.select("text.axis-text").attr({x:b+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?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?"":w?w[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(N);h.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var Q=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));j.attr({transform:"translate("+[b+Q,h.margin.top]+")"});var $=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||$){var et=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 it,at,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ht=ot.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(X).angle;ht.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ft=ot.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(X).radius;ft.attr({r:r}).style({opacity:.5}),at=i.invert(o.util.getMousePos(X).radius);var n=o.util.convertToCartesian(r,h.radialAxis.orientation);ut.text(o.util.round(at)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ft.style({opacity:0}),ct.hide(),lt.hide(),ut.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=w[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-V[0]-f.left,h.top+h.height/2-V[1]-f.top];ct.config({color:s}).text(c),ct.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return 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;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var 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 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,m=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:m,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 i[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[n].data.visible?"block":"none"}},g=n.select(this).selectAll("g.layer").data(l);g.enter().append("g").attr({class:"layer"});var y=g.selectAll("path.mark").data(function(t,e){return t});y.enter().append("path").attr({class:"mark"}),y.style(v).each(h[t.geometryType]),y.exit().remove(),g.exit().remove()})}var e=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),i={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){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||void 0===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 m=n.range(o.length),v=n.scale[c?"linear":"ordinal"]().domain(m).range(l),g=n.scale[c?"linear":"ordinal"]().domain(m)[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 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,g(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(g).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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=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+10,dy:.3*+i.fontSize}),l};return l.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(c);var h=i.padding,f=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},p=f.width+2*h+10,m=f.height+2*h;return r.attr({d:"M"+[[10,-m/2],[10,-m/4],[i.hasTick?0:10,0],[10,m/4],[10,m/2],[p,m/2],[p,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-m/2+2*h]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return a(i,t),l},l},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",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);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":709,d3:118}],816:[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":590,"../../lib":709,"./micropolar":815,"./undo_manager":817,d3:118}],817:[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,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),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":590,"../../subplot_defaults":818,"./axis_defaults":822,"./layout_attributes":824}],824:[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":589,"./axis_attributes":821}],825:[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("../plots"),p=t("../cartesian/axes"),m=t("../../components/dragelement"),v=t("../../components/fx"),g=t("../../components/titles"),y=t("../cartesian/select"),b=t("../cartesian/constants");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=this,n=e[r.id],i=e._size;r.adjustLayout(n,i),d.generalUpdatePerTraceModule(r,t,n),r.layers.plotbg.select("path").call(u.fill,n.bgcolor)},x.makeFramework=function(){var t=this,e=t.defs.selectAll("g.clips").data([0]);e.enter().append("g").classed("clips",!0);var r="clip"+t.layoutId+t.id;t.clipDef=e.selectAll("#"+r).data([0]),t.clipDef.enter().append("clipPath").attr("id",r).append("path").attr("d","M0,0Z"),t.plotContainer=t.container.selectAll("g."+t.id).data([0]),t.plotContainer.enter().append("g").classed(t.id,!0),t.layers={};var n=["draglayer","plotbg","backplot","grids","frontplot","zoom","aaxis","baxis","caxis","axlines"];t.plotContainer.selectAll("g.toplevel").data(n).enter().append("g").attr("class",function(t){return"toplevel "+t}).each(function(e){var r=a.select(this);t.layers[e]=r,"frontplot"===e?r.append("g").classed("scatterlayer",!0):"backplot"===e?r.append("g").classed("maplayer",!0):"plotbg"===e?r.append("path").attr("d","M0,0Z"):"axlines"===e&&r.selectAll("path").data(["aline","bline","cline"]).enter().append("path").each(function(t){a.select(this).classed(t,!0)})}),t.plotContainer.select(".grids").selectAll("g.grid").data(["agrid","bgrid","cgrid"]).enter().append("g").attr("class",function(t){return"grid "+t}).each(function(e){t.layers[e]=a.select(this)}),t.plotContainer.selectAll(".backplot,.frontplot,.grids").call(c.setClipUrl,r),t.graphDiv._context.staticPlot||t.initInteractions()};var _=Math.sqrt(4/3);x.adjustLayout=function(t,e){var r,n,i,a,o,s,l=this,c=t.domain,d=(c.x[0]+c.x[1])/2,p=(c.y[0]+c.y[1])/2,m=c.x[1]-c.x[0],v=c.y[1]-c.y[0],g=m*e.w,y=v*e.h,b=t.sum,x=t.aaxis.min,w=t.baxis.min,M=t.caxis.min;g>_*y?(a=y,i=a*_):(i=g,a=i/_),o=m*i/g,s=v*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=b,l.xaxis={type:"linear",range:[x+2*M-b,b-x-2*w],domain:[d-o/2,d+o/2],_id:"x"},h(l.xaxis,l.graphDiv._fullLayout),l.xaxis.setScale(),l.yaxis={type:"linear",range:[x,b-w-M],domain:[p-s/2,p+s/2],_id:"y"},h(l.yaxis,l.graphDiv._fullLayout),l.yaxis.setScale();var k=l.yaxis.domain[0],A=l.aaxis=f({},t.aaxis,{visible:!0,range:[x,b-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(A,l.graphDiv._fullLayout),A.setScale();var T=l.baxis=f({},t.baxis,{visible:!0,range:[b-x-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});h(T,l.graphDiv._fullLayout),T.setScale(),A._counteraxis=T;var S=l.caxis=f({},t.caxis,{visible:!0,range:[b-x-w,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});h(S,l.graphDiv._fullLayout),S.setScale();var E="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",E),l.layers.plotbg.select("path").attr("d",E);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var C="translate("+r+","+(n+a)+")";l.layers.baxis.attr("transform",C),l.layers.bgrid.attr("transform",C);var z="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",z),l.layers.agrid.attr("transform",z);var D="translate("+(r+i/2)+","+n+")rotate(-30)";l.layers.caxis.attr("transform",D),l.layers.cgrid.attr("transform",D),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1);var I=l.layers.axlines;I.select(".aline").attr("d",A.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),I.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"),I.select(".cline").attr("d",S.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,S.linecolor||"#000").style("stroke-width",(S.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(p.doTicks(r,i,!0),p.doTicks(r,a,!0),p.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 w=b.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",k="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=!0;x.initInteractions=function(){function t(t,e,r){var n=j.getBoundingClientRect();x=e-n.left,w=r-n.top,S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=S,E=O.aaxis.range[1]-S.a,C=o(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),z="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",D=!1,I=R.append("path").attr("class","zoombox").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",z),P=R.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=x+t,o=w+i,s=Math.max(0,Math.min(1,e(x,w),e(a,o))),l=Math.max(0,Math.min(1,r(x,w),r(a,o))),u=Math.max(0,Math.min(1,n(x,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,m=p-d/_;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),P.transition().style("opacity",1).duration(200),D=!0)}function c(t,e){if(L===S)return 2===e&&g(),i(F);i(F);var r={};r[O.id+".aaxis.min"]=L.a,r[O.id+".baxis.min"]=L.b,r[O.id+".caxis.min"]=L.c,s.relayout(F,r),T&&F.data&&F._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),T=!1)}function h(){S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=S}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m;L={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[L.a,L.b,L.c].sort(),a={a:i.indexOf(L.a),b:i.indexOf(L.b),c:i.indexOf(L.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),L={a:i[a.a],b:i[a.b],c:i[a.c]},e=(S.a-L.a)*O.yaxis._m,t=(S.c-L.c-S.b+L.b)*O.xaxis._m);var o="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",o),O.aaxis.range=[L.a,O.sum-L.b-L.c],O.baxis.range=[O.sum-L.a-L.c,L.b],O.caxis.range=[O.sum-L.a-L.b,L.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[O.id+".aaxis.min"]=L.a,r[O.id+".baxis.min"]=L.b,r[O.id+".caxis.min"]=L.c,s.relayout(F,r)}else 2===e&&g()}function p(){O.plotContainer.selectAll(".select-outline").remove()}function g(){var t={};t[O.id+".aaxis.min"]=0,t[O.id+".baxis.min"]=0,t[O.id+".caxis.min"]=0,F.emit("plotly_doubleclick",null),s.relayout(F,t)}var x,w,S,E,L,C,z,D,I,P,O=this,j=O.layers.plotbg.select("path").node(),F=O.graphDiv,R=O.layers.zoom,N={element:j,gd:F,plotinfo:{plot:R},doubleclick:g,subplot:O.id,prepFn:function(e,r,n){N.xaxes=[O.xaxis],N.yaxes=[O.yaxis];var i=F._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),N.minDrag="lasso"===i?1:void 0,"zoom"===i?(N.moveFn=a,N.doneFn=c,t(e,r,n)):"pan"===i?(N.moveFn=f,N.doneFn=d,h(),p()):"select"!==i&&"lasso"!==i||y(e,r,n,N,i)}};j.onmousemove=function(t){v.hover(F,t,O.id),F._fullLayout._lasthover=j,F._fullLayout._hoversubplot=O.id},j.onmouseout=function(t){F._dragging||m.unhover(F,t)},j.onclick=function(t){v.click(F,t)},m.init(N)}},{"../../components/color":590,"../../components/dragelement":611,"../../components/drawing":614,"../../components/fx":631,"../../components/titles":679,"../../lib":709,"../../lib/extend":701,"../../plotly":743,"../cartesian/axes":748,"../cartesian/constants":753,"../cartesian/select":764,"../cartesian/set_convert":765,"../plots":811,d3:118,tinycolor2:526}],826:[function(t,e,r){"use strict";function n(t){if(t.layoutAttributes){var e=t.layoutAttributes._arrayAttrRegexps;if(e)for(var n=0;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),h=l({},u,n(e.tileClass)),f=t._context||{};if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var d=Object.keys(h);for(r=0;r0&&A>0,N=M<=j&&A<=F,B=M<=F&&A<=j,U="h"===g?j>=M*(F/A):F>=A*(j/M);R&&(N||B||U)?b="inside":(b="outside",x.remove(),x=null)}else b="inside";if(!x&&(x=m(e,y,"outside"===b?E:S),_=k.bBox(x.node()),M=_.width,A=_.height,M<=0||A<=0))return void x.remove();var V;V="outside"===b?a(o,f,d,p,_,g):i(o,f,d,p,_,g),x.attr("transform",V)}}}function i(t,e,r,n,i,a){var s,l,u,c,h,f=i.width,d=i.height,p=(i.left+i.right)/2,m=(i.top+i.bottom)/2,v=Math.abs(e-t),g=Math.abs(n-r);v>2*D&&g>2*D?(h=D,v-=2*h,g-=2*h):h=0;var y,b;return f<=v&&d<=g?(y=!1,b=1):f<=g&&d<=v?(y=!0,b=1):fr?(u=(t+e)/2,c=n-h-l/2):(u=(t+e)/2,c=n+h+l/2),o(p,m,u,c,b,y)}function a(t,e,r,n,i,a){var s,l="h"===a?Math.abs(n-r):Math.abs(e-t);l>2*D&&(s=D,l-=2*s);var u,c,h,f,d="h"===a?Math.min(1,l/i.height):Math.min(1,l/i.width),p=(i.left+i.right)/2,m=(i.top+i.bottom)/2;return u=d*i.width,c=d*i.height,"h"===a?er?(h=(t+e)/2,f=n+s+c/2):(h=(t+e)/2,f=n-s-c/2),o(p,m,h,f,d,!1)}function o(t,e,r,n,i,a){var o,s;return i<1?o="scale("+i+") ":(i=1,o=""),s=a?"rotate("+a+" "+t+" "+e+") ":"","translate("+(r-i*t)+" "+(n-i*e)+")"+o+s}function s(t,e){var r=d(t.text,e);return p(S,r)}function l(t,e){var r=d(t.textposition,e);return m(E,r)}function u(t,e,r){return f(L,t.textfont,e,r)}function c(t,e,r){return f(C,t.insidetextfont,e,r)}function h(t,e,r){return f(z,t.outsidetextfont,e,r)}function f(t,e,r,n){e=e||{};var i=d(e.family,r),a=d(e.size,r),o=d(e.color,r);return{family:p(t.family,i,n.family),size:v(t.size,a,n.size),color:g(t.color,o,n.color)}}function d(t,e){var r;return Array.isArray(t)?ei))return e}return void 0!==r?r:t.dflt}function g(t,e,r){return x(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),b=t("fast-isnumeric"),x=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),M=t("../../components/color"),k=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),S=T.text,E=T.textposition,L=T.textfont,C=T.insidetextfont,z=T.outsidetextfont,D=3;e.exports=function(t,e,r){var i=e.xaxis,a=e.yaxis,o=t._fullLayout,s=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);s.enter().append("g").attr("class","trace bars"),s.append("g").attr("class","points").each(function(e){var r=e[0].t,s=e[0].trace,l=r.poffset,u=Array.isArray(l);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,c){function h(t){return 0===o.bargap&&0===o.bargroupgap?y.round(Math.round(t)-A,2):t}function f(t,e){return Math.abs(t-e)>=2?h(t):t>e?Math.ceil(t):Math.floor(t)}var d,p,m,v,g=r.p+(u?l[c]:l),x=g+r.w,_=r.b,w=_+r.s;if("h"===s.orientation?(m=a.c2p(g,!0),v=a.c2p(x,!0),d=i.c2p(_,!0),p=i.c2p(w,!0)):(d=i.c2p(g,!0),p=i.c2p(x,!0),m=a.c2p(_,!0),v=a.c2p(w,!0)),!(b(d)&&b(p)&&b(m)&&b(v)&&d!==p&&m!==v))return void y.select(this).remove();var k=(r.mlw+1||s.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(k/2%1,2);if(!t._context.staticPlot){var T=M.opacity(r.mc||s.marker.color),S=T<1||k>.01?h:f;d=S(d,p),p=S(p,d),m=S(m,v),v=S(v,m)}var E=y.select(this);E.append("path").attr("d","M"+d+","+m+"V"+v+"H"+p+"V"+m+"Z"),n(t,E,e,c,d,p,m,v)})}),s.call(A.plot,e)}},{"../../components/color":590,"../../components/drawing":614,"../../components/errorbars":620,"../../lib":709,"../../lib/svg_text_utils":728,"./attributes":836,d3:118,"fast-isnumeric":127,tinycolor2:526}],844:[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;uu+s||!y(l))&&(h=!0,f(c,t))}for(var i=r.traces,a=g(e),o="fraction"===t._fullLayout.barnorm?1:100,s=o/1e9,l=e.l2c(e.c2l(0)),u="stack"===t._fullLayout.barmode?o:l,c=[l,u],h=!1,d=0;d1||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":590,"../../components/drawing":614,"../../components/errorbars":620,d3:118}],847:[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":590,"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603}],848:[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"},xcalendar:n.xcalendar,ycalendar:n.ycalendar,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":589,"../../lib/extend":701,"../scatter/attributes":1008}],849:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,o,s,l,u,c,h,f,d,p=a.getFromId(t,e.xaxis||"x"),m=a.getFromId(t,e.yaxis||"y"),v=e.orientation,g=[];"h"===v?(r=p,o="x",u=m,c="y"):(r=m,o="y",u=p,c="x"),s=r.makeCalcdata(e,o),a.expand(r,s,{padded:!0}),h=function(t,e,r,a,o){var s;return r in e?h=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,0,e[r+"calendar"]),h=o.map(function(){return s})),h}(t,e,c,u,s);var y=i.distinctVals(h);return f=y.vals,d=y.minDiff/2,l=function(t,e,r,a,o){var s,l,u,c,h=a.length,f=e.length,d=[],p=[];for(s=0;s=0&&u1,m=r.dPos*(1-c.boxgap)*(1-c.boxgroupgap)/(p?t.numboxes:1),v=p?2*r.dPos*(-.5+(r.boxnum+.5)/t.numboxes)*(1-c.boxgap):0,g=m*d.whiskerwidth;if(d.visible!==!0||r.emptybox)return void a.select(this).remove();"h"===d.orientation?(l=f,u=h):(l=h,u=f),r.bPos=v,r.bdPos=m,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+v,!0),r=l.c2p(t.pos+v-m,!0),n=l.c2p(t.pos+v+m,!0),i=l.c2p(t.pos+v-g,!0),s=l.c2p(t.pos+v+g,!0),c=u.c2p(t.q1,!0),h=u.c2p(t.q3,!0),f=o.constrain(u.c2p(t.med,!0),Math.min(c,h)+1,Math.max(c,h)-1),p=u.c2p(d.boxpoints===!1?t.min:t.lf,!0),y=u.c2p(d.boxpoints===!1?t.max:t.uf,!0);"h"===d.orientation?a.select(this).attr("d","M"+f+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+h+"V"+r+"ZM"+c+","+e+"H"+p+"M"+h+","+e+"H"+y+(0===d.whiskerwidth?"":"M"+p+","+i+"V"+s+"M"+y+","+i+"V"+s)):a.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+c+"H"+n+"V"+h+"H"+r+"ZM"+e+","+c+"V"+p+"M"+e+","+h+"V"+y+(0===d.whiskerwidth?"":"M"+i+","+p+"H"+s+"M"+i+","+y+"H"+s))}),d.boxpoints&&a.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=d}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,a,s,l,u,c="all"===d.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),f=1e-9*h,p=.01*h,g=[],y=0;if(d.jitter){if(0===h)for(y=1,g=new Array(c.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,h,f),d.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+v,!0),r=l.c2p(t.pos+v-m,!0),n=l.c2p(t.pos+v+m,!0),i=u.c2p(t.mean,!0),o=u.c2p(t.mean-t.sd,!0),s=u.c2p(t.mean+t.sd,!0);"h"===d.orientation?a.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==d.boxmean?"":"m0,0L"+o+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):a.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==d.boxmean?"":"m0,0L"+e+","+o+"L"+r+","+i+"L"+e+","+s+"Z"))})})}},{"../../components/drawing":614,"../../lib":709,d3:118}],856:[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;o=10)return null;for(var r=1/0,i=-1/0,a=t.length,o=0;o0?Math.floor:Math.ceil,D=L>0?Math.ceil:Math.floor,I=L>0?Math.min:Math.max,P=L>0?Math.max:Math.min,O=z(S+C),j=D(E-C);c=T(S);var F=[[c]];for(i=O;i*L=0;i--)a[c-i]=t[h][i],o[c-i]=e[h][i];for(s.push({x:a,y:o,bicubic:l}),i=h,a=[],o=[];i>=0;i--)a[h-i]=t[i][0],o[h-i]=e[i][0];return s.push({x:a,y:o,bicubic:u}),s}},{}],870:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e,r,a){function o(e){var n,i,o,s,l,u,c,h,f,d,p,v,g=[],y=[],b={};if("b"===r)for(i=t.b2j(e),o=Math.floor(Math.max(0,Math.min(P-2,i))),s=i-o,b.length=P,b.crossLength=I,b.xy=function(e){return t.evalxy([],e,i)},b.dxy=function(e,r){return t.dxydi([],e,o,r,s)},n=0;n0&&(f=t.dxydi([],n-1,o,0,s),g.push(l[0]+f[0]/3),y.push(l[1]+f[1]/3),d=t.dxydi([],n-1,o,1,s),g.push(h[0]-d[0]/3),y.push(h[1]-d[1]/3)),g.push(h[0]),y.push(h[1]),l=h;else for(n=t.a2i(e),u=Math.floor(Math.max(0,Math.min(I-2,n))),c=n-u,b.length=I,b.crossLength=P,b.xy=function(e){return t.evalxy([],n,e)},b.dxy=function(e,r){return t.dxydj([],u,e,c,r)},i=0;i0&&(p=t.dxydj([],u,i-1,c,0),g.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),v=t.dxydj([],u,i-1,c,1),g.push(h[0]-v[0]/3),y.push(h[1]-v[1]/3)),g.push(h[0]),y.push(h[1]),l=h;return b.axisLetter=r,b.axis=M,b.crossAxis=E,b.value=e,b.constvar=a,b.index=m,b.x=g,b.y=y,b.smoothing=E.smoothing,b}function s(e){var n,i,o,s,l,u=[],c=[],h={};if(h.length=w.length,h.crossLength=S.length,"b"===r)for(o=Math.max(0,Math.min(P-2,e)),l=Math.min(1,Math.max(0,e-o)),h.xy=function(r){return t.evalxy([],r,e)},h.dxy=function(e,r){return t.dxydi([],e,o,r,l)},n=0;nw.length-1||k.push(i(s(u),{color:M.gridcolor,width:M.gridwidth}));for(m=d;mw.length-1||y<0||y>w.length-1))for(b=w[c],x=w[y],l=0;lw[w.length-1]||A.push(i(o(g),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&T.push(i(s(0),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&T.push(i(s(w.length-1),{color:M.endlinecolor,width:M.endlinewidth}))}else{for(h=5e-15,f=[Math.floor((w[w.length-1]-M.tick0)/M.dtick*(1+h)),Math.ceil((w[0]-M.tick0)/M.dtick/(1+h))].sort(function(t,e){return t-e}),d=f[0],p=f[1],m=d;m<=p;m++)v=M.tick0+M.dtick*m,k.push(i(o(v),{color:M.gridcolor,width:M.gridwidth}));for(m=d-1;mw[w.length-1]||A.push(i(o(g),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&T.push(i(o(w[0]),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&T.push(i(o(w[w.length-1]),{color:M.endlinecolor,width:M.endlinewidth}))}}},{"../../lib/extend":701,"../../plots/cartesian/axes":748}],871:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e){var r,a,o,s=e._labels=[],l=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t[n]=t[n].slice(0,e.length)):t[n]=[],i=0;i90&&(d-=180,l=-l),{angle:d,flip:l,p:t.c2p(n,e,r),offsetMultplier:u}}},{}],887:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll(e+"."+r).data([0]);return n.enter().append(e).classed(r,!0),n}function i(t,e,r){var i=r[0],u=r[0].trace,c=e.xaxis,f=e.yaxis,d=u.aaxis,p=u.baxis,m=t._fullLayout,v=e.plot.selectAll(".carpetlayer"),g=n(m._defs,"g","clips"),y=n(v,"g","carpet"+u.uid).classed("trace",!0),b=n(y,"g","minorlayer"),x=n(y,"g","majorlayer"),_=n(y,"g","boundarylayer"),w=n(y,"g","labellayer");y.style("opacity",u.opacity),o(c,f,x,d,"a",d._gridlines),o(c,f,x,p,"b",p._gridlines),o(c,f,b,d,"a",d._minorgridlines),o(c,f,b,p,"b",p._minorgridlines),o(c,f,_,d,"a-boundary",d._boundarylines),o(c,f,_,p,"b-boundary",p._boundarylines),l(w,u,i,c,f,s(h.tester,c,f,u,i,w,d._labels,"a-label"),s(h.tester,c,f,u,i,w,p._labels,"b-label")),a(u,i,g,c,f)}function a(t,e,r,i,a){var o,s,l,u;t.clipPathId="clip"+t.uid+"carpet";var c=r.select("#"+t.clipPathId);c.size()||(c=r.append("clipPath").classed("carpetclip",!0));var h=n(c,"path","carpetboundary"),p=e.clipsegments,m=[];for(u=0;u0?"start":"end").text(i.text).attr("transform","translate("+a.p[0]+","+a.p[1]+") rotate("+a.angle+")translate("+i.axis.labelpadding*s+","+.3*l.height+")").call(h.font,i.font.family,i.font.size,i.font.color),u=Math.max(u,l.width+i.axis.labelpadding)}),l.exit().remove(),u}function l(t,e,r,n,i,a,o){var s,l,c,h;s=.5*(e.a[0]+e.a[e.a.length-1]),l=e.b[0],c=e.ab2xy(s,l,!0),h=e.dxyda_rough(s,l),u(t,e,r,c,h,e.aaxis,n,i,a,"a-title"),s=e.a[0],l=.5*(e.b[0]+e.b[e.b.length-1]),c=e.ab2xy(s,l,!0),h=e.dxydb_rough(s,l),u(t,e,r,c,h,e.baxis,n,i,o,"b-title")}function u(t,e,r,n,i,a,o,s,l,u){var f=[];a.title&&f.push(a.title);var d=t.selectAll("text."+u).data(f);d.enter().append("text").classed(u,!0),d.each(function(){var t=p(e,o,s,n,i);["start","both"].indexOf(a.showticklabels)===-1&&(l=0),l+=a.titlefont.size+a.titleoffset,c.select(this).text(a.title||"").attr("transform","translate("+t.p[0]+","+t.p[1]+") rotate("+t.angle+") translate(0,"+l+")").classed("user-select-none",!0).attr("text-anchor","middle").call(h.font,a.titlefont)}),d.exit().remove()}var c=t("d3"),h=t("../../components/drawing"),f=t("./map_1d_array"),d=t("./makepath"),p=t("./orient_text");e.exports=function(t,e,r){for(var n=0;nd&&tm&&ep||ev},h.c2p=function(t){return t},f.c2p=function(t){return t},t.setScale=function(){var e=t.x,r=t.y,n=a(t.xctrl,t.yctrl,e,r,h.smoothing,f.smoothing);t.xctrl=n[0],t.yctrl=n[1],t.evalxy=o([t.xctrl,t.yctrl],u,c,h.smoothing,f.smoothing),t.dxydi=s([t.xctrl,t.yctrl],h.smoothing,f.smoothing),t.dxydj=l([t.xctrl,t.yctrl],h.smoothing,f.smoothing)},t.i2a=function(t){var r=Math.max(0,Math.floor(t[0]),u-2),n=t[0]-r;return(1-n)*e[r]+n*e[r+1]},t.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),u-2),n=t[1]-e;return(1-n)*r[e]+n*r[e+1]},t.ij2ab=function(e){return[t.i2a(e[0]),t.j2b(e[1])]},t.a2i=function(t){var r=Math.max(0,Math.min(i(t,e),u-2)),n=e[r],a=e[r+1];return Math.max(0,Math.min(u-1,r+(t-n)/(a-n)))},t.b2j=function(t){var e=Math.max(0,Math.min(i(t,r),c-2)),n=r[e],a=r[e+1];return Math.max(0,Math.min(c-1,e+(t-n)/(a-n)))},t.ab2ij=function(e){return[t.a2i(e[0]),t.b2j(e[1])]},t.i2c=function(e,r){return t.evalxy([],e,r)},t.ab2xy=function(n,i,a){if(!a&&(ne[u-1]|ir[c-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(i),l=t.evalxy([],o,s);if(a){var h,f,d,p,m=0,v=0,g=[];ne[u-1]?(h=u-2,f=1,m=(n-e[u-1])/(e[u-1]-e[u-2])):(h=Math.max(0,Math.min(u-2,Math.floor(o))),f=o-h),ir[c-1]?(d=c-2,p=1,v=(i-r[c-1])/(r[c-1]-r[c-2])):(d=Math.max(0,Math.min(c-2,Math.floor(s))),p=s-d),m&&(t.dxydi(g,h,d,f,p),l[0]+=g[0]*m,l[1]+=g[1]*m),v&&(t.dxydj(g,h,d,f,p),l[0]+=g[0]*v,l[1]+=g[1]*v)}return l},t.c2p=function(t,e,r){return[e.c2p(t[0]),r.c2p(t[1])]},t.p2x=function(t,e,r){return[e.p2c(t[0]),r.p2c(t[1])]},t.dadi=function(t){var r=Math.max(0,Math.min(e.length-2,t));return e[r+1]-e[r]},t.dbdj=function(t){var e=Math.max(0,Math.min(r.length-2,t));return r[e+1]-r[e]},t.dxyda=function(e,r,n,i){var a=t.dxydi(null,e,r,n,i),o=t.dadi(e,n);return[a[0]/o,a[1]/o]},t.dxydb=function(e,r,n,i){var a=t.dxydj(null,e,r,n,i),o=t.dbdj(r,i);return[a[0]/o,a[1]/o]},t.dxyda_rough=function(e,r,n){var i=g*(n||.1),a=t.ab2xy(e+i,r,!0),o=t.ab2xy(e-i,r,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dxydb_rough=function(e,r,n){var i=y*(n||.1),a=t.ab2xy(e,r+i,!0),o=t.ab2xy(e,r-i,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}},{"../../lib/search":723,"./compute_control_points":874,"./constants":875,"./create_i_derivative_evaluator":876,"./create_j_derivative_evaluator":877,"./create_spline_evaluator":878}],889:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a,o,s=[],l=[],u=t[0].length,c=t.length,h=0;for(i=0;i0&&void 0!==(n=t[r][e-1])&&(a++,i+=n),e0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r0&&a0&&i1e-5);return n.log("Smoother converged to",M,"after",k,"iterations"),t}},{"../../lib":709}],890:[function(t,e,r){"use strict";var n=t("./has_columns"),i=t("../heatmap/convert_column_xyz");e.exports=function(t,e,r){var a=[],o=r("x");o&&!n(o)&&a.push("x"),e._cheater=!o;var s=r("y");if(s&&!n(s)&&a.push("y"),o||s)return a.length&&i(e,e.aaxis,e.baxis,"a","b",a),!0}},{"../heatmap/convert_column_xyz":931,"./has_columns":880}],891:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=n.marker.line;e.exports=s({},{locations:{valType:"data_array"},locationmode:n.locationmode,z:{valType:"data_array"},text:{valType:"data_array"},marker:{line:{color:l.color,width:s({},l.width,{dflt:1})}},hoverinfo:s({},o.hoverinfo,{flags:["location","z","text","name"]})},i,{colorbar:a})},{"../../components/colorbar/attributes":591,"../../components/colorscale/attributes":595,"../../lib/extend":701,"../../plots/attributes":746,"../scattergeo/attributes":1045}],892:[function(t,e,r){"use strict" -;var n=t("../../components/colorscale/calc");e.exports=function(t,e){n(e,e.z,"","z")}},{"../../components/colorscale/calc":596}],893:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}var l,u=s("locations");if(u&&(l=u.length),!u||!l)return void(e.visible=!1);var c=s("z");if(!Array.isArray(c))return void(e.visible=!1);c.length>l&&(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"}),s("hoverinfo",1===o._dataLength?"location+z+text":void 0)}},{"../../components/colorscale/defaults":599,"../../lib":709,"./attributes":891}],894:[function(t,e,r){"use strict";e.exports=function(t,e){return t.location=e.location,t.z=e.z,t}},{}],895:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e.hoverinfo,s="all"===o?a.hoverinfo.flags:o.split("+"),l=s.indexOf("name")!==-1,u=s.indexOf("location")!==-1,c=s.indexOf("z")!==-1,h=s.indexOf("text")!==-1,f=!l&&u,d=[];f?t.nameOverride=r.id:(l&&(t.nameOverride=e.name),u&&d.push(r.id)),c&&d.push(function(t){return i.tickText(n,n.c2l(t),"hover").text}(r.z)),h&&d.push(r.tx),t.extraText=d.join("
")}var i=t("../../plots/cartesian/axes"),a=t("./attributes");e.exports=function(t){var e=t.cd,r=e[0].trace,i=t.subplot,a=i.choroplethHoverPt;if(a){var o=i.projection(a.properties.ct);return t.x0=t.x1=o[0],t.y0=t.y1=o[1],t.index=a.index,t.location=a.id,t.z=a.z,n(t,r,a,i.mockAxis),[t]}}},{"../../plots/cartesian/axes":748,"./attributes":891}],896:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":776,"../heatmap/colorbar":930,"./attributes":891,"./calc":892,"./defaults":893,"./event_data":894,"./hover":895,"./plot":897}],897:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],i=t.locations,a=i.length,o=u(t,e),s=(t.marker||{}).line||{},l=0;l0&&(n[0].trace=t),n}function i(t){t.framework.selectAll("g.trace.choropleth").each(function(t){var e=t[0].trace,r=a.select(this),n=e.marker||{},i=n.line||{},u=l.makeColorScaleFunc(l.extractScale(e.colorscale,e.zmin,e.zmax));r.selectAll("path.choroplethlocation").each(function(t){a.select(this).attr("fill",function(t){return u(t.z)}).call(o.stroke,t.mlc||i.color).call(s.dashLine,"",t.mlw||i.width||0)})})}var a=t("d3"),o=t("../../components/color"),s=t("../../components/drawing"),l=t("../../components/colorscale"),u=t("../../lib/topojson_utils").getTopojsonFeatures,c=t("../../lib/geo_location_utils").locationToFeature,h=t("../../lib/array_to_calc_item"),f=t("../../plots/geo/constants");e.exports=function(t,e,r){function o(t){return t[0].trace.uid}var s,l=t.framework,u=l.select("g.choroplethlayer"),c=l.select("g.baselayer"),h=l.select("g.baselayeroverchoropleth"),d=f.baseLayersOverChoropleth,p=u.selectAll("g.trace.choropleth").data(e,o);p.enter().append("g").attr("class","trace choropleth"),p.exit().remove(),p.each(function(e){var r=e[0].trace,i=n(r,t.topojson),o=a.select(this).selectAll("path.choroplethlocation").data(i);o.enter().append("path").classed("choroplethlocation",!0).on("mouseover",function(e){t.choroplethHoverPt=e}).on("mouseout",function(){t.choroplethHoverPt=null}),o.exit().remove()}),h.selectAll("*").remove();for(var m=0;ms.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),a(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var u=s.start,c=s.end,h=e._input.contours;if(u>c&&(s.start=h.start=c,c=s.end=h.end=u,u=s.start),!(s.size>0)){var f;f=u===c?1:n(u,c,e.ncontours).dtick,h.size=s.size=f}}return r}},{"../../lib":709,"../../plots/cartesian/axes":748,"../heatmap/calc":928}],900:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../components/colorbar/draw"),a=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void n.autoMargin(t,s);var l=i(t,s);e[0].t.cb=l;var u=r.contours,c=r.line,h=u.size||1,f=u.coloring,d=a(r,{isColorbar:!0});"heatmap"===f&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===f||"heatmap"===f?d:"").line({color:"lines"===f?d:c.color,width:u.showlines!==!1?c.width:0,dash:c.dash}).levels({start:u.start,end:o(u),size:h}).options(r.colorbar)()}},{"../../components/colorbar/draw":593,"../../plots/plots":811,"./end_plus":904,"./make_color_map":908}],901:[function(t,e,r){"use strict";e.exports.BOTTOMSTART=[1,9,13,104,713],e.exports.TOPSTART=[4,6,7,104,713],e.exports.LEFTSTART=[8,12,14,208,1114],e.exports.RIGHTSTART=[2,3,11,208,1114],e.exports.NEWDELTA=[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],e.exports.CHOOSESADDLE={104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},e.exports.SADDLEREMAINDER={1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11}},{}],902:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){var a,o=n.coerce2(t,e,i,"contours.start"),s=n.coerce2(t,e,i,"contours.end"),l=o===!1||s===!1,u=r("contours.size");!(a=l?e.autocontour=!0:r("autocontour",!1))&&u||r("ncontours")}},{"../../lib":709,"./attributes":898}],903:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/has_columns"),a=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}if(!a(t,e,c,u))return void(e.visible=!1);c("text"),c("connectgaps",i(e)),o(t,e,c),s(t,e,c,u)}},{"../../lib":709,"../heatmap/has_columns":934,"../heatmap/xyz_defaults":942,"./attributes":898,"./contours_defaults":902,"./style_defaults":912}],904:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],905:[function(t,e,r){"use strict";function n(t,e,r,n){return Math.abs(t[0]-e[0])20?(m=u.CHOOSESADDLE[m][(v[0]||v[1])<0?0:1],t.crossings[p]=u.SADDLEREMAINDER[m]):delete t.crossings[p],!(v=u.NEWDELTA[m])){l.log("Found bad marching index:",m,e,t.level);break}g.push(s(t,e,v)),e[0]+=v[0],e[1]+=v[1],n(g[g.length-1],g[g.length-2],a,c)&&g.pop(),p=e.join(",");var _=v[0]&&(e[0]<0||e[0]>x-2)||v[1]&&(e[1]<0||e[1]>b-2);if(p===d&&v.join(",")===y||r&&_)break;m=t.crossings[p]}1e4===f&&l.log("Infinite loop in contour?");var w,M,k,A,T,S,E,L=n(g[0],g[g.length-1],a,c),C=0,z=.2*t.smoothing,D=[],I=0;for(f=1;f=I;f--)if((w=D[f])=I&&w+D[M]20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:u.BOTTOMSTART.indexOf(t)!==-1?i=1:u.LEFTSTART.indexOf(t)!==-1?n=1:u.TOPSTART.indexOf(t)!==-1?i=-1:n=-1,[n,i]}function s(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)]}var l=t("../../lib"),u=t("./constants");e.exports=function(t,e,r){var n,i,o,s,u;for(e=e||.01,r=r||.01,o=0;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){return t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208}return 15===r?0:r}var i=t("./constants");e.exports=function(t){var e,r,a,o,s,l,u,c,h,f=t[0].z,d=f.length,p=f[0].length,m=2===d||2===p;for(r=0;r1e3){d.warn("Too many contours, clipping at 1000",t);break}return i}function a(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 o(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 s(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=l(t,r);e?f.select(this).attr("d",e).style("stroke","none"):f.select(this).remove()})}function l(t,e){function r(t){return Math.abs(t[0]-e[2][0])<.01}for(var n,i,a,o,s,l,u=Math.min(t.z[0][0],t.z[0][1]),c=t.edgepaths.length||u<=t.level?"":"M"+e.join("L")+"Z",h=0,f=t.edgepaths.map(function(t,e){return e}),m=!0;f.length;){for(l=p.smoothopen(t.edgepaths[h],t.smoothing),c+=m?l:l.replace(/^M/,"L"),f.splice(f.indexOf(h),1),n=t.edgepaths[h][t.edgepaths[h].length-1],o=-1,a=0;a<4;a++){if(!n){d.log("Missing end?",h,t);break}for(!function(t){return Math.abs(t[1]-e[0][1])<.01}(n)||r(n)?!function(t){return Math.abs(t[0]-e[0][0])<.01}(n)?!function(t){return Math.abs(t[1]-e[2][1])<.01}(n)?r(n)&&(i=e[2]):i=e[3]:i=e[0]:i=e[1],s=0;s=0&&(i=v,o=s):Math.abs(n[1]-i[1])<.01?Math.abs(n[1]-v[1])<.01&&(v[0]-n[0])*(i[0]-v[0])>=0&&(i=v,o=s):d.log("endpt to newendpt is not vert. or horz.",n,i,v)}if(n=i,o>=0)break;c+="L"+i}if(o===t.edgepaths.length){d.log("unclosed perimeter path");break}h=o,m=f.indexOf(h)===-1,m&&(h=f[0],c+="Z")}for(h=0;hS){r("a scale is not linear");break}}if(s.length&&"fast"===A){var E=(s[s.length-1]-s[0])/(s.length-1),L=Math.abs(E/100);for(x=0;xL){r("b scale is not linear");break}}}var C=d(b),z="scaled"===e.xtype?"":n,D=v(e,z,i,o,C,w),I="scaled"===e.ytype?"":s,P=v(e,I,g,y,b.length,M),O={a:D,b:P,z:b};return"levels"===e.contours.type&&u(e,b,"","z"),[O]}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),s=t("../../lib").extendFlat,l=t("../../registry"),u=t("../../components/colorscale/calc"),c=t("../heatmap/has_columns"),h=t("../heatmap/convert_column_xyz"),f=t("../heatmap/clean_2d_array"),d=t("../heatmap/max_row_length"),p=t("../heatmap/interp2d"),m=t("../heatmap/find_empties"),v=t("../heatmap/make_bound_array"),g=t("./defaults"),y=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=y(t,e);if(r&&r.visible&&"legendonly"!==r.visible){if(!e.a||!e.b){var a=t.data[r.index],l=t.data[e.index];l.a||(l.a=a.a),l.b||(l.b=a.b),g(l,e,e._defaultColor,t._fullLayout)}var u=i(t,e),c=e.contours;if(e.autocontour===!0){var h=n(e.zmin,e.zmax,e.ncontours);c.size=h.dtick,c.start=o.tickFirst(h),h.range.reverse(),c.end=o.tickFirst(h),c.start===e.zmin&&(c.start+=c.size),c.end===e.zmax&&(c.end-=c.size),c.start>c.end&&(c.start=c.end=(c.start+c.end)/2),e._input.contours=s({},c)}else{var f=c.start,d=c.end,p=e._input.contours;if(f>d&&(c.start=p.start=d,d=c.end=p.end=f,f=c.start),!(c.size>0)){var m;m=f===d?1:n(f,d,e.ncontours).dtick,p.size=c.size=m}}return u}}},{"../../components/colorscale/calc":596,"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"../carpet/lookup_carpetid":882,"../heatmap/clean_2d_array":929,"../heatmap/convert_column_xyz":931,"../heatmap/find_empties":933,"../heatmap/has_columns":934,"../heatmap/interp2d":937,"../heatmap/make_bound_array":938,"../heatmap/max_row_length":939,"./defaults":920}],915:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i,a,o,s=n.a.length,l=n.b.length,u=n.z,c=-1/0,h=1/0;for(i=0;i":case">=":n.contours.value>c&&(t[0].prefixBoundary=!0);break;case"<":case"<=":n.contours.valuec&&(t[0].prefixBoundary=!0);break;case"][":case")(":a=Math.min.apply(null,n.contours.value),o=Math.max.apply(null,n.contours.value),ac&&(t[0].prefixBoundary=!0)}}},{}],916:[function(t,e,r){"use strict";e.exports={INEQUALITY_OPS:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"]}},{}],917:[function(t,e,r){"use strict";function n(t,e){function r(t){return s(t)?+t:null}var n,i=Array.isArray(e);return o.INEQUALITY_OPS.indexOf(t)!==-1?n=r(i?e[0]:e):o.INTERVAL_OPS.indexOf(t)!==-1?n=i?[r(e[0]),r(e[1])]:[r(e),r(e)]:o.SET_OPS.indexOf(t)!==-1&&(n=i?e.map(r):[r(e)]),n}function i(t){return function(e){e=n(t,e);var r=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return{start:r,end:i,size:i-r}}}function a(t){return function(e){return e=n(t,e),{start:e,end:1/0,size:1/0}}}var o=t("./constants"),s=t("fast-isnumeric");e.exports["[]"]=i("[]"),e.exports["()"]=i("()"),e.exports["[)"]=i("[)"),e.exports["(]"]=i("(]"),e.exports["]["]=i("]["),e.exports[")("]=i(")("),e.exports[")["]=i(")["),e.exports["]("]=i("]("),e.exports[">"]=a(">"),e.exports[">="]=a(">="),e.exports["<"]=a("<"),e.exports["<="]=a("<="),e.exports["="]=a("=")},{"./constants":916,"fast-isnumeric":127}],918:[function(t,e,r){"use strict";var n=t("./constraint_mapping"),i=t("fast-isnumeric");e.exports=function(t,e){var r;["=","<","<=",">",">="].indexOf(e.operation)===-1?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:i(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),i(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0));var a=n[e.operation](e.value);e.start=a.start,e.end=a.end,e.size=a.size}},{"./constraint_mapping":917,"fast-isnumeric":127}],919:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r,i,a,o=function(t){return t.reverse()},s=function(t){return t};switch(e){case"][":case")[":case"](":case")(":var l=o;o=s,s=l;case"[]":case"[)":case"(]":case"()":if(2!==t.length)return void n.warn("Contour data invalid for the specified inequality range operation.");for(i=t[0],a=t[1],r=0;r=":case">":if(1!==t.length)return void n.warn("Contour data invalid for the specified inequality operation.");for(i=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return a}},{"../../lib":709}],922:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../contour/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.moduleType="trace",n.name="contourcarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","carpet","contour","symbols","showLegend","hasLines","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":758,"../contour/colorbar":900,"./attributes":913,"./calc":914,"./defaults":920,"./plot":925,"./style":926}],923:[function(t,e,r){"use strict";var n=t("../../components/drawing"),i=t("../carpet/axis_aligned_line"),a=t("../../lib");e.exports=function(t,e,r,o,s,l,u,c){function h(t){return Math.abs(t[1]-r[0][1])=0&&(y=L,x=_):Math.abs(g[1]-y[1])=0&&(y=L,x=_):a.log("endpt to newendpt is not vert. or horz.",g,y,L)}if(x>=0)break;M+=m(g,y),g=y}if(x===e.edgepaths.length){a.log("unclosed perimeter path");break}v=x,A=k.indexOf(v)===-1,A&&(v=k[0],M+=m(g,y)+"Z",g=null)}for(v=0;v=0;F--)P=d.clipsegments[F],O=h([],P.x,A.c2p),j=h([],P.y,T.c2p),O.reverse(),j.reverse(),N.push(f(O,j,P.bicubic));var B="M"+N.join("L")+"Z";l(R,d.clipsegments,A,T,C,M.coloring),u(i,R,A,T,L,z,n,c,d,M.coloring,B),s(R,L,M),a(R,c)}}function a(t,e){t.attr("clip-path","url(#"+e.clipPathId+")")}function o(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).classed("trace",!0).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function s(t,e,r){var n=e[0].smoothing,i=t.selectAll("g.contourlevel").data(r.showlines===!1?[]:e);i.enter().append("g").classed("contourlevel",!0),i.exit().remove();var a=i.selectAll("path.openline").data(function(t){return t.pedgepaths});a.enter().append("path").classed("openline",!0),a.exit().remove(),a.attr("d",function(t){return d.smoothopen(t,n)}).style("vector-effect","non-scaling-stroke");var o=i.selectAll("path.closedline").data(function(t){return t.ppaths});o.enter().append("path").classed("closedline",!0),o.exit().remove(),o.attr("d",function(t){return d.smoothclosed(t,n)}).style("vector-effect","non-scaling-stroke").style("stroke-miterlimit",1)}function l(t,e,r,i,a,o){var s,l,u,c,d=n(t,"g","contourbg"),p=d.selectAll("path").data("fill"!==o||a?[]:[0]);p.enter().append("path"),p.exit().remove();var m=[];for(c=0;cz){r("x scale is not linear");break}}if(y.length&&"fast"===E){var D=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(D/100);for(w=0;wI){r("y scale is not linear");break}}}var P=c(_),O="scaled"===e.xtype?"":m,j=p(e,O,v,g,P,M),F="scaled"===e.ytype?"":y,R=p(e,F,b,x,_.length,k);S||(a.expand(M,j),a.expand(k,R));var N={x:j,y:R,z:_,text:e.text};if(s(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};N.xfill=p(B,O,v,g,P,M),N.yfill=p(B,F,b,x,_.length,k)}return[N]}},{"../../components/colorscale/calc":596,"../../lib":709,"../../plots/cartesian/axes":748,"../../registry":826,"../histogram2d/calc":956,"./clean_2d_array":929,"./convert_column_xyz":931,"./find_empties":933,"./has_columns":934,"./interp2d":937,"./make_bound_array":938,"./max_row_length":939}],929:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,i,a,o,s,l;if(e){for(r=0,s=0;s=0;o--)a=f[o],r=a[0],i=a[1],(s=((h[[r-1,i]]||m)[2]+(h[[r+1,i]]||m)[2]+(h[[r,i-1]]||m)[2]+(h[[r,i+1]]||m)[2])/20)&&(l[a]=[r,i,s],f.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(a in l)h[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":939}],934:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],935:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../lib"),a=n.constants.MAXDIST;e.exports=function(t,e,r,o,s){if(!(t.distance=y[0].length||h<0||h>y.length)return}else{if(n.inbox(e-v[0],e-v[v.length-1])>a||n.inbox(r-g[0],r-g[g.length-1])>a)return;if(s){var w;for(x=[2*v[0]-v[1]],w=1;wm&&(g=Math.max(g,Math.abs(t[i][a]-p)/(v-m))))}return g}var a=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o.01;o++)l=i(t,e,n(l));return l>.01&&a.log("interp2d didn't converge quickly",l),t}},{"../../lib":709}],938:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i,a,o){var s,l,u,c=[],h=n.traceIs(t,"contour"),f=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!f&&"category"!==o.type){var p=e.length;if(!(p<=a))return h?e.slice(0,a):e.slice(0,a+1);if(h||d)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]],u=1;u0;)b=p.c2p(A[M]),M--;for(b0;)w=m.c2p(T[M]),M--;if(w<_&&(x=_,_=w,w=x,D=!0),S&&(A=r[0].xfill,T=r[0].yfill),"fast"!==E){var I="best"===E?0:.5;y=Math.max(-I*p._length,y),b=Math.min((1+I)*p._length,b),_=Math.max(-I*m._length,_),w=Math.min((1+I)*m._length,w)}var P=Math.round(b-y),O=Math.round(w-_),j=P<=0||O<=0,F=e.plot.select(".imagelayer").selectAll("g.hm."+g).data(j?[]:[0]);if(F.enter().append("g").classed("hm",!0).classed(g,!0),F.exit().remove(),!j){var R,N;"fast"===E?(R=C,N=L):(R=P,N=O);var B=document.createElement("canvas");B.width=R,B.height=N;var U,V,q=B.getContext("2d"),H=s.makeColorScaleFunc(s.extractScale(f.colorscale,f.zmin,f.zmax),{noNumericCheck:!0,returnArray:!0});"fast"===E?(U=z?function(t){return C-1-t}:o.identity,V=D?function(t){return L-1-t}:o.identity):(U=function(t){return o.constrain(Math.round(p.c2p(A[t])-y),0,P)},V=function(t){return o.constrain(Math.round(m.c2p(T[t])-_),0,O)});var G,Y,X,W,Z,J,K,Q=V(0),$=[Q,Q],tt=z?0:1,et=D?0:1,rt=0,nt=0,it=0,at=0;if(E){var ot,st=0;try{ot=new Uint8Array(P*O*4)}catch(t){ot=new Array(P*O*4)}if("best"===E){var lt,ut,ct,ht=new Array(A.length),ft=new Array(T.length),dt=new Array(P);for(M=0;M0&&a0&&s0&&(n=!0);for(var s=0;sa){var o=a-r[t];return r[t]=a,o}}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]=0;a--)i(a);else if("increasing"===e){for(a=1;a=0;a--)t[a]+=t[a+1];"exclude"===r&&(t.push(0),t.shift())}}var i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes"),s=t("../bar/arrays_to_calcdata"),l=t("./bin_functions"),u=t("./norm_functions"),c=t("./average"),h=t("./clean_bins");e.exports=function(t,e){if(e.visible===!0){var r,f=[],d=[],p=o.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),m="h"===e.orientation?"y":"x",v={x:"y",y:"x"}[m],g=e[m+"calendar"],y=e.cumulative;h(e,p,m);var b,x=p.makeCalcdata(e,m),_=m+"bins";e["autobin"+m]===!1&&_ in e?b=e[_]:(b=o.autoBin(x,p,e["nbins"+m],!1,g),y.enabled&&"include"!==y.currentbin&&("decreasing"===y.direction?b.start=p.c2r(p.r2c(b.start)-b.size):b.end=p.c2r(p.r2c(b.end)+b.size)),e._input[_]=e[_]=b);var w,M,k,A="string"==typeof b.size,T=A?[]:b,S=[],E=[],L=0,C=e.histnorm,z=e.histfunc,D=C.indexOf("density")!==-1;y.enabled&&D&&(C=C.replace(/ ?density$/,""),D=!1);var I,P="max"===z||"min"===z,O=P?null:0,j=l.count,F=u[C],R=!1,N=function(t){return p.r2c(t,0,g)};for(Array.isArray(e[v])&&"count"!==z&&(I=e[v],R="avg"===z,j=l[z]),r=N(b.start),M=N(b.end)+(r-o.tickIncrement(r,b.size,!1,g))/1e6;r=0&&kq;r--)if(d[r]){H=r;break}for(r=q;r<=H;r++)i(f[r])&&i(d[r])&&V.push({p:f[r],s:d[r],b:0});return s(V,e),V}}},{"../../lib":709,"../../plots/cartesian/axes":748,"../bar/arrays_to_calcdata":835,"./average":947,"./bin_functions":949,"./clean_bins":951,"./norm_functions":954,"fast-isnumeric":127}],951:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical"),o=a.ONEDAY,s=a.BADNUM;e.exports=function(t,e,r){var a=e.type,l=r+"bins",u=t[l];u||(u=t[l]={});var c="date"===a?function(t){return t||0===t?i(t,s,u.calendar):null}:function(t){return n(t)?Number(t):null};u.start=c(u.start),u.end=c(u.end);var h="date"===a?o:1,f=u.size;if(n(f))u.size=f>0?Number(f):h;else if("string"!=typeof f)u.size=h;else{var d=f.charAt(0),p=f.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==a||"M"!==d||p!==Math.round(p))&&(u.size=h)}var m="autobin"+r;"boolean"!=typeof t[m]&&(t[m]=!((u.start||0===u.start)&&(u.end||0===u.end))),t[m]||delete t["nbins"+r]}},{"../../constants/numerical":690,"../../lib":709,"fast-isnumeric":127}],952:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),s=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),u=t("./attributes");e.exports=function(t,e,r,c){function h(r,n){return i.coerce(t,e,u,r,n)}var f=h("x"),d=h("y");h("cumulative.enabled")&&(h("cumulative.direction"),h("cumulative.currentbin")),h("text");var p=h("orientation",d&&!f?"h":"v"),m=e["v"===p?"x":"y"];if(!m||!m.length)return void(e.visible=!1);n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],c),e["h"===p?"x":"y"]&&h("histfunc"),o(t,e,h,"h"===p?["y"]:["x"]),s(t,e,h,r,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":590,"../../components/errorbars/defaults":619,"../../lib":709,"../../registry":826,"../bar/style_defaults":847,"./attributes":946,"./bin_defaults":948}],953:[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":758,"../bar/hover":839,"../bar/layout_attributes":841,"../bar/layout_defaults":842,"../bar/plot":843,"../bar/set_positions":844,"../bar/style":846,"../scatter/colorbar":1011,"./attributes":946,"./calc":950,"./defaults":952}],954:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;ik&&m.splice(k,m.length-k),g.length>k&&g.splice(k,g.length-k),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(m,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(i.tickIncrement(x(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(i.tickIncrement(x(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(g,v,e.nbinsy,"2d",b),"histogram2dcontour"===e.type&&(e.ybins.start=M(i.tickIncrement(_(e.ybins.start),e.ybins.size,!0,b)),e.ybins.end=M(i.tickIncrement(_(e.ybins.end),e.ybins.size,!1,b))),e._input.ybins=e.ybins),f=[];var A,T,S=[],E=[],L="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,z=L?[]:e.xbins,D=C?[]:e.ybins,I=0,P=[],O=e.histnorm,j=e.histfunc,F=O.indexOf("density")!==-1,R="max"===j||"min"===j,N=R?null:0,B=a.count,U=o[O],V=!1,q=[],H=[],G="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";G&&"count"!==j&&(V="avg"===j,B=a[j]);var Y=e.xbins,X=x(Y.start),W=x(Y.end)+(X-i.tickIncrement(X,Y.size,!1,y))/1e6;for(d=X;d=0&&A=0&&T0)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.vertexcolor[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":727,"alpha-shape":41,"convex-hull":99,"delaunay-triangulate":119,"gl-mesh3d":200,tinycolor2:526}],965:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorbar/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function u(t){var e=t.map(function(t){var e=l(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var c=u(["x","y","z"]),h=u(["i","j","k"]);if(!c)return void(e.visible=!1);h&&h.forEach(function(t){for(var e=0;ee}}},r.addRangeSlider=function(t,e){for(var r=!1,n=0;n1)){var h=o.simpleMap(c.x,e.d2c,0,r.xcalendar),f=o.distinctVals(h).minDiff;a=Math.min(a,f)}}for(1/0===a&&(a=1),u=0;u");_.push(o,o,o,o,o,o,null)}(L,d[L],p[L],m[L],v[L]));e.x=b,e.y=x,e.text=_}},{"../../lib":709,"../../plots/cartesian/axes":748,"../../plots/cartesian/axis_ids":751,"./helpers":970}],974:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/colorbar/attributes"),a=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendDeep,u=t("../../lib/extend").extendFlat;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]}},labelfont:u({},s,{}),tickfont:u({},s,{}),rangefont:u({},s,{}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string"},tickvals:o.tickvals,ticktext:o.ticktext,tickformat:{valType:"string",dflt:"3s"},visible:{valType:"boolean",dflt:!0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},constraintrange:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},values:{valType:"data_array",dflt:[]}},line:u({},l({},n("line"),{colorscale:l({},n("line").colorscale,{dflt:a.Viridis}),autocolorscale:l({},n("line").autocolorscale,{dflt:!1})}),{showscale:{valType:"boolean",dflt:!1},colorbar:i})}},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/colorscale/scales":608,"../../lib/extend":701,"../../plots/cartesian/layout_attributes":759,"../../plots/font_attributes":772}],975:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("./plot"),o=t("../../constants/xmlns_namespaces"),s=t("./constants");r.name="parcoords",r.attr="type",r.plot=function(t){var e=i.getSubplotCalcData(t.calcdata,"parcoords","parcoords");e.length&&a(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("parcoords"),a=e._has&&e._has("parcoords");i&&!a&&(n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){function e(e){var n=this,i=n.toDataURL("image/png"),a=r.append("svg:image"),l=t._fullLayout._size,u=t._fullData[e.model.key].domain;a.attr({xmlns:o.svg,"xlink:href":i,x:l.l+l.w*u.x[0]-s.overdrag,y:l.t+l.h*(1-u.y[1]),width:(u.x[1]-u.x[0])*l.w+2*s.overdrag,height:(u.y[1]-u.y[0])*l.h,preserveAspectRatio:"none"})}var r=t._fullLayout._glimages,i=n.selectAll(".svg-container");i.filter(function(t,e){return e===i.size()-1}).selectAll(".parcoords-lines.context, .parcoords-lines.focus").each(e),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":692,"../../plots/plots":811,"./constants":978,"./plot":983,d3:118}],976:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("../../lib");e.exports=function(t,e){var r=!!e.line.colorscale&&a.isArray(e.line.color),o=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),s=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&i(e,e.line.color,"line","c"),[{lineColor:o,cscale:s}]}},{"../../components/colorscale/calc":596,"../../components/colorscale/has_colorscale":603,"../../lib":709}],977:[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.line,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":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],978:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0}}},{}],979:[function(t,e,r){"use strict";function n(t,e,r,n,i){i("line.color",r),s(t,"line")&&a.isArray(t.line.color)?(i("line.colorscale"),l(t,e,n,i,{prefix:"line.",cLetter:"c"})):i("line.color",r)}function i(t,e){function r(t,e){return a.coerce(n,i,o.dimensions,t,e)}var n,i,s,l=t.dimensions||[],c=e.dimensions=[],h=1/0;for(l.length>u&&(a.log("parcoords traces support up to "+u+" dimensions at the moment"),l.splice(u)),s=0;s0);d&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),h=Math.min(h,i.values.length)),i._index=s,c.push(i)}if(isFinite(h))for(s=0;sh&&(i.values=i.values.slice(0,h));return c}var a=t("../../lib"),o=t("./attributes"),s=t("../../components/colorscale/has_colorscale"),l=t("../../components/colorscale/defaults"),u=t("./constants").maxDimensionCount;e.exports=function(t,e,r,s){function l(r,n){return a.coerce(t,e,o,r,n)}var u=i(t,e);n(t,e,r,s,l),l("domain.x"),l("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var c={family:s.font.family,size:Math.round(s.font.size*(10/12)),color:s.font.color};a.coerceFont(l,"labelfont",c),a.coerceFont(l,"tickfont",c),a.coerceFont(l,"rangefont",c)}},{"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603,"../../lib":709,"./attributes":974,"./constants":978}],980:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","noOpacity"],n.meta={},e.exports=n},{"./attributes":974,"./base_plot":975,"./calc":976,"./colorbar":977,"./defaults":979,"./plot":983}],981:[function(t,e,r){"use strict";function n(t){t.read({x:0,y:0,width:1,height:1,data:x})}function i(t,e,r,n,i){var a=t._gl;a.enable(a.SCISSOR_TEST),a.scissor(e,r,n,i),t.clear({color:[0,0,0,0],depth:1})}function a(t,e,r,a,o,s){function l(n){var c;c=Math.min(a,o-n*a),s.offset=g*n*a,s.count=g*c,0===n&&(window.cancelAnimationFrame(r.currentRafs[u]),delete r.currentRafs[u],i(t,s.scissorX,s.scissorY,s.scissorWidth,s.viewBoxSize[1])),r.clearOnly||(e(s),n*a+c>>8*e)%256/255}function u(t,e,r,n){for(var i=[],a=0;a=v-4?l(a,v-2-s):.5);return i}function c(t,e,r){var n,i,a,o=[];for(i=0;if&&(f=t[l].dim2.canvasX,c=l),t[l].dim1.canvasXi)return a;i=o,a=n[r]}return n[n.length-1]}function l(t,e,r){var n=o(r);return r.tickvals?_.scale.ordinal().domain(r.tickvals).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):_.scale.linear().domain(n).range([t-e,e])}function u(t,e){return _.scale.linear().range([t-e,e])}function c(t){return _.scale.linear().domain(o(t))}function h(t){var e=o(t);return t.tickvals&&_.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}function f(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}),n=r.map(function(t){return _.rgb(t)}),i=function(t){return function(e){return e[t]}},a="rgb".split("").map(function(t){return _.scale.linear().clamp(!0).domain(e).range(n.map(i(t)))});return function(t){return a.map(function(e){return e(t)})}}function d(t){return t[0]}function p(t,e,r){var n=d(e),i=n.trace,o=n.lineColor,s=n.cscale,l=i.line,u=i.domain,h=i.dimensions,p=t.width,m=i.labelfont,v=i.tickfont,g=i.rangefont,y=x.extendDeep({},l,{color:o.map(c({values:o,range:[l.cmin,l.cmax]})),blockLineCount:b.blockLineCount,canvasOverdrag:b.overdrag*b.canvasPixelRatio}),_=Math.floor(p*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),M=t.margin||{l:80,r:80,t:100,b:80},k=_,A=w -;return{key:r,colCount:h.filter(a).length,dimensions:h,tickDistance:b.tickDistance,unitToColor:f(s),lines:y,labelFont:m,tickFont:v,rangeFont:g,translateX:u.x[0]*p,translateY:t.height-u.y[1]*t.height,pad:M,canvasWidth:k*b.canvasPixelRatio+2*y.canvasOverdrag,canvasHeight:A*b.canvasPixelRatio,width:k,height:A,canvasPixelRatio:b.canvasPixelRatio}}function m(t){var e=t.width,r=t.height,n=t.dimensions,i=t.canvasPixelRatio,o=function(r){return e*r/Math.max(1,t.colCount-1)},s=b.verticalPadding/(r*i),f=1-2*s,d=function(t){return s+f*t},p={key:t.key,xScale:o,model:t},m={};return p.dimensions=n.filter(a).map(function(e,n){var a=c(e),s=m[e.label];return m[e.label]=(s||0)+1,{key:e.label+(s?"__"+s:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:b.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(a).map(d),xScale:o,x:o(n),canvasX:o(n)*i,unitScale:u(r,b.verticalPadding),domainScale:l(r,b.verticalPadding,e),ordinalScale:h(e),domainToUnitScale:a,filter:e.constraintrange?e.constraintrange.map(a):[0,1],parent:p,model:t}}),p}function v(t){return b.layers.map(function(e){return{key:e,context:"contextLineLayer"===e,pick:"pickLineLayer"===e,viewModel:t,model:t.model}})}function g(t){t.classed("axisExtentText",!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var y=t("./lines"),b=t("./constants"),x=t("../../lib"),_=t("d3"),w=t("../../components/drawing");e.exports=function(t,e,r,a,o){function l(t){var e=t.selectAll("defs").data(i,n);e.enter().append("defs");var r=e.selectAll("#filterBarPattern").data(i,n);r.enter().append("pattern").attr("id","filterBarPattern").attr("patternUnits","userSpaceOnUse"),r.attr("x",-b.bar.width).attr("width",b.bar.capturewidth).attr("height",function(t){return t.model.height});var a=r.selectAll("rect").data(i,n);a.enter().append("rect").attr("shape-rendering","crispEdges"),a.attr("height",function(t){return t.model.height}).attr("width",b.bar.width).attr("x",b.bar.width/2).attr("fill",b.bar.fillcolor).attr("fill-opacity",b.bar.fillopacity).attr("stroke",b.bar.strokecolor).attr("stroke-opacity",b.bar.strokeopacity).attr("stroke-width",b.bar.strokewidth)}function u(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function c(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),i=n.length-1,a=0;a<1;a++)for(var o=0;o=r||s>=n)return;var l=t.lineLayer.readPixel(a,n-1-s),u=0!==l[3],c=u?l[2]+256*(l[1]+256*l[0]):null,h={x:a,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};c!==D&&(u?o.hover(h):o.unhover&&o.unhover(h),D=c)}}),C.style("margin",function(t){var e=t.model.pad;return e.t+"px "+e.r+"px "+e.b+"px "+e.l+"px"}).attr("width",function(t){return t.model.canvasWidth}).attr("height",function(t){return t.model.canvasHeight}).style("width",function(t){return t.model.width+2*b.overdrag+"px"}).style("height",function(t){return t.model.height+"px"}).style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var I=e.selectAll(".parcoords").data(E,n);I.exit().remove(),I.enter().append("g").classed("parcoords",!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(l),I.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var P=I.selectAll(".parcoordsControlView").data(i,n);P.enter().append("g").classed("parcoordsControlView",!0).style("box-sizing","content-box"),P.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var O=P.selectAll(".yAxis").data(function(t){return t.dimensions},n);O.enter().append("g").classed("yAxis",!0).each(function(t){z.dimensions.push(t)}),P.each(function(t){f(O,t)}),C.each(function(t){t.lineLayer=y(this,t.model.lines,t.model.canvasWidth,t.model.canvasHeight,t.viewModel.dimensions,t.viewModel.panels,t.model.unitToColor,t.context,t.pick,b.scatter),t.viewModel[t.key]=t.lineLayer,z.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}),O.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),O.call(_.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;S=!1,T||(t.x=Math.max(-b.overdrag,Math.min(t.model.width+b.overdrag,_.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,O.sort(function(t,e){return t.x-e.x}).each(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio}),f(O,e),O.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),_.select(this).attr("transform","translate("+t.x+", 0)"),O.each(function(r,n,i){i===t.parent.key&&(e.dimensions[n]=r)}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer.render&&e.focusLineLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;if(T)return void("ending"===T&&(T=!1));t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,f(O,e),_.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer&&e.focusLineLayer.render(e.panels),e.pickLineLayer&&e.pickLineLayer.render(e.panels,!0),S=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex}))})),O.exit().remove();var j=O.selectAll(".axisOverlays").data(i,n);j.enter().append("g").classed("axisOverlays",!0),j.selectAll(".axis").remove();var F=j.selectAll(".axis").data(i,n);F.enter().append("g").classed("axis",!0),F.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain(),i=t.ticktext;_.select(this).call(_.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n.map(function(t,e){return i&&i[e]||t}):null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),w.font(F.selectAll("text"),t.model.tickFont)}),F.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),F.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var R=j.selectAll(".axisHeading").data(i,n);R.enter().append("g").classed("axisHeading",!0);var N=R.selectAll(".axisTitle").data(i,n);N.enter().append("text").classed("axisTitle",!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),N.attr("transform","translate(0,"+-b.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){w.font(N,t.model.labelFont)});var B=j.selectAll(".axisExtent").data(i,n);B.enter().append("g").classed("axisExtent",!0);var U=B.selectAll(".axisExtentTop").data(i,n);U.enter().append("g").classed("axisExtentTop",!0),U.attr("transform","translate(0,"+-b.axisExtentOffset+")");var V=U.selectAll(".axisExtentTopText").data(i,n);V.enter().append("text").classed("axisExtentTopText",!0).attr("alignment-baseline","after-edge").call(g),V.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){w.font(V,t.model.rangeFont)});var q=B.selectAll(".axisExtentBottom").data(i,n);q.enter().append("g").classed("axisExtentBottom",!0),q.attr("transform",function(t){return"translate(0,"+(t.model.height+b.axisExtentOffset)+")"});var H=q.selectAll(".axisExtentBottomText").data(i,n);H.enter().append("text").classed("axisExtentBottomText",!0).attr("alignment-baseline","before-edge").call(g),H.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){w.font(H,t.model.rangeFont)});var G=j.selectAll(".axisBrush").data(i,n),Y=G.enter().append("g").classed("axisBrush",!0);G.each(function(t){t.brush||(t.brush=_.svg.brush().y(t.unitScale).on("brushstart",M).on("brush",k).on("brushend",A),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),_.select(this).call(t.brush))}),Y.selectAll("rect").attr("x",-b.bar.capturewidth/2).attr("width",b.bar.capturewidth),Y.selectAll("rect.extent").attr("fill","url(#filterBarPattern)").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),Y.selectAll(".resize rect").attr("height",b.bar.handleheight).attr("opacity",0).style("visibility","visible"),Y.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",b.bar.handleoverlap-b.bar.handleheight),Y.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",b.bar.handleoverlap);var X=!1,W=!1;return z}},{"../../components/drawing":614,"../../lib":709,"./constants":978,"./lines":981,d3:118}],983:[function(t,e,r){"use strict";var n=t("./parcoords");e.exports=function(t,e){var r=t._fullLayout,i=r._paper,a=r._paperdiv,o={},s={},l=r._size;e.forEach(function(e,r){o[r]=t.data[r].dimensions,s[r]=t.data[r].dimensions.slice()});var u=function(e,r,n){var i=s[e][r],a=i.constraintrange;a&&2===a.length||(a=i.constraintrange=[]),a[0]=n[0],a[1]=n[1],t.emit("plotly_restyle")},c=function(e){t.emit("plotly_hover",e)},h=function(e){t.emit("plotly_unhover",e)},f=function(e,r){function n(t){return!("visible"in t)||t.visible}function i(t,e,r){var n=e.indexOf(r),i=t.indexOf(n);return i===-1&&(i+=e.length),i}var a=function(t){return function(e,n){return i(r,t,e)-i(r,t,n)}}(s[e].filter(n));o[e].sort(a),s[e].filter(function(t){return!n(t)}).sort(function(t){return s[e].indexOf(t)}).forEach(function(t){o[e].splice(o[e].indexOf(t),1),o[e].splice(s[e].indexOf(t),0,t)}),t.emit("plotly_restyle")};n(a,i,e,{width:l.w,height:l.h,margin:{t:l.t,r:l.r,b:l.b,l:l.l}},{filterChanged:u,hover:c,unhover:h,axesMoved:f})}},{"./parcoords":982}],984:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=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:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},hovertext:{valType:"string",dflt:"",arrayOk:!0},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:o({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:o({},i,{}),insidetextfont:o({},i,{}),outsidetextfont:o({},i,{}),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":589,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/font_attributes":772}],985:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n")}return m};var l},{"../../components/color":590,"./helpers":988,"fast-isnumeric":127,tinycolor2:526}],987:[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")),o("marker.line.width")&&o("marker.line.color");var c=o("marker.colors");Array.isArray(c)||(e.marker.colors=[]),o("scalegroup");var h=o("text"),f=o("textinfo",Array.isArray(h)?"text+percent":"percent");if(o("hovertext"),o("hoverinfo",1===a._dataLength?"label+text+value+percent":void 0),f&&"none"!==f){var d=o("textposition"),p=Array.isArray(d)||"auto"===d,m=p||"inside"===d,v=p||"outside"===d;if(m||v){var g=s(o,"textfont",a.font);m&&s(o,"insidetextfont",g),v&&s(o,"outsidetextfont",g)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":709,"./attributes":984}],988:[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":709}],989:[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":984,"./base_plot":985,"./calc":986,"./defaults":987,"./layout_attributes":990,"./layout_defaults":991,"./plot":992,"./style":993,"./style_one":994}],990:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],991:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){!function(r,a){n.coerce(t,e,i,r,a)}("hiddenlabels")}},{"../../lib":709,"./layout_attributes":990}],992:[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)),m=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),v={scale:2*m/t.width,rCenter:Math.cos(m/r.r)-m/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},g=v.scale>f.scale?v:f;return u.scale<1&&g.scale>u.scale?g: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]}var i,a,o,s,l,u,c,h,f,d,p,m,v;for(a=0;a<2;a++)for(o=a?r:n,l=a?Math.max:Math.min,c=a?1:-1,i=0;i<2;i++){for(s=i?Math.max:Math.min,u=i?1:-1,h=t[a][i],h.sort(o),f=t[1-a][i],d=f.concat(h),m=[],p=0;p0&&(t.labelExtraY=b),Array.isArray(e.pull))for(i=0;i=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*c>0?(h=o.cyFinal+l(o.px0[1],o.px1[1]),(b=h-v-t.labelExtraY)*c>0&&(t.labelExtraY+=b)):(g+t.labelExtraY-y)*c>0&&(n=3*u*Math.abs(i-d.indexOf(t)),f=o.cxFinal+s(o.px0[0],o.px1[0]),(p=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*u>0&&(t.labelExtraX+=p)))}(m[p],g)}}}function s(t,e){var r,n,i,a,o,s,l,c,h,f,d=[];for(i=0;ic&&(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("../../components/fx"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),m=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],v=u.trace,g=(v.depth||0)*u.r*Math.sin(0)/2,y=v.tiltaxis||0,b=y*Math.PI/180,x=[g*Math.sin(b),g*Math.cos(b)],_=u.r*Math.cos(0),w=s.selectAll("g.part").data(v.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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=[[[],[]],[[],[]]],g=!1;s.each(function(e){function o(n){n.originalEvent=c.event;var a=t._fullLayout,o=t._fullData[v.index],s=o.hoverinfo;if("all"===s&&(s="label+text+value+percent+name"),t._dragging||a.hovermode===!1||"none"===s||"skip"===s||!s)return void h.hover(t,n,"pie");var l=i(e,u),f=w+e.pxmid[0]*(1-l),d=M+e.pxmid[1]*(1-l),p=r.separators,g=[];s.indexOf("label")!==-1&&g.push(e.label),s.indexOf("text")!==-1&&(o.hovertext?g.push(Array.isArray(o.hovertext)?o.hovertext[e.i]:o.hovertext):o.text&&o.text[e.i]&&g.push(o.text[e.i])),s.indexOf("value")!==-1&&g.push(m.formatPieValue(e.v,p)),s.indexOf("percent")!==-1&&g.push(m.formatPiePercent(e.v/u.vTotal,p));var y=o.hoverlabel;h.loneHover({x0:f-l*u.r,x1:f+l*u.r,y:d,text:g.join("
"),name:s.indexOf("name")!==-1?o.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:e.hbg||y.bgcolor||e.color,borderColor:e.hbc||y.bordercolor,fontFamily:e.htf||y.font.family,fontSize:e.hts||y.font.size,fontColor:e.htc||y.font.color},{container:a._hoverlayer.node(),outerContainer:a._paper.node()}),h.hover(t,n,"pie"),T=!0}function s(e){e.originalEvent=c.event,t.emit("plotly_unhover",{event:c.event,points:[e]}),T&&(h.loneUnhover(r._hoverlayer.node()),T=!1)}function f(){t._hoverdata=[e],t._hoverdata.trace=u.trace,h.click(t,c.event)}function b(t,r,n,i){return"a"+i*u.r+","+i*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+i*(r[0]-t[0])+","+i*(r[1]-t[1])}if(e.hidden)return void c.select(this).selectAll("path,g").remove();l[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=u.cx+x[0],M=u.cy+x[1],k=c.select(this),A=k.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",o).on("mouseout",s).on("click",f),v.pull){var S=+(Array.isArray(v.pull)?v.pull[e.i]:v.pull)||0;S>0&&(w+=S*e.pxmid[0],M+=S*e.pxmid[1])}e.cxFinal=w,e.cyFinal=M;var E=v.hole;if(e.v===u.vTotal){var L="M"+(w+e.px0[0])+","+(M+e.px0[1])+b(e.px0,e.pxmid,!0,1)+b(e.pxmid,e.px0,!0,1)+"Z";E?A.attr("d","M"+(w+E*e.px0[0])+","+(M+E*e.px0[1])+b(e.px0,e.pxmid,!1,E)+b(e.pxmid,e.px0,!1,E)+"Z"+L):A.attr("d",L)}else{var C=b(e.px0,e.px1,!0,1);if(E){var z=1-E;A.attr("d","M"+(w+E*e.px1[0])+","+(M+E*e.px1[1])+b(e.px1,e.px0,!1,E)+"l"+z*e.px0[0]+","+z*e.px0[1]+C+"Z")}else A.attr("d","M"+w+","+M+"l"+e.px0[0]+","+e.px0[1]+C+"Z")}var D=Array.isArray(v.textposition)?v.textposition[e.i]:v.textposition,I=k.selectAll("g.slicetext").data(e.text&&"none"!==D?[0]:[]);I.enter().append("g").classed("slicetext",!0),I.exit().remove(),I.each(function(){var t=c.select(this).selectAll("text").data([0]);t.enter().append("text").attr("data-notex",1),t.exit().remove(),t.text(e.text).attr({class:"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===D?v.outsidetextfont:v.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var r,i=d.bBox(t.node());"outside"===D?r=a(i,e):(r=n(i,e,u),"auto"===D&&r.scale<1&&(t.call(d.font,v.outsidetextfont),v.outsidetextfont.family===v.insidetextfont.family&&v.outsidetextfont.size===v.insidetextfont.size||(t.attr({"data-bb":""}),i=d.bBox(t.node())),r=a(i,e)));var o=w+e.pxmid[0]*r.rCenter+(r.x||0),s=M+e.pxmid[1]*r.rCenter+(r.y||0);r.outside&&(e.yLabelMin=s-i.height/2,e.yLabelMid=s,e.yLabelMax=s+i.height/2,e.labelExtraX=0,e.labelExtraY=0,g=!0),t.attr("transform","translate("+o+","+s+")"+(r.scale<1?"scale("+r.scale+")":"")+(r.rotate?"rotate("+r.rotate+")":"")+"translate("+-(i.left+i.right)/2+","+-(i.top+i.bottom)/2+")")})}),g&&o(l,v),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]);Math.abs(s)>Math.abs(l)?a+="l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+o):a+="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,v.outsidetextfont.color).attr({"stroke-width":Math.min(2,v.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":590,"../../components/drawing":614,"../../components/fx":631,"../../lib/svg_text_utils":728,"./helpers":988,d3:118}],993:[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":994,d3:118}],994:[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}).call(n.fill,e.color).call(n.stroke,i)}},{"../../components/color":590}],995:[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":1052}],996:[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.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=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),m=o(t.marker.border.color),v=t.opacity*t.marker.opacity;p[3]*=v,this.pointcloudOptions.color=p;var g=t.marker.blend;if(null===g){g=l.length<100||u.length<100}this.pointcloudOptions.blend=g,m[3]*=v,this.pointcloudOptions.borderColor=m;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},u.expandAxesFast=function(t,e){for(var r,n,i,a=e||.5,o=0;o<2;o++)r=this.scene[l[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:a}),i=r._max,i||(i=[]),i.push({val:t[o+2],pad:a})},u.dispose=function(){this.pointcloud.dispose()},e.exports=i},{"../../lib/str2rgbarray":727,"../scatter/get_trace_color":1016,"gl-pointcloud2d":225}],997:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}a("x"),a("y"),a("xbounds"),a("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),a("text"),a("marker.color",r),a("marker.opacity"),a("marker.blend"),a("marker.sizemin"), -a("marker.sizemax"),a("marker.border.color",r),a("marker.border.arearatio")}},{"../../lib":709,"./attributes":995}],998:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":788,"../scatter3d/calc":1032,"./attributes":995,"./convert":996,"./defaults":997}],999:[function(t,e,r){"use strict";var n=t("../../components/shapes/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=t("../../components/color/attributes"),s=t("../../lib/extend").extendFlat;e.exports={hoverinfo:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),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]}},orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:i,node:{label:{valType:"data_array",dflt:[]},color:s({},n.fillcolor,{arrayOk:!0}),line:{color:{valType:"color",dflt:o.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20}},link:{label:{valType:"data_array",dflt:[]},color:s({},n.fillcolor,{arrayOk:!0}),line:{color:{valType:"color",dflt:o.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]}}}},{"../../components/color/attributes":589,"../../components/shapes/attributes":666,"../../lib/extend":701,"../../plots/attributes":746,"../../plots/font_attributes":772}],1e3:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./plot");r.name="sankey",r.attr="type",r.plot=function(t){var e=n.getSubplotCalcData(t.calcdata,"sankey","sankey");e.length&&i(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("sankey"),a=e._has&&e._has("sankey");i&&!a&&n._paperdiv.selectAll(".sankey").remove()}},{"../../plots/plots":811,"./plot":1005}],1001:[function(t,e,r){"use strict";function n(t,e,r){for(var n=t.map(function(){return[]}),a=0;a1})}var i=t("strongly-connected-components"),a=t("../../lib");e.exports=function(t,e){return n(e.node.label,e.link.source,e.link.target)&&(a.error("Circularity is present in the Sankey data. Removing all nodes and links."),e.link.label=[],e.link.source=[],e.link.target=[],e.link.value=[],e.link.color=[],e.node.label=[],e.node.color=[]),[{link:e.link,node:e.node}]}},{"../../lib":709,"strongly-connected-components":520}],1002:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear"}},{}],1003:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color/attributes").defaults,o=t("../../components/color"),s=t("tinycolor2");e.exports=function(t,e,r,l){function u(r,a){return n.coerce(t,e,i,r,a)}u("node.label"),u("node.pad"),u("node.thickness"),u("node.line.color"),u("node.line.width");var c=function(t){return a[t%a.length]};u("node.color",e.node.label.map(function(t,e){return o.addOpacity(c(e),.8)})),u("link.label"),u("link.source"),u("link.target"),u("link.value"),u("link.line.color"),u("link.line.width"),u("link.color",e.link.value.map(function(){return s(l.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)"})),u("hoverinfo",1===l._dataLength?"label+text+value+percent":void 0),u("domain.x"),u("domain.y"),u("orientation"),u("valueformat"),u("valuesuffix"),u("arrangement"),n.coerceFont(u,"textfont",n.extendFlat({},l.font));var h=function(t,r){return e.link.source.indexOf(r)===-1&&e.link.target.indexOf(r)===-1};e.node.label.some(h)&&n.warn("Some of the nodes are neither sources nor targets, they will not be displayed.")}},{"../../components/color":590,"../../components/color/attributes":589,"../../lib":709,"./attributes":999,tinycolor2:526}],1004:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.moduleType="trace",n.name="sankey",n.basePlotModule=t("./base_plot"),n.categories=["noOpacity"],n.meta={},e.exports=n},{"./attributes":999,"./base_plot":1e3,"./calc":1001,"./defaults":1003,"./plot":1005}],1005:[function(t,e,r){"use strict";function n(t){return""!==t}function i(t,e){return t.filter(function(t){return t.key===e.traceId})}function a(t,e){p.select(t).select("path").style("fill-opacity",e),p.select(t).select("rect").style("fill-opacity",e)}function o(t){p.select(t).select("text.name").style("fill","black")}function s(t){return function(e){return t.node.sourceLinks.indexOf(e.link)!==-1||t.node.targetLinks.indexOf(e.link)!==-1}}function l(t){return function(e){return e.node.sourceLinks.indexOf(t.link)!==-1||e.node.targetLinks.indexOf(t.link)!==-1}}function u(t,e,r){e&&r&&i(r,e).selectAll(".sankeyLink").filter(s(e)).call(h.bind(0,e,r,!1))}function c(t,e,r){e&&r&&i(r,e).selectAll(".sankeyLink").filter(s(e)).call(f.bind(0,e,r,!1))}function h(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",.4),a&&i(e,t).selectAll(".sankeyLink").filter(function(t){return t.link.label===a}).style("fill-opacity",.4),r&&i(e,t).selectAll(".sankeyNode").filter(l(t)).call(u)}function f(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha}),a&&i(e,t).selectAll(".sankeyLink").filter(function(t){return t.link.label===a}).style("fill-opacity",function(t){return t.tinyColorAlpha}),r&&i(e,t).selectAll(".sankeyNode").filter(l(t)).call(c)}function d(t,e){var r=t.hoverlabel||{},n=y.nestedProperty(r,e).get();return!Array.isArray(n)&&n}var p=t("d3"),m=t("./render"),v=t("../../components/fx"),g=t("../../components/color"),y=t("../../lib");e.exports=function(t,e){var r=t._fullLayout,i=r._paper,s=r._size,l=function(r,n){t._hoverdata=[n.link],t._hoverdata.trace=e.trace,v.click(t,{target:!0})},y=function(e,r,n){p.select(e).call(h.bind(0,r,n,!0)),v.hover(t,r.link,"sankey")},b=function(e,i){var s=t._fullData[i.traceId],l=t.getBoundingClientRect(),u=e.getBoundingClientRect(),c=u.left+u.width/2,h=u.top+u.height/2,f=v.loneHover({x:c-l.left,y:h-l.top,name:p.format(i.valueFormat)(i.link.value)+i.valueSuffix,text:[i.link.label,["Source:",i.link.source.label].join(" "),["Target:",i.link.target.label].join(" ")].filter(n).join("
"),color:d(s,"bgcolor")||g.addOpacity(i.tinyColorHue,1),borderColor:d(s,"bordercolor"),fontFamily:d(s,"font.family"),fontSize:d(s,"font.size"),fontColor:d(s,"font.color"),idealAlign:p.event.x"),color:d(s,"bgcolor")||i.tinyColorHue,borderColor:d(s,"bordercolor"),fontFamily:d(s,"font.family"),fontSize:d(s,"font.size"),fontColor:d(s,"font.color"),idealAlign:"left"},{container:r._hoverlayer.node(),outerContainer:r._paper.node()});a(g,.85),o(g)},k=function(e,n,i){p.select(e).call(c,n,i),t.emit("plotly_unhover",{points:[n.node]}),v.loneUnhover(r._hoverlayer.node())};m(i,e,{width:s.w,height:s.h,margin:{t:s.t,r:s.r,b:s.b,l:s.l}},{linkEvents:{hover:y,follow:b,unhover:x,select:l},nodeEvents:{hover:w,follow:M,unhover:k,select:_}})}},{"../../components/color":590,"../../components/fx":631,"../../lib":709,"./render":1006,d3:118}],1006:[function(t,e,r){"use strict";function n(t){return t.key}function i(t){return[t]}function a(t){return t[0]}function o(t){var e,r=[];for(e=0;e1||t.linkLineWidth>0}function _(t){return t.horizontal?"matrix(1,0,0,1,0,0)":"matrix(0,1,1,0,0,0)"}function w(t){return L.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+E.nodeTextOffsetHorizontal:E.nodeTextOffsetHorizontal,t.labelY],[t.horizontal?t.left?-E.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleWidth-E.nodeTextOffsetHorizontal,t.labelY]])}function M(t,e,r){t.on(".basic",null).on("mouseover.basic",function(t){t.interactionState.dragInProgress||(r.hover(this,t,e),t.interactionState.hovered=[this,t])}).on("mousemove.basic",function(t){t.interactionState.dragInProgress||(r.follow(this,t),t.interactionState.hovered=[this,t])}).on("mouseout.basic",function(t){t.interactionState.dragInProgress||(r.unhover(this,t,e),t.interactionState.hovered=!1)}).on("click.basic",function(t){t.interactionState.hovered&&(r.unhover(this,t,e),t.interactionState.hovered=!1),t.interactionState.dragInProgress||r.select(this,t,e)})}function k(t,e,r){var n=L.behavior.drag().origin(function(t){return t.horizontal?t.node:{x:t.node.y,y:t.node.x}}).on("dragstart",function(n){if("fixed"!==n.arrangement&&(this.parentNode.appendChild(this),n.interactionState.dragInProgress=n.node,s(n.node),n.interactionState.hovered&&(r.nodeEvents.unhover.apply(0,n.interactionState.hovered),n.interactionState.hovered=!1),"snap"===n.arrangement)){var i=n.traceId+"|"+Math.floor(n.node.originalX);n.forceLayouts[i]?n.forceLayouts[i].alpha(1):A(t,i,n),T(t,e,n,i)}}).on("drag",function(r){if("fixed"!==r.arrangement){var n=r.horizontal?L.event.x:L.event.y,i=r.horizontal?L.event.y:L.event.x;"snap"===r.arrangement?(r.node.x=n,r.node.y=i):("freeform"===r.arrangement&&(r.node.x=n),r.node.y=Math.max(r.node.dy/2,Math.min(r.size-r.node.dy/2,i))),s(r.node),"snap"!==r.arrangement&&(r.sankey.relayout(),y(t.filter(l(r)),e),t.call(p))}}).on("dragend",function(t){t.interactionState.dragInProgress=!1});t.on(".drag",null).call(n)}function A(t,e,r){var n=r.sankey.nodes().filter(function(t){return t.originalX===r.node.originalX});r.forceLayouts[e]=P.forceSimulation(n).alphaDecay(0).force("collide",P.forceCollide().radius(function(t){return t.dy/2+r.nodePad/2}).strength(1).iterations(E.forceIterations)).force("constrain",S(t,e,n,r)).stop()}function T(t,e,r,n){window.requestAnimationFrame(function i(){for(var a=0;a0&&window.requestAnimationFrame(i)})}function S(t,e,r,n){return function(){for(var i=0,a=0;a0&&(n.forceLayouts[e].alpha(0),window.setTimeout(function(){t.call(p)},30))}}var E=t("./constants"),L=t("d3"),C=t("tinycolor2"),z=t("../../components/color"),D=t("../../components/drawing"),I=t("@plotly/d3-sankey").sankey,P=t("d3-force"),O=t("../../lib");e.exports=function(t,e,r,s){var l=t.selectAll(".sankey").data(e.filter(function(t){return a(t).trace.visible}).map(h.bind(null,r)),n);l.exit().remove(),l.enter().append("g").classed("sankey",!0).style("box-sizing","content-box").style("position","absolute").style("left",0).style("shape-rendering","geometricPrecision").style("pointer-events","auto").style("box-sizing","content-box"),l.attr("transform",function(t){return"translate("+t.translateX+","+t.translateY+")"});var u=l.selectAll(".sankeyLinks").data(i,n);u.enter().append("g").classed("sankeyLinks",!0).style("fill","none").style("transform",_),u.transition().ease(E.ease).duration(E.duration).style("transform",_);var c=u.selectAll(".sankeyLink").data(function(t){var e={};return t.sankey.links().filter(function(t){return t.value}).map(f.bind(null,e,t))},n);c.enter().append("path").classed("sankeyLink",!0).attr("d",v).call(M,l,s.linkEvents),c.style("stroke",function(t){return x(t)?z.tinyRGB(C(t.linkLineColor)):t.tinyColorHue}).style("stroke-opacity",function(t){return x(t)?z.opacity(t.linkLineColor):t.tinyColorAlpha}).style("stroke-width",function(t){return x(t)?t.linkLineWidth:1}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha}),c.transition().ease(E.ease).duration(E.duration).attr("d",v),c.exit().transition().ease(E.ease).duration(E.duration).style("opacity",0).remove();var p=l.selectAll(".sankeyNodeSet").data(i,n);p.enter().append("g").style("shape-rendering","geometricPrecision").classed("sankeyNodeSet",!0),p.style("cursor",function(t){switch(t.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var g=p.selectAll(".sankeyNode").data(function(t){var e=t.sankey.nodes(),r={};return o(e),e.filter(function(t){return t.value}).map(d.bind(null,r,t))},n);g.enter().append("g").classed("sankeyNode",!0).call(m).call(M,l,s.nodeEvents),g.call(k,c,s),g.transition().ease(E.ease).duration(E.duration).call(m),g.exit().transition().ease(E.ease).duration(E.duration).style("opacity",0).remove();var y=g.selectAll(".nodeRect").data(i);y.enter().append("rect").classed("nodeRect",!0).call(b),y.style("stroke-width",function(t){return t.nodeLineWidth}).style("stroke",function(t){return z.tinyRGB(C(t.nodeLineColor))}).style("stroke-opacity",function(t){return z.opacity(t.nodeLineColor)}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha}),y.transition().ease(E.ease).duration(E.duration).call(b);var A=g.selectAll(".nodeCapture").data(i);A.enter().append("rect").classed("nodeCapture",!0).style("fill-opacity",0),A.attr("x",function(t){return t.zoneX}).attr("y",function(t){return t.zoneY}).attr("width",function(t){return t.zoneWidth}).attr("height",function(t){return t.zoneHeight});var T=g.selectAll(".nodeLabelGuide").data(i);T.enter().append("path").classed("nodeLabelGuide",!0).attr("id",function(t){return t.uniqueNodeLabelPathId}).attr("d",w),T.transition().ease(E.ease).duration(E.duration).attr("d",w);var S=g.selectAll(".nodeLabel").data(i);S.enter().append("text").classed("nodeLabel",!0).style("user-select","none").style("cursor","default").style("fill","black"),S.style("text-shadow",function(t){return t.horizontal?"-1px 1px 1px #fff, 1px 1px 1px #fff, 1px -1px 1px #fff, -1px -1px 1px #fff":"none"}).each(function(t){D.font(S,t.textFont)});var L=S.selectAll(".nodeLabelTextPath").data(i);L.enter().append("textPath").classed("nodeLabelTextPath",!0).attr("alignment-baseline","middle").attr("xlink:href",function(t){return"#"+t.uniqueNodeLabelPathId}),L.text(function(t){return t.horizontal||t.node.dy>5?t.node.label:""}).attr("startOffset",function(t){return t.horizontal&&t.left?"100%":"0%"}).style("text-anchor",function(t){return t.horizontal&&t.left?"end":"start"}).style("fill",function(t){return t.darkBackground&&!t.horizontal?"white":"black"})}},{"../../components/color":590,"../../components/drawing":614,"../../lib":709,"./constants":1002,"@plotly/d3-sankey":36,d3:118,"d3-force":114,tinycolor2:526}],1007:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rm&&d.splice(m,d.length-m),p.length>m&&p.splice(m,p.length-m);var v={padded:!0},g={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};i.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>m&&u.splice(m,u.length-m)}var b,x=1.6*(e.marker.sizeref||1);b="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/x),3)}:function(t){return Math.max((t||0)/x,3)},v.ppad=g.ppad=Array.isArray(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-1]?e.error_y.visible||["tonexty","tozeroy"].indexOf(e.fill)===-1&&(o.hasMarkers(e)||o.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-1]?["tonextx","tozerox"].indexOf(e.fill)!==-1&&(g.padded=!1):g.tozero=!0,i.expand(h,d,v),i.expand(f,p,g);var _=new Array(m);for(c=0;c=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],1011:[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":593,"../../components/colorscale":604,"../../lib":709,"../../plots/plots":811,"fast-isnumeric":127}],1012:[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":596,"../../components/colorscale/has_colorscale":603,"./subtypes":1028}],1013:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],1014:[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 m(r,a){return n.coerce(t,e,i,r,a)}var v=s(t,e,p,m),g=vU!=I>=U&&(C=E[T-1][0],z=E[T][0],L=C+(z-C)*(U-D)/(I-D),F=Math.min(F,L),R=Math.max(R,L));F=Math.max(F,0),R=Math.min(R,f._length);var V=s.defaultLine;return s.opacity(h.fillcolor)?V=h.fillcolor:s.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:l+10,x0:F,x1:R,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":590,"../../components/errorbars":620,"../../components/fx":631,"../../lib":709,"./get_trace_color":1016}],1018:[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":758,"./arrays_to_calcdata":1007,"./attributes":1008,"./calc":1009,"./clean_data":1010,"./colorbar":1011,"./defaults":1014,"./hover":1017,"./plot":1025,"./select":1026,"./style":1027,"./subtypes":1028}],1019:[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,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603}],1020:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),i=w.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var a,o,s,l,u,c,h,f,d,p,m,v,g,y,b,x,_=e.xaxis,w=e.yaxis,M=e.simplify,k=e.connectGaps,A=e.baseTolerance,T=e.linear,S=[],E=.2,L=new Array(t.length),C=0;for(M||(A=E=-1),a=0;ai(c))break;s=c,g=p[0]*d[0]+p[1]*d[1],g>m?(m=g,l=c,f=!1):g=t.length||!c)break;L[C++]=c,o=c}}else L[C++]=l}S.push(L.slice(0,C))}return S}},{"../../constants/numerical":690}],1021:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1022:[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":127}],1024:[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,u){var c,h=o.isBubble(t),f=(t.line||{}).color;if(u=u||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",h?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=f&&!Array.isArray(f)&&e.marker.color!==f?f:h?n.background:n.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",h?1:0)),h&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":590,"../../components/colorscale/defaults":599,"../../components/colorscale/has_colorscale":603,"./subtypes":1028}],1025:[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,f,p){function m(t){return M?t.transition():t}function v(t){return t.filter(function(t){return t.vis})}function g(t){return t.id}function y(t){if(t.ids)return g}function b(){return!1}function x(e){var r,n,i,a=e[0].trace,u=o.select(this),h=c.hasMarkers(a),f=c.hasText(a),d=y(a),p=b,g=b;h&&(p=a.marker.maxdisplayed||a._needsCull?v:s.identity),f&&(g=a.marker.maxdisplayed||a._needsCull?v:s.identity),n=u.selectAll("path.point"),r=n.data(p,d);var x=r.enter().append("path").classed("point",!0);x.call(l.pointStyle,a).call(l.translatePoints,k,A,a),M&&x.style("opacity",0).transition().style("opacity",1);var _=h&&l.tryColorscale(a.marker,""),w=h&&l.tryColorscale(a.marker,"line");r.each(function(e){var r=o.select(this),n=m(r);(i=l.translatePoint(e,n,k,A))&&(l.singlePointStyle(e,n,a,_,w,t),a.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data))}),M?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=u.selectAll("g"),r=n.data(g,d),r.enter().append("g").classed("textpoint",!0).append("text"),r.each(function(t){var e=o.select(this),r=m(e.select("text"));(i=l.translatePoint(t,r,k,A))||e.remove()}),r.selectAll("text").call(l.textPointStyle,a).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||A.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){m(o.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;a(t,e,r,n,i);var M=!!p&&p.duration>0,k=r.xaxis,A=r.yaxis,T=n[0].trace,S=T.line,E=o.select(f);if(E.call(u.plot,r,p),T.visible===!0){m(E).style("opacity",T.opacity);var L,C,z=T.fill.charAt(T.fill.length-1);"x"!==z&&"y"!==z&&(z=""),n[0].node3=E;var D="",I=[],P=T._prevtrace;P&&(D=P._prevRevpath||"",C=P._nextFill,I=P._polygons);var O,j,F,R,N,B,U,V,q,H="",G="",Y=[],X=[],W=s.noop;if(L=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(C&&C.datum(n),["hv","vh","hvh","vhv"].indexOf(S.shape)!==-1?(F=l.steps(S.shape),R=l.steps(S.shape.split("").reverse().join(""))):F=R="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")},N=function(t){return R(t.reverse())},Y=h(n,{xaxis:k,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(S.width||1,3)/4,linear:"linear"===S.shape,simplify:S.simplify}),q=T._polygons=new Array(Y.length),w=0;w1}),W=function(t){return function(e){if(O=F(e),j=N(e),H?z?(H+="L"+O.substr(1),G=j+"L"+G.substr(1)):(H+="Z"+O,G=j+"Z"+G):(H=O,G=j),c.hasLines(T)&&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 Z=E.selectAll(".js-line").data(X);m(Z.exit()).style("opacity",0).remove(),Z.each(W(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),Y.length&&(L?B&&V&&(z?("y"===z?B[1]=V[1]=A.c2p(0,!0):"x"===z&&(B[0]=V[0]=k.c2p(0,!0)),m(L).attr("d","M"+V+"L"+B+"L"+H.substr(1))):m(L).attr("d",H+"Z")):"tonext"===T.fill.substr(0,6)&&H&&D&&("tonext"===T.fill?m(C).attr("d",H+"Z"+D+"Z"):m(C).attr("d",H+"L"+D.substr(1)+"Z"),T._polygons=T._polygons.concat(I)),T._prevRevpath=G,T._prevPolygons=q);var J=E.selectAll(".points");_=J.data([n]),J.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(a.range,a.r2c)),h=o.extent(s.simpleMap(l.range,l.r2c)),f=n[0].trace;if(c.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=h[0]&&t.y<=h[1]}),m=Math.ceil(p.length/d),v=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),f(t,e,r),n(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),v){s&&(d=s());o.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).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)});m&&h.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":614,"../../components/errorbars":620,"../../lib":709,"../../lib/polygon":719,"./line_points":1020,"./link_traces":1022,"./subtypes":1028,d3:118}],1026:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],h=s[0].trace,f=h.index,d=h.marker,p=!n.hasMarkers(h)&&!n.hasText(h);if(h.visible===!0&&!p){var m=Array.isArray(d.opacity)?1:d.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=v(f),this.delaunayMesh._trace=this,this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},A.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":687,"../../constants/gl_markers":688,"../../lib":709,"../../lib/gl_format_color":706,"../../lib/str2rgbarray":727,"../scatter/make_bubble_size_func":1023,"./calc_errors":1033,"delaunay-triangulate":119,"gl-error3d":157,"gl-line3d":167,"gl-mesh3d":200,"gl-scatter3d":246}],1035:[function(t,e,r){"use strict";function n(t,e,r,n){var a=0,o=r("x"),s=r("y"),l=r("z");return i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),o&&s&&l&&(a=Math.min(o.length,s.length,l.length),a=0&&f("surfacecolor",d||p);for(var m=["x","y","z"],v=0;v<3;++v){var g="projection."+m[v];f(g+".show")&&(f(g+".opacity"),f(g+".scale"))}c(t,e,r,{axis:"z"}),c(t,e,r,{axis:"y",inherit:"z"}),c(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":619,"../../lib":709,"../../registry":826,"../scatter/line_defaults":1019,"../scatter/marker_defaults":1024,"../scatter/subtypes":1028,"../scatter/text_defaults":1029,"./attributes":1031}],1036:[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":688,"../../plots/gl3d":791,"../scatter/colorbar":1011,"./attributes":1031,"./calc":1032,"./convert":1034,"./defaults":1035}],1037:[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={carpet:{valType:"string"},a:{valType:"data_array"},b:{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)),gradient:l.gradient},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":591,"../../components/colorscale/color_attributes":597,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1038:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../scatter/subtypes"),o=t("../scatter/colorscale_calc"),s=t("../scatter/arrays_to_calcdata"),l=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=l(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var u;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var c,h,f=e.a.length,d=new Array(f),p=!1;for(u=0;uf&&y.splice(f,y.length-f)}return o(e),s(d,e),d}}},{"../../plots/cartesian/axes":748,"../carpet/lookup_carpetid":882,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"../scatter/subtypes":1028,"fast-isnumeric":127}],1039:[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)}d("carpet"),e.xaxis="x",e.yaxis="y";var p,m=d("a"),v=d("b");if(!(p=Math.min(m.length,v.length)))return void(e.visible=!1);m&&p0?t.labelprefix:t._hovertitle+": ")+e.toFixed(3)+t.labelsuffix)}var o=n(t,e,r,i);if(o&&o[0].index!==!1){var s=o[0];if(void 0===s.index){var l=1-s.y0/t.ya._length,u=t.xa._length,c=u*l/2,h=u-c;return s.x0=Math.max(Math.min(s.x0,h),c),s.x1=Math.max(Math.min(s.x1,h),c),o}var f=s.cd[s.index];s.a=f.a,s.b=f.b,s.xLabelVal=void 0,s.yLabelVal=void 0;var d=s.trace,p=d._carpet,m=d.hoverinfo.split("+"),v=[];m.indexOf("all")!==-1&&(m=["a","b"]),m.indexOf("a")!==-1&&a(p.aaxis,f.a),m.indexOf("b")!==-1&&a(p.baxis,f.b);var g=p.ab2ij([f.a,f.b]),y=Math.floor(g[0]),b=g[0]-y,x=Math.floor(g[1]),_=g[1]-x,w=p.evalxy([],y,x,b,_);return v.push("y: "+w[1].toFixed(3)),s.extraText=v.join("
"),o}}},{"../scatter/hover":1017}],1041:[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="scattercarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["carpet","symbols","markerColorscale","showLegend","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":758,"../scatter/colorbar":1011,"./attributes":1037,"./calc":1038,"./defaults":1039,"./hover":1040,"./plot":1042,"./select":1043,"./style":1044}],1042:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../plots/cartesian/axes");e.exports=function(t,e,r){var a,o,s,l=r[0][0].carpet,u={xaxis:i.getFromId(t,l.xaxis||"x"),yaxis:i.getFromId(t,l.yaxis||"y"),plot:e.plot};for(n(t,u,r),a=0;a")}var i=t("../../components/fx"),a=t("../../plots/cartesian/axes"),o=t("../../constants/numerical").BADNUM,s=t("../scatter/get_trace_color"),l=t("./attributes");e.exports=function(t){function e(t){return h.projection(t)}function r(t){var r=t.lonlat;if(r[0]===o)return 1/0;if(h.isLonLatOverEdges(r))return 1/0;var n=e(r),i=u.c2p(),a=c.c2p(),s=Math.abs(i-n[0]),l=Math.abs(a-n[1]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(s*s+l*l)-f,1-3/f)}var a=t.cd,l=a[0].trace,u=t.xa,c=t.ya,h=t.subplot;if(i.getClosest(a,r,t),t.index!==!1){var f=a[t.index],d=f.lonlat,p=e(d),m=f.mrc||1;return t.x0=p[0]-m,t.x1=p[0]+m,t.y0=p[1]-m,t.y1=p[1]+m,t.loc=f.loc,t.lat=d[0],t.lon=d[1],t.color=s(l,f),t.extraText=n(l,f,h.mockAxis),[t]}}},{"../../components/fx":631,"../../constants/numerical":690,"../../plots/cartesian/axes":748, -"../scatter/get_trace_color":1016,"./attributes":1045}],1050:[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":776,"../scatter/colorbar":1011,"./attributes":1045,"./calc":1046,"./defaults":1047,"./event_data":1048,"./hover":1049,"./plot":1051}],1051:[function(t,e,r){"use strict";function n(t,e){var r=t[0].trace;if(Array.isArray(r.locations))for(var n=c(r,e),i=r.locationmode,a=0;a=e.length?i:e[a]);return n}function o(t,e,r){return l(z(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")}var i=t("../../components/fx"),a=t("../scatter/get_trace_color"),o=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){function s(t){var e=t.lonlat;if(e[0]===o)return 1/0;var n=Math.abs(c.c2p(e)-c.c2p([p,e[1]])),i=Math.abs(h.c2p(e)-h.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 l=t.cd,u=l[0].trace,c=t.xa,h=t.ya,f=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),d=360*f,p=e-d;if(i.getClosest(l,s,t),t.index!==!1){var m=l[t.index],v=m.lonlat,g=[v[0]+d,v[1]],y=c.c2p(g),b=h.c2p(g),x=m.mrc||1;return t.x0=y-x,t.x1=y+x,t.y0=b-x,t.y1=b+x,t.color=a(u,m),t.extraText=n(u,m),[t]}}},{"../../components/fx":631,"../../constants/numerical":690,"../scatter/get_trace_color":1016}],1061:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("../scattergeo/calc"),n.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":805,"../scatter/colorbar":1011,"../scattergeo/calc":1046,"./attributes":1056,"./defaults":1058,"./event_data":1059,"./hover":1060,"./plot":1062}],1062:[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":1057}],1063:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/colorbar/attributes"),s=t("../../components/drawing/attributes").dash,l=t("../../lib/extend").extendFlat,u=n.marker,c=n.line,h=u.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),line:{color:c.color,width:c.width,dash:s,shape:l({},c.shape,{values:["linear","spline"]}),smoothing:c.smoothing},connectgaps:n.connectgaps,fill:l({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:l({},{symbol:u.symbol,opacity:u.opacity,maxdisplayed:u.maxdisplayed,size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,line:l({},{width:h.width},a("marker".line)),gradient:u.gradient},a("marker"),{showscale:u.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,hoverinfo:l({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":591,"../../components/colorscale/color_attributes":597,"../../components/drawing/attributes":613,"../../lib/extend":701,"../../plots/attributes":746,"../scatter/attributes":1008}],1064:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../scatter/subtypes"),o=t("../scatter/colorscale_calc"),s=t("../scatter/arrays_to_calcdata"),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,m=t._fullLayout[e.subplot],v=m.sum,g=e.sum||v;for(r=0;rk&&S.splice(k,S.length-k)}return o(e),s(A,e),A}},{"../../plots/cartesian/axes":748,"../scatter/arrays_to_calcdata":1007,"../scatter/colorscale_calc":1012,"../scatter/subtypes":1028,"fast-isnumeric":127}],1065:[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,m=d("a"),v=d("b"),g=d("c");if(m?(p=m.length,v?(p=Math.min(p,v.length),g&&(p=Math.min(p,g.length))):p=g?Math.min(p,g.length):0):v&&g&&(p=Math.min(v.length,g.length)),!p)return void(e.visible=!1);m&&p"),s}}},{"../../plots/cartesian/axes":748,"../scatter/hover":1017}],1067:[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":819,"../scatter/colorbar":1011,"./attributes":1063,"./calc":1064,"./defaults":1065,"./hover":1066,"./plot":1068,"./select":1069,"./style":1070}],1068:[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=0;a":return function(t){return f(t)>i};case">=":return function(t){return f(t)>=i};case"[]":return function(t){var e=f(t);return e>=i[0]&&e<=i[1]};case"()":return function(t){var e=f(t);return e>i[0]&&e=i[0]&&ei[0]&&e<=i[1]};case"][":return function(t){var e=f(t);return e<=i[0]||e>=i[1]};case")(":return function(t){var e=f(t);return ei[1]};case"](":return function(t){var e=f(t);return e<=i[0]||e>i[1]};case")[":return function(t){var e=f(t);return e=i[1]};case"{}":return function(t){return i.indexOf(f(t))!==-1};case"}{":return function(t){return i.indexOf(f(t))===-1}}}var i=t("../lib"),a=t("../registry"),o=t("../plot_api/plot_schema"),s=t("../plots/cartesian/axes"),l=["=","!=","<",">=",">","<="],u=["[]","()","[)","(]","][",")(","](",")["],c=["{}","}{"];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(l).concat(u).concat(c),dflt:"="},value:{valType:"any",dflt:0},preservegaps:{valType:"boolean",dflt:!1}},r.supplyDefaults=function(t){function e(e,a){return i.coerce(t,n,r.attributes,e,a)}var n={};if(e("enabled")){e("preservegaps"),e("operation"),e("value"),e("target");var o=a.getComponentMethod("calendars","handleDefaults");o(t,n,"valuecalendar",null),o(t,n,"targetcalendar",null)}return n},r.calcTransform=function(t,e,r){function a(t,r){for(var n=0;nMath.abs(e))u.rotate(o,0,0,-t*n*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,h*(Math.exp(s)-1))}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":35,"mouse-change":448,"mouse-event-offset":449,"mouse-wheel":451,"right-now":498}],35:[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;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n0&&(e.y+=r),a=e.y+e.dy+p;if((r=a-p-m[1])>0)for(a=e.y-=r,n=o-2;n>=0;--n)e=t[n],r=e.y+e.dy+p-a,r>0&&(e.y-=r),a=e.y})}function i(t,e){return t.y-e.y}var a=r.nest().key(function(t){return t.x}).sortKeys(e.ascending).entries(g).map(function(t){return t.values});!function(){var t=e.min(a,function(t){return(m[1]-(t.length-1)*p)/e.sum(t,h)});a.forEach(function(e){e.forEach(function(e,r){e.y=r,e.dy=e.value*t})}),v.forEach(function(e){e.dy=e.value*t})}(),n();for(var o=1;t>0;--t)!function(t){function r(t){return c(t.target)*t.value}a.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var i=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,h);n.y+=(i-c(n))*t}})})}(o*=.99),n(),function(t){function r(t){return c(t.source)*t.value}a.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var i=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,h);n.y+=(i-c(n))*t}})})}(o),n()}function u(){function t(t,e){return t.source.y-e.source.y||t.originalIndex-e.originalIndex}function e(t,e){return t.target.y-e.target.y||t.originalIndex-e.originalIndex}g.forEach(function(r){r.sourceLinks.sort(e),r.targetLinks.sort(t)}),g.forEach(function(t){var e=0,r=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=r,r+=t.dy})})}function c(t){return t.y+t.dy/2}function h(t){return t.value}var f={},d=24,p=8,m=[1,1],g=[],v=[];return f.nodeWidth=function(t){return arguments.length?(d=+t,f):d},f.nodePadding=function(t){return arguments.length?(p=+t,f):p},f.nodes=function(t){return arguments.length?(g=t,f):g},f.links=function(t){return arguments.length?(v=t,f):v},f.size=function(t){return arguments.length?(m=t,f):m},f.layout=function(e){return t(),i(),a(),l(e),u(),f},f.relayout=function(){return u(),f},f.link=function(){function t(t){var r=t.source.x+t.source.dx,i=t.target.x,a=n.interpolateNumber(r,i),o=a(e),s=a(1-e),l=t.source.y+t.sy,u=l+t.dy,c=t.target.y+t.ty,h=c+t.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+c+" "+i+","+c+"L"+i+","+h+"C"+s+","+h+" "+o+","+u+" "+r+","+u+"Z"}var e=.5;return t.curvature=function(r){return arguments.length?(e=+r,t):e},t},f};t.sankey=i,Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-array":112,"d3-collection":113,"d3-interpolate":117}],37:[function(t,e,r){"use strict";function n(t){var e=s.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=a(t,new Float32Array([-1,-1,-1,4,4,-1]));e=o(t,[{buffer:n,type:t.FLOAT,size:2}]),e._triangleBuffer=n,s.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}var i="undefined"==typeof WeakMap?t("weak-map"):WeakMap,a=t("gl-buffer"),o=t("gl-vao"),s=new i;e.exports=n},{"gl-buffer":154,"gl-vao":269,"weak-map":555}],38:[function(t,e,r){function n(t,e,r){e="number"==typeof e?e:1,r=r||": ";var n=t.split(/\r?\n/),a=String(n.length+e-1).length;return n.map(function(t,n){var o=n+e,s=String(o).length;return i(o,a-s)+r+t}).join("\n")}var i=t("pad-left");e.exports=n},{"pad-left":470}],39:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;ni&&(i=t[o]),t[o]>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}()},{}],45:[function(t,e,r){(function(r){"use strict";function n(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i=0;s--)if(l[s]!==u[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!d(t[o],e[o],r,n))return!1;return!0}function g(t,e,r){d(t,e,!0)&&h(t,e,r,"notDeepStrictEqual",g)}function v(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)} +function y(t){var e;try{t()}catch(t){e=t}return e}function b(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=y(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&h(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!t&&x.isError(i),s=!t&&i&&!r;if((o&&a&&v(i,r)||s)&&h(i,r,"Got unwanted exception"+n),t&&i&&r&&!v(i,r)||!t&&i)throw i}var x=t("util/"),_=Object.prototype.hasOwnProperty,w=Array.prototype.slice,M=function(){return"foo"===function(){}.name}(),k=e.exports=f,A=/\s*function\s+([^\(\s]*)\s*/;k.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=c(this),this.generatedMessage=!0);var e=t.stackStartFunction||h;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=s(e),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},x.inherits(k.AssertionError,Error),k.fail=h,k.ok=f,k.equal=function(t,e,r){t!=e&&h(t,e,r,"==",k.equal)},k.notEqual=function(t,e,r){t==e&&h(t,e,r,"!=",k.notEqual)},k.deepEqual=function(t,e,r){d(t,e,!1)||h(t,e,r,"deepEqual",k.deepEqual)},k.deepStrictEqual=function(t,e,r){d(t,e,!0)||h(t,e,r,"deepStrictEqual",k.deepStrictEqual)},k.notDeepEqual=function(t,e,r){d(t,e,!1)&&h(t,e,r,"notDeepEqual",k.notDeepEqual)},k.notDeepStrictEqual=g,k.strictEqual=function(t,e,r){t!==e&&h(t,e,r,"===",k.strictEqual)},k.notStrictEqual=function(t,e,r){t===e&&h(t,e,r,"!==",k.notStrictEqual)},k.throws=function(t,e,r){b(!0,t,e,r)},k.doesNotThrow=function(t,e,r){b(!1,t,e,r)},k.ifError=function(t){if(t)throw t};var T=Object.keys||function(t){var e=[];for(var r in t)_.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":545}],46:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],47:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.ushln(h):h<0&&(c=c.ushln(-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":50,"./is-rat":52,"./lib/is-bn":56,"./lib/num-to-bn":57,"./lib/rationalize":58,"./lib/str-to-bn":59}],52:[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":56}],53:[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":66}],54:[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 a=0;a20?52:r+32}var i=t("double-bits"),a=t("bit-twiddle").countTrailingZeros;e.exports=n},{"bit-twiddle":65,"double-bits":122}],56:[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":66}],57:[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)).ushln(e-52)}var i=t("bn.js"),a=t("double-bits");e.exports=n},{"bn.js":66,"double-bits":122}],58:[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":53,"./num-to-bn":57}],59:[function(t,e,r){"use strict";function n(t){return new i(t)}var i=t("bn.js");e.exports=n},{"bn.js":66}],60:[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":58}],61:[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":53}],62:[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":58}],63:[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.abs().divmod(r.abs()),o=n.div,s=i(o),l=n.mod,u=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return u*s;if(s){var c=a(s)+4,h=i(l.ushln(c).divRound(r));return u*(s+h*Math.pow(2,-c))}var f=r.bitLength()-l.bitLength()+53,h=i(l.ushln(f).divRound(r));return f<1023?u*h*Math.pow(2,-f):(h*=Math.pow(2,-1023),u*h*Math.pow(2,1023-f))}var i=t("./lib/bn-to-num"),a=t("./lib/ctz");e.exports=n},{"./lib/bn-to-num":54,"./lib/ctz":55}],64:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?e.indexOf("c")<0?o.push(";if(x===y){return m}else if(x<=y){"):o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){"):o.push(";if(",e,"){i=m;"),r?o.push("l=m+1}else{h=m-1}"):o.push("h=m-1}else{l=m+1}"),o.push("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return new Function([n("A","x"+t+"y",e,["y"],!1,i),n("B","x"+t+"y",e,["y"],!0,i),n("P","c(x,y)"+t+"0",e,["y","c"],!1,i),n("Q","c(x,y)"+t+"0",e,["y","c"],!0,i),"function dispatchBsearch",r,"(a,y,c,l,h){if(a.shape){if(typeof(c)==='function'){return Q(a,(l===undefined)?0:l|0,(h===undefined)?a.shape[0]-1:h|0,y,c)}else{return B(a,(c===undefined)?0:c|0,(l===undefined)?a.shape[0]-1:l|0,y)}}else{if(typeof(c)==='function'){return P(a,(l===undefined)?0:l|0,(h===undefined)?a.length-1:h|0,y,c)}else{return A(a,(c===undefined)?0:c|0,(l===undefined)?a.length-1:l|0,y)}}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],65:[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}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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)|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,16843009*((t=(858993459&t)+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return t&=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))<<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))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],66:[function(t,e,r){!function(e,r){"use strict";function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function a(t,e,r){if(a.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}function o(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 s(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 l(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,h=67108863&l,f=Math.min(u,e.length-1),d=Math.max(0,u-t.length+1);d<=f;d++){var p=u-d|0;i=0|t.words[p],a=0|e.words[d],o=i*a+h,c+=o/67108864|0,h=67108863&o}r.words[u]=0|h,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0,i+=o>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}function h(t,e,r){return(new f).mulp(t,e,r)}function f(t,e){this.x=t,this.y=e}function d(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function m(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function g(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function b(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var x;try{x=t("buffer").Buffer}catch(t){}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36),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.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var _=["","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"],w=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,r=0!==a||o!==this.length-1?_[6-l.length]+l+r:l+r,i+=2,i>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var u=w[t],c=M[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var f=h.modn(c).toString(t);h=h.idivn(c),r=h.isZero()?f+r:_[u-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==x),this.toArrayLike(x,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=this.cmp(t);if(0===r)return this.negative=0,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>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],v=8191&g,y=g>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,k=w>>>13,A=0|o[5],T=8191&A,S=A>>>13,E=0|o[6],L=8191&E,C=E>>>13,z=0|o[7],I=8191&z,D=z>>>13,P=0|o[8],O=8191&P,F=P>>>13,R=0|o[9],j=8191&R,N=R>>>13,B=0|s[0],U=8191&B,V=B>>>13,q=0|s[1],H=8191&q,G=q>>>13,Y=0|s[2],X=8191&Y,W=Y>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ut=st>>>13,ct=0|s[8],ht=8191&ct,ft=ct>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,U),i=Math.imul(h,V),i=i+Math.imul(f,U)|0,a=Math.imul(f,V);var gt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,U),i=Math.imul(p,V),i=i+Math.imul(m,U)|0,a=Math.imul(m,V),n=n+Math.imul(h,H)|0,i=i+Math.imul(h,G)|0,i=i+Math.imul(f,H)|0,a=a+Math.imul(f,G)|0;var vt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,U),i=Math.imul(v,V),i=i+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,H)|0,i=i+Math.imul(p,G)|0,i=i+Math.imul(m,H)|0,a=a+Math.imul(m,G)|0,n=n+Math.imul(h,X)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(f,X)|0,a=a+Math.imul(f,W)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(x,U),i=Math.imul(x,V),i=i+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(v,H)|0,i=i+Math.imul(v,G)|0,i=i+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,X)|0,i=i+Math.imul(p,W)|0,i=i+Math.imul(m,X)|0,a=a+Math.imul(m,W)|0,n=n+Math.imul(h,J)|0,i=i+Math.imul(h,K)|0,i=i+Math.imul(f,J)|0,a=a+Math.imul(f,K)|0;var bt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=Math.imul(M,V),i=i+Math.imul(k,U)|0,a=Math.imul(k,V),n=n+Math.imul(x,H)|0,i=i+Math.imul(x,G)|0,i=i+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(v,X)|0,i=i+Math.imul(v,W)|0,i=i+Math.imul(y,X)|0,a=a+Math.imul(y,W)|0,n=n+Math.imul(p,J)|0,i=i+Math.imul(p,K)|0,i=i+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(f,$)|0,a=a+Math.imul(f,tt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(T,U),i=Math.imul(T,V),i=i+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(M,H)|0,i=i+Math.imul(M,G)|0,i=i+Math.imul(k,H)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(x,X)|0,i=i+Math.imul(x,W)|0,i=i+Math.imul(_,X)|0,a=a+Math.imul(_,W)|0,n=n+Math.imul(v,J)|0,i=i+Math.imul(v,K)|0,i=i+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(p,$)|0,i=i+Math.imul(p,tt)|0,i=i+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(f,rt)|0,a=a+Math.imul(f,nt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=Math.imul(L,V),i=i+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(T,H)|0,i=i+Math.imul(T,G)|0,i=i+Math.imul(S,H)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(M,X)|0,i=i+Math.imul(M,W)|0,i=i+Math.imul(k,X)|0,a=a+Math.imul(k,W)|0,n=n+Math.imul(x,J)|0,i=i+Math.imul(x,K)|0,i=i+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(v,$)|0,i=i+Math.imul(v,tt)|0,i=i+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(p,rt)|0,i=i+Math.imul(p,nt)|0,i=i+Math.imul(m,rt)|0,a=a+Math.imul(m,nt)|0,n=n+Math.imul(h,at)|0,i=i+Math.imul(h,ot)|0,i=i+Math.imul(f,at)|0,a=a+Math.imul(f,ot)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(I,U),i=Math.imul(I,V),i=i+Math.imul(D,U)|0,a=Math.imul(D,V),n=n+Math.imul(L,H)|0,i=i+Math.imul(L,G)|0,i=i+Math.imul(C,H)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(T,X)|0,i=i+Math.imul(T,W)|0,i=i+Math.imul(S,X)|0,a=a+Math.imul(S,W)|0,n=n+Math.imul(M,J)|0,i=i+Math.imul(M,K)|0,i=i+Math.imul(k,J)|0,a=a+Math.imul(k,K)|0,n=n+Math.imul(x,$)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=i+Math.imul(v,nt)|0,i=i+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(p,at)|0,i=i+Math.imul(p,ot)|0,i=i+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0,n=n+Math.imul(h,lt)|0,i=i+Math.imul(h,ut)|0,i=i+Math.imul(f,lt)|0,a=a+Math.imul(f,ut)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,U),i=Math.imul(O,V),i=i+Math.imul(F,U)|0,a=Math.imul(F,V),n=n+Math.imul(I,H)|0,i=i+Math.imul(I,G)|0,i=i+Math.imul(D,H)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(L,X)|0,i=i+Math.imul(L,W)|0,i=i+Math.imul(C,X)|0,a=a+Math.imul(C,W)|0,n=n+Math.imul(T,J)|0,i=i+Math.imul(T,K)|0,i=i+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(M,$)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(k,$)|0,a=a+Math.imul(k,tt)|0,n=n+Math.imul(x,rt)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(v,at)|0,i=i+Math.imul(v,ot)|0,i=i+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(p,lt)|0,i=i+Math.imul(p,ut)|0,i=i+Math.imul(m,lt)|0,a=a+Math.imul(m,ut)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,ft)|0,i=i+Math.imul(f,ht)|0,a=a+Math.imul(f,ft)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,U),i=Math.imul(j,V),i=i+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(O,H)|0,i=i+Math.imul(O,G)|0,i=i+Math.imul(F,H)|0,a=a+Math.imul(F,G)|0,n=n+Math.imul(I,X)|0,i=i+Math.imul(I,W)|0,i=i+Math.imul(D,X)|0,a=a+Math.imul(D,W)|0,n=n+Math.imul(L,J)|0,i=i+Math.imul(L,K)|0,i=i+Math.imul(C,J)|0,a=a+Math.imul(C,K)|0,n=n+Math.imul(T,$)|0,i=i+Math.imul(T,tt)|0,i=i+Math.imul(S,$)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(M,rt)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(k,rt)|0,a=a+Math.imul(k,nt)|0,n=n+Math.imul(x,at)|0,i=i+Math.imul(x,ot)|0,i=i+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,i=i+Math.imul(v,ut)|0,i=i+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(p,ht)|0,i=i+Math.imul(p,ft)|0,i=i+Math.imul(m,ht)|0,a=a+Math.imul(m,ft)|0,n=n+Math.imul(h,pt)|0,i=i+Math.imul(h,mt)|0,i=i+Math.imul(f,pt)|0,a=a+Math.imul(f,mt)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,H),i=Math.imul(j,G),i=i+Math.imul(N,H)|0,a=Math.imul(N,G),n=n+Math.imul(O,X)|0,i=i+Math.imul(O,W)|0,i=i+Math.imul(F,X)|0,a=a+Math.imul(F,W)|0,n=n+Math.imul(I,J)|0,i=i+Math.imul(I,K)|0,i=i+Math.imul(D,J)|0,a=a+Math.imul(D,K)|0,n=n+Math.imul(L,$)|0,i=i+Math.imul(L,tt)|0,i=i+Math.imul(C,$)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(T,rt)|0,i=i+Math.imul(T,nt)|0,i=i+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(M,at)|0,i=i+Math.imul(M,ot)|0,i=i+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(v,ht)|0,i=i+Math.imul(v,ft)|0,i=i+Math.imul(y,ht)|0,a=a+Math.imul(y,ft)|0,n=n+Math.imul(p,pt)|0,i=i+Math.imul(p,mt)|0,i=i+Math.imul(m,pt)|0,a=a+Math.imul(m,mt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,X),i=Math.imul(j,W),i=i+Math.imul(N,X)|0,a=Math.imul(N,W),n=n+Math.imul(O,J)|0,i=i+Math.imul(O,K)|0,i=i+Math.imul(F,J)|0,a=a+Math.imul(F,K)|0,n=n+Math.imul(I,$)|0,i=i+Math.imul(I,tt)|0,i=i+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,n=n+Math.imul(L,rt)|0,i=i+Math.imul(L,nt)|0,i=i+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(T,at)|0,i=i+Math.imul(T,ot)|0,i=i+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(k,lt)|0,a=a+Math.imul(k,ut)|0,n=n+Math.imul(x,ht)|0,i=i+Math.imul(x,ft)|0,i=i+Math.imul(_,ht)|0,a=a+Math.imul(_,ft)|0,n=n+Math.imul(v,pt)|0,i=i+Math.imul(v,mt)|0,i=i+Math.imul(y,pt)|0,a=a+Math.imul(y,mt)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,J),i=Math.imul(j,K),i=i+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(O,$)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(F,$)|0,a=a+Math.imul(F,tt)|0,n=n+Math.imul(I,rt)|0,i=i+Math.imul(I,nt)|0,i=i+Math.imul(D,rt)|0,a=a+Math.imul(D,nt)|0,n=n+Math.imul(L,at)|0,i=i+Math.imul(L,ot)|0,i=i+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(T,lt)|0,i=i+Math.imul(T,ut)|0,i=i+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(M,ht)|0,i=i+Math.imul(M,ft)|0,i=i+Math.imul(k,ht)|0,a=a+Math.imul(k,ft)|0,n=n+Math.imul(x,pt)|0,i=i+Math.imul(x,mt)|0,i=i+Math.imul(_,pt)|0,a=a+Math.imul(_,mt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,$),i=Math.imul(j,tt),i=i+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(F,rt)|0,a=a+Math.imul(F,nt)|0,n=n+Math.imul(I,at)|0,i=i+Math.imul(I,ot)|0,i=i+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,n=n+Math.imul(L,lt)|0,i=i+Math.imul(L,ut)|0,i=i+Math.imul(C,lt)|0,a=a+Math.imul(C,ut)|0,n=n+Math.imul(T,ht)|0,i=i+Math.imul(T,ft)|0,i=i+Math.imul(S,ht)|0,a=a+Math.imul(S,ft)|0,n=n+Math.imul(M,pt)|0,i=i+Math.imul(M,mt)|0,i=i+Math.imul(k,pt)|0,a=a+Math.imul(k,mt)|0;var Lt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,rt),i=Math.imul(j,nt),i=i+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(O,at)|0,i=i+Math.imul(O,ot)|0,i=i+Math.imul(F,at)|0,a=a+Math.imul(F,ot)|0,n=n+Math.imul(I,lt)|0,i=i+Math.imul(I,ut)|0,i=i+Math.imul(D,lt)|0,a=a+Math.imul(D,ut)|0,n=n+Math.imul(L,ht)|0,i=i+Math.imul(L,ft)|0,i=i+Math.imul(C,ht)|0,a=a+Math.imul(C,ft)|0,n=n+Math.imul(T,pt)|0,i=i+Math.imul(T,mt)|0,i=i+Math.imul(S,pt)|0,a=a+Math.imul(S,mt)|0;var Ct=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,at),i=Math.imul(j,ot),i=i+Math.imul(N,at)|0, +a=Math.imul(N,ot),n=n+Math.imul(O,lt)|0,i=i+Math.imul(O,ut)|0,i=i+Math.imul(F,lt)|0,a=a+Math.imul(F,ut)|0,n=n+Math.imul(I,ht)|0,i=i+Math.imul(I,ft)|0,i=i+Math.imul(D,ht)|0,a=a+Math.imul(D,ft)|0,n=n+Math.imul(L,pt)|0,i=i+Math.imul(L,mt)|0,i=i+Math.imul(C,pt)|0,a=a+Math.imul(C,mt)|0;var zt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(j,lt),i=Math.imul(j,ut),i=i+Math.imul(N,lt)|0,a=Math.imul(N,ut),n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,ft)|0,i=i+Math.imul(F,ht)|0,a=a+Math.imul(F,ft)|0,n=n+Math.imul(I,pt)|0,i=i+Math.imul(I,mt)|0,i=i+Math.imul(D,pt)|0,a=a+Math.imul(D,mt)|0;var It=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,ht),i=Math.imul(j,ft),i=i+Math.imul(N,ht)|0,a=Math.imul(N,ft),n=n+Math.imul(O,pt)|0,i=i+Math.imul(O,mt)|0,i=i+Math.imul(F,pt)|0,a=a+Math.imul(F,mt)|0;var Dt=(u+n|0)+((8191&i)<<13)|0;u=(a+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(j,pt),i=Math.imul(j,mt),i=i+Math.imul(N,pt)|0,a=Math.imul(N,mt);var Pt=(u+n|0)+((8191&i)<<13)|0;return u=(a+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l[0]=gt,l[1]=vt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=kt,l[9]=At,l[10]=Tt,l[11]=St,l[12]=Et,l[13]=Lt,l[14]=Ct,l[15]=zt,l[16]=It,l[17]=Dt,l[18]=Pt,0!==u&&(l[19]=u,r.length++),r};Math.imul||(k=u),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?k(this,t,e):r<63?u(this,t,e):r<1024?c(this,t,e):h(this,t,e)},f.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},f.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=l(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);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)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var h=0|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()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){s=new a(null),s.length=l+1,s.words=new Array(s.length);for(var u=0;u=0;h--){var f=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=f)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e)},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(h)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(u)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,u=1;0==(e.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var c=0,h=1;0==(r.words[0]&h)&&c<26;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var f;return f=0===e.cmpn(1)?i:o,f.cmpn(0)<0&&f.iadd(t),f},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new y(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var A={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},d.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},d.prototype.split=function(t,e){t.iushrn(this.n,0,e)},d.prototype.imulK=function(t){return t.imul(this.k)},i(p,d),p.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},p.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(A[t])return A[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new m;else if("p192"===t)e=new g;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new v}return A[t]=e,e},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new a(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var h=u>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new b(t)},i(b,y),b.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},b.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},b.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},b.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},b.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],67:[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))>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),m=h.mallocInt32(o);o=i(e,s,p,m),o>0&&(f.init(a+o),l=1===s?f.sweepBipartite(s,r,0,a,u,c,0,o,p,m):d(s,r,n,a,u,c,o,p,m),h.free(p),h.free(m))}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":70,"./lib/sweep":74,"typedarray-pool":537}],69:[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="+m+","+b+"="+u+"*"+m+";j<"+g+";++j,"+b+"+="+u+"){var y0="+v+"["+o+"+"+b+"],"+(r?"y1="+v+"["+o+"+"+b+"+"+a+"],":"")+"yi="+y+"[j];";return t?i.push(l,_,":",M):i.push(M,_,":",l),r?i.push("if(y1"+g+"-"+m+"){"),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("");return new Function(s)()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",h="re",f="rb",d="ri",p="rp",m="bs",g="be",v="bb",y="bi",b="bp",x="rv",_="Q",w=[a,o,s,c,h,f,d,m,g,v,y];r.partial=i(!1),r.full=i(!0)},{}],70:[function(t,e,r){"use strict";function n(t,e){var r=8*u.log2(e+1)*(t+1)|0,n=u.nextPow2(A*r);S.length0;){z-=1;var D=z*A,P=S[D],O=S[D+1],F=S[D+2],R=S[D+3],j=S[D+4],N=S[D+5],B=z*T,U=E[B],V=E[B+1],q=1&N,H=!!(16&N),G=l,Y=u,X=m,W=L;if(q&&(G=m,Y=L,X=l,W=u),!(2&N&&(F=_(t,P,O,F,G,Y,V),O>=F)||4&N&&(O=w(t,P,O,F,G,Y,U))>=F)){var Z=F-O,J=j-R;if(H){if(t*Z*(Z+J)=p0)&&!(p1>=hi)",["p0","p1"]),x=m("lo===p0",["p0"]),_=m("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=b?(d=y,p=b):v>=_?(d=g,p=v):(d=x,p=_):b>=_?(d=y,p=b):_>=v?(d=g,p=v):(d=x,p=_);for(var w=f*(c-1),M=f*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"},{}],73:[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,g=m-n,v=m+n,y=d,b=g,x=m,_=v,w=p,M=t+1,k=e-1,A=0;u(y,b,r)&&(A=y,y=b,b=A),u(_,w,r)&&(A=_,_=w,w=A),u(y,x,r)&&(A=y,y=x,x=A),u(b,x,r)&&(A=b,b=x,x=A),u(y,_,r)&&(A=y,y=_,_=A),u(x,_,r)&&(A=x,x=_,_=A),u(b,w,r)&&(A=b,b=w,w=A),u(b,x,r)&&(A=b,b=x,x=A),u(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*b],S=r[2*b+1],E=r[2*_],L=r[2*_+1],C=2*y,z=2*x,I=2*w,D=2*d,P=2*m,O=2*p,F=0;F<2;++F){var R=r[C+F],j=r[z+F],N=r[I+F];r[D+F]=R,r[P+F]=j,r[O+F]=N}o(g,t,r),o(v,e,r);for(var B=M;B<=k;++B)if(c(B,T,S,r))B!==M&&a(B,M,r),++M;else if(!c(B,E,L,r))for(;;){if(c(k,E,L,r)){c(k,T,S,r)?(s(B,M,k,r),++M,--k):(a(B,k,r),--k);break}if(--k>>1;f(x,S);for(var E=0,L=0,M=0;M=d)C=C-d|0,i(g,v,L--,C);else if(C>=0)i(p,m,E--,C);else if(C<=-d){C=-C-d|0;for(var z=0;z>>1;f(x,E);for(var L=0,C=0,z=0,k=0;k>1==x[2*k+3]>>1&&(D=2,k+=1),I<0){for(var P=-(I>>1)-1,O=0;O>1)-1;0===D?i(p,m,L--,P):1===D?i(g,v,C--,P):2===D&&i(y,b,z--,P)}}}function l(t,e,r,n,o,s,l,u,c,h,g,v){var y=0,b=2*t,_=e,w=e+t,M=1,k=1;n?k=d:M=d;for(var A=o;A>>1;f(x,L);for(var C=0,A=0;A=d?(I=!n,T-=d):(I=!!n,T-=1),I)a(p,m,C++,T);else{ +var D=v[T],P=b*T,O=g[P+e+1],F=g[P+e+1+t];t:for(var R=0;R>>1;f(x,M);for(var k=0,y=0;y=d)p[k++]=b-d;else{b-=1;var T=c[b],S=m*b,E=u[S+e+1],L=u[S+e+1+t];t:for(var C=0;C=0;--C)if(p[C]===b){for(var P=C+1;PZ)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=i.prototype,e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?h(t,e,r):"string"==typeof t?u(t,e):f(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}function l(t){return o(t),n(t<0?0:0|d(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|m(t,e),a=n(r),o=a.write(t,e);return o!==r&&(a=a.slice(0,o)),a}function c(t){for(var e=t.length<0?0:0|d(t.length),r=n(e),i=0;i=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|t}function p(t){return+t!=t&&(t=0),i.alloc(+t)}function m(t,e){if(i.isBuffer(t))return t.length;if(G(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 B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function g(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 z(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return L(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,a){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Y(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,a);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function b(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&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}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)>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)>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)>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 E(n)}function E(t){var e=t.length;if(e<=J)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 P(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}function O(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 F(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||O(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,e,r,n,52,8),r+8}function j(t){if(t=t.trim().replace(K,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function N(t){return t<16?"0"+t.toString(16):t.toString(16)}function B(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=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(t){for(var e=[],r=0;r>8,i=r%256,a.push(i),a.push(n);return a}function q(t){return X.toByteArray(j(t))}function H(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function G(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function Y(t){return t!==t}var X=t("base64-js"),W=t("ieee754");r.Buffer=i,r.SlowBuffer=p,r.INSPECT_MAX_BYTES=50;var Z=2147483647;r.kMaxLength=Z,i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return s(t,e,r)},i.allocUnsafe=function(t){return l(t)},i.allocUnsafeSlow=function(t){return l(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},i.prototype.compare=function(t,e,r,n,a){if(!i.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===a&&(a=this.length),e<0||r>t.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&e>=r)return 0;if(n>=a)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),u=this.slice(n,a),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return x(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return M(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var J=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);for(var n=this[t],i=1,a=0;++a=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(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},i.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),W.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),W.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),W.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),W.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){P(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,!n){P(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(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},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);P(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeFloatLE=function(t,e,r){return F(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return F(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return R(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},i.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)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)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;al?l:o+16383));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":82,"robust-in-sphere":502}],79:[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 m=f[3*d+p];m>=0&&0===u[m]&&(h[3*d+p]?l.push(m):(s.push(m),u[m]=i))}}}var g=l;l=s,s=g,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,n.prototype.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,g,h),new i(d,v,m,h))}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=[],h=0,_=l.length;h<_;++h){var w=l[h],M=w.type;M===p?s(x,b,t,w.a,w.idx):M===g?u(b,t,w):c(b,t,w)}return x}var f=t("binary-search-bounds"),d=t("robust-orientation")[3],p=0,m=1,g=2;e.exports=h},{"binary-search-bounds":82,"robust-orientation":504}],81:[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){return new Function([n("A","x"+t+"y",e,["y"],i),n("P","c(x,y)"+t+"0",e,["y","c"],i),"function dispatchBsearch",r,"(a,y,c,l,h){if(typeof(c)==='function'){return P(a,(l===void 0)?0:l|0,(h===void 0)?a.length-1:h|0,y,c)}else{return A(a,(c===void 0)?0:c|0,(l===void 0)?a.length-1:l|0,y)}}return dispatchBsearch",r].join(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],83:[function(t,e,r){"use strict";function n(t){for(var e=1,r=1;rr?r:t:te?e:t}e.exports=n},{}],87:[function(t,e,r){"use strict";function n(t){var e=_(t);return[M(e,-1/0),M(e,1/0)]}function i(t,e){for(var r=new Array(e.length),n=0;n=0;--a){var p=n[a];o=p[0];var m=e[o],g=m[0],v=m[1],y=t[g],M=t[v];if((y[0]-M[0]||y[1]-M[1])<0){var A=g;g=v,v=A}m[0]=g;var T,S=m[1]=p[1];for(i&&(T=m[2]);a>0&&n[a-1][0]===o;){var p=n[--a],E=p[1];i?e.push([S,E,T]):e.push([S,E]),S=E}i?e.push([S,v,T]):e.push([S,v])}return s}function u(t,e,r){for(var i=e.length,a=new g(i),o=[],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 m(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;a>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}var a=t("clamp");e.exports=n,e.exports.to=n,e.exports.from=i},{clamp:86}],91:[function(t,e,r){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],92:[function(t,e,r){"use strict";function n(t){var e,r,n=[],s=1;if("string"==typeof t)if(i[t])n=i[t].slice(),r="rgb";else if("transparent"===t)s=0,r="rgb",n=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var l=t.slice(1),u=l.length,c=u<=4;s=1,c?(n=[parseInt(l[0]+l[0],16),parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16)],4===u&&(s=parseInt(l[3]+l[3],16)/255)):(n=[parseInt(l[0]+l[1],16),parseInt(l[2]+l[3],16),parseInt(l[4]+l[5],16)],8===u&&(s=parseInt(l[6]+l[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),r="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var h=e[1],l=h.replace(/a$/,"");r=l;var u="cmyk"===l?4:"gray"===l?1:3;n=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===u?parseFloat(t)/100:"rgb"===l?255*parseFloat(t)/100:parseFloat(t);if("h"===l[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),h===l&&n.push(1),s=void 0===n[u]?1:n[u],n=n.slice(0,u)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(n=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),r=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(r="rgb",n=[t>>>16,(65280&t)>>>8,255&t]):a(t)?(null!=t.r?(n=[t.r,t.g,t.b],r="rgb"):null!=t.red?(n=[t.red,t.green,t.blue],r="rgb"):null!=t.h?(n=[t.h,t.s,t.l],r="hsl"):null!=t.hue&&(n=[t.hue,t.saturation,t.lightness],r="hsl"),null!=t.a?s=t.a:null!=t.alpha?s=t.alpha:null!=t.opacity&&(s=t.opacity/100)):(Array.isArray(t)||ArrayBuffer.isView(t))&&(n=[t[0],t[1],t[2]],r="rgb",s=4===t.length?t[3]:1);return{space:r,values:n,alpha:s}}e.exports=n;var i=t("color-name"),a=t("is-plain-obj"),o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}},{"color-name":91,"is-plain-obj":293}],93:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){null==e&&(e=!0);var r=n(t);if(!r.space)return[];if(Array.isArray(t))return t;var o,s=r.values,l=s.length;for(o=0;o1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i}},n.hsl=function(t){var e,r,n,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),u=l-s;return l===s?e=0:i===l?e=(a-o)/u:a===l?e=2+(o-i)/u:o===l&&(e=4+(i-a)/u),e=Math.min(60*e,360),e<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?u/(l+s):u/(2-l-s),[e,100*r,100*n]}},{"./rgb":95}],95:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],96:[function(t,e,r){e.exports={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:0,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],97:[function(t,e,r){"use strict";function n(t){var e,r,n,u,c,h,f,d,p,m,g,v,y,b=[],x=[],_=[],w=[];if(o.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",f=t.colormap,f||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!l[f])throw Error(f+" not a supported colorscale");h=s(l[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=s(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(g=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)}),g[0]<0&&(g[0]=0),g[1]<0&&(g[0]=0),g[0]>1&&(g[0]=1),g[1]>1&&(g[0]=1),y=0;y=0&&r[3]<=1||(r[3]=g[0]+(g[1]-g[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);return c===n(t,e,i)?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);return h>0?s>0&&a(t,e,i)>0?1:-1:h<0?s>0||a(t,e,i)>0?1:-1:a(t,e,i)>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":504,"robust-product":505,"robust-sum":509,signum:511,"two-sum":536}],99:[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],m=e[1],g=e[2],v=e[3];return c+h+f+d-(p+m+g+v)||a(c,h,f,d)-a(p,m,g,v,p)||a(c+h,c+f,c+d,h+f,h+d,f+d)-a(p+m,p+g,p+v,m+g,m+v,g+v)||a(c+h+f,c+h+d,c+f+d,h+f+d)-a(p+m+g,p+m+v,p+g+v,m+g+v);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},{}],103:[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":39,"incremental-convex-hull":287}],105:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],106:[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(-1!==i&&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]),m=o(h[2]),g=m<=.5?m*(p+1):m+p-m*p,v=2*m-g;return[n(255*s(v,g,d+1/3)),n(255*s(v,g,d)),n(255*s(v,g,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){}},{}],107:[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},{}],108:[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":110}],109:[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;n0&&l.push("var "+u.join(",")),n=a-1;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;h0&&x.push("var "+_.join(","));for(var h=0;h3&&x.push(o(t.pre,t,c));var T=o(t.body,t,c),S=a(g);S3&&x.push(o(t.post,t,c)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+x.join("\n")+"\n----------");var E=[t.funcName||"unnamed","_cwise_loop_",l[0].join("s"),"m",S,s(c)].join("");return new Function(["function ",E,"(",b.join(","),"){",x.join("\n"),"} return ",E].join(""))()}var u=t("uniq");e.exports=l},{uniq:539}],110:[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--\x3e0;) {"),e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var c=0;c=0?(a>=k?10:a>=A?5:a>=T?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=k?10:a>=A?5:a>=T?2:1)}function i(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=k?i*=10:a>=A?i*=5:a>=T&&(i*=2),ee?1:t>=e?0:NaN},s=function(t){return 1===t.length&&(t=e(t)),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},l=s(o),u=l.right,c=l.left,h=function(t,e){null==e&&(e=r);for(var n=0,i=t.length-1,a=t[0],o=new Array(i<0?0:i);nt?1:e>=t?0:NaN},p=function(t){return null===t?NaN:+t},m=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o1)return l/(a-1)},g=function(t,e){var r=m(t,e);return r?Math.sqrt(r):r},v=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++lf;)d.pop(),--p;var m,g=new Array(p+1);for(a=0;a<=p;++a)m=g[a]=[],m.x0=a>0?d[a-1]:h,m.x1=a=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},z=function(t,e,r){return t=x.call(t,p).sort(o),Math.ceil((r-e)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))},I=function(t,e,r){return Math.ceil((r-e)/(3.5*g(t)*Math.pow(t.length,-1/3)))},D=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},P=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(n=t[i],e=n.length;--e>=0;)r[--o]=n[e];return r},R=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},j=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},N=function(t,e){if(r=t.length){var r,n,i=0,a=0,s=t[a];for(null==e&&(e=o);++i=c.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,u,h,f=-1,d=e.length,p=c[n++],m=r(),g=i();++fc.length)return t;var n,i=h[r-1];return null!=l&&r>=c.length?n=t.entries():(n=[],t.each(function(t,i){n.push({key:i,values:e(t,r)})})),null!=i?n.sort(function(t,e){return i(t.key,e.key)}):n}var s,l,u,c=[],h=[];return u={object:function(e){return t(e,0,n,i)},map:function(e){return t(e,0,a,o)},entries:function(r){return e(t(r,0,a,o),0)},key:function(t){return c.push(t),u},sortKeys:function(t){return h[c.length-1]=t,u},sortValues:function(t){return s=t,u},rollup:function(t){return l=t,u}}},c=r.prototype;s.prototype=l.prototype={constructor:s,has:c.has,add:function(t){return t+="",this["$"+t]=t,this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};var h=function(t){var e=[];for(var r in t)e.push(r);return e},f=function(t){var e=[];for(var r in t)e.push(t[r]);return e},d=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e};t.nest=u,t.set=l,t.map=r,t.keys=h,t.values=f,t.entries=d,Object.defineProperty(t,"__esModule",{value:!0})})},{}],114:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function r(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=z.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=I.exec(t))?i(parseInt(e[1],16)):(e=D.exec(t))?new l(e[1],e[2],e[3],1):(e=P.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=O.exec(t))?a(e[1],e[2],e[3],e[4]):(e=F.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=R.exec(t))?u(e[1],e[2]/100,e[3]/100,1):(e=j.exec(t))?u(e[1],e[2]/100,e[3]/100,e[4]):N.hasOwnProperty(t)?i(N[t]):"transparent"===t?new l(NaN,NaN,NaN,0):null}function i(t){return new l(t>>16&255,t>>8&255,255&t,1)}function a(t,e,r,n){return n<=0&&(t=e=r=NaN),new l(t,e,r,n)}function o(t){return t instanceof r||(t=n(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function s(t,e,r,n){return 1===arguments.length?o(t):new l(t,e,r,null==n?1:n)}function l(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function u(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new f(t,e,r,n)}function c(t){if(t instanceof f)return new f(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new f;if(t instanceof f)return t;t=t.rgb();var e=t.r/255,i=t.g/255,a=t.b/255,o=Math.min(e,i,a),s=Math.max(e,i,a),l=NaN,u=s-o,c=(s+o)/2;return u?(l=e===s?(i-a)/u+6*(i0&&c<1?0:l,new f(l,u,c,t.opacity)}function h(t,e,r,n){return 1===arguments.length?c(t):new f(t,e,r,null==n?1:n)}function f(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function d(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function p(t){if(t instanceof g)return new g(t.l,t.a,t.b,t.opacity);if(t instanceof M){var e=t.h*B;return new g(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var r=x(t.r),n=x(t.g),i=x(t.b),a=v((.4124564*r+.3575761*n+.1804375*i)/V),s=v((.2126729*r+.7151522*n+.072175*i)/q);return new g(116*s-16,500*(a-s),200*(s-v((.0193339*r+.119192*n+.9503041*i)/H)),t.opacity)}function m(t,e,r,n){return 1===arguments.length?p(t):new g(t,e,r,null==n?1:n)}function g(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function v(t){return t>W?Math.pow(t,1/3):t/X+G}function y(t){return t>Y?t*t*t:X*(t-G)}function b(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _(t){if(t instanceof M)return new M(t.h,t.c,t.l,t.opacity);t instanceof g||(t=p(t));var e=Math.atan2(t.b,t.a)*U;return new M(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function w(t,e,r,n){return 1===arguments.length?_(t):new M(t,e,r,null==n?1:n)}function M(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function k(t){if(t instanceof T)return new T(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(rt*n+tt*e-et*r)/(rt+tt-et),a=n-i,s=($*(r-i)-K*a)/Q,u=Math.sqrt(s*s+a*a)/($*i*(1-i)),c=u?Math.atan2(s,a)*U-120:NaN;return new T(c<0?c+360:c,u,i,t.opacity)}function A(t,e,r,n){return 1===arguments.length?k(t):new T(t,e,r,null==n?1:n)}function T(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}var S=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t},E="\\s*([+-]?\\d+)\\s*",L="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",C="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",z=/^#([0-9a-f]{3})$/,I=/^#([0-9a-f]{6})$/,D=new RegExp("^rgb\\("+[E,E,E]+"\\)$"),P=new RegExp("^rgb\\("+[C,C,C]+"\\)$"),O=new RegExp("^rgba\\("+[E,E,E,L]+"\\)$"),F=new RegExp("^rgba\\("+[C,C,C,L]+"\\)$"),R=new RegExp("^hsl\\("+[L,C,C]+"\\)$"),j=new RegExp("^hsla\\("+[L,C,C,L]+"\\)$"),N={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};S(r,n,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),S(l,s,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),S(f,h,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new f(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new f(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new l(d(t>=240?t-240:t+120,i,n),d(t,i,n),d(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var B=Math.PI/180,U=180/Math.PI,V=.95047,q=1,H=1.08883,G=4/29,Y=6/29,X=3*Y*Y,W=Y*Y*Y;S(g,m,e(r,{brighter:function(t){return new g(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new g(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=q*y(t),e=V*y(e),r=H*y(r),new l(b(3.2404542*e-1.5371385*t-.4985314*r),b(-.969266*e+1.8760108*t+.041556*r),b(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),S(M,w,e(r,{brighter:function(t){return new M(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new M(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return p(this).rgb()}}));var Z=-.14861,J=1.78277,K=-.29227,Q=-.90649,$=1.97294,tt=$*Q,et=$*J,rt=J*K-Q*Z;S(T,A,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new T(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new T(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*B,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new l(255*(e+r*(Z*n+J*i)),255*(e+r*(K*n+Q*i)),255*(e+r*($*n)),this.opacity)}})),t.color=n,t.rgb=s,t.hsl=h,t.lab=m,t.hcl=w,t.cubehelix=A,Object.defineProperty(t,"__esModule",{value:!0})})},{}],115:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){for(var t,e=0,n=arguments.length,i={};e=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}function i(t,e){for(var r,n=0,i=t.length;n0)for(var r,n,i=new Array(r),a=0;af+s||np+s||ih.index){var l=f-a.x-a.vx,c=p-a.y-a.vy,v=l*l+c*c;vt.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e1?(null==e?p.remove(t):p.set(t,s(e)),l):p.get(t)},find:function(e,r,n){var i,a,o,s,l,u=0,c=t.length;for(null==n?n=1/0:n*=n,u=0;u1?(y.on(t,e),l):y.on(t)}}},b=function(){function t(t){var r,l=a.length,h=e.quadtree(a,u,c).visitAfter(n);for(s=t,r=0;r=m)){(t.data!==o||t.next)&&(0===i&&(i=d(),c+=i*i),0===a&&(a=d(),c+=a*a),c180||r<-180?r-360*Math.round(r/360):r):S(isNaN(t)?e:t)}function o(t){return 1==(t=+t)?s:function(e,r){return r-e?i(e,r,t):S(isNaN(e)?r:e)}}function s(t,e){var r=e-t;return r?n(t,r):S(isNaN(t)?e:t)}function l(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;n180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:D(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}function s(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:D(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}function l(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:D(t,r)},{i:s-2,x:D(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}return function(e,r){var n=[],i=[];return e=t(e),r=t(r),a(e.translateX,e.translateY,r.translateX,r.translateY,n,i),o(e.rotate,r.rotate,n,i),s(e.skewX,r.skewX,n,i),l(e.scaleX,e.scaleY,r.scaleX,r.scaleY,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=ia&&(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:D(r,n)})),a=F.lastIndex;return a=(a=(m+v)/2))?m=a:v=a,(c=r>=(o=(g+y)/2))?g=o:y=o,i=d,!(d=d[h=c<<1|u]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&r===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(a=(m+v)/2))?m=a:v=a,(c=r>=(o=(g+y)/2))?g=o:y=o}while((h=c<<1|u)==(f=(l>=o)<<1|s>=a));return i[f]=d,i[h]=p,t}function r(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),u=1/0,c=1/0,h=-1/0,f=-1/0;for(n=0;nh&&(h=i),af&&(f=a));for(ht||t>i||n>e||e>a))return this;var o,s,l=i-r,u=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,a=n+l,t>i||e>a);break;case 1:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,a=n+l,r>t||e>a);break;case 2:do{o=new Array(4),o[s]=u,u=o}while(l*=2,i=r+l,n=a-l,t>i||n>e);break;case 3:do{o=new Array(4),o[s]=u,u=o}while(l*=2,r=i-l,n=a-l,r>t||n>e)}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},h=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},f=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},d=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},p=function(t,e,r){var n,i,a,o,s,l,u,c=this._x0,h=this._y0,f=this._x1,p=this._y1,m=[],g=this._root;for(g&&m.push(new d(g,c,h,f,p)),null==r?r=1/0:(c=t-r,h=e-r,f=t+r,p=e+r,r*=r);l=m.pop();)if(!(!(g=l.node)||(i=l.x0)>f||(a=l.y0)>p||(o=l.x1)=y)<<1|t>=v)&&(l=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=l)}else{var b=t-+this._x.call(null,g.data),x=e-+this._y.call(null,g.data),_=b*b+x*x;if(_=(s=(p+g)/2))?p=s:g=s,(c=o>=(l=(m+v)/2))?m=l:v=l,e=d,!(d=d[h=c<<1|u]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[f]=d:this._root=d),this):(this._root=i,this)},g=function(){return this._root},v=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},y=function(t){var e,r,n,i,a,o,s=[],l=this._root;for(l&&s.push(new d(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,n=e.x0,i=e.y0,a=e.x1,o=e.y1)&&l.length){var u=(n+a)/2,c=(i+o)/2;(r=l[3])&&s.push(new d(r,u,c,a,o)),(r=l[2])&&s.push(new d(r,n,c,u,o)),(r=l[1])&&s.push(new d(r,u,i,a,c)),(r=l[0])&&s.push(new d(r,n,i,u,c))}return this},b=function(t){var e,r=[],n=[];for(this._root&&r.push(new d(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var i=e.node;if(i.length){var a,o=e.x0,s=e.y0,l=e.x1,u=e.y1,c=(o+l)/2,h=(s+u)/2;(a=i[0])&&r.push(new d(a,o,s,c,h)),(a=i[1])&&r.push(new d(a,c,s,l,h)),(a=i[2])&&r.push(new d(a,o,h,c,u)),(a=i[3])&&r.push(new d(a,c,h,l,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},x=function(t){return arguments.length?(this._x=t,this):this._x},_=function(t){return arguments.length?(this._y=t,this):this._y},w=o.prototype=s.prototype;w.copy=function(){var t,e,r=new s(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=l(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=l(e));return r},w.add=u,w.addAll=r,w.cover=c,w.data=h,w.extent=f,w.find=p,w.remove=m,w.removeAll=n,w.root=g,w.size=v,w.visit=y,w.visitAfter=b,w.x=x,w.y=_,t.quadtree=o,Object.defineProperty(t,"__esModule",{value:!0})})},{}],119:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?i(n):"function"==typeof t&&t.amd?t(["exports"],i):i(e.d3=e.d3||{})}(this,function(t){"use strict";function e(){return v||(x(r),v=b.now()+y)}function r(){v=0}function n(){this._call=this._time=this._next=null}function i(t,e,r){var i=new n;return i.restart(t,e,r),i}function a(){e(),++f;for(var t,r=c;r;)(t=v-r._time)>=0&&r._call.call(null,t),r=r._next;--f}function o(){v=(g=b.now())+y,f=d=0;try{a()}finally{f=0,l(),v=0}}function s(){var t=b.now(),e=t-g;e>m&&(y-=e,g=t)}function l(){for(var t,e,r=c,n=1/0;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:c=e);h=t,u(n)}function u(t){if(!f){d&&(d=clearTimeout(d));var e=t-v;e>24?(t<1/0&&(d=setTimeout(o,e)),p&&(p=clearInterval(p))):(p||(g=v,p=setInterval(s,m)),f=1,x(o))}}var c,h,f=0,d=0,p=0,m=1e3,g=0,v=0,y=0,b="object"==typeof performance&&performance.now?performance:Date,x="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};n.prototype=i.prototype={constructor:n,restart:function(t,r,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?e():+n)+(null==r?0:+r),this._next||h===this||(h?h._next=this:c=this,h=this),this._call=t,this._time=n,u()},stop:function(){this._call&&(this._call=null,this._time=1/0,u())}};var _=function(t,e,r){var i=new n;return e=null==e?0:+e,i.restart(function(r){i.stop(),t(r+e)},e,r),i},w=function(t,r,i){var a=new n,o=r;return null==r?(a.restart(t,r,i),a):(r=+r,i=null==i?e():+i,a.restart(function e(n){n+=o,a.restart(e,o+=r,i),t(n)},r,i),a)};t.now=e,t.timer=i,t.timerFlush=a,t.timeout=_,t.interval=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],120:[function(e,r,n){!function(){function e(t){return t&&(t.ownerDocument||t.document||t).documentElement}function n(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function i(t,e){return 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,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 m(t){return(t=f(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 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=Mo.length;r=e&&(e=i+1);!(o=s[e])&&++e0&&(t=t.slice(0,s));var u=Do.get(t);return u&&(t=u,l=J),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 J(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==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 Q(t,e){e.changedTouches&&(e=e.changedTouches[0]);var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();if(Fo<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();Fo=!(o.f||o.e),r.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 $(){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,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 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?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 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):At((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=gt(i)*Qo,n=gt(n)*$o,a=gt(a)*ts,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 mt(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 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 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):Mt(""+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 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(St(i[0]),St(i[1]),St(i[2]))}return(a=ns.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 At(t,e,r){t=Tt(t),e=Tt(e),r=Tt(r);var n=vt((.4124564*t+.3575761*e+.1804375*r)/Qo),i=vt((.2126729*t+.7151522*e+.072175*r)/$o);return dt(116*i-16,500*(n-i),200*(i-vt((.0193339*t+.119192*e+.9503041*r)/ts)))}function Tt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function St(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function Et(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),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(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(zt(n))}function zt(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 Dt(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 as?as.n=a:is=a,as=a,os||(ss=clearTimeout(ss),os=1,ls(Pt)),a}function Pt(){var t=Ot(),e=Ft()-t;e>24?(isFinite(e)&&(clearTimeout(ss),ss=setTimeout(Pt,e)),os=0):(os=1,ls(Pt))}function Ot(){for(var t=Date.now(),e=is;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ft(){for(var t,e=is,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)}:x;return function(t){var r=cs.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,m="",g="",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,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,f=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=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=hs.get(d)||Bt;var b=u&&h;return function(t){var r=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,f);t=l.scale(t),r=l.symbol+g}else t*=p;t=d(t,f);var x,_,w=t.lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!u&&h&&(x=a(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),A=k"===o?A+i+t:"^"===o?A.substring(0,k>>=1)+i+t+A.substring(k):i+(b?t:A+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(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=L[o in ms?e.charAt(s++):o])||(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){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=S.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=A.get(n[0].toLowerCase()),r+n[0].length):-1}function s(t,e,n){return r(t,E.c.toString(),e,n)}function l(t,e,n){return r(t,E.x.toString(),e,n)}function u(t,e,n){return r(t,E.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 h=t.dateTime,f=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 r(t){try{ds=Ut;var e=new ds;return e._=t,n(e)}finally{ds=Date}}var n=e(t);return r.parse=function(t){try{ds=Ut;var e=n.parse(t);return e&&e._}finally{ds=Date}},r.toString=n.toString,r},e.multi=e.utc.multi=ce;var b=uo.map(),x=Yt(m),_=Xt(m),w=Yt(g),M=Xt(g),k=Yt(v),A=Xt(v),T=Yt(y),S=Xt(y);p.forEach(function(t,e){b.set(t.toLowerCase(),e)});var E={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(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+fs.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(fs.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Gt(fs.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:Jt,x:l,X:u,y:Qt,Y:Kt,Z:$t,"%":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){gs.lastIndex=0;var n=gs.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function re(t,e,r){gs.lastIndex=0;var n=gs.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function ne(t,e,r){gs.lastIndex=0;var n=gs.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function ie(t,e,r){gs.lastIndex=0;var n=gs.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function ae(t,e,r){gs.lastIndex=0;var n=gs.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function oe(t,e,r){gs.lastIndex=0;var n=gs.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function se(t,e,r){gs.lastIndex=0;var n=gs.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){vs.lastIndex=0;var n=vs.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);Ms.add(Math.atan2(f,h)),n=t,i=l,a=u}var e,r,n,i,a;ks.point=function(o,s){ks.point=t,n=(e=o)*qo,i=Math.cos(s=(r=s)*qo/2+No/4),a=Math.sin(s)},ks.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 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 Me(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((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 De(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(Fe))}var d,p,m,g=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()}},b=Re(),x=e(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,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-Ro:Vo-t[1])-((e=e.x)[0]<0?e[1]-Vo-Ro: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=xo(a-r);xo(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&&(xo(r-i)Ro?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(xo(t[0]-e[0])>Ro){var a=t[0]=0?1:-1,M=w*_,k=M>No,A=p*b;if(Ms.add(Math.atan2(A*w*Math.sin(M),m*x+A*Math.cos(M))),a+=k?_+w*Bo:_,k^f>=r^v>=r){var T=be(ve(h),ve(t));we(T);var S=be(i,T);we(S);var E=(k^_>=0?-1:1)*nt(S[2]);(n>E||n===E&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!g++)break;f=v,p=b,m=x,h=t}}return(a<-Ro||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],m=e(h,f),g=o?m?0:i(h,f):m?i(h+(h<0?No:-No),f):0;if(!r&&(u=l=m)&&t.lineStart(),m!==l&&(d=n(r,p),(ke(r,d)||ke(p,d))&&(p[0]+=Ro,p[1]+=Ro,m=e(p[0],p[1]))),m!==l)c=0,m?(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^m){var v;g&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])))}!m||r&&ke(r,p)||t.point(p[0],p[1]),r=p,l=m,a=g},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=be(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=be(o,s),p=_e(o,h);xe(p,_e(s,f));var m=d,g=ye(p,m),v=ye(m,m),y=g*g-v*(ye(p,p)-1);if(!(y<0)){var b=Math.sqrt(y),x=_e(m,(-g-b)/v);if(xe(x,p),x=Me(x),!r)return x;var _,w=t[0],M=e[0],k=t[1],A=e[1];M0^x[1]<(xo(x[0]-w)No^(w<=x[0]&&x[0]<=M)){var L=_e(m,(-g+b)/v);return xe(L,p),[x,Me(L)]}}}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=xo(a)>Ro;return Oe(e,r,gr(t,6*qo),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,m=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/=m,m<0){if(a0){if(a>d)return;a>f&&(f=a)}if(a=n-u,m||!(a<0)){if(a/=m,m<0){if(a>d)return;a>f&&(f=a)}else if(m>0){if(a0&&(i.a={x:l+f*p,y:u+f*m}),d<1&&(i.b={x:l+d*p,y:u+d*m}),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=g.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,g&&g.push(v=[]),k=!0,M=!1,_=w=NaN}function d(){m&&(p(y,b),x&&M&&S.rejoin(),m.push(S.buffer())),L.point=h,M&&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(g&&v.push([t,e]),k)y=t,b=e,x=r,k=!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}};E(n)?(M||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),A=!1):r&&(s.lineStart(),s.point(t,e),A=!1)}_=t,w=e,M=r}var m,g,v,y,b,x,_,w,M,k,A,T=s,S=Re(),E=He(t,e,r,n),L={point:h,lineStart:f,lineEnd:d,polygonStart:function(){s=S,m=[],g=[],A=!0},polygonEnd:function(){s=T,m=uo.merge(m);var e=l([t,n]),r=A&&e,i=m.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),u(null,null,1,s),s.lineEnd()),i&&Ie(m,a,e,u,s),s.polygonEnd()),m=g=v=null}};return L}}function Ye(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 Xe(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){Bs+=i*t-n*e,n=t,i=e}var e,r,n,i;Gs.point=function(a,o){Gs.point=t,e=n=a,r=i=o},Gs.lineEnd=function(){t(e,r)}}function Ze(t,e){tqs&&(qs=t),eHs&&(Hs=e)}function Je(){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 Qe(t,e){Ss+=t,Es+=e,++Ls}function $e(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);Cs+=o*(e+t)/2,zs+=o*(r+n)/2,Is+=o,Qe(e=t,r=n)}var e,r;Xs.point=function(n,i){Xs.point=t,Qe(e=n,r=i)}}function tr(){Xs.point=Qe}function er(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Cs+=o*(n+t)/2,zs+=o*(i+e)/2,Is+=o,o=i*t-n*e,Ds+=o*(n+t),Ps+=o*(i+e),Os+=3*o,Qe(n=t,i=e)}var e,r,n,i;Xs.point=function(a,o){Xs.point=t,Qe(e=n=a,r=i=o)},Xs.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(){b=NaN,k.point=a,e.lineStart()}function a(r,n){var a=ve([r,n]),o=t(r,n);i(b,x,y,_,w,M,b=o[0],x=o[1],y=r,_=a[0],w=a[1],M=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(h=t,f=e),d=b,p=x,m=_,g=w,v=M,k.point=a}function c(){i(b,x,y,_,w,M,d,p,h,m,g,v,s,e),k.lineEnd=o,o()}var h,f,d,p,m,g,v,y,b,x,_,w,M,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,h,f,d,p,m,g,v){var y=c-e,b=h-r,x=y*y+b*b;if(x>4*a&&g--){var _=s+d,w=l+p,M=u+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=xo(xo(M)-1)a||xo((y*C+b*z)/x-.5)>.3||s*d+l*p+u*m0&&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[0]*Ho,t[1]*Ho]}function n(){s=Ce(o=fr(v,y,b),a);var t=a(m,g);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,m=0,g=0,v=0,y=0,b=0,_=Rs,w=x,M=null,k=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,Rs):qe((M=+t)*qo),i()):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]):x,i()):k},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?(m=t[0]%360*qo,g=t[1]%360*qo,n()):[m*Ho,g*Ho]},e.rotate=function(t){return arguments.length?(v=t[0]%360*qo,y=t[1]%360*qo,b=t.length>2?t[2]%360*qo:0,n()):[v*Ho,y*Ho,b*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?Ce(pr(t),mr(e,r)):pr(t):e||r?mr(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 mr(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 gr(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+Ro&&(e=-Vo+Ro):e>Vo-Ro&&(e=Vo-Ro);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):Sr}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 Dr(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 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 Fr(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=sl.pop()||new Rr;return e.site=t,e}function Nr(t){Zr(t),il.remove(t),sl.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&&xo(r-l.circle.x)Ro)s=s.L;else{if(!((i=a-qr(s,o))>Ro)){n>-Ro?(e=s.P,r=s):i>-Ro?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=jr(t);if(il.insert(e,l),e||r){if(e===r)return Zr(e),r=jr(e.site),il.insert(l,r),l.edge=r.edge=$r(e.site,l.site),Wr(e),void Wr(r);if(!r)return void(l.edge=$r(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,m=p.x-c,g=p.y-h,v=2*(f*g-d*m),y=f*f+d*d,b=m*m+g*g,x={x:(g*y-d*b)/v+c,y:(f*b-m*y)/v+h};en(r.edge,u,p,x),l.edge=$r(u,t,null,x),r.edge=$r(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,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],m=nl,g=m.length;g--;)if((a=m[g])&&a.prepare())for(s=a.edges,l=s.length,o=0;oRo||xo(i-r)>Ro)&&(s.splice(o,0,new rn(tn(a.site,c,xo(n-h)Ro?{x:h,y:xo(e-h)Ro?{x:xo(r-p)Ro?{x:f,y:xo(e-f)Ro?{x:xo(r-d)=-jo)){var d=l*l+u*u,p=c*c+h*h,m=(h*d-u*p)/f,g=(l*p-c*d)/f,h=g+s,v=ll.pop()||new Xr;v.arc=t,v.site=i,v.x=m+o,v.y=h+Math.sqrt(m*m+g*g),v.cy=h,t.circle=v;for(var y=null,b=ol._;b;)if(v.y=s)return;if(f>p){if(a){if(a.y>=u)return}else a={x:g,y:l};r={x:g,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=x,M=r>=_,k=M<<1|w,A=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=hl.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 An(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Tn(t){return t*t}function Sn(t){return t*t*t}function En(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 Cn(t){return 1-Math.cos(t*Vo)}function zn(t){return Math.pow(2,10*(t-1))}function In(t){return 1-Math.sqrt(1-t*t)}function Dn(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 Pn(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 Fn(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 Rn(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:bn(t,e)})):e&&r.push(Hn(r)+"rotate("+e+")")}function Xn(t,e,r,n){t!==e?n.push({i:r.push(Hn(r)+"skewX(",null,")")-2,x:bn(t,e)}):e&&r.push(Hn(r)+"skewX("+e+")")}function Wn(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(Hn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:bn(t[0],e[0])},{i:i-2,x:bn(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(Hn(r)+"scale("+e+")")}function Zn(t,e){var r=[],n=[];return t=uo.transform(t),e=uo.transform(e),Gn(t.translate,e.translate,r,n),Yn(t.rotate,e.rotate,r,n),Xn(t.skew,e.skew,r,n),Wn(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,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 Mi(t){return[uo.min(t),uo.max(t)]}function ki(t,e){return t.value-e.value}function Ai(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 Si(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 Ei(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),Ai(n,a),n._pack_prev=a,Ai(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?Ji:Xi,l=n?Kn:Jn;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 $i(t,e),i()},a.copy=function(){return Ki(t,e,r,n)},i()}function Qi(t,e){return uo.rebind(t,e,"range","rangeRound","interpolate","clamp")}function $i(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=cs.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:Al);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 kl;arguments.length<2?r=kl:"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,h=t[1]+u,f=e[0]+l,d=e[1]+u,p=(c+f)/2,m=(h+d)/2,g=f-c,v=d-h,y=g*g+v*v,b=r-n,x=c*d-f*h,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*_)/y,M=(-x*g-v*_)/y,k=(x*v+g*_)/y,A=(-x*g+v*_)/y,T=w-p,S=M-m,E=k-p,L=A-m;return T*T+S*S>E*E+L*L&&(w=k,M=A),[[w-l,M-u],[w*r/b,M*r/b]]}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=Et(r),p=Et(n);++h1?t.join("L"):t+"Z"}function Ma(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 Aa(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 m.event&&m.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}),m=p[n];m||(l=i.time,u=Dt(a,0,l),m=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(Jl,i);return a==Jl.length?[e.year,ta(t.map(function(t){return t/31536e6}),r)[2]]:a?e[i/Jl[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)},Qi(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,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,r){go.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 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=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=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,f,d=-1,p=o.length,m=a[s++],g=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 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,Ao={}.__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)},So=function(t,e){return e.querySelectorAll(t)},Eo=function(t,e){var r=t.matches||t[w(t,"matchesSelector")];return(Eo=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(To=function(t,e){return Sizzle(t,e)[0]||null},So=Sizzle,Eo=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=C(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),zo.hasOwnProperty(r)?{space:zo[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(x.range().map(function(t){return(t-k.x)/k.k}).map(x.invert)),M&&M.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"}),g=null)}function h(){function t(){s=1,a(uo.mouse(i),f),u(o)}function r(){h.on(I,null).on(D,null),d(s),c(o)}var i=this,o=O.of(i,arguments),s=0,h=uo.select(n(i)).on(I,t).on(D,r),f=e(uo.mouse(i)),d=K(i);Bl.call(i),l(o)}function f(){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 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],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);Bl.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,hs=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))))}}),fs=uo.time={},ds=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(){ps.setUTCDate.apply(this._,arguments)},setDay:function(){ps.setUTCDay.apply(this._,arguments)},setFullYear:function(){ps.setUTCFullYear.apply(this._,arguments)},setHours:function(){ps.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ps.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ps.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ps.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ps.setUTCSeconds.apply(this._,arguments)},setTime:function(){ps.setTime.apply(this._,arguments)}};var ps=Date.prototype;fs.year=Vt(function(t){return t=fs.day(t),t.setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),fs.years=fs.year.range,fs.years.utc=fs.year.utc.range,fs.day=Vt(function(t){var e=new ds(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}),fs.days=fs.day.range,fs.days.utc=fs.day.utc.range,fs.dayOfYear=function(t){var e=fs.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=fs[t]=Vt(function(t){return(t=fs.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=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});fs[t+"s"]=r.range,fs[t+"s"].utc=r.utc.range,fs[t+"OfYear"]=function(t){var r=fs.year(t).getDay();return Math.floor((fs.dayOfYear(t)+(r+e)%7)/7)}}),fs.week=fs.sunday,fs.weeks=fs.sunday.range,fs.weeks.utc=fs.sunday.utc.range,fs.weekOfYear=fs.sundayOfYear;var ms={"-":"",_:" ",0:"0"},gs=/^\s*\d+/,vs=/^%/;uo.locale=function(t){return{numberFormat:Nt(t),timeFormat:Ht(t)}};var ys=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=ys.numberFormat,uo.geo={},he.prototype={s:0,t:0,add:function(t){fe(t,this.t,bs),fe(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 he;uo.geo.stream=function(t,e){t&&xs.hasOwnProperty(t.type)?xs[t.type](t,e):de(t,e)};var xs={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=be(v,n),a=[i[1],-i[0],0],o=be(a,i);we(o),o=Me(o);var l=e-p,u=l>0?1:-1,m=o[0]*Ho*u,g=xo(l)>180;if(g^(u*pd&&(d=y)}else if(m=(m+360)%360-180,g^(u*pd&&(d=r);g?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(){x[0]=c,x[1]=f,_.point=t,v=null}function i(t,r){if(v){var n=t-p;y+=xo(n)>180?n+(n>0?360:-360):n}else m=t,g=r;ks.point(t,r),e(t,r)}function a(){ks.lineStart()}function o(){i(m,g),ks.lineEnd(),xo(y)>Ro&&(c=-(f=180)),x[0]=c,x[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]:tRo?d=90:y<-Ro&&(h=-90),x[0]=c,x[1]=f}};return function(t){d=f=-(c=h=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],f=i[1])}return b=x=null,c===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[c,h],[f,d]]}}(),uo.geo.centroid=function(t){As=Ts=Ss=Es=Ls=Cs=zs=Is=Ds=Ps=Os=0,uo.geo.stream(t,Fs);var e=Ds,r=Ps,n=Os,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+Ro,h+.12*u+Ro],[c-.214*u-Ro,h+.234*u-Ro]]).stream(l).point,i=s.translate([c-.205*u,h+.212*u]).clipExtent([[c-.214*u+Ro,h+.166*u+Ro],[c-.115*u-Ro,h+.234*u-Ro]]).stream(l).point,t},t.scale(1070)};var Ns,Bs,Us,Vs,qs,Hs,Gs={point:M,lineStart:M,lineEnd:M,polygonStart:function(){Bs=0,Gs.lineStart=We},polygonEnd:function(){Gs.lineStart=Gs.lineEnd=Gs.point=M,Ns+=xo(Bs/2)}},Ys={point:Ze,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Xs={point:Qe,lineStart:$e,lineEnd:tr,polygonStart:function(){Xs.lineStart=er},polygonEnd:function(){Xs.point=Qe,Xs.lineStart=$e,Xs.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 Ns=0,uo.geo.stream(t,i(Gs)),Ns},t.centroid=function(t){return Ss=Es=Ls=Cs=zs=Is=Ds=Ps=Os=0,uo.geo.stream(t,i(Xs)),Os?[Ds/Os,Ps/Os]:Is?[Cs/Is,zs/Is]:Ls?[Ss/Ls,Es/Ls]:[NaN,NaN]},t.bounds=function(t){return qs=Hs=-(Us=Vs=1/0),uo.geo.stream(t,i(Ys)),[[Us,Vs],[qs,Hs]]},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 Je: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=gr((e=+n)*qo,i*qo),t):e},t.precision=function(n){return arguments.length?(r=gr(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/g)*g,i,g).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 xo(t%g)>Ro}).map(c)).concat(uo.range(Math.ceil(s/m)*m,o,m).filter(function(t){return xo(t%v)>Ro}).map(h))}var r,n,i,a,o,s,l,u,c,h,f,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:[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?(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=yr(s,o,90),h=br(n,r,y),f=yr(u,l,90),d=br(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||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]*qo,t[1]*qo,e[0]*qo,e[1]*qo)},uo.geo.length=function(t){return Ws=0,uo.geo.stream(t,Zs),Ws};var Ws,Zs={sphere:M,point:M,lineStart:Mr,lineEnd:M,polygonStart:M,polygonEnd:M},Js=kr(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(uo.geo.azimuthalEqualArea=function(){return sr(Js)}).raw=Js;var Ks=kr(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},x);(uo.geo.azimuthalEquidistant=function(){return sr(Ks)}).raw=Ks,(uo.geo.conicConformal=function(){return Ye(Ar)}).raw=Ar,(uo.geo.conicEquidistant=function(){return Ye(Tr)}).raw=Tr;var Qs=kr(function(t){return 1/t},Math.atan);(uo.geo.gnomonic=function(){return sr(Qs)}).raw=Qs,Sr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Vo]},(uo.geo.mercator=function(){return Er(Sr)}).raw=Sr;var $s=kr(function(){return 1},Math.asin);(uo.geo.orthographic=function(){return sr($s)}).raw=$s;var tl=kr(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(uo.geo.stereographic=function(){return sr(tl)}).raw=tl,Lr.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Vo]},(uo.geo.transverseMercator=function(){var t=Er(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=Et(r),a=Et(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]]:[]).point=t[s]}),e}function r(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 n=Cr,i=zr,a=n,o=i,s=ul;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=r.site,o=r.edges.sort(Yr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s=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,m,g,v,y,b=Et(s),x=Et(l);if(null!=e)m=e,g=r,v=n,y=i;else if(v=y=-(m=g=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-m,k=y-g;M>k?y=g+M:v=m+k;var A=pn();if(A.add=function(t){a(A,t,+b(t,++d),+x(t,d),m,g,v,y)},A.visit=function(t){mn(t,A,m,g,v,y)},A.find=function(t){return gn(A,t[0],t[1],m,g,v,y)},d=-1,null==e){for(;++d=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=dl.get(r)||fl,n=pl.get(n)||x,Mn(n(r.apply(null,co.call(arguments,1))))},uo.interpolateHcl=Fn,uo.interpolateHsl=Rn,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: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=Dt(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=Et(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return wi(t,e)}:Et(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,Ei),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,Ei),li(s,function(t){t.r-=h})}return zi(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),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,m=h;si(h,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(h,function(t){t.x=(t.x+g)*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&&(Fi(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&&!Pi(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=Di,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=Di,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,m))<=p?(f.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 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,m,g,v,y,b,x,_,w,M,k,A,T=0,S=0,E=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===Cl?Math.sqrt(t*t+u*u):+a.apply(this,arguments),d||(S*=-1),u&&(S=nt(g/u*Math.sin(v))),t&&(T=nt(g/t*Math.sin(v)))),u){y=u*Math.cos(c+S),b=u*Math.sin(c+S),x=u*Math.cos(h-S),_=u*Math.sin(h-S);var L=Math.abs(h-c-2*S)<=No?0:1;if(S&&ba(y,b,x,_)===d^L){var C=(c+h)/2;y=u*Math.cos(C),b=u*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-T),M=t*Math.sin(h-T),k=t*Math.cos(c+T),A=t*Math.sin(c+T);var z=Math.abs(c-h+2*T)<=No?0:1;if(T&&ba(w,M,k,A)===1-d^z){var I=(c+h)/2;w=t*Math.cos(I),M=t*Math.sin(I),k=A=null}}else w=M=0;if(f>Ro&&(p=Math.min(Math.abs(u-t)/2,+i.apply(this,arguments)))>.001){m=tNo)+",1 "+e}function i(t,e,r,n){return"Q 0,0 "+n}var a=xr,o=_r,s=Ha,l=ga,u=va;return t.radius=function(e){return arguments.length?(s=Et(e),t):s},t.source=function(e){return arguments.length?(a=Et(e),t):a},t.target=function(e){return arguments.length?(o=Et(e),t):o},t.startAngle=function(e){return arguments.length?(l=Et(e),t):l},t.endAngle=function(e){return arguments.length?(u=Et(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=Et(r),t):e},t.target=function(e){return arguments.length?(r=Et(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(Ya(e=t)):e},t},uo.svg.symbol=function(){function t(t,n){return(Ol.get(e.call(this,t,n))||Za)(r.call(this,t,n))}var e=Wa,r=Xa;return t.type=function(r){return arguments.length?(e=Et(r),t):e},t.size=function(e){return arguments.length?(r=Et(e),t):r},t};var Ol=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*Rl)),r=e*Rl;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=Ol.keys();var Fl=Math.sqrt(3),Rl=Math.tan(30*qo);Lo.transition=function(t){for(var e,r,n=jl||++Vl,i=to(t),a=[],o=Nl||{time:Date.now(),ease:En,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||(b=null,z[0]-=h[1],z[1]-=f[1],L=2),T())}function m(){32==uo.event.keyCode&&2==L&&(z[0]+=h[1],z[1]+=f[1],L=0,T())}function g(){var t=uo.mouse(_),n=!1;x&&(t[0]+=x[0],t[1]+=x[1]),L||(uo.event.altKey?(b||(b=[(h[0]+h[1])/2,(f[0]+f[1])/2]),z[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){return(e.exports.hi(t)<<1>>>21)-1023},e.exports.fraction=function(t){var r=e.exports.lo(t),n=e.exports.hi(t),i=1048575&n;return 2146435072&n&&(i+=1<<20),[r,i]},e.exports.denormalized=function(t){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:75}],123:[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},{}],124:[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,m,g;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),m>d&&(d=m);g=Math.max(f-u,d-c)}return o(s,l,r,u,c,g),l}function i(t,e,r,n,i){var a,o;if(i===z(t,e,r,n)>0)for(a=e;a=e;a-=n)o=E(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.next)return null;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&m(t,n,i,h);for(var d,p,g=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,g=p.next;else if((t=p)===g){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(b(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&&b(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&&b(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)&&A(i,a)&&A(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&&x(l,u)){var c=S(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&&b(ar.x)&&A(n,t)&&(r=n,f=l),n=n.next;return r}function m(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,g(i)}function g(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 x(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!k(t,e)&&A(t,e)&&A(e,t)&&T(t,e)}function _(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function 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 k(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 A(t,e){return _(t.prev,t,t.next)<0?_(t,e,t.next)>=0&&_(t,t.prev,e)>=0:_(t,e,t.prev)<0||_(t,t.next,e)<0}function T(t,e){var r=t,n=!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 S(t,e){var r=new C(t.i,t.x,t.y),n=new C(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 E(t,e,r,n){var i=new C(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 C(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 z(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}},{}],125:[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){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],128:[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},{}],129:[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(0===(t=+t)&&n(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],130:[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];return t.length<=1?"any"===e?"false":"true":"("+("=="===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")+")"}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"]},{}],131:[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=(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":64,"cubic-hermite":107}],132:[function(t,e,r){"use strict";function n(t){t=t||{};var e,r,n=t.canvas||document.createElement("canvas"),o=t.family||"sans-serif",s=t.shape||[512,512],l=t.step||[32,32],u=parseFloat(t.size)||16,c=t.chars||[32,126],h=Math.floor((l[0]-u)/2),f=t.radius||1.5*h,d=new a(u,h,f,0,o),p=null==t.align?"optical":t.align,m=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(c)){if(2===c.length&&"number"==typeof c[0]&&"number"==typeof c[1]){var g=[];for(e=c[0],r=0;e<=c[1];e++)g[r++]=String.fromCharCode(e);c=g}}else c=String(c).split("");s=s.slice(),n.width=s[0],n.height=s[1];var v=n.getContext("2d");v.fillStyle="#000",v.fillRect(0,0,n.width,n.height),v.textBaseline="middle";var y=l[0],b=l[1],x=0,_=0,w=u/b,M=Math.min(c.length,Math.floor(s[0]/y)*Math.ceil(s[1]/b)),k=d.ctx.textAlign,A=d.buffer,T=d.middle;for(d.ctx.textAlign="center",d.buffer=d.size/2,e=0;es[0]-l[0]&&(x=0,_+=l[1])}return d.ctx.textAlign=k,d.buffer=A,d.middle=T,n}function i(t,e,r){if(s[e]&&s[e][t])return s[e][t];var n=200*r,i=o(t,{size:200,fontSize:n,fontFamily:e});s[e]||(s[e]={});var a={center:[i.center[0]/200,i.center[1]/200],bounds:i.bounds.map(function(t){return t/200}),radius:i.radius/200};return s[e][t]=a,a}var a=t("tiny-sdf"),o=t("optical-properties");e.exports=n;var s={}},{"optical-properties":467,"tiny-sdf":529}],133:[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||(e.right?l(t,e.right):void 0)}function u(t,e,r,n){if(e(t,n.key)<=0){if(n.left){var i=u(t,e,r,n.left);if(i)return i}var i=r(n.key,n.value);if(i)return i}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===g){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===g){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===g)return r._color=v,void(r.right=a(g,n));r.right=a(g,n);continue}if(n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=g,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===g){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===g)return r._color=v,void(r.left=a(g,n));r.left=a(g,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=g,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 m(t){return new s(t||p,null)}e.exports=m;var g=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(g,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!==g){if(d._color=g,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 m=l[h-3];m.left===d?m.left=f:m.right=f}break}f._color=v,d.right=a(v,p),d._color=g,h-=1}else{var p=d.right;if(!p||p._color!==g){if(f.right=i.left,d._color=g,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 m=l[h-3];m.left===d?m.left=i:m.right=i}break}f._color=v,d.right=a(v,p),d._color=g,h-=1}else if(f.right===i){var p=d.left;if(!p||p._color!==g){if(d._color=g,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 m=l[h-3];m.right===d?m.right=f:m.left=f}break}f._color=v,d.left=a(v,p),d._color=g,h-=1}else{var p=d.left;if(!p||p._color!==g){if(f.left=i.right,d._color=g,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 m=l[h-3];m.right===d?m.right=i:m.left=i}break}f._color=v,d.left=a(v,p),d._color=g,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 b=h.prototype;Object.defineProperty(b,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(b,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),b.clone=function(){return new h(this.tree,this._stack.slice())},b.remove=function(){var t=this._stack;if(0===t.length)return this.tree;var e=new Array(t.length),r=t[t.length-1];e[e.length-1]=new n(r._color,r.key,r.value,r.left,r.right,r._count);for(var i=t.length-2;i>=0;--i){var r=t[i];r.left===t[i+1]?e[i]=new n(r._color,r.key,r.value,e[i+1],r.right,r._count):e[i]=new n(r._color,r.key,r.value,r.left,e[i+1],r._count)}if(r=e[e.length-1],r.left&&r.right){var 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===g){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}})},{}],134:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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=i[0],a=1;a<9;a++)r+=i[a]/(e+a);var o=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,e+.5)*Math.exp(-o)*r},e.exports.log=n},{}],135:[function(t,e,r){function n(t){if("Polygon"===t.type)return i(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r0){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":135}],137:[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(m);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?(x.push(i(u,p,e),i(u,p,r)),a||(x=o(s,x,g,v,y))):d>=e&&x.push(i(u,p,e)):f>r?dr&&(x.push(i(u,p,r)),a||(x=o(s,x,g,v,y))));u=m[b-1],f=u[n],f>=e&&f<=r&&x.push(u),h=x[x.length-1],a&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),o(s,x,g,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":139}],138:[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"),b=this.tiles[y]=p(t,v,r,n,x,e===d.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,i){if(e===d.maxZoom||e===i)continue;var w=1<1&&console.time("clipping");var M,k,A,T,S,E,L=.5*d.buffer/d.extent,C=.5-L,z=.5+L,I=1+L;M=k=A=T=null,S=f(t,v,r-L,r+z,0,o,b.min[0],b.max[0]),E=f(t,v,r+C,r+I,0,o,b.min[0],b.max[0]),S&&(M=f(S,v,n-L,n+z,1,s,b.min[1],b.max[1]),k=f(S,v,n+C,n+I,1,s,b.min[1],b.max[1])),E&&(A=f(E,v,n-L,n+z,1,s,b.min[1],b.max[1]),T=f(E,v,n+C,n+I,1,s,b.min[1],b.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(h.push(M||[],e+1,2*r,2*n),h.push(k||[],e+1,2*r,2*n+1),h.push(A||[],e+1,2*r+1,2*n),h.push(T||[],e+1,2*r+1,2*n+1))}else i&&(g=e)}return g},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 m=this.splitTile(c.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var g=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},{}],142:[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){o(t)<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 m=a("labels");a("labelFont")&&(m=!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&&(m||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 m=[new a,new a,new a],g=[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],b=[0,0,0],x=[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,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=u[k],this.lastCubeProps.axis[k]=c[k];for(var A=m,k=0;k<3;++k)o(m[k],k,this.bounds,u,c);for(var e=this.gl,T=g,k=0;k<3;++k)this.backgroundEnable[k]?T[k]=c[k]:T[k]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(var k=0;k<3;++k){var S=[0,0,0];c[k]>0?S[k]=s[1][k]:S[k]=s[0][k];for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.gridEnable[L]&&this._lines.drawGrid(L,C,this.bounds,S,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(L,C,this.bounds,S,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(var k=0;k<3;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);for(var z=n(y,A[k].primalMinor),I=n(b,A[k].mirrorMinor),D=this.lineTickLength,E=0;E<3;++E){var P=M/r[5*E];z[E]*=D[E]*P,I[E]*=D[E]*P}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,z,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(var k=0;k<3;++k){for(var O=A[k].primalMinor,F=n(x,A[k].primalOffset),E=0;E<3;++E)this.lineTickEnable[k]&&(F[E]+=M*O[E]*Math.max(this.lineTickLength[E],0)/r[5*E]);if(this.tickEnable[k]){for(var E=0;E<3;++E)F[E]+=M*O[E]*this.tickPad[E]/r[5*E];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],F,this.tickColor[k])}if(this.labelEnable[k]){for(var E=0;E<3;++E)F[E]+=M*O[E]*this.labelPad[E]/r[5*E];F[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],F,this.labelColor[k])}}},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":147,"./lib/cube.js":148,"./lib/lines.js":149,"./lib/text.js":151,"./lib/ticks.js":152}],147:[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 m=-1;m<=1;m+=2)h[c]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),i+=1}var g=u;u=c,c=g}var v=a(t,new Float32Array(e)),y=a(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=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),x=s(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,v,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":150,"gl-buffer":154,"gl-vao":269}],148:[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;eS&&(_|=1<S&&(_|=1<f[m][1]&&(O=m));for(var F=-1,m=0;m<3;++m){var R=O^1<f[j][0]&&(j=R)}}var N=g;N[0]=N[1]=N[2]=0,N[o.log2(F^O)]=O&F,N[o.log2(O^j)]=O&j;var B=7^j;B===_||B===P?(B=7^F,N[o.log2(j^B)]=B&j):N[o.log2(F^B)]=B&F;for(var U=v,V=_,k=0;k<3;++k)U[k]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":253}],151:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n){this.gl=t,this.shader=e,this.buffer=r,this.vao=n,this.tickOffset=this.tickCount=this.labelOffset=this.labelCount=null}function i(t,e){try{return l(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}function a(t,e,r,i,a,l){var c=o(t),h=s(t,[{buffer:c,size:3}]),f=u(t);f.attributes.position.location=0;var d=new n(t,f,c,h);return d.update(e,r,i,a,l),d}e.exports=a;var o=t("gl-buffer"),s=t("gl-vao"),l=t("vectorize-text"),u=t("./shaders").text,c=window||r.global||{},h=c.__TEXT_CACHE||{};c.__TEXT_CACHE={};var f=n.prototype,d=[0,0];f.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=d},f.update=function(t,e,r,n,a){function o(t,e,r,n){var a=h[r];a||(a=h[r]={});var o=a[e];o||(o=a[e]=i(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=o.positions,c=o.cells,f=0,d=c.length;f=0;--m){var g=u[p[m]];s.push(l*g[0],-l*g[1],t)}}for(var s=(this.gl,[]),l=[0,0,0],u=[0,0,0],c=[0,0,0],f=[0,0,0],d=0;d<3;++d){c[d]=s.length/3|0,o(.5*(t[0][d]+t[1][d]),e[d],r),f[d]=(s.length/3|0)-c[d],l[d]=s.length/3|0;for(var p=0;p=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&&void 0!==t.shape){var r=t.dtype;if(h.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"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 n=l.malloc(t.size,r),s=c(n,t.shape);u.assign(s,t),this.length=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),l.free(n)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,f,e):i(this.gl,this.type,this.length,this.usage,f.subarray(0,t.length),e),l.free(f)}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:463,"ndarray-ops":457,"typedarray-pool":537}],155:[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"}},{}],156:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":155}],157:[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],m=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1],y=2*p/g,b=2*m/v,x=(s[0]-h[0]-.5*g)/p,_=(s[1]-h[1]-.5*v)/m;t[0]=y,t[1]=b,e[0]=y-t[0],e[1]=b-t[1],r[0]=x,r[1]=_,n[0]=x-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*=_),S<0?S*=w:S>0&&(S*=M),g[b++]=f*(r-p+T),g[b++]=d*(n-m+S),g[b++]=o*A[2]+(l+o)*A[4],g[b++]=o*A[3]+(l+o)*A[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,this.lineCount[h]&&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 m=h.slice();m[u]+=d[1][u],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,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":161,"gl-buffer":154,"gl-vao":269}],160:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&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 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 g=0;gs||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))<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,m,g,v,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 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}}),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*d&255;this.pickOffset=r,i.bind();var p=i.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),h.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]]}},h.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,h=this.bounds,d=h[0]=r[0],p=h[1]=n[0],m=h[2]=r[r.length-1],g=h[3]=n[n.length-1],v=1/(m-d),y=1/(g-p),b=e[0],x=e[1];this.shape=[b,x];var _=(b-1)*(x-1)*(f.length>>>1);this.numVertices=_;for(var w=s.mallocUint8(4*_),M=s.mallocFloat32(2*_),k=s.mallocUint8(2*_),A=s.mallocUint32(_),T=0,S=0;S2&&!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)}}}}(),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 m=t.positions;this.data=m;var g=this.bounds;g[0]=g[1]=1/0,g[2]=g[3]=-1/0;var v=this.numPoints=m.length>>>1;if(0!==v){for(e=0;e1;){var A=--n;a=m[2*n],o=m[2*n+1];var T=A-1,S=m[2*T],E=m[2*T+1];if(!(isNaN(a)||isNaN(o)||isNaN(S)||isNaN(E))){k+=1,a=(a-g[0])/(g[2]-g[0]),o=(o-g[1])/(g[3]-g[1]),S=(S-g[0])/(g[2]-g[0]),E=(E-g[1])/(g[3]-g[1]);var L=S-a,C=E-o,z=A|1<<24,I=A-1,D=A,P=A-1|1<<24;y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=C,y[--w]=L,y[--w]=E,y[--w]=S,_[--M]=D,_[--M]=P,y[--w]=-C,y[--w]=-L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I,y[--w]=C,y[--w]=L,y[--w]=o,y[--w]=a,_[--M]=z,_[--M]=I}}for(e=0;e FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",null,a)}},{"gl-shader":253}],170:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function i(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++r)e[0][r]=Math.max(t[0][r],e[0][r]),e[1][r]=Math.min(t[1][r],e[1][r]);return e}function a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}function s(t){var e=t.gl||t.scene&&t.scene.gl,r=m(e);r.attributes.position.location=0,r.attributes.nextPosition.location=1,r.attributes.arcLength.location=2,r.attributes.lineWidth.location=3,r.attributes.color.location=4;var n=g(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]),h=0;h<1024;++h)s.data[h]=255;var f=c(e,s);f.wrap=e.REPEAT;var p=new o(e,r,n,i,a,f);return p.update(t),p}e.exports=s;var l=t("gl-buffer"),u=t("gl-vao"),c=t("gl-texture2d"),h=t("glsl-read-float"),f=t("binary-search-bounds"),d=t("ndarray"),p=t("./lib/shaders"),m=p.createShader,g=p.createPickShader,v=[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||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,m=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],g=!1;t:for(e=1;e0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,g=!0}continue t}m[0][r]=Math.min(m[0][r],v[r],y[r]),m[1][r]=Math.max(m[1][r],v[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 M=h;if(h+=n(v,y),g){for(r=0;r<2;++r)l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,g=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[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=m,this.vertexCount=p,this.points=c,this.arcLength=u,"dashes"in t){var k=t.dashes,A=k.slice();for(A.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,m=a*c,g=o*c,v=s*l,y=s*u,b=s*c,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+g))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+g))*_,t[6]=(m+v)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-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,m=o*c,g=o*h,v=s*h,y=l*u,b=l*c,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],A=i[1],T=i[2];return t[0]=(1-(m+v))*_,t[1]=(d+x)*_,t[2]=(p-b)*_,t[3]=0,t[4]=(d-x)*w,t[5]=(1-(f+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(g-y)*M,t[10]=(1-(f+m))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*A+t[8]*T),t[13]=r[1]+A-(t[1]*k+t[5]*A+t[9]*T),t[14]=r[2]+T-(t[2]*k+t[6]*A+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,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[1]=c+v,t[2]=f-g,t[3]=0,t[4]=c-v,t[5]=1-u-p,t[6]=d+m,t[7]=0,t[8]=f+g,t[9]=d-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,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,m,g=e[0],v=e[1],y=e[2],b=a[0],x=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(g-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],m=r[2],g=r[3];return a=u*d+c*p+h*m+f*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-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*m,t[3]=s*f+l*g,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":192,"./mat3.js":195,"./vec3.js":199,"./vec4.js":200}],198:[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":192}],200:[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;g+=m[c]}return Math.abs(g-1)>.001?null:[h,o(t,m),m]}var l=t("barycentric"),u=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=s},{barycentric:47,"polytope-closest-point/lib/closest_point_2d.js":482}],202:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}";r.meshShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"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}",fragment:"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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"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}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"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}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],203:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p,m,g,v,y,b,x,_,w,M,k,A,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=g,this.edgeUVs=v,this.edgeIds=m,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=M,this.pointIds=x,this.pointVAO=k,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=T,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=D,this._view=D,this._projection=D,this._resolution=[1,1]}function i(t){for(var e=w({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 _(r,[256,256,4],[4,0,1])}function a(t,e,r){for(var n=new Array(e),i=0;i=1},P.isTransparent=function(){return this.opacity<1},P.pickSlots=1,P.setPickBase=function(t){this.pickId=t},P.highlight=function(t){if(!t||!this.contourEnable)return void(this.contourCount=0);for(var e=M(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=k.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()}},P.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||D,n=t.view||D,i=t.projection||D,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()}},P.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[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n],a.uniforms.angle=v[n],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n]&&M&&(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,M)),e[1^n]=T*c[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*m[n+2],ks[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n+2],a.uniforms.angle=v[n+2],u.drawArrays(u.TRIANGLES,s[k],s[A]-s[k]))),y[n+2]&&M&&(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,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],m=l[u],g=l[u+2],v=g-m,y=s[u],b=s[u+2],x=b-y;e[u]=2*f/p*v/x,t[u]=2*(c-d)/p*v/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)],h=[-1/0],f=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;w[b]=S}var E=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,E))},e.exports=a},{"./lib/GLError":211,"./lib/create-attributes":212,"./lib/create-uniforms":213,"./lib/reflect":214,"./lib/runtime-reflect":215,"./lib/shader-cache":216}],211:[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},{}],212:[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":211}],213:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(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;parseInt(n)+""===n?a+="["+n+"]":a+="."+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 m=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(m,e[1],m,e[3],d[p],f[p]):o.drawLine(e[0],m,e[2],m,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(!w&&G.autoResize){var t=M.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*G.pixelRatio),i=0|Math.ceil(r*G.pixelRatio);if(n!==M.width||i!==M.height){M.width=n,M.height=i;var a=M.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",N=!0}}}function r(){for(var t=O.length,e=j.length,r=0;r0&&0===R[e-1];)R.pop(),j.pop().dispose()}function s(){if(G.contextLost)return!0;A.isContextLost()&&(G.contextLost=!0,G.mouseListener.enabled=!1,G.selection.object=null,G.oncontextloss&&G.oncontextloss())}function b(){if(!s()){A.colorMask(!0,!0,!0,!0),A.depthMask(!0),A.disable(A.BLEND),A.enable(A.DEPTH_TEST);for(var t=O.length,e=j.length,r=0;rS.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":220,"gl-buffer":154,"gl-shader":221,"typedarray-pool":537}],229:[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],m=r[2],g=r[3];return a=u*d+c*p+h*m+f*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-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*m,t[3]=s*f+l*g,t}e.exports=n},{}],230:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],231:[function(t,e,r){arguments[4][82][0].apply(r,arguments)},{dup:82}],232:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{"./lib/GLError":233,"./lib/create-attributes":234,"./lib/create-uniforms":235,"./lib/reflect":236,"./lib/runtime-reflect":237,"./lib/shader-cache":238,dup:210}],233:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],234:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{"./GLError":233,dup:212}],235:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":233,"./reflect":236,dup:213}],236:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],237:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{dup:215}],238:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":233,dup:216,"gl-format-compiler-error":163,"weakmap-shim":558}],239:[function(t,e,r){"use strict";function n(t,e,r,n,a){a<=4*f?i(0,a-1,t,e,r,n):h(0,a-1,t,e,r,n)}function i(t,e,r,n,i,a){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],u=n[2*o+1],c=i[o],h=a[o],f=o;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],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 m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,b=y-m,x=y+m,_=g,w=b,M=y,k=x,A=v,T=t+1,S=e-1,E=0;u(_,w,r,n,d,p)&&(E=_,_=w,w=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E),u(_,M,r,n,d,p)&&(E=_,_=M,M=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(_,k,r,n,d,p)&&(E=_,_=k,k=E),u(M,k,r,n,d,p)&&(E=M,M=k,k=E),u(w,A,r,n,d,p)&&(E=w,w=A,A=E),u(w,M,r,n,d,p)&&(E=w,w=M,M=E),u(k,A,r,n,d,p)&&(E=k,k=A,A=E);var L=r[w],C=n[2*w],z=n[2*w+1],I=d[w],D=p[w],P=r[k],O=n[2*k],F=n[2*k+1],R=d[k],j=p[k],N=_,B=M,U=A,V=g,q=y,H=v,G=r[N],Y=r[B],X=r[U];r[V]=G,r[q]=Y,r[H]=X;for(var W=0;W<2;++W){var Z=n[2*N+W],J=n[2*B+W],K=n[2*U+W];n[2*V+W]=Z,n[2*q+W]=J,n[2*H+W]=K}var Q=d[N],$=d[B],tt=d[U];d[V]=Q,d[q]=$,d[H]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,o(b,t,r,n,d,p),o(x,e,r,n,d,p);for(var it=T;it<=S;++it)if(c(it,L,C,z,I,r,n,d))it!==T&&a(it,T,r,n,d,p),++T;else if(!c(it,P,O,F,R,r,n,d))for(;;){if(c(S,P,O,F,R,r,n,d)){c(S,L,C,z,I,r,n,d)?(s(it,T,S,r,n,d,p),++T,--S):(a(it,S,r,n,d,p),--S);break}if(--S=Math.max(.9*d,32)){var b=u+s>>>1;l(g,v,h,f,b,c+1),f=b}l(g,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 A=x[_];A!==M&&(w.push(new i(b*Math.pow(.5,A),_+1,k-(_+1))),k=_+1,M=A)}return w.push(new i(b*Math.pow(.5,A+1),0,k)),o.free(x),w}var o=t("typedarray-pool"),s=t("./lib/sort");e.exports=a},{"./lib/sort":239,"typedarray-pool":537}],241:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=m(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=m(this.plot.gl,[256,1])}function i(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,i=r[2]-r[0],a=r[3]-r[1],u=2/i,c=2/a,h=-r[0]-.5*i,f=-r[1]-.5*a;_[0]=u,w[0]=u-_[0],_[1]=c,w[1]=c-_[1],M[0]=h,k[0]=h-M[0],M[1]=f,k[1]=f-M[1];var d=e[2]-e[0],p=e[3]-e[1];o=Math.min(i/d,a/p),A[0]=2*n/d,A[1]=2*n/p,s=r[0],l=r[2]}function a(t,e){var r=t.gl,i=u(r,f.vertex,f.fragment),a=u(r,f.pickVertex,f.pickFragment),o=c(r),s=c(r),l=c(r),h=c(r),d=c(r),p=new n(t,i,a,o,s,l,h,d);return p.update(e),t.addObject(p),p}e.exports=a;var o,s,l,u=t("gl-shader"),c=t("gl-buffer"),h=t("typedarray-pool"),f=t("./lib/shaders"),d=t("snap-points-2d"),p=t("font-atlas-sdf"),m=t("gl-texture2d"),g=t("color-id"),v=t("ndarray"),y=t("clamp"),b=t("binary-search-bounds"),x=n.prototype,_=new Float32Array([0,0]),w=new Float32Array([0,0]),M=new Float32Array([0,0]),k=new Float32Array([0,0]),A=[0,0],T=[0,0,0,0];x.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,a=n>this.snapThreshold;if(!n)return t;i.call(this);var u=r.gl,c=e?this.pickShader:this.shader,h=u.isEnabled(u.BLEND);if(c.bind(),e){this.pickOffset=t;for(var f=0;f<4;++f)T[f]=t>>8*f&255;c.uniforms.pickOffset=T,this.idBuffer.bind(),c.attributes.id.pointer(u.UNSIGNED_BYTE,!1)}else u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA),u.blendColor(0,0,0,1),h||u.enable(u.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(u.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(u.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(u.FLOAT,!1,8,0),e||c.attributes.border.pointer(u.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(u.FLOAT,!1,16,0),c.attributes.positionLo.pointer(u.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=_,c.uniforms.scaleLo=w,c.uniforms.translateHi=M,c.uniforms.translateLo=k,c.uniforms.viewBox=r.viewBox;var d=this.scales;if(a)for(var p=d.length-1;p>=0;p--){var m=d[p];if(!(m.pixelSize&&m.pixelSize<1.25*o&&p>1)){var g=m.offset,v=m.count+g,y=b.ge(this.xCoords,s,g,v-1),x=b.lt(this.xCoords,l,y,v-1)+1;x>y&&u.drawArrays(u.POINTS,y,x-y)}}else u.drawArrays(u.POINTS,0,n);if(e)return t+n;h?u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA):u.disable(u.BLEND)},x.draw=x.drawPick,x.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]]}},x.update=function(t){t=t||{};var e=t.positions||[],r=t.colors||[],n=t.glyphs||[],i=t.sizes||[],a=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,l=this.points.length/2,u=l>this.snapThreshold;var c=h.mallocFloat32(2*l),f=h.mallocFloat64(2*l),m=h.mallocUint32(l),b=h.mallocFloat32(4*l);f.set(this.points),u&&(this.i2idx&&h.free(this.i2idx),this.i2idx=h.mallocInt32(l),this.scales=d(f,this.i2idx,c)),this.pointCount=l;for(var x=0;xR&&(R=i[x]);var j=this.charStep;this.charStep=y(Math.ceil(4*R),128,768);var N=Object.keys(O),B=this.charStep,U=Math.floor(B/2),V=s.getParameter(s.MAX_TEXTURE_SIZE),q=V/B*(V/B),H=Math.min(V,B*N.length),G=Math.min(V,B*Math.ceil(B*N.length/V)),Y=Math.floor(H/B);N.length>q&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==N+""&&this.charStep==j||(this.charCanvas=p({canvas:this.charCanvas,family:"sans-serif",size:U,shape:[H,G],step:[B,B],chars:N,align:!0,fit:this.charFit}),this.chars=N);for(var x=0;x>>1,n=u.mallocInt32(r),i=u.mallocFloat32(r),a=u.mallocFloat64(2*r);if(a.set(this.points),this.snapPoints)this.scales=l(a,n,i,this.bounds);else{this.bounds=f(a,2),h(a,2,this.bounds);for(var o=0;o>8&255,y[2]=t>>16&255,y[3]=t>>24&255,n.uniforms.pickOffset=y,s.bind(),n.attributes.pickId.pointer(h.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var z=!0;if(this.snapPoints)for(var I=i.length-1;I>=0;I--){var D=i[I];if(!(D.pixelSize1)){var P=this.getVisibleRange(D),O=P[0],F=P[1];F>O&&h.drawArrays(h.POINTS,O,F-O),!e&&z&&(z=!1,n.uniforms.useWeight=0)}}else h.drawArrays(h.POINTS,0,this.pointCount);return t+this.pointCount},d.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,i=this.size,a=this.plot.pixelRatio,o=r[2]-r[0];r[3],r[1];if(!t)for(var t,l=this.scales.length-1;l>=0&&(t=this.scales[l],t.pixelSize1);l--);var u=this.xCoords,c=(e[0]-r[0]-n*i*a)/o,h=(e[2]-r[0]+n*i*a)/o,f=t.offset,d=t.count+f,p=s.ge(u,c,f,d-1);return[p,s.lt(u,h,p,d-1)+1]},d.drawPick=d.draw,d.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":242,"array-bounds":42,"array-normalize":43,"binary-search-bounds":243,"gl-buffer":154,"gl-shader":253,"snap-points-2d":245,"typedarray-pool":537}],247:[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(F[1])){var R=O;O=F,F=R,R=D,D=P,P=R;var j=z;z=I,I=j}O[0]<0&&(D[z]=-1),F[1]>0&&(P[I]=-1);for(var N=0,B=0,C=0;C<4;++C)N+=Math.pow(p[4*z+C],2),B+=Math.pow(p[4*I+C],2);D[z]/=Math.sqrt(N),P[I]/=Math.sqrt(B),d.axes[0]=D,d.axes[1]=P,d.fragClipBounds[0]=u(E,b[0],_,-1e8),d.fragClipBounds[1]=u(E,b[1],_,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.LINES,e.lineVertexCount,e.vertexCount))}}function f(t,e,r,n,i,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=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=m(e,[{buffer:u,size:3,type:e.FLOAT},{buffer:c,size:4,type:e.FLOAT},{buffer:h,size:2,type:e.FLOAT},{buffer:f,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),g=new o(e,r,n,i,u,c,h,f,d,a,s,l);return g.update(t),g}var p=t("gl-buffer"),m=t("gl-vao"),g=t("typedarray-pool"),v=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],M=[0,0,0],k=[0,0,0],A=[0,0,0,1],T=[0,0,0,1],S=x.slice(),E=[0,0,0],L=[[0,0,0],[0,0,0]],C=[-1e8,-1e8,-1e8],z=[1e8,1e8,1e8],I=[C,z];_.draw=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},_.drawTransparent=function(t){f(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},_.drawPick=function(t){f(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,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,m=0,v=n.length;t:for(var y=0;y0&&(z[0]=-a[0]*(1+A[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":250,"gl-buffer":154,"gl-shader":253}],252:[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){return new i(t,o(t,e),s.mallocUint8(e[0]*e[1]*4))}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 k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;_[w]=S}var E=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,E))},e.exports=a},{"./lib/GLError":254,"./lib/create-attributes":255,"./lib/create-uniforms":256,"./lib/reflect":257,"./lib/runtime-reflect":258,"./lib/shader-cache":259}],254:[function(t,e,r){arguments[4][211][0].apply(r,arguments)},{dup:211}],255:[function(t,e,r){arguments[4][212][0].apply(r,arguments)},{"./GLError":254,dup:212}],256:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./GLError":254,"./reflect":257,dup:213}],257:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],258:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{dup:215}],259:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":254,dup:216,"gl-format-compiler-error":163,"weakmap-shim":558}],260:[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)}},{}],261:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"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","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}",null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":253}],262:[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":261,"gl-buffer":154,"gl-vao":269}],263:[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":253}],264:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}function i(t){var e=x([y({colormap:t,nshades:F,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return b.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||D,n.view=t.view||D,n.projection=t.projection||D,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=k(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),k(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},R.pickSlots=1,R.setPickBase=function(t){this.pickId=t};var j=[0,0,0],N={showSurface:!1,showContour:!1, +projections:[D.slice(),D.slice(),D.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},B={model:D,view:D,projection:D,inverseModel:D.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=D.slice(),V=[1,0,0,0,1,0,0,0,1];R.draw=function(t){return s.call(this,t,!1)},R.drawTransparent=function(t){return s.call(this,t,!0)};var q={model:D,view:D,projection:D,inverseModel:D,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]};R.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=q;r.model=t.model||D,r.view=t.view||D,r.projection=t.projection||D,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,m=s+f,g=h*d,v=0;v<3;++v)u[v]+=this._field[v].get(p,m)*g;for(var y=this._pickResult.level,b=0;b<3;++b)if(y[b]=A.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],v=0;v<3;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},R.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 m=_(p.data,a);m.stride[o]=p.stride[0],m.stride[1^o]=0,l(this._field[o],m)}}else{for(o=0;o<2;++o){var g=[0,0];g[o]=1,this._field[o]=_(this._field[o].data,[a[0]+2,a[1]+2],g,0)}this._field[0].set(0,0,0);for(var y=0;y0){for(var xt=0;xt<5;++xt)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");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}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 v=l.size,y=o.indexOf(n)<0;if(y&&o.push(n),h===a&&d)0===l.offset&&l.data.length===v?y?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):y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,l.data.subarray(l.offset,l.offset+v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,l.data.subarray(l.offset,l.offset+v));else{var b;b=a===t.FLOAT?g.mallocFloat32(v):g.mallocUint8(v);var _=p(b,c,[c[2],c[2]*c[0],1]);h===t.FLOAT&&a===t.UNSIGNED_BYTE?x(_,l):m.assign(_,l),y?t.texImage2D(t.TEXTURE_2D,n,i,c[0],c[1],0,i,a,b.subarray(0,v)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,c[0],c[1],i,a,b.subarray(0,v)),a===t.FLOAT?g.freeFloat32(b):g.freeUint8(b)}}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,i,a){var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,a,e),new o(t,s,r,n,i,a)}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=g.malloc(d,r);var y=p(f,n,v,0);"float32"!==r&&"float64"!==r||l!==t.UNSIGNED_BYTE?m.assign(y,e):x(y,e),h=f.subarray(0,d)}var b=u(t);return t.texImage2D(t.TEXTURE_2D,0,c,n[0],n[1],0,c,l,h),a||g.free(f),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(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],r=i(e)?e:e.raw;if(r)return h(t,r,0|e.width,0|e.height,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"),m=t("ndarray-ops"),g=t("typedarray-pool");e.exports=d;var v=null,y=null,b=null,x=function(t,e){m.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(),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;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var o=i(t)?t:t.raw;if(o){this._mipLevels.indexOf(n)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,o),this._mipLevels.push(n)):a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,o)}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:463,"ndarray-ops":457,"typedarray-pool":537}],266:[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},{}],275:[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},{}],276:[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)},{}],277:[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 z(){return/[^a-fA-F0-9]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),F=O,j+1)}function I(){return"."===O?(U.push(O),B=g,F=O,j+1):/[eE]/.test(O)?(U.push(O),B=g,F=O,j+1):"x"===O&&1===U.length&&"0"===U[0]?(B=w,U.push(O),F=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),F=O,j+1)}function D(){return"f"===O&&(U.push(O),F=O,j+=1),/[eE]/.test(O)?(U.push(O),F=O,j+1):"-"===O&&/[eE]/.test(F)?(U.push(O),F=O,j+1):/[^\d]/.test(O)?(e(U.join("")),B=u,j):(U.push(O),F=O,j+1)}function P(){if(/[^\d\w_]/.test(O)){var t=U.join("");return B=J.indexOf(t)>-1?b:Z.indexOf(t)>-1?y:v,e(U.join("")),B=u,j}return U.push(O),F=O,j+1}var O,F,R,j=0,N=0,B=u,U=[],V=[],q=1,H=0,G=0,Y=!1,X=!1,W="";t=t||{};var Z=o,J=i;return"300 es"===t.version&&(Z=l,J=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,m=4,g=5,v=6,y=7,b=8,x=9,_=10,w=11,M=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":280,"./lib/builtins-300es":279,"./lib/literals":282,"./lib/literals-300es":281,"./lib/operators":283}],279:[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":280}],280:[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"]},{}],281:[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":282}],282:[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"]},{}],283:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],284:[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":278}],285:[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:1/0*(d?-1:1);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,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+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*m}},{}],287:[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(),m=0;m<=i;++m)m===c&&(p[m]=-1);var g=p[0];p[0]=p[1],p[1]=g;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,m=0;m<=i;++m){var b=p[m];if(b<0)y[m]=h;else for(var x=0;x<=i;++x)f[x].vertices.indexOf(b)<0&&(y[m]=f[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,h=0;h<=r;++h){var f=c[h];i[h]=f<0?e: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,m=d.indexOf(r);if(!(m<0))for(var g=0;g<=o;++g)if(g!==m){var v=p[g];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.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,v.boundary=!1,u.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var w=v.adjacent,M=d.slice(),k=p.slice(),A=new n(M,k,!0);c.push(A);var T=w.indexOf(e);if(!(T<0)){w[T]=A,k[m]=v,M[g]=-1,k[g]=e,p[g]=A,A.flip();for(var x=0;x<=o;++x){var S=M[x];if(!(S<0||S===r)){for(var E=new Array(o-1),L=0,C=0;C<=o;++C){var z=M[C];z<0||C===x||(E[L++]=z)}f.push(new i(E,A,x))}}}}}}f.sort(a);for(var g=0;g+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":504,"simplicial-complex":515}],288:[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=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)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1))return s(this,t);var r=this.left.remove(t);return 2===r?(this.left=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(t[0]>this.mid){if(!this.right)return y;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);var r=this.right.remove(t);return 2===r?(this.right=null,this.count-=1,b):(r===b&&(this.count-=1),r)}if(1===this.count)return this.leftPoints[0]===t?2:y;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var n=this,a=this.left;a.right;)n=a,a=a.right;if(n===this)a.right=this.right;else{var o=this.left,r=this.right;n.count-=a.count,n.right=a.left,a.left=o,a.right=r}i(this,a),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 o=v.ge(this.leftPoints,t,f);othis.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)},x.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 _=m.prototype;_.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},_.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==y}return!1},_.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},_.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(_,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(_,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":64}],289:[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 m=Math.floor((d+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[m]);var g=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(d),u.push(m-1),u.push(g)),(0===h?i>=s:a>=l)&&(u.push(m+1),u.push(f),u.push(g))}}return c}e.exports=n},{}],296:[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);i(t,e,r,Math.max(n,Math.floor(r-u*h/l+f)),Math.min(o,Math.floor(r+(l-u)*h/l+f)),s)}var d=e[2*r+s],p=n,m=o;for(a(t,e,n,r),e[2*o+s]>d&&a(t,e,n,o);pd;)m--}e[2*n+s]===d?a(t,e,n,m):(m++,a(t,e,m,o)),m<=r&&(n=m+1),r<=m&&(o=m-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},{}],297:[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),m=e[2*p],g=e[2*p+1];i(m,g,r,n)<=u&&l.push(t[p]);var v=(c+1)%2;(0===c?r-a<=m:n-a<=g)&&(s.push(f),s.push(p-1),s.push(v)),(0===c?r+a>=m:n+a>=g)&&(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},{}],298:[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={},m=[],g=0;g=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:472}],300:[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:545}],301:[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":300,"../util/extend":301,"../util/get_type":302,"./validate_array":305,"./validate_boolean":306,"./validate_color":307,"./validate_constants":308,"./validate_enum":309,"./validate_filter":310,"./validate_function":311,"./validate_layer":313,"./validate_number":315,"./validate_object":316,"./validate_source":318,"./validate_string":319}],305:[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 a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var o=[];for(var s in r)"@"!==s[0]&&o.push(new n(e+"."+s,r[s],'constants must start with "@"'));return o}},{"../error/validation_error":300,"../util/get_type":302}],309:[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-1===a.values.indexOf(i(r))&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":300,"../util/unbundle_jsonlint":303}],310:[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":300,"../util/get_type":302,"./validate":304,"./validate_array":305,"./validate_number":315,"./validate_object":316}],312:[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:(-1===e.indexOf("{fontstack}")&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":300,"./validate_string":319}],313:[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 m=0;ma.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":300,"../util/get_type":302}],316:[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["*"]),m=s[d]||s["*"];p||m?c=c.concat((m||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":300,"../util/get_type":302,"./validate":304}],317:[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":300,"./validate":304}],318:[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')];switch(i(e.type)){case"vector":case"raster":var u=[];if(u=u.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var c in e)["type","url","tileSize"].indexOf(c)<0&&u.push(new n(r+"."+c,e[c],'a source with a "url" property may not include a "%s" property',c));return u;case"geojson":return a({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":300,"../util/unbundle_jsonlint":303,"./validate_enum":309,"./validate_object":316}],319:[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":300,"../util/get_type":302}],320:[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":321,"./validate/validate":304,"./validate/validate_constants":308,"./validate/validate_filter":310,"./validate/validate_glyphs_url":312,"./validate/validate_layer":313,"./validate/validate_layout_property":314,"./validate/validate_paint_property":317,"./validate/validate_source":318}],321:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":322}],322:[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"}}}},{}],323:[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)}void 0!==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}},{}],324:[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":438}],325:[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;x[w]=m[_]*g}}},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":436,"../util/util":438,"./array_group":324,"./bucket/circle_bucket":326,"./bucket/fill_bucket":327,"./bucket/line_bucket":328,"./bucket/symbol_bucket":329,"./buffer_group":331,assert:45,"feature-filter":130}],326:[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":438,"../bucket":325,"../load_geometry":333}],327:[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");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,500),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,15),r=0;r2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=s/(512*this.overscaling)*15,u=t[0],c=t[a-1],h=u.equals(c);if(this.prepareArrayGroup("line",10*a),2!==a||!h){this.distance=0;var f,d,p,m,g,v,y,b=r,x=h?"butt":r,_=!0;this.e1=this.e2=this.e3=-1,h&&(f=t[a-2],g=u.sub(f)._unit()._perp());for(var w=0;w0){var S=f.dist(d);if(S>2*o){var E=f.sub(f.sub(d)._mult(o/S)._round());this.distance+=E.dist(d),this.addCurrentVertex(E,this.distance,m.mult(1),0,0,!1),d=E}}var L=d&&p,C=L?e:p?b:x;if(L&&"round"===C&&(An&&(C="bevel"),"bevel"===C&&(A>2&&(C="flipbevel"),A100)M=g.clone();else{var z=m.x*g.y-m.y*g.x>0?-1:1,I=A*m.add(g).mag()/m.sub(g).mag();M._perp()._mult(I*z)}this.addCurrentVertex(f,this.distance,M,0,0,!1),this.addCurrentVertex(f,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var D=m.x*g.y-m.y*g.x>0,P=-Math.sqrt(A*A-1);if(D?(y=0,v=P):(v=0,y=P),_||this.addCurrentVertex(f,this.distance,m,v,y,!1),"fakeround"===C){for(var O,F=Math.floor(8*(.5-(k-.5))),R=0;R=0;j--)O=m.mult((j+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(f,this.distance,O,D)}p&&this.addCurrentVertex(f,this.distance,g,-v,-y,!1)}else"butt"===C?(_||this.addCurrentVertex(f,this.distance,m,0,0,!1),p&&this.addCurrentVertex(f,this.distance,g,0,0,!1)):"square"===C?(_||(this.addCurrentVertex(f,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(f,this.distance,g,-1,-1,!1)):"round"===C&&(_||(this.addCurrentVertex(f,this.distance,m,0,0,!1),this.addCurrentVertex(f,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(f,this.distance,g,-1,-1,!0),this.addCurrentVertex(f,this.distance,g,0,0,!1)));if(T&&w2*o){var B=f.add(p.sub(f)._mult(o/N)._round());this.distance+=B.dist(f),this.addCurrentVertex(B,this.distance,g.mult(1),0,0,!1),f=B}}_=!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],c=l.layoutVertexArray,h=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(c,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&h.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(c,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&h.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>u/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":438,"../bucket":325,"../load_geometry":333}],329:[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"),m=t("../../util/util"),g=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,b=h.shapeIcon,x=c.getGlyphQuads,_=c.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,n.prototype=m.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"}]),k=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: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"}])}},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*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,v=24*a["text-letter-spacing"],x=[24*a["text-offset"][0],24*a["text-offset"][1]],_=this.fontstack=a["text-font"].join(","),M=[],k=0;kw||L.y<0||L.y>w);if(!d||C){var z=C||x;this.addSymbolInstance(L,T,e,r,this.layer,z,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,u,m,y,h,g,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 g=p.tl,v=p.tr,y=p.bl,b=p.br,x=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 k=Math.round(p.glyphAngle/(2*Math.PI)*256),A=i(c,_.x,_.y,g.x,g.y,x.x,x.y,w,M,f,k);i(c,_.x,_.y,v.x,v.y,x.x+x.w,x.y,w,M,f,k),i(c,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,f,k),i(c,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,f,k),u.emplaceBack(A,A+1,A+2),u.emplaceBack(A+1,A+2,A+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rn.MAX_QUADS&&m.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),A>n.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(D,P,O,F,k,A,T,S,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":387,"../../symbol/clip_line":389,"../../symbol/collision_feature":391,"../../symbol/get_anchors":393,"../../symbol/mergelines":396,"../../symbol/quads":397,"../../symbol/resolve_text":398,"../../symbol/shaping":399,"../../util/token":437,"../../util/util":438,"../bucket":325,"../load_geometry":333,"point-geometry":480}],330:[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":438,"./bucket":325,assert:45}],334:[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}}},{}],335:[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":438}],336:[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":335}],337:[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){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*(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=[t.x,t.y,0,1],r=[t.x,t.y,1,1];f.transformMat4(e,e,this.pixelMatrixInverse),f.transformMat4(r,r,this.pixelMatrixInverse);var n=e[3],i=r[3],a=e[0]/n,s=r[0]/i,u=e[1]/n,c=r[1]/i,h=e[2]/n,d=r[2]/i,p=h===d?0:(0-h)/(d-h),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(a,s,p)/m,l(u,c,p)/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,m=u.x/2;p-mn&&(s=n-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),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)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":325,"../source/tile_coord":365,"../util/interpolate":432,"../util/util":438,"./coordinate":334,"./lng_lat":335,"gl-matrix":191,"point-geometry":480}],338:[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&x,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":359,"./create_uniform_pragmas":340}],342:[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":359}],346:[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,m,g,v,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),b=h.height/2*Math.tan(h._pitch),x=(y+b)/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"]),m=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,m.y),s.uniform1f(d.u_mix,_.t),s.uniform1f(d.u_extra,x),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f);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,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,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,r.paint["line-opacity"]),s.uniform1f(d.u_extra,x),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,x),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":436,"../util/util":438}],348:[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,m){for(var g=0;gthis.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;this.opacities[r]=r<=t?this.changeOpacities[r]+i: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))}},{}],350:[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;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o0?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);e.blendColor(1/8,1/8,1/8,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":325,"../data/buffer":330,"../source/pixels_to_tile_units":359,"../source/source_cache":363,"../util/browser":422,"../util/struct_array":436,"../util/util":438,"./create_uniform_pragmas":340,"./draw_background":341,"./draw_circle":342,"./draw_debug":344,"./draw_fill":345,"./draw_line":346,"./draw_raster":347,"./draw_symbol":348,"./frame_history":349,"./painter/use_program":352,"./vertex_array_object":353,"gl-matrix":191}],352:[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":325,"../util/evented":430,"../util/util":438,"resolve-url":497}],355:[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){if(r)return e(r);this._geoJSONIndexes[t.source]=n,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":421,"../util/util":438,"./geojson_wrapper":356,"./vector_tile_worker_source":367,"geojson-rewind":136,"geojson-vt":140,supercluster:525,"vt-pbf":552}],356:[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;this._cache.setMaxSize(Math.floor(5*n))},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 b=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=[],b=0;b=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)<0&&(n=-1*n-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":430,"../util/mapbox":435,"../util/util":438,"./load_tilejson":358}],367:[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":421,"./worker_tile":370,pbf:474,"vector-tile":546}],368:[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=new h;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new f(e.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":325,"../data/buffer":330,"../geo/lng_lat":335,"../render/draw_raster":347,"../render/vertex_array_object":353,"../util/ajax":421,"../util/evented":430,"../util/util":438,"./tile_coord":365,"point-geometry":480}],369:[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--)b(E,P[e]);x()}}function b(t,e){if(e.populateArrays(A,j,R),"symbol"!==e.type)for(var r=0;r=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||(k=c.create({layer:w,index:z++,childLayers:e[I],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:S.encode(w.sourceLayer||"_geojsonTileLayer")}),k.createFilter(),L[w.id]=k,t.layers&&(M=w.sourceLayer,C[M]=C[M]||{},C[M][w.id]=k)));if(t.layers)for(M in C)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])&&v(w,C[M]);else v(t,L);var D=[],P=this.symbolBuckets=[],O=[];T.bucketLayerIDs={};for(var F in L)k=L[F],0!==k.features.length&&(T.bucketLayerIDs[k.index]=k.childLayers.map(s),D.push(k),"symbol"===k.type?P.push(k):O.push(k));var R={},j={},N=0;if(P.length>0){for(_=P.length-1;_>=0;_--)P[_].updateIcons(R),P[_].updateFont(j);for(var B in j)j[B]=Object.keys(j[B]).map(Number);R=Object.keys(R),r.send("get glyphs",{uid:this.uid,stacks:j},function(t,e){j=e,y(t)}),R.length?r.send("get icons",{icons:R},function(t,e){R=e,y(t)}):y()}for(_=O.length-1;_>=0;_--)b(this,O[_]);if(0===P.length)return x()},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":325,"../data/feature_index":332,"../symbol/collision_box":390,"../symbol/collision_tile":392,"../symbol/symbol_instances":401,"../symbol/symbol_quads":402,"../util/dictionary_coder":428,"../util/util":438}],371:[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})}},{}],372:[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){if(t)return void this.fire("error",{error:t});this.data=e,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":421,"../util/browser":422,"../util/evented":430,"../util/mapbox":435}],373:[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":438,"./style_function":376,csscolorparser:106}],374:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new m,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(!g.emitErrors(this,g(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"),m=t("./animation_loop"),g=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),b=t("../source/source_cache"),x=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&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&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&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new b(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 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(g.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);return i.setPaintProperty(e,r,n),!(r&&_.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property)&&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:1,t:n}}}var a=t("./style_function"),o=t("./parse_color"),s=t("../util/util");e.exports=n},{"../util/util":438,"./parse_color":373,"./style_function":376}],376:[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":298}],377:[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;n.create=function(e,r){return new({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")}[(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,"-transition"))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,"-transition")?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){return this._paintTransitions[t].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<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},{}],389:[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":480}],390:[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":436,"../util/util":438,"point-geometry":480}],391:[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 m=f-h,g=p-d;if(m>0)if(m=Math.max(10*s,m),c){var v=e[r.segment+1].sub(e[r.segment])._unit()._mult(g),y=[r.sub(v),r.add(v)];this._addLineCollisionBoxes(t,y,r,0,g,m,n,i,a)}else this._addLineCollisionBoxes(t,e,r,r.segment,g,m,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,m=h;do{if(--p<0)return f;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 f;g=e[p].dist(e[p+1])}var b=y-m,x=e[p],_=e[p+1],w=_.sub(x)._unit()._mult(b)._add(x)._round(),M=Math.max(Math.abs(y-h)-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 f}},{}],392:[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();r.emplaceBack(0,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(a,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-32767,0,32767,0,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,a,-32767,0,32767,0,32767,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),k=new i(u.x2,u.y1).matMult(w),A=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,k.x,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=u.maxScale}else _=u;for(var S=0;S=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]),m=0;m=a&&(o[y][b]=!0,s.push(d[g]))}}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&&A=0&&T=0&&v+d<=p){var S=new o(A,T,M,b)._round();n&&!s(t,S,u,n,l)||y.push(S)}}g+=w}return h||y.length||c||(y=i(t,g/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":387,"../util/interpolate":432,"./check_max_angle":388}],394:[function(t,e,r){"use strict";function n(){this.width=o,this.height=o,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=128;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=o+2,u=s+2;l+=4-l%4,u+=4-u%4;var c=this.bin.packOne(l,u);if(c||(this.resize(),c=this.bin.packOne(l,u)),!c)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=c,this.ids[i]=[t];for(var h=this.data,f=r.bitmap,d=0;d=2048||e>=2048)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=4,this.height*=4,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 x=v[c+1].x;g=Math.max(x,g);for(var _=c+1;_<=y;_++)v[_].y+=r,v[_].x-=x;if(o){var w=c;h[v[c].codePoint]&&w--,s(v,e,p,w,o)}p=c+1,c=null,d+=x,m++}f[b.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)*r;s(v,e,p,v.length-1,o),l(v,o,i,a,g,r,m,u),t.top+=-a*A,t.bottom=t.top+A,t.left+=-i*g,t.right=t.left+g}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){n.mousePos(b,t).equals(_)&&v("click",t)}function m(t){v("dblclick",t),t.preventDefault()}function g(t){x=t,t.preventDefault()}function v(e,r){var i=n.mousePos(b,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function y(e,r){var a=n.touchPos(b,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 b=t.getCanvasContainer(),x=null,_=null,w=null;for(var M in a)t[M]=new a[M](t,e),e.interactive&&e[M]&&t[M].enable();b.addEventListener("mouseout",r,!1),b.addEventListener("mousedown",o,!1),b.addEventListener("mouseup",s,!1),b.addEventListener("mousemove",l,!1),b.addEventListener("touchstart",u,!1),b.addEventListener("touchend",h,!1),b.addEventListener("touchmove",c,!1),b.addEventListener("touchcancel",f,!1),b.addEventListener("click",p,!1),b.addEventListener("dblclick",m,!1),b.addEventListener("contextmenu",g,!1)}},{"../util/dom":424,"./handler/box_zoom":409,"./handler/dblclick_zoom":410,"./handler/drag_pan":411,"./handler/drag_rotate":412,"./handler/keyboard":413,"./handler/scroll_zoom":414,"./handler/touch_zoom_rotate":415,"point-geometry":480}],404:[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&&m.lng<0?m.lng+=360:c.center.lng<0&&m.lng>0&&(m.lng-=360));var b=c.zoomScale(g-f),x=c.point,_="center"in t?c.project(m).sub(h.div(b)):x,w=c.worldSize,M=t.curve,k=Math.max(c.width,c.height),A=k/b,T=_.sub(x).mag();if("minZoom"in t){var S=n.clamp(Math.min(t.minZoom,f,g),c.minZoom,c.maxZoom),E=k/c.zoomScale(S-f);M=Math.sqrt(E/T*2)}var L=M*M,C=r(0),z=function(t){return s(C)/s(C+M*t)},I=function(t){return k*((s(C)*u(C+M*t)-a(C))/L)/T},D=(r(1)-C)/M;if(Math.abs(T)<1e-6){if(Math.abs(k-A)<1e-6)return this.easeTo(t);var P=A=0)return!1;return!0}),e.join(" | ")},n.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e=this._container=a.create("div","mapboxgl-ctrl-attrib",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)),e},_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":424,"../../util/util":438,"./control":406}],406:[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",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,a)},{"../../util/evented":430,"../../util/util":438}],407:[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=this._container=o.create("div","mapboxgl-ctrl-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),e):e},_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":422,"../../util/dom":424,"../../util/util":438,"./control":406}],408:[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":424,"../../util/util":438,"./control":406}],409:[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":336,"../../util/dom":424,"../../util/util":438}],410:[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)}}},{}],411:[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=a.bezier(0,0,.3,1);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]),s=(n[0]-i[0])/1e3;if(0===s||n[1].equals(i[1]))return void e();var l=a.mult(.3/s),u=l.mag();u>1400&&(u=1400,l._unit()._mult(u));var c=u/750,h=l.mult(-c/2);this._map.panBy(h,{duration:1e3*c,easing:o,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;return"mousemove"===t.type?!1&t.buttons:0!==t.button},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":424,"../../util/util":438}],412:[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=o.bezier(0,0,.25,1);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);e.mag()<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)180&&(d=180);var p=d/180;u+=h*d*(p/2),Math.abs(e._normalizeBearing(u,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();t.length>0&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":424,"../../util/util":438,"point-geometry":480}],413:[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;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()-2},r):(t.preventDefault(),e.panBy([-80,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+2},r):(t.preventDefault(),e.panBy([80,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+5},r):(t.preventDefault(),e.panBy([0,-80],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-5,0)},r):(t.preventDefault(),e.panBy([0,80],r))}}}}},{}],414:[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=-1!==s.indexOf("firefox"),u=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=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":422,"../../util/dom":424,"../../util/util":438}],415:[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=a.bezier(0,0,.15,1);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 c=Math.abs(1-o)>.15;Math.abs(s)>4?this._gestureIntent="rotate":c&&(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]),s=r.transform.scaleZoom(this._startScale*i[1]),l=a-s,u=(n[0]-i[0])/1e3,c=n[2];if(0===u||a===s)return void r.snapToNorth({},{originalEvent:t});var h=.15*l/u;Math.abs(h)>2.5&&(h=h>0?2.5:-2.5);var f=1e3*Math.abs(h/(12*.15)),d=a+h*f/2e3;d<0&&(d=0),r.easeTo({zoom:d,duration:f,easing:o,around:r.unproject(c)},{originalEvent:t})},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>2&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":424,"../../util/util":438}],416:[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":438}],417:[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"),m=t("./bind_handlers"),g=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),b=t("point-geometry"),x=t("./control/attribution"),_={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:20,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)},w=e.exports=function(t){if(t=a.extend({},_,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)),void 0!==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 x(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(w.prototype,l),a.extend(w.prototype,g.prototype),a.extend(w.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 b(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new b(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new b(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?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom&&t<=20)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 20, inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(b.convert(t))},queryRenderedFeatures:function(){var t,e={};return 2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length&&function(t){return t instanceof b||Array.isArray(t)}(arguments[0])?t=arguments[0]:1===arguments.length&&(e=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(t),e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[b.convert([0,0]),b.convert([this.transform.width,this.transform.height])]);var e;if(t instanceof b||"number"==typeof t[0])e=[b.convert(t)];else{var r=[b.convert(t[0]),b.convert(t[1])];e=[r[0],new b(r[1].x,r[0].y),r[1],new b(r[0].x,r[1].y),r[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?(this.style=t instanceof c?t: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});if(!t)return void this.fire("error",{error:new Error("Failed to initialize WebGL")});this.painter=new f(t,this.transform)},_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),void 0!==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(w.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":335,"../geo/lng_lat_bounds":336,"../geo/transform":337,"../render/painter":351,"../style/animation_loop":371,"../style/style":374,"../util/browser":422,"../util/canvas":423,"../util/dom":424,"../util/evented":430,"../util/util":438,"./bind_handlers":403,"./camera":404,"./control/attribution":405,"./hash":416,"point-geometry":480}],418:[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":335,"../util/dom":424,"point-geometry":480}],419:[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))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":335,"../util/dom":424,"../util/evented":430,"../util/util":438}],420:[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(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if(void 0!==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)}},{}],421:[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":323}],423:[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":438,"mapbox-gl-supported":323}],424:[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}},{}],434:[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}},{}],435:[function(t,e,r){"use strict";function n(t,e,r){if(!(r=r||o.ACCESS_TOKEN)&&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+=-1!==t.indexOf("?")?"&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){return"mapbox:"!==l.parse(t).protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=l.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox://"+r.pathname.split("/")[1]+"/{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;if("mapbox:"!==l.parse(e).protocol)return t;var i=s.supportsWebp?".webp":"$1",o=s.devicePixelRatio>=2||512===r?"@2x":"";return l.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,o+i),query:a(n.query)})}},{"./browser":422,"./config":427,"./util":438,url:541}],436:[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(g[n])return g[n];void 0===t.alignment&&(t.alignment=1),e.prototype=Object.create(f.prototype);var s=0,u=0,v=["Uint8"];return e.prototype.members=t.members.map(function(r){r={name:r.name,type:r.type, +components:r.components||1},p(r.name.length),p(r.type in m),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":334,unitbezier:540}],439:[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}}},{}],440:[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"}},{}],441:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;ig[1][2]&&(b[0]=-b[0]),g[0][2]>g[2][0]&&(b[1]=-b[1]),g[1][0]>g[0][1]&&(b[2]=-b[2]),!0}},{"./normalize":443,"gl-mat4/clone":173,"gl-mat4/create":174,"gl-mat4/determinant":175,"gl-mat4/invert":179,"gl-mat4/transpose":189,"gl-vec3/cross":270,"gl-vec3/dot":271,"gl-vec3/length":272,"gl-vec3/normalize":274}],443:[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}},{}],444:[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":175,"gl-vec3/lerp":273,"mat4-decompose":442,"mat4-recompose":445,"quat-slerp":485}],445:[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":174,"gl-mat4/fromRotationTranslation":177,"gl-mat4/identity":178,"gl-mat4/multiply":181,"gl-mat4/scale":187,"gl-mat4/translate":188}],446:[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){return t=t||{},new n(t.matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}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 m=n.prototype;m.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 m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[9],d(m,m);var g=this.computedInverse;s(g,n);var v=this.computedEye,y=g[15];v[0]=g[12]/y,v[1]=g[13]/y,v[2]=g[14]/y;for(var b=this.computedCenter,x=Math.exp(this.computedRadius[0]),u=0;u<3;++u)b[u]=v[u]-n[2+4*u]*x}},m.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":504}],448:[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!==d||a!==p||o!==m||r(n))&&(d=0|t,p=a||0,m=o||0,e&&e(d,p,m,g))}function a(t){n(0,t)}function o(){(d||p||m||g.shift||g.alt||g.meta||g.control)&&(p=m=0,d=0,g.shift=g.alt=g.control=g.meta=!1,e&&e(0,0,0,g))}function s(t){r(t)&&e&&e(d,p,m,g)}function l(t){0===i.buttons(t)?n(0,t):n(d,t)}function u(t){n(d|i.buttons(t),t)}function c(t){n(d&~i.buttons(t),t)}function h(){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)))}function f(){v&&(v=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",u),t.removeEventListener("mouseup",c),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))}e||(e=t,t=window);var d=0,p=0,m=0,g={shift:!1,alt:!1,control:!1,meta:!1},v=!1;h();var y={element:t};return Object.defineProperties(y,{enabled:{get:function(){return v},set:function(t){t?h():f()},enumerable:!0},buttons:{get:function(){return d},enumerable:!0},x:{get:function(){return p},enumerable:!0},y:{get:function(){return m},enumerable:!0},mods:{get:function(){return g},enumerable:!0}}),y}e.exports=n;var i=t("mouse-event")},{"mouse-event":450}],449:[function(t,e,r){function n(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var n=t.clientX||0,a=t.clientY||0,o=i(e);return r[0]=n-o.left,r[1]=a-o.top,r}function i(t){return t===window||t===document||t===document.body?a:t.getBoundingClientRect()}var a={left:0,top:0};e.exports=n},{}],450:[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&m)x.push(w+"["+T+"+"+g(_)+"]");x.push(v(0));for(var _=0;_0){",f(x[t]),"=1;"),P(t-1,e|1<0&&G.push(s(U,x[V-1])+"*"+o(x[V-1])),N.push(d(U,x[V])+"=("+G.join("-")+")|0")}for(var U=0;U=0;--U)Y.push(o(x[U]));N.push(A+"=("+Y.join("*")+")|0",M+"=mallocUint32("+A+")",w+"=mallocUint32("+A+")",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 b(t.vertex,t.cell,t.phase,i,r,o)}var _=t("typedarray-pool");e.exports=x;var w="V",M="P",k="N",A="Q",T="X",S="T"},{"typedarray-pool":537}],453:[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":111}],454:[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"),o.push("s["+l+"]-2"));var u=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(u=""),r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",u);a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.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?a.push("dst.set(",s.join(),",",c,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),m=s.slice();e[l]<0?(p[c]="s["+c+"]-2",m[c]="0"):(p[c]="s["+c+"]-1",m[c]="1"),0===r?a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",p.join(),")-src.get(",m.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):a.push("if(s[",c,"]>2){diff(",h,",src.pick(",p.join(),")",u,",src.pick(",m.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}(p)}}a.push("return dst;};return gradient");for(var m=["diff","zero"],g=[h,f],o=1;o<=i;++o)m.push("grad"+o),g.push(n(o));m.push(a.join(""));var v=Function.apply(void 0,m),r=v.apply(void 0,g);return l[e]=r,r}function a(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r="string"==typeof r?o(e.dimension,r):o(e.dimension,"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var n=0;n>",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":108}],458:[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":459,ndarray:463}],459:[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":108}],460:[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,"b){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,"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&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var s="__l"+ ++A;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"+ ++A;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 m(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 g(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){m(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",++A,":while(true){"].join("")),l([e],!0,["if(",o("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].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)),k=n(e),A=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 S=[],E=1;E1?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){"),m("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){"),g("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),m("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){"),m("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&&k){var L=new Function("insertionSort","malloc","free",_.join("\n"));return L(r,k[0],k[1])}var L=new Function("insertionSort",_.join("\n"));return L(r)}function s(t,e){var r=["'use strict'"],n=["ndarraySortWrapper",t.join("d"),e].join(""),s=["array"];r.push(["function ",n,"(",s.join(","),"){"].join(""));for(var l=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],c=0;c0?l.push(["d",g,"=s",g,"-d",p,"*n",p].join("")):l.push(["d",g,"=s",g].join("")),p=g);var d=t.length-1-c;0!==d&&(m>0?l.push(["e",d,"=s",d,"-e",m,"*n",m,",f",d,"=",h[d],"-f",m,"*n",m].join("")):l.push(["e",d,"=s",d,",f",d,"=",h[d]].join("")),m=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")),b=a(t,e);return y(b,o(t,e,b))}var l=t("typedarray-pool"),u=32;e.exports=s},{"typedarray-pool":537}],461:[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":460}],462:[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":111,"ndarray-linear-interpolate":456}],463:[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+"]"}),m=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(",")+","+m.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+r+"(this.data,"+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 g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");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":122}],465:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa)for(var x=i[u],_=1/Math.sqrt(g*y),b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(v[w]*m[M]-v[M]*m[w])}}for(var o=0;oa)for(var _=1/Math.sqrt(k),b=0;b<3;++b)x[b]*=_;else for(var b=0;b<3;++b)x[b]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(var u=0;u<3;++u)f[u]*=d;i[o]=f}return i}},{}],466:[function(t,e,r){"use strict";function n(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var i=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,s,l=n(t),u=1;uk&&(k=d[1]),T[r]=d}for(l=0,c=0,u=0,r=0;rA&&(A=m);return{center:[h,f],bounds:[M,_,k,w+1],radius:Math.sqrt(A)}}function o(t,e){var r=0,n=t.length,i=0;for(e||(e=4);!t[i]&&ir;)i-=e;return n=i,[r/e,n/e]}function s(t,e){return t*t+e*e}e.exports=n;var l=document.createElement("canvas"),u=l.getContext("2d");l.width=200,l.height=200,n.canvas=l},{}],468:[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},{}],469:[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 m=a[2],g=a[6],v=a[10],y=m*o+g*s+v*l,b=m*c+g*h+v*f;m-=y*o+b*c,g-=y*s+b*h,v-=y*l+b*f;var x=n(m,g,v);m/=x,g/=x,v/=x;var _=c*e+o*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+i),this.radius.set(t,Math.log(k))},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],m=o[10],g=e*s+r*c,v=e*l+r*h,y=e*u+r*f,b=-(p*y-m*v),x=-(m*g-d*y),_=-(d*v-p*g),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var k=this.computedRotation,A=k[0],T=k[1],S=k[2],E=k[3],L=A*w+E*b+T*_-S*x,C=T*w+E*x+S*b-A*_,z=S*w+E*_+A*x-T*b,I=E*w-A*b-T*x-S*_;if(a){b=d,x=p,_=m;var D=Math.sin(a)/n(b,x,_);b*=D,x*=D,_*=D,w=Math.cos(e),L=L*w+I*b+C*_-z*x,C=C*w+I*x+z*b-L*_,z=z*w+I*_+L*x-C*b,I=I*w-L*b-C*x-z*_}var P=i(L,C,z,I);P>1e-6?(L/=P,C/=P,z/=P,I/=P):(L=C=z=0,I=1),this.rotation.set(t,L,C,z,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":468,"filtered-vector":131,"gl-mat4/fromQuat":176,"gl-mat4/invert":179,"gl-mat4/lookAt":180}],470:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":496}],471:[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}},{}],472:[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)+4294967296*this.buf.readUInt32LE(this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+4294967296*this.buf.readInt32LE(this.pos+4);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)return void a(t,this);this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127)))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t);var e=g.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;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,m,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":473}],475:[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||[];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":289,"typedarray-pool":537}],477:[function(t,e,r){"use strict";function n(t,e){function r(t,e){var r=s[e][t[e]];r.splice(r.indexOf(t),1)}function n(t,n,a){for(var o,l,u,c=0;c<2;++c)if(s[c][n].length>0){o=s[c][n][0],u=c;break}l=o[1^u];for(var h=0;h<2;++h)for(var f=s[h][n],d=0;d0&&(o=p,l=m,u=h)}return a?l:(o&&r(o,u),l)}for(var a=0|e.length,o=t.length,s=[new Array(a),new Array(a)],l=0;l0;){var d=(s[0][l].length,function(t,a){var o=s[a][t][0],l=[t];r(o,a);for(var u=o[1^a];;){for(;u!==t;)l.push(u),u=n(l[l.length-2],u,!1);if(s[0][t].length+s[1][t].length===0)break;var c=l[l.length-1],h=t,f=l[1],d=n(c,h,!0);if(i(e[c],e[h],e[f],e[d])<0)break;l.push(t),u=n(c,h)}return l}(l,h));!function(t,e){return e[1]===e[e.length-1]}(f,d)?(f.length>0&&c.push(f),f=d):f.push.apply(f,d)}f.length>0&&c.push(f)}return c}e.exports=n;var i=t("compare-angle")},{"compare-angle":98}],478:[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 g=0;g=0)&&(B[Y]=1^G,N.push(Y),0===G)){var T=v[Y];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":478,"edges-to-adjacency-list":125,"planar-dual":477,"point-in-big-polygon":481,"robust-sum":509,"two-product":535,uniq:539}],480:[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}},{}],481:[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?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p)):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):(_=-d/h,y=d*_+p));else if(_<0)_=0,f>=0?(x=0,y=p):-f>=u?(x=1,y=u+2*f+p):(x=-f/u,y=f*x+p);else{var w=1/b;x*=w,_*=w,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p}else{var M,k,A,T;x<0?(M=c+f,k=h+d,k>M?(A=k-M,T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(x=0,k<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):(_=-d/h,y=d*_+p))):_<0?(M=c+d,k=u+f,k>M?(A=k-M,T=u-2*c+h,A>=T?(_=1,x=0,y=h+2*d+p):(_=A/T,x=1-_,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)):(_=0,k<=0?(x=1,y=u+2*f+p):f>=0?(x=0,y=p):(x=-f/u,y=f*x+p))):(A=h+d-c-f,A<=0?(x=0,_=1,y=h+2*d+p):(T=u-2*c+h,A>=T?(x=1,_=0,y=u+2*f+p):(x=A/T,_=1-x,y=x*(u*x+c*_+2*f)+_*(c*x+h*_+2*d)+p)))}for(var S=1-x-_,l=0;l1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(D,"."),n+o(t.split("."),e).join(".")}function l(t){for(var e,r,n=[],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 h(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?F(t/S):t>>1,t+=F(t/e);t>O*A>>1;n+=M)t=F(t/O);return F(n+(O+1)*t/(t+T))}function d(t){var e,r,n,i,o,s,l,h,d,p,m=[],g=t.length,v=0,y=L,b=E;for(r=t.lastIndexOf(C),r<0&&(r=0),n=0;n=128&&a("not-basic"),m.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=g&&a("invalid-input"),h=c(t.charCodeAt(i++)),(h>=M||h>F((w-v)/s))&&a("overflow"),v+=h*s,d=l<=b?k:l>=b+A?A:l-b,!(hF(w/p)&&a("overflow"),s*=p;e=m.length+1,b=f(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,r,n,i,o,s,u,c,d,p,m,g,v,y,b,x=[];for(t=l(t),g=t.length,e=L,r=0,o=E,s=0;s=e&&mF((w-r)/v)&&a("overflow"),r+=(u-e)*v,e=u,s=0;sw&&a("overflow"),m==e){for(c=r,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(x={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 x});else if(v&&y)if(r.exports==v)y.exports=x;else for(_ in x)x.hasOwnProperty(_)&&(v[_]=x[_]);else i.punycode=x}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],485:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":229}],486:[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=m.substr(0,g),f=m.substr(g+1)):(h=m,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)}},{}],487:[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);n(t,e,Math.max(r,Math.floor(e-u*h/l+f)),Math.min(o,Math.floor(e+(l-u)*h/l+f)),s)}var d=t[e],p=r,m=o;for(i(t,r,e),s(t[o],d)>0&&i(t,r,o);p0;)m--}0===s(t[r],d)?i(t,r,m):(m++,i(t,m,o)),m<=e&&(r=m+1),e<=m&&(o=m-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},{}],490:[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":83,"compare-cell":99,"compare-oriented-cell":100}],495:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==r?r.exports=i():"function"==typeof t&&t.amd?t(i):e.createREGL=i()}(this,function(){"use strict";function t(t){return"undefined"!=typeof btoa?btoa(t):"base64:"+t}function e(t){var e=new Error("(regl) "+t);throw console.error(e),e}function r(t,r){t||e(r)}function n(t){return t?": "+t:""}function i(t,r,i){t in r||e("unknown parameter ("+t+")"+n(i)+". possible values: "+Object.keys(r).join())}function a(t,r){Qt(t)||e("invalid parameter type"+n(r)+". must be a typed array")}function o(t,r,i){typeof t!==r&&e("invalid parameter type"+n(i)+". expected "+r+", got "+typeof t)}function s(t,r){t>=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")}function l(t,r,i){r.indexOf(t)<0&&e("invalid value"+n(i)+". must be one of: "+r)}function u(t){Object.keys(t).forEach(function(t){te.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+te)})}function c(t,e){for(t+="";t.length0&&e.push(new d("unknown",0,t))}}),e}function y(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}function b(t,e,n,i,a){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(e),s=i===t.FRAGMENT_SHADER?"fragment":"vertex";T(n,"string",s+" shader source must be a string",a);var l=g(n,a),u=v(o);y(l,u),Object.keys(l).forEach(function(t){function e(t,e){n.push(t),i.push(e||"")}var r=l[t];if(r.hasErrors){var n=[""],i=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(c(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var i=n.message,a=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(i);if(a){var o=a[1];switch(i=a[2],o){case"assign":o="="}r=Math.max(t.line.indexOf(o,r),0)}else r=0;e(c("| ",6)),e(c("^^^",r+3)+"\n","font-weight:bold"),e(c("| ",6)),e(i+"\n","font-weight:bold")}),e(c("| ",6)+"\n")}else e(c(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(i[0]=n.join("%c"),console.log.apply(console,i)):console.log(n.join(""))}}),r.raise("Error compiling "+s+" shader, "+l[0].name)}}function x(t,e,n,i,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=g(n,a),l=g(i,a),u='Error linking program with vertex shader, "'+l[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+o),r.raise(u)}}function _(t){t._commandRef=p()}function w(t,e,r,n){function i(t){return t?n.id(t):0}function a(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}_(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var o=t._uniformSet={};a(o,e.static),a(o,e.dynamic);var s=t._attributeSet={};a(s,r.static),a(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic}function M(t,r){var n=m();e(t+" in command "+(r||p())+("unknown"===n?"":" called from "+n))}function k(t,e,r){t||M(e,r||p())}function A(t,e,r,i){t in e||M("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),i||p())}function T(t,e,r,i){typeof t!==e&&M("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,i||p())}function S(t){t()}function E(t,e,r){t.texture?l(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):l(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")}function L(t,e){return t===ue||t===le||t===ce?2:t===he?4:fe[t]*e}function C(t){return!(t&t-1||!t)}function z(t,e,n){var i,a=e.width,o=e.height,s=e.channels;r(a>0&&a<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ee&&t.wrapT===ee||r(C(a)&&C(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==a&&1!==o&&r(t.minFilter!==ne&&t.minFilter!==ae&&t.minFilter!==ie&&t.minFilter!==oe,"min filter requires mipmap"):(r(C(a)&&C(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(a<<1)-1,"missing or incomplete mipmap data")),e.type===se&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===re&&t.magFilter===re,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(i=0;i<16;++i)if(l[i]){var u=a>>i,c=o>>i;r(e.mipmask&1<0&&a<=i.maxTextureSize&&o>0&&o<=i.maxTextureSize,"invalid texture shape"),r(a===o,"cube map must be square"),r(e.wrapS===ee&&e.wrapT===ee,"wrap mode not supported by cube map");for(var l=0;l>h,p=o>>h;r(u.mipmask&1<1&&e===r&&('"'===e||"'"===e))return['"'+P(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return O(t.substr(0,n.index)).concat(O(n[1])).concat(O(t.substr(n.index+n[0].length)));var i=t.split(".");if(1===i.length)return['"'+P(t)+'"'];for(var a=[],o=0;o0,"invalid pixel ratio"))):de.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!i){if(!n){de("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=U(r||document.body,h,u);if(!d)return null;n=d.canvas,f=d.onDestroy}i=V(n,o)}return i?{gl:i,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:u,profile:c,onDone:h,onDestroy:f}:(f(),h("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function W(t,e){function r(e){de.type(e,"string","extension name must be string");var r,i=e.toLowerCase();try{r=n[i]=t.getExtension(i)}catch(t){}return!!r}for(var n={},i=0;i65535)<<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)|t>>1}function $(t){var e=K(t),r=Ee[Q(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function tt(t){Ee[Q(t.byteLength)>>2].push(t)}function et(t,e){var r=null;switch(t){case _e:r=new Int8Array($(e),0,e);break;case we:r=new Uint8Array($(e),0,e);break;case Me:r=new Int16Array($(2*e),0,e);break;case ke:r=new Uint16Array($(2*e),0,e);break;case Ae:r=new Int32Array($(4*e),0,e);break;case Te:r=new Uint32Array($(4*e),0,e);break;case Se:r=new Float32Array($(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r}function rt(t){tt(t.buffer)}function nt(t,e,r){for(var n=0;n0){var l;if(Array.isArray(e[0])){s=Pe(e);for(var u=1,c=1;c0)if("number"==typeof t[0]){var i=Le.allocType(p.dtype,t.length);ct(i,t),h(i,n),Le.freeType(i)}else if(Array.isArray(t[0])||Qt(t[0])){r=Pe(t);var a=De(t,r,p.dtype);h(a,n),Le.freeType(a)}else de.raise("invalid buffer data")}else if(Qt(t))h(t,n);else if(Z(t)){r=t.shape;var o=t.stride,s=0,l=0,u=0,f=0;1===r.length?(s=r[0],l=1,u=o[0],f=0):2===r.length?(s=r[0],l=r[1],u=o[0],f=o[1]):de.raise("invalid shape");var d=Array.isArray(t.data)?p.dtype:ut(t.data),m=Le.allocType(d,s*l);ht(m,t.data,s,l,u,f,t.offset),h(m,n),Le.freeType(m)}else de.raise("invalid data for buffer subdata");return c}e.bufferCount++;var p=new n(a);return f[p.id]=p,o||c(i),c._reglType="buffer",c._buffer=p,c.subdata=d,r.profile&&(c.stats=p.stats),c.destroy=function(){l(p)},c}function c(){xe(f).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}var h=0,f={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){l(this)};var d=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(f).forEach(function(e){t+=f[e].stats.size}),t}),{create:u,createStream:i,destroyStream:a,clear:function(){xe(f).forEach(l),d.forEach(l)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:c,_initBuffer:s}}function dt(t,e,r,n){function i(t){this.id=h++,c[this.id]=this,this.buffer=t,this.primType=qe,this.vertCount=0,this.type=0}function a(t){var e=d.pop();return e||(e=new i(r.create(null,Je,!0,!1)._buffer)),s(e,t,Ke,-1,-1,0,0),e}function o(t){d.push(t)}function s(n,i,a,o,s,l,u){if(n.buffer.bind(),i){var c=u;u||Qt(i)&&(!Z(i)||Qt(i.data))||(c=e.oes_element_index_uint?Ze:Xe),r._initBuffer(n.buffer,i,a,c,3)}else t.bufferData(Je,l,a),n.buffer.dtype=h||Ge,n.buffer.usage=a,n.buffer.dimension=3,n.buffer.byteLength=l;var h=u;if(!u){switch(n.buffer.dtype){case Ge:case He:h=Ge;break;case Xe:case Ye:h=Xe;break;case Ze:case We:h=Ze;break;default:de.raise("unsupported type for element array")}n.buffer.dtype=h}n.type=h,de(h!==Ze||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var f=s;f<0&&(f=n.buffer.byteLength,h===Xe?f>>=1:h===Ze&&(f>>=2)),n.vertCount=f;var d=o;if(o<0){d=qe;var p=n.buffer.dimension;1===p&&(d=Ue),2===p&&(d=Ve),3===p&&(d=qe)}n.primType=d}function l(t){n.elementsCount--,de(null!==t.buffer,"must not double destroy elements"),delete c[t.id],t.buffer.destroy(),t.buffer=null}function u(t,e){function a(t){if(t)if("number"==typeof t)o(t),u.primType=qe,u.vertCount=0|t,u.type=Ge;else{var e=null,r=Qe,n=-1,i=-1,l=0,c=0;Array.isArray(t)||Qt(t)||Z(t)?e=t:(de.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,de(Array.isArray(e)||Qt(e)||Z(e),"invalid data for element buffer")),"usage"in t&&(de.parameter(t.usage,Ie,"invalid element buffer usage"),r=Ie[t.usage]),"primitive"in t&&(de.parameter(t.primitive,Be,"invalid element buffer primitive"),n=Be[t.primitive]),"count"in t&&(de("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),i=0|t.count),"type"in t&&(de.parameter(t.type,f,"invalid buffer type"),c=f[t.type]),"length"in t?l=0|t.length:(l=i,c===Xe||c===Ye?l*=2:c!==Ze&&c!==We||(l*=4))),s(u,e,r,n,i,l,c)}else o(),u.primType=qe,u.vertCount=0,u.type=Ge;return a}var o=r.create(null,Je,!0),u=new i(o._buffer);return n.elementsCount++,a(t),a._reglType="elements",a._elements=u,a.subdata=function(t,e){return o.subdata(t,e),a},a.destroy=function(){l(u)},a}var c={},h=0,f={uint8:Ge,uint16:Xe};e.oes_element_index_uint&&(f.uint32=Ze),i.prototype.bind=function(){this.buffer.bind()};var d=[];return{create:u,createStream:a,destroyStream:o,getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){xe(c).forEach(l)}}}function pt(t){for(var e=Le.allocType(er,t.length),r=0;r>>31<<15,a=(n<<1>>>24)-127,o=n>>13&1023;if(a<-24)e[r]=i;else if(a<-14){var s=-14-a;e[r]=i+(o+1024>>s)}else e[r]=a>15?i+31744:i+(a+15<<10)+o}return e}function mt(t){return Array.isArray(t)||Qt(t)}function gt(t){return"[object "+t+"]"}function vt(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function yt(t){return!!Array.isArray(t)&&!(0===t.length||!mt(t[0]))}function bt(t){return Object.prototype.toString.call(t)}function xt(t){return bt(t)===dn}function _t(t){return bt(t)===pn}function wt(t){return bt(t)===mn}function Mt(t){return bt(t)===gn}function kt(t){if(!t)return!1;var e=bt(t);return vn.indexOf(e)>=0||(vt(t)||yt(t)||Z(t))}function At(t){return 0|Kt[Object.prototype.toString.call(t)]}function Tt(t,e){var r=e.length;switch(t.type){case Or:case Fr:case Rr:case jr:var n=Le.allocType(t.type,r);n.set(e),t.data=n;break;case wr:t.data=pt(e);break;default:de.raise("unsupported texture type, must specify a typed array")}}function St(t,e){return Le.allocType(t.type===wr?jr:t.type,e)}function Et(t,e){t.type===wr?(t.data=pt(e),Le.freeType(e)):t.data=e}function Lt(t,e,r,n,i,a){ +for(var o=t.width,s=t.height,l=t.channels,u=o*s*l,c=St(t,u),h=0,f=0;f=1;)s+=o*l*l,l/=2;return s}return o*r*n}function zt(t,e,r,n,i,a,o){function s(){this.internalformat=or,this.format=or,this.type=Or,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function u(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(de.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(de.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(de.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(de.parameter(n.colorSpace,j,"invalid colorSpace"),t.colorSpace=j[n.colorSpace]),"type"in n){var i=n.type;de(e.oes_texture_float||!("float"===i||"float32"===i),"you must enable the OES_texture_float extension in order to use floating point textures."),de(e.oes_texture_half_float||!("half float"===i||"float16"===i),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),de(e.webgl_depth_texture||!("uint16"===i||"uint32"===i||"depth stencil"===i),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(i,N,"invalid texture type"),t.type=N[i]}var a=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(de(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),a=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],de(s>0&&s<=4,"invalid number of channels"),l=!0),de(a>=0&&a<=r.maxTextureSize,"invalid width"),de(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(a=o=n.radius,de(a>=0&&a<=r.maxTextureSize,"invalid radius")),"width"in n&&(a=n.width,de(a>=0&&a<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,de(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,de(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|a,t.height=0|o,t.channels=0|s;var u=!1;if("format"in n){var c=n.format;de(e.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),de.parameter(c,B,"invalid texture format");var h=t.internalformat=B[c];t.format=J[h],c in N&&("type"in n||(t.type=N[c])),c in U&&(t.compressed=!0),u=!0}!l&&u?t.channels=fn[t.format]:l&&!u?t.channels!==hn[t.format]&&(t.format=t.internalformat=hn[t.channels]):u&&l&&de(t.channels===fn[t.format],"number of channels inconsistent with specified format")}}function c(e){t.pixelStorei(an,e.flipY),t.pixelStorei(on,e.premultiplyAlpha),t.pixelStorei(sn,e.colorSpace),t.pixelStorei(nn,e.unpackAlignment)}function h(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function f(t,e){var n=null;if(kt(e)?n=e:e&&(de.type(e,"object","invalid pixel data type"),u(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),kt(e.data)&&(n=e.data)),de(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){de(!n,"can not specify copy and data field for the same texture");var a=i.viewportWidth,o=i.viewportHeight;t.width=t.width||a-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,de(t.xOffset>=0&&t.xOffset=0&&t.yOffset0&&t.width<=a&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(Qt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Or||(t.type=At(n));else if(vt(n))t.channels=t.channels||4,Tt(t,n),t.alignment=1,t.needsFree=!0;else if(Z(n)){var s=n.data;Array.isArray(s)||t.type!==Or||(t.type=At(s));var l,c,h,f,d,p,m=n.shape,g=n.stride;3===m.length?(h=m[2],p=g[2]):(de(2===m.length,"invalid ndarray pixel data, must be 2 or 3D"),h=1,p=1),l=m[0],c=m[1],f=g[0],d=g[1],t.alignment=1,t.width=l,t.height=c,t.channels=h,t.format=t.internalformat=hn[h],t.needsFree=!0,Lt(t,s,f,d,p,n.offset)}else if(xt(n)||_t(n))xt(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(wt(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(Mt(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(yt(n)){var v=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=mt(n[0][0])?b||n[0][0].length:b||1;for(var x=Ce.shape(n),_=1,w=0;w=0,"oes_texture_float extension not enabled"):t.type===wr&&de(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,i){var a=e.element,o=e.data,s=e.internalformat,l=e.format,u=e.type,h=e.width,f=e.height;c(e),a?t.texImage2D(r,i,l,l,u,a):e.compressed?t.compressedTexImage2D(r,i,s,h,f,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,i,l,e.xOffset,e.yOffset,h,f,0)):t.texImage2D(r,i,l,h,f,0,l,u,o)}function p(e,r,i,a,o){var s=e.element,l=e.data,u=e.internalformat,h=e.format,f=e.type,d=e.width,p=e.height;c(e),s?t.texSubImage2D(r,o,i,a,h,f,s):e.compressed?t.compressedTexSubImage2D(r,o,i,a,u,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,i,a,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,i,a,d,p,h,f,l)}function m(){return K.pop()||new h}function g(t){t.needsFree&&Le.freeType(t.data),h.call(t),K.push(t)}function v(){s.call(this),this.genMipmaps=!1,this.mipmapHint=$r,this.mipmask=0,this.images=Array(16)}function y(t,e,r){var n=t.images[0]=m();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function b(t,e){var r=null;if(kt(e))r=t.images[0]=m(),l(r,t),f(r,e),t.mipmask=1;else if(u(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,i=0;i>=i,r.height>>=i,f(r,n[i]),t.mipmask|=1<=0&&(t.genMipmaps=!0)}if("mag"in e){var i=e.mag;de.parameter(i,F),t.magFilter=F[i]}var a=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(de.parameter(s,O),a=o=O[s]):Array.isArray(s)&&(de.parameter(s[0],O),de.parameter(s[1],O),a=O[s[0]],o=O[s[1]])}else{if("wrapS"in e){var l=e.wrapS;de.parameter(l,O),a=O[l]}if("wrapT"in e){var u=e.wrapT;de.parameter(u,O),o=O[u]}}if(t.wrapS=a,t.wrapT=o,"anisotropic"in e){var c=e.anisotropic;de("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var h=!1;switch(typeof e.mipmap){case"string":de.parameter(e.mipmap,P,"invalid mipmap hint"),t.mipmapHint=P[e.mipmap],t.genMipmaps=!0,h=!0;break;case"boolean":h=t.genMipmaps=e.mipmap;break;case"object":de(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,h=!0;break;default:de.raise("invalid mipmap type")}!h||"min"in e||(t.minFilter=Wr)}}function A(r,n){t.texParameteri(n,Gr,r.minFilter),t.texParameteri(n,Hr,r.magFilter),t.texParameteri(n,Nr,r.wrapS),t.texParameteri(n,Br,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,rn,r.anisotropic),r.genMipmaps&&(t.hint(Qr,r.mipmapHint),t.generateMipmap(n))}function T(e){s.call(this),this.mipmask=0,this.internalformat=or,this.id=$++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new M,o.profile&&(this.stats={size:0})}function S(e){t.activeTexture(un),t.bindTexture(e.target,e.texture)}function E(){var e=rt[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(nr,null)}function L(e){var r=e.texture;de(r,"must not double destroy texture");var n=e.unit,i=e.target;n>=0&&(t.activeTexture(un+n),t.bindTexture(i,null),rt[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete tt[e.id],a.textureCount--}function C(e,n){function i(t,e){var n=c.texInfo;M.call(n);var a=_();return"number"==typeof t?"number"==typeof e?y(a,0|t,0|e):y(a,0|t,0|t):t?(de.type(t,"object","invalid arguments to regl.texture"),k(n,t),b(a,t)):y(a,1,1),n.genMipmaps&&(a.mipmask=(a.width<<1)-1),c.mipmask=a.mipmask,l(c,a),de.texture2D(n,a,r),c.internalformat=a.internalformat,i.width=a.width,i.height=a.height,S(c),x(a,nr),A(n,nr),E(),w(a),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,a.width,a.height,n.genMipmaps,!1)),i.format=H[c.internalformat],i.type=G[c.type],i.mag=Y[n.magFilter],i.min=X[n.minFilter],i.wrapS=W[n.wrapS],i.wrapT=W[n.wrapT],i}function s(t,e,r,n){de(!!t,"must specify image data");var a=0|e,o=0|r,s=0|n,u=m();return l(u,c),u.width=0,u.height=0,f(u,t),u.width=u.width||(c.width>>s)-a,u.height=u.height||(c.height>>s)-o,de(c.type===u.type&&c.format===u.format&&c.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(a>=0&&o>=0&&a+u.width<=c.width&&o+u.height<=c.height,"texture.subimage write out of bounds"),de(c.mipmask&1<>s;++s)t.texImage2D(nr,s,c.format,n>>s,a>>s,0,c.format,c.type,null);return E(),o.profile&&(c.stats.size=Ct(c.internalformat,c.type,n,a,!1,!1)),i}var c=new T(nr);return tt[c.id]=c,a.textureCount++,i(e,n),i.subimage=s,i.resize=u,i._reglType="texture2d",i._texture=c,o.profile&&(i.stats=c.stats),i.destroy=function(){c.decRef()},i}function z(e,n,i,s,c,h){function d(t,e,n,i,a,s){var c,h=C.texInfo;for(M.call(h),c=0;c<6;++c)z[c]=_();if("number"!=typeof t&&t)if("object"==typeof t)if(e)b(z[0],t),b(z[1],e),b(z[2],n),b(z[3],i),b(z[4],a),b(z[5],s);else if(k(h,t),u(C,t),"faces"in t){var f=t.faces;for(de(Array.isArray(f)&&6===f.length,"cube faces must be a length 6 array"),c=0;c<6;++c)de("object"==typeof f[c]&&!!f[c],"invalid input for cube map face"),l(z[c],C),b(z[c],f[c])}else for(c=0;c<6;++c)b(z[c],t);else de.raise("invalid arguments to cube map");else{var p=0|t||1;for(c=0;c<6;++c)y(z[c],p,p)}for(l(C,z[0]),h.genMipmaps?C.mipmask=(z[0].width<<1)-1:C.mipmask=z[0].mipmask,de.textureCube(C,h,z,r),C.internalformat=z[0].internalformat,d.width=z[0].width,d.height=z[0].height,S(C),c=0;c<6;++c)x(z[c],ar+c);for(A(h,ir),E(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,h.genMipmaps,!0)),d.format=H[C.internalformat],d.type=G[C.type],d.mag=Y[h.magFilter],d.min=X[h.minFilter],d.wrapS=W[h.wrapS],d.wrapT=W[h.wrapT],c=0;c<6;++c)w(z[c]);return d}function v(t,e,r,n,i){de(!!e,"must specify image data"),de("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var a=0|r,o=0|n,s=0|i,u=m();return l(u,C),u.width=0,u.height=0,f(u,e),u.width=u.width||(C.width>>s)-a,u.height=u.height||(C.height>>s)-o,de(C.type===u.type&&C.format===u.format&&C.internalformat===u.internalformat,"incompatible format for texture.subimage"),de(a>=0&&o>=0&&a+u.width<=C.width&&o+u.height<=C.height,"texture.subimage write out of bounds"),de(C.mipmask&1<>i;++i)t.texImage2D(ar+n,i,C.format,r>>i,r>>i,0,C.format,C.type,null);return E(),o.profile&&(C.stats.size=Ct(C.internalformat,C.type,d.width,d.height,!1,!0)),d}}var C=new T(ir);tt[C.id]=C,a.cubeCount++;var z=new Array(6);return d(e,n,i,s,c,h),d.subimage=v,d.resize=L,d._reglType="textureCube",d._texture=C,o.profile&&(d.stats=C.stats),d.destroy=function(){C.decRef()},d}function I(){for(var e=0;e>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(ar+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);A(e.texInfo,e.target)})}var P={"don't care":$r,"dont care":$r,nice:en,fast:tn},O={repeat:Ur,clamp:Vr,mirror:qr},F={nearest:Yr,linear:Xr},R=$t({mipmap:Kr,"nearest mipmap nearest":Wr,"linear mipmap nearest":Zr,"nearest mipmap linear":Jr,"linear mipmap linear":Kr},F),j={none:0,browser:ln},N={uint8:Or,rgba4:pr,rgb565:gr,"rgb5 a1":mr},B={alpha:sr,luminance:ur,"luminance alpha":cr,rgb:lr,rgba:or,rgba4:hr,"rgb5 a1":fr,rgb565:dr},U={};e.ext_srgb&&(B.srgb=xr,B.srgba=_r),e.oes_texture_float&&(N.float32=N.float=jr),e.oes_texture_half_float&&(N.float16=N["half float"]=wr),e.webgl_depth_texture&&($t(B,{depth:yr,"depth stencil":br}),$t(N,{uint16:Fr,uint32:Rr,"depth stencil":vr})),e.webgl_compressed_texture_s3tc&&$t(U,{"rgb s3tc dxt1":Mr,"rgba s3tc dxt1":kr,"rgba s3tc dxt3":Ar,"rgba s3tc dxt5":Tr}),e.webgl_compressed_texture_atc&&$t(U,{"rgb atc":Sr,"rgba atc explicit alpha":Er,"rgba atc interpolated alpha":Lr}),e.webgl_compressed_texture_pvrtc&&$t(U,{"rgb pvrtc 4bppv1":Cr,"rgb pvrtc 2bppv1":zr,"rgba pvrtc 4bppv1":Ir,"rgba pvrtc 2bppv1":Dr}),e.webgl_compressed_texture_etc1&&(U["rgb etc1"]=Pr);var V=Array.prototype.slice.call(t.getParameter(rr));Object.keys(U).forEach(function(t){var e=U[t];V.indexOf(e)>=0&&(B[t]=e)});var q=Object.keys(B);r.textureFormats=q;var H=[];Object.keys(B).forEach(function(t){var e=B[t];H[e]=t});var G=[];Object.keys(N).forEach(function(t){var e=N[t];G[e]=t});var Y=[];Object.keys(F).forEach(function(t){var e=F[t];Y[e]=t});var X=[];Object.keys(R).forEach(function(t){var e=R[t];X[e]=t});var W=[];Object.keys(O).forEach(function(t){var e=O[t];W[e]=t});var J=q.reduce(function(t,e){var r=B[e];return r===ur||r===sr||r===ur||r===cr||r===yr||r===br?t[r]=r:r===fr||e.indexOf("rgba")>=0?t[r]=or:t[r]=lr,t},{}),K=[],Q=[],$=0,tt={},et=r.maxTextureUnits,rt=Array(et).map(function(){return null});return $t(T.prototype,{bind:function(){var e=this;e.bindCount+=1;var r=e.unit;if(r<0){for(var n=0;n0)continue;i.unit=-1}rt[n]=e,r=n;break}r>=et&&de.raise("insufficient number of texture units"),o.profile&&a.maxTextureUnits=Sn&&e=2,"invalid shape for framebuffer"),u=I[0],d=I[1]}else"radius"in z&&(u=d=z.radius),"width"in z&&(u=z.width),"height"in z&&(d=z.height);("color"in z||"colors"in z)&&(y=z.color||z.colors,Array.isArray(y)&&de(1===y.length||o,"multiple render targets not supported")),y||("colorCount"in z&&(T=0|z.colorCount,de(T>0,"invalid color buffer count")),"colorTexture"in z&&(b=!!z.colorTexture,x="rgba4"),"colorType"in z&&(A=z.colorType,b?(de(e.oes_texture_float||!("float"===A||"float32"===A),"you must enable OES_texture_float in order to use floating point framebuffer objects"),de(e.oes_texture_half_float||!("half float"===A||"float16"===A),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===A||"float16"===A?(de(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),x="rgba16f"):"float"!==A&&"float32"!==A||(de(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),x="rgba32f"),de.oneOf(A,k,"invalid color type")),"colorFormat"in z&&(x=z.colorFormat,w.indexOf(x)>=0?b=!0:M.indexOf(x)>=0?b=!1:b?de.oneOf(z.colorFormat,w,"invalid color format for texture"):de.oneOf(z.colorFormat,M,"invalid color format for renderbuffer"))),("depthTexture"in z||"depthStencilTexture"in z)&&(C=!(!z.depthTexture&&!z.depthStencilTexture),de(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in z&&("boolean"==typeof z.depth?p=z.depth:(S=z.depth,g=!1)),"stencil"in z&&("boolean"==typeof z.stencil?g=z.stencil:(E=z.stencil,p=!1)),"depthStencil"in z&&("boolean"==typeof z.depthStencil?p=g=z.depthStencil:(L=z.depthStencil,p=!1,g=!1))}else u=d=1;var D=null,P=null,O=null,F=null;if(Array.isArray(y))D=y.map(c);else if(y)D=[c(y)];else for(D=new Array(T),a=0;a=0||D[a].renderbuffer&&Bn.indexOf(D[a].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+a+" is invalid"),D[a]&&D[a].texture){var j=On[D[a].texture._texture.format]*Fn[D[a].texture._texture.type];null===R?R=j:de(R===j,"all color attachments much have the same number of bits per pixel.")}return l(P,u,d),de(!P||P.texture&&P.texture._texture.format===Dn||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Rn,"invalid depth attachment for framebuffer object"),l(O,u,d),de(!O||O.renderbuffer&&O.renderbuffer._renderbuffer.format===jn,"invalid stencil attachment for framebuffer object"),l(F,u,d),de(!F||F.texture&&F.texture._texture.format===Nn||F.renderbuffer&&F.renderbuffer._renderbuffer.format===Nn,"invalid depth-stencil attachment for framebuffer object"),m(s),s.width=u,s.height=d,s.colorAttachments=D,s.depthAttachment=P,s.stencilAttachment=O,s.depthStencilAttachment=F,i.color=D.map(f),i.depth=f(P),i.stencil=f(O),i.depthStencil=f(F),i.width=s.width,i.height=s.height,v(s),i}function o(t,e){de(_.next!==s,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===s.width&&n===s.height)return i;for(var a=s.colorAttachments,o=0;o=2,"invalid shape for framebuffer"),de(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&de(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(u=d.color||d.colors,Array.isArray(u)&&de(1===u.length||a,"multiple render targets not supported")),u||("colorCount"in d&&(f=0|d.colorCount,de(f>0,"invalid color buffer count")),"colorType"in d&&(de.oneOf(d.colorType,k,"invalid color type"),h=d.colorType),"colorFormat"in d&&(c=d.colorFormat,de.oneOf(d.colorFormat,w,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var m;if(u)if(Array.isArray(u))for(m=[],r=0;r0&&(s.depth=o[0].depth,s.stencil=o[0].stencil,s.depthStencil=o[0].depthStencil),o[r]?o[r](s):o[r]=y(s)}return $t(i,{width:l,height:l,color:m})}function a(t){var e,n=0|t;if(de(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===i.width)return i;var a=i.color;for(e=0;e1)for(var m=0;mt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return d.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);xe(c).forEach(e),c={},xe(h).forEach(e),h={},d.forEach(function(e){t.deleteProgram(e.program)}),d.length=0,f={},r.shaderCount=0},program:function(t,e,n){de.command(t>=0,"missing vertex shader",n),de.command(e>=0,"missing fragment shader",n);var i=f[e];i||(i=f[e]={});var a=i[t];return a||(a=new s(e,t),r.shaderCount++,l(a,n),i[t]=a,d.push(a)),a},restore:u,shader:o,frag:-1,vert:-1}}function Rt(t,e,r,n,i,a){function o(o){var s;null===e.next?(de(i.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=Wn):(de(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,a.oes_texture_float?de(s===Wn||s===Jn,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):de(s===Wn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,u=0,c=n.framebufferWidth,h=n.framebufferHeight,f=null;Qt(o)?f=o:o&&(de.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,u=0|o.y,de(l>=0&&l=0&&u0&&c+l<=n.framebufferWidth,"invalid width for read pixels"),de(h>0&&h+u<=n.framebufferHeight,"invalid height for read pixels"),r();var d=c*h*4;return f||(s===Wn?f=new Uint8Array(d):s===Jn&&(f=f||new Float32Array(d))),de.isTypedArray(f,"data buffer for regl.read() must be a typedarray"),de(f.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(Zn,4),t.readPixels(l,u,c,h,Xn,s,f),f}function s(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}function l(t){return t&&"framebuffer"in t?s(t):o(t)}return l}function jt(t){return Array.prototype.slice.call(t)}function Nt(t){return jt(t).join("")}function Bt(){function t(t){for(var e=0;e0&&(r.push(t,"="),r.push.apply(r,jt(arguments)),r.push(";")),t}var r=[],n=[];return $t(t,{def:e,toString:function(){return Nt([n.length>0?"var "+n+";":"",Nt(r)])}})}function r(){function t(t,e){n(t,e,"=",r.def(t,e),";")}var r=e(),n=e(),i=r.toString,a=n.toString;return $t(function(){r.apply(r,jt(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,i){t(e,n),r(e,n,"=",i,";")},toString:function(){return i()+a()}})}function n(){var t=Nt(arguments),e=r(),n=r(),i=e.toString,a=n.toString;return $t(e,{then:function(){return e.apply(e,jt(arguments)),this},else:function(){return n.apply(n,jt(arguments)),this},toString:function(){var e=a();return e&&(e="else{"+e+"}"),Nt(["if(",t,"){",i(),"}",e])}})}function i(t,e){function n(){var t="a"+i.length;return i.push(t),t}var i=[];e=e||0;for(var a=0;a=1,n>=2,e)}if(r===ai){var i=t.data;return new qt(i.thisDep,i.contextDep,i.propDep,e)}return new qt(r===ii,r===ni,r===ri,e)}function Xt(t,e,r,n,i,a,o,s,l,u,c,h,f,d,p){function m(t){return t.replace(".","_")}function g(t,e,r){var n=m(t);et.push(t),tt[n]=$[n]=!!r,rt[n]=e}function v(t,e,r){var n=m(t);et.push(t), +Array.isArray(r)?($[n]=r.slice(),tt[n]=r.slice()):$[n]=tt[n]=r,nt[n]=e}function y(){var t=Bt(),r=t.link,n=t.global;t.id=ot++,t.batchId="0";var i=r(it),a=t.shared={props:"a0"};Object.keys(it).forEach(function(t){a[t]=n.def(i,".",t)}),de.optional(function(){t.CHECK=r(de),t.commandStr=de.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},at.invalidBlendCombinations=Ua});var o=t.next={},s=t.current={};Object.keys(nt).forEach(function(t){Array.isArray($[t])&&(o[t]=n.def(a.next,".",t),s[t]=n.def(a.current,".",t))});var l=t.constants={};Object.keys(at).forEach(function(t){l[t]=n.def(JSON.stringify(at[t]))}),t.invoke=function(e,n){switch(n.type){case ei:var i=["this",a.context,a.props,t.batchId];return e.def(r(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case ri:return e.def(a.props,n.data);case ni:return e.def(a.context,n.data);case ii:return e.def("this",n.data);case ai:return n.data.append(t,e),n.data.ref}},t.attribCache={};var c={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in c)return c[n];var i=u.scope[n];return i||(i=u.scope[n]=new W),c[n]=r(i)},t}function b(t){var e,r=t.static,n=t.dynamic;if(Di in r){var i=!!r[Di];e=Gt(function(t,e){return i}),e.enable=i}else if(Di in n){var a=n[Di];e=Yt(a,function(t,e){return t.invoke(e,a)})}return e}function x(t,e){var r=t.static,n=t.dynamic;if(Pi in r){var i=r[Pi];return i?(i=s.getFramebuffer(i),de.command(i,"invalid framebuffer object"),Gt(function(t,e){var r=t.link(i),n=t.shared;e.set(n.framebuffer,".next",r);var a=n.context;return e.set(a,"."+Vi,r+".width"),e.set(a,"."+qi,r+".height"),r})):Gt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Vi,n+"."+Yi),e.set(n,"."+qi,n+"."+Xi),"null"})}if(Pi in n){var a=n[Pi];return Yt(a,function(t,e){var r=t.invoke(e,a),n=t.shared,i=n.framebuffer,o=e.def(i,".getFramebuffer(",r,")");de.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(i,".next",o);var s=n.context;return e.set(s,"."+Vi,o+"?"+o+".width:"+s+"."+Yi),e.set(s,"."+qi,o+"?"+o+".height:"+s+"."+Xi),o})}return null}function _(t,e,r){function n(t){if(t in i){var n=i[t];de.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,u=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,de.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,de.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new qt(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,i=o;"width"in n||(i=e.def(r,".",Vi,"-",u));var a=s;return"height"in n||(a=e.def(r,".",qi,"-",c)),[u,c,i,a]})}if(t in a){var h=a[t],f=Yt(h,function(e,r){var n=e.invoke(r,h);de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var i=e.shared.context,a=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",i,".",Vi,"-",a,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",i,".",qi,"-",o,")");return de.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[a,o,s,l]});return e&&(f.thisDep=f.thisDep||e.thisDep,f.contextDep=f.contextDep||e.contextDep,f.propDep=f.propDep||e.propDep),f}return e?new qt(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Vi),e.def(r,".",qi)]}):null}var i=t.static,a=t.dynamic,o=n(Ii);if(o){var s=o;o=new qt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+Hi,r[2]),e.set(n,"."+Gi,r[3]),r})}return{viewport:o,scissor_box:n(zi)}}function w(t){function r(t){if(t in i){var r=e.id(i[t]);de.optional(function(){c.shader(Ha[t],r,de.guessCommand())});var n=Gt(function(){return r});return n.id=r,n}if(t in a){var o=a[t];return Yt(o,function(e,r){var n=e.invoke(r,o),i=r.def(e.shared.strings,".id(",n,")");return de.optional(function(){r(e.shared.shader,".shader(",Ha[t],",",i,",",e.command,");")}),i})}return null}var n,i=t.static,a=t.dynamic,o=r(Fi),s=r(Oi),l=null;return Ht(o)&&Ht(s)?(l=c.program(s.id,o.id),n=Gt(function(t,e){return t.link(l)})):n=new qt(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",Fi);var i;i=s?s.append(t,e):e.def(n,".",Oi);var a=n+".program("+i+","+r;return de.optional(function(){a+=","+t.command}),e.def(a+")")}),{frag:o,vert:s,progVar:n,program:l}}function M(t,e){function r(t,r){if(t in n){var a=0|n[t];return de.command(!r||a>=0,"invalid "+t,e.commandStr),Gt(function(t,e){return r&&(t.OFFSET=a),a})}if(t in i){var s=i[t];return Yt(s,function(e,n){var i=e.invoke(n,s);return r&&(e.OFFSET=i,de.optional(function(){e.assert(n,i+">=0","invalid "+t)})),i})}return r&&o?Gt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,i=t.dynamic,o=function(){if(Ri in n){var t=n[Ri];Ut(t)?t=a.getElements(a.create(t,!0)):t&&(t=a.getElements(t),de.command(t,"invalid elements",e.commandStr));var r=Gt(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Ri in i){var o=i[Ri];return Yt(o,function(t,e){var r=t.shared,n=r.isBufferArgs,i=r.elements,a=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",a,")"),u=t.cond(l).then(s,"=",i,".createStream(",a,");").else(s,"=",i,".getElements(",a,");");return de.optional(function(){t.assert(u.else,"!"+a+"||"+s,"invalid elements")}),e.entry(u),e.exit(t.cond(l).then(i,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(Bi,!0);return{elements:o,primitive:function(){if(ji in n){var t=n[ji];return de.commandParameter(t,Be,"invalid primitve",e.commandStr),Gt(function(e,r){return Be[t]})}if(ji in i){var r=i[ji];return Yt(r,function(t,e){var n=t.constants.primTypes,i=t.invoke(e,r);return de.optional(function(){t.assert(e,i+" in "+n,"invalid primitive, must be one of "+Object.keys(Be))}),e.def(n,"[",i,"]")})}return o?Ht(o)?Gt(o.value?function(t,e){return e.def(t.ELEMENTS,".primType")}:function(){return Aa}):new qt(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Aa)}):null}(),count:function(){if(Ni in n){var t=0|n[Ni];return de.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),Gt(function(){return t})}if(Ni in i){var r=i[Ni];return Yt(r,function(t,e){var n=t.invoke(e,r);return de.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(Ht(o)){if(o)return s?new qt(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return de.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):Gt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var a=Gt(function(){return-1});return de.optional(function(){a.MISSING=!0}),a}var l=new qt(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return de.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Ui,!1),offset:s}}function k(t,e){var r=t.static,i=t.dynamic,a={};return et.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);a[s]=Gt(function(){return o})}else if(t in i){var l=i[t];a[s]=Yt(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=m(t);switch(t){case gi:case si:case oi:case Ai:case hi:case Ci:case xi:case wi:case Mi:case pi:return o(function(r){return de.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return de.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case fi:return o(function(r){return de.commandParameter(r,Va,"invalid "+t,e.commandStr),Va[r]},function(e,r,n){var i=e.constants.compareFuncs;return de.optional(function(){e.assert(r,n+" in "+i,"invalid "+t+", must be one of "+Object.keys(Va))}),r.def(i,"[",n,"]")});case di:return o(function(t){return de.command(mt(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case ci:return o(function(t){de.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,a="dstAlpha"in t?t.dstAlpha:t.dst;return de.commandParameter(r,Ba,s+".srcRGB",e.commandStr),de.commandParameter(n,Ba,s+".srcAlpha",e.commandStr),de.commandParameter(i,Ba,s+".dstRGB",e.commandStr),de.commandParameter(a,Ba,s+".dstAlpha",e.commandStr),de.command(-1===Ua.indexOf(r+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+i+")",e.commandStr),[Ba[r],Ba[i],Ba[n],Ba[a]]},function(e,r,n){function i(i,o){var s=r.def('"',i,o,'" in ',n,"?",n,".",i,o,":",n,".",i);return de.optional(function(){e.assert(r,s+" in "+a,"invalid "+t+"."+i+o+", must be one of "+Object.keys(Ba))}),s}var a=e.constants.blendFuncs;de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=i("src","RGB"),s=i("dst","RGB");de.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(a,"[",o,"]"),u=r.def(a,"[",i("src","Alpha"),"]");return[l,r.def(a,"[",s,"]"),u,r.def(a,"[",i("dst","Alpha"),"]")]});case ui:return o(function(r){return"string"==typeof r?(de.commandParameter(r,Z,"invalid "+t,e.commandStr),[Z[r],Z[r]]):"object"==typeof r?(de.commandParameter(r.rgb,Z,t+".rgb",e.commandStr),de.commandParameter(r.alpha,Z,t+".alpha",e.commandStr),[Z[r.rgb],Z[r.alpha]]):void de.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var i=e.constants.blendEquations,a=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return de.optional(function(){function r(t,r,n){e.assert(t,n+" in "+i,"invalid "+r+", must be one of "+Object.keys(Z))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(a,"=",o,"=",i,"[",n,"];"),s.else(a,"=",i,"[",n,".rgb];",o,"=",i,"[",n,".alpha];"),r(s),[a,o]});case li:return o(function(t){return de.command(mt(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),J(4,function(e){return+t[e]})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),J(4,function(t){return e.def("+",r,"[",t,"]")})});case Ti:return o(function(t){return de.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Si:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",i=r.ref||0,a="mask"in r?r.mask:-1;return de.commandParameter(n,Va,t+".cmp",e.commandStr),de.commandType(i,"number",t+".ref",e.commandStr),de.commandType(a,"number",t+".mask",e.commandStr),[Va[n],i,a]},function(t,e,r){var n=t.constants.compareFuncs;return de.optional(function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(r+"&&typeof ",r,'==="object"'),i('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Da),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case Ei:case Li:return o(function(r){de.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",i=r.zfail||"keep",a=r.zpass||"keep";return de.commandParameter(n,qa,t+".fail",e.commandStr),de.commandParameter(i,qa,t+".zfail",e.commandStr),de.commandParameter(a,qa,t+".zpass",e.commandStr),[t===Li?Sa:Ta,qa[n],qa[i],qa[a]]},function(e,r,n){function i(i){return de.optional(function(){e.assert(r,'!("'+i+'" in '+n+")||("+n+"."+i+" in "+a+")","invalid "+t+"."+i+", must be one of "+Object.keys(qa))}),r.def('"',i,'" in ',n,"?",a,"[",n,".",i,"]:",Da)}var a=e.constants.stencilOps;return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Li?Sa:Ta,i("fail"),i("zfail"),i("zpass")]});case _i:return o(function(t){de.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return de.commandType(r,"number",s+".factor",e.commandStr),de.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return de.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case vi:return o(function(t){var r=0;return"front"===t?r=Ta:"back"===t&&(r=Sa),de.command(!!r,s,e.commandStr),r},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Ta,":",Sa)});case bi:return o(function(t){return de.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return de.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case yi:return o(function(t){return de.commandParameter(t,Ga,s,e.commandStr),Ga[t]},function(t,e,r){return de.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+Ea+":"+La)});case mi:return o(function(t){return de.command(mt(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return de.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),J(4,function(t){return"!!"+r+"["+t+"]"})});case ki:return o(function(t){de.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return de.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return de.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),a}function A(t,e){var r=t.static,n=t.dynamic,i={};return Object.keys(r).forEach(function(t){var n,a=r[t];if("number"==typeof a||"boolean"==typeof a)n=Gt(function(){return a});else if("function"==typeof a){var o=a._reglType;"texture2d"===o||"textureCube"===o?n=Gt(function(t){return t.link(a)}):"framebuffer"===o||"framebufferCube"===o?(de.command(a.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=Gt(function(t){return t.link(a.color[0])})):de.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else mt(a)?n=Gt(function(e){return e.global.def("[",J(a.length,function(r){return de.command("number"==typeof a[r]||"boolean"==typeof a[r],"invalid uniform "+t,e.commandStr),a[r]}),"]")}):de.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=a,i[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];i[t]=Yt(e,function(t,r){return t.invoke(r,e)})}),i}function T(t,r){var n=t.static,a=t.dynamic,o={};return Object.keys(n).forEach(function(t){var a=n[t],s=e.id(t),l=new W;if(Ut(a))l.state=$n,l.buffer=i.getBuffer(i.create(a,Zi,!1,!0)),l.type=0;else{var u=i.getBuffer(a);if(u)l.state=$n,l.buffer=u,l.type=0;else if(de.command("object"==typeof a&&a,"invalid data for attribute "+t,r.commandStr),a.constant){var c=a.constant;l.buffer="null",l.state=ti,"number"==typeof c?l.x=c:(de.command(mt(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+t,r.commandStr),Kn.forEach(function(t,e){e=0,'invalid offset for attribute "'+t+'"',r.commandStr);var f=0|a.stride;de.command(f>=0&&f<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|a.size;de.command(!("size"in a)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!a.normalized,m=0;"type"in a&&(de.commandParameter(a.type,ze,"invalid type for attribute "+t,r.commandStr),m=ze[a.type]);var g=0|a.divisor;"divisor"in a&&(de.command(0===g||K,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),de.command(g>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),de.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(a).forEach(function(r){de.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=u,l.state=$n,l.size=d,l.normalized=p,l.type=m||u.dtype,l.offset=h,l.stride=f,l.divisor=g}}o[t]=Gt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(a).forEach(function(t){function e(e,n){function i(t){n(u[t],"=",a,".",t,"|0;")}var a=e.invoke(n,r),o=e.shared,s=o.isBufferArgs,l=o.buffer;de.optional(function(){e.assert(n,a+"&&(typeof "+a+'==="object"||typeof '+a+'==="function")&&('+s+"("+a+")||"+l+".getBuffer("+a+")||"+l+".getBuffer("+a+".buffer)||"+s+"("+a+'.buffer)||("constant" in '+a+"&&(typeof "+a+'.constant==="number"||'+o.isArrayLike+"("+a+".constant))))",'invalid dynamic attribute "'+t+'"')});var u={isStream:n.def(!1)},c=new W;c.state=$n,Object.keys(c).forEach(function(t){u[t]=n.def(""+c[t])});var h=u.buffer,f=u.type;return n("if(",s,"(",a,")){",u.isStream,"=true;",h,"=",l,".createStream(",Zi,",",a,");",f,"=",h,".dtype;","}else{",h,"=",l,".getBuffer(",a,");","if(",h,"){",f,"=",h,".dtype;",'}else if("constant" in ',a,"){",u.state,"=",ti,";","if(typeof "+a+'.constant === "number"){',u[Kn[0]],"=",a,".constant;",Kn.slice(1).map(function(t){return u[t]}).join("="),"=0;","}else{",Kn.map(function(t,e){return u[t]+"="+a+".constant.length>="+e+"?"+a+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",a,".buffer)){",h,"=",l,".createStream(",Zi,",",a,".buffer);","}else{",h,"=",l,".getBuffer(",a,".buffer);","}",f,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",h,".dtype;",u.normalized,"=!!",a,".normalized;"),i("size"),i("offset"),i("stride"),i("divisor"),n("}}"),n.exit("if(",u.isStream,"){",l,".destroyStream(",h,");","}"),u}var r=a[t];o[t]=Yt(r,e)}),o}function S(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=Gt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=Yt(e,function(t,r){return t.invoke(r,e)})}),n}function E(t,e,r,n,i){function a(t){var e=u[t];e&&(h[t]=e)}var o=t.static,s=t.dynamic;de.optional(function(){function t(t){Object.keys(t).forEach(function(t){de.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',i.commandStr)})}var e=[Pi,Oi,Fi,Ri,ji,Bi,Ni,Ui,Di].concat(et);t(o),t(s)});var l=x(t,i),u=_(t,l,i),c=M(t,i),h=k(t,i),f=w(t,i);a(Ii),a(m(zi));var d=Object.keys(h).length>0,p={framebuffer:l,draw:c,shader:f,state:h,dirty:d};return p.profile=b(t,i),p.uniforms=A(r,i),p.attributes=T(e,i),p.context=S(n,i),p}function L(t,e,r){var n=t.shared,i=n.context,a=t.scope();Object.keys(r).forEach(function(n){e.save(i,"."+n);var o=r[n];a(i,".",n,"=",o.append(t,e),";")}),e(a)}function C(t,e,r,n){var i,a=t.shared,o=a.gl,s=a.framebuffer;Q&&(i=e.def(a.extensions,".webgl_draw_buffers"));var l,u=t.constants,c=u.drawBuffer,h=u.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",ja,",",l,".framebuffer);"),Q&&e(i,".drawBuffersWEBGL(",c,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",ja,",null);"),Q&&e(i,".drawBuffersWEBGL(",h,");"),e("}",s,".cur=",l,";"),n||e("}")}function z(t,e,r){var n=t.shared,i=n.gl,a=t.current,o=t.next,s=n.current,l=n.next,u=t.cond(s,".dirty");et.forEach(function(e){var n=m(e);if(!(n in r.state)){var c,h;if(n in o){c=o[n],h=a[n];var f=J($[n].length,function(t){return u.def(c,"[",t,"]")});u(t.cond(f.map(function(t,e){return t+"!=="+h+"["+e+"]"}).join("||")).then(i,".",nt[n],"(",f,");",f.map(function(t,e){return h+"["+e+"]="+t}).join(";"),";"))}else{c=u.def(l,".",n);var d=t.cond(c,"!==",s,".",n);u(d),n in rt?d(t.cond(c).then(i,".enable(",rt[n],");").else(i,".disable(",rt[n],");"),s,".",n,"=",c,";"):d(i,".",nt[n],"(",c,");",s,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&u(s,".dirty=false;"),e(u)}function I(t,e,r,n){var i=t.shared,a=t.current,o=i.current,s=i.gl;Vt(Object.keys(r)).forEach(function(i){var l=r[i];if(!n||n(l)){var u=l.append(t,e);if(rt[i]){var c=rt[i];Ht(l)?u?e(s,".enable(",c,");"):e(s,".disable(",c,");"):e(t.cond(u).then(s,".enable(",c,");").else(s,".disable(",c,");")),e(o,".",i,"=",u,";")}else if(mt(u)){var h=a[i];e(s,".",nt[i],"(",u,");",u.map(function(t,e){return h+"["+e+"]="+t}).join(";"),";")}else e(s,".",nt[i],"(",u,");",o,".",i,"=",u,";")}})}function D(t,e){K&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function P(t,e,r,n,i){function a(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){u=e.def(),t(u,"=",a(),";"),"string"==typeof i?t(p,".count+=",i,";"):t(p,".count++;"),d&&(n?(c=e.def(),t(c,"=",g,".getNumPendingQueries();")):t(g,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",a(),"-",u,";"),d&&(n?t(g,".pushScopeStats(",c,",",g,".getNumPendingQueries(),",p,");"):t(g,".endQuery();"))}function l(t){var r=e.def(m,".profile");e(m,".profile=",t,";"),e.exit(m,".profile=",r,";")}var u,c,h,f=t.shared,p=t.stats,m=f.current,g=f.timer,v=r.profile;if(v){if(Ht(v))return void(v.enable?(o(e),s(e.exit),l("true")):l("false"));h=v.append(t,e),l(h)}else h=e.def(m,".profile");var y=t.block();o(y),e("if(",h,"){",y,"}");var b=t.block();s(b),e.exit("if(",h,"){",b,"}")}function O(t,e,r,n,i){function a(t){switch(t){case ua:case da:case va:return 2;case ca:case pa:case ya:return 3;case ha:case ma:case ba:return 4;default:return 1}}function o(r,n,i){function a(){e("if(!",c,".buffer){",l,".enableVertexAttribArray(",u,");}");var r,a=i.type;if(r=i.size?e.def(i.size,"||",n):n,e("if(",c,".type!==",a,"||",c,".size!==",r,"||",p.map(function(t){return c+"."+t+"!=="+i[t]}).join("||"),"){",l,".bindBuffer(",Zi,",",f,".buffer);",l,".vertexAttribPointer(",[u,r,a,i.normalized,i.stride,i.offset],");",c,".type=",a,";",c,".size=",r,";",p.map(function(t){return c+"."+t+"="+i[t]+";"}).join(""),"}"),K){var o=i.divisor;e("if(",c,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[u,o],");",c,".divisor=",o,";}")}}function o(){e("if(",c,".buffer){",l,".disableVertexAttribArray(",u,");","}if(",Kn.map(function(t,e){return c+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",u,",",d,");",Kn.map(function(t,e){return c+"."+t+"="+d[e]+";"}).join(""),"}")}var l=s.gl,u=e.def(r,".location"),c=e.def(s.attributes,"[",u,"]"),h=i.state,f=i.buffer,d=[i.x,i.y,i.z,i.w],p=["buffer","normalized","offset","stride"];h===$n?a():h===ti?o():(e("if(",h,"===",$n,"){"),a(),e("}else{"),o(),e("}"))}var s=t.shared;n.forEach(function(n){var s,l=n.name,u=r.attributes[l];if(u){if(!i(u))return;s=u.append(t,e)}else{if(!i(Ya))return;var c=t.scopeAttrib(l);de.optional(function(){t.assert(e,c+".state","missing attribute "+l)}),s={},Object.keys(new W).forEach(function(t){s[t]=e.def(c,".",t)})}o(t.link(n),a(n.info.type),s)})}function F(t,r,n,i,a){for(var o,s=t.shared,l=s.gl,u=0;u1?J(_,function(t){return c+"["+t+"]"}):c);r(");")}}function R(t,e,r,n){function i(i){var a=c[i];return a?a.contextDep&&n.contextDynamic||a.propDep?a.append(t,r):a.append(t,e):e.def(u,".",i)}function a(){function t(){r(g,".drawElementsInstancedANGLE(",[f,p,v,d+"<<(("+v+"-"+Qn+")>>1)",m],");")}function e(){r(g,".drawArraysInstancedANGLE(",[f,d,p,m],");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[f,p,v,d+"<<(("+v+"-"+Qn+")>>1)"]+");")}function e(){r(l+".drawArrays("+[f,d,p]+");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,h=function(){var i,a=c.elements,o=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(o=r),i=a.append(t,o)):i=o.def(u,".",Ri),i&&o("if("+i+")"+l+".bindBuffer("+Ji+","+i+".buffer.buffer);"),i}(),f=i(ji),d=i(Bi),p=function(){var i,a=c.count,o=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(o=r),i=a.append(t,o),de.optional(function(){a.MISSING&&t.assert(e,"false","missing vertex count"),a.DYNAMIC&&t.assert(o,i+">=0","missing vertex count")})):(i=o.def(u,".",Ni),de.optional(function(){t.assert(o,i+">=0","missing vertex count")})),i}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var m,g;K&&(m=i(Ui),g=t.instancing);var v=h+".type",y=c.elements&&Ht(c.elements);K&&("number"!=typeof m||m>=0)?"string"==typeof m?(r("if(",m,">0){"),a(),r("}else if(",m,"<0){"),o(),r("}")):a():o()}function j(t,e,r,n,i){var a=y(),o=a.proc("body",i);return de.optional(function(){a.commandStr=e.commandStr,a.command=a.link(e.commandStr)}),K&&(a.instancing=o.def(a.shared.extensions,".angle_instanced_arrays")),t(a,o,r,n),a.compile().body}function N(t,e,r,n){D(t,e),O(t,e,r,n.attributes,function(){return!0}),F(t,e,r,n.uniforms,function(){return!0}),R(t,e,e,r)}function B(t,e){var r=t.proc("draw",1);D(t,r),L(t,r,e.context),C(t,r,e.framebuffer),z(t,r,e),I(t,r,e.state),P(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)N(t,r,e,e.shader.program);else{var i=t.global.def("{}"),a=r.def(n,".id"),o=r.def(i,"[",a,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",i,"[",a,"]=",t.link(function(r){return j(N,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}function U(t,e,r,n){function i(){return!0}t.batchId="a1",D(t,e),O(t,e,r,n.attributes,i),F(t,e,r,n.uniforms,i),R(t,e,e,r)}function V(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}D(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();if(e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&L(t,c,r.context),r.needsFramebuffer&&C(t,c,r.framebuffer),I(t,c,r.state,i),r.profile&&i(r.profile)&&P(t,c,r,!1,!0),n)O(t,u,r,n.attributes,a),O(t,c,r,n.attributes,i),F(t,u,r,n.uniforms,a),F(t,c,r,n.uniforms,i),R(t,u,c,r);else{var h=t.global.def("{}"),f=r.shader.progVar.append(t,c),d=c.def(f,".id"),p=c.def(h,"[",d,"]");c(t.shared.gl,".useProgram(",f,".program);","if(!",p,"){",p,"=",h,"[",d,"]=",t.link(function(e){return j(U,t,r,e,2)}),"(",f,");}",p,".call(this,a0[",s,"],",s,");")}}function q(t,e){function r(t){return t.contextDep&&i||t.propDep}var n=t.proc("batch",2);t.batchId="0",D(t,n);var i=!1,a=!0;Object.keys(e.context).forEach(function(t){i=i||e.context[t].propDep}),i||(L(t,n,e.context),a=!1);var o=e.framebuffer,s=!1;o?(o.propDep?i=s=!0:o.contextDep&&i&&(s=!0),s||C(t,n,o)):C(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(i=!0),z(t,n,e),I(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||P(t,n,e,!1,"a1"),e.contextDep=i,e.needsContext=a,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&i||l.propDep)V(t,n,e,null);else{var u=l.append(t,n);if(n(t.shared.gl,".useProgram(",u,".program);"),e.shader.program)V(t,n,e,e.shader.program);else{var c=t.global.def("{}"),h=n.def(u,".id"),f=n.def(c,"[",h,"]");n(t.cond(f).then(f,".call(this,a0,a1);").else(f,"=",c,"[",h,"]=",t.link(function(r){return j(V,t,e,r,2)}),"(",u,");",f,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}function H(t,r){function n(e){var n=r.shader[e];n&&i.set(a.shader,"."+e,n.append(t,i))}var i=t.proc("scope",3);t.batchId="a2";var a=t.shared,o=a.current;L(t,i,r.context),r.framebuffer&&r.framebuffer.append(t,i),Vt(Object.keys(r.state)).forEach(function(e){var n=r.state[e],o=n.append(t,i);mt(o)?o.forEach(function(r,n){i.set(t.next[e],"["+n+"]",r)}):i.set(a.next,"."+e,o)}),P(t,i,r,!0,!0),[Ri,Bi,Ni,Ui,ji].forEach(function(e){var n=r.draw[e] +;n&&i.set(a.draw,"."+e,""+n.append(t,i))}),Object.keys(r.uniforms).forEach(function(n){i.set(a.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,i))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,i),a=t.scopeAttrib(e);Object.keys(new W).forEach(function(t){i.set(a,"."+t,n[t])})}),n(Oi),n(Fi),Object.keys(r.state).length>0&&(i(o,".dirty=true;"),i.exit(o,".dirty=true;")),i("a1(",t.shared.context,",a0,",t.batchId,");")}function G(t){if("object"==typeof t&&!mt(t)){for(var e=Object.keys(t),r=0;r=0;--t){var r=H[t];r&&r(E,null,0)}v.flush(),k&&k.update()}function r(){!J&&H.length>0&&(J=ve.next(e))}function n(){J&&(ve.cancel(e),J=null)}function i(t){t.preventDefault(),b=!0,n(),G.forEach(function(t){t()})}function a(t){v.getError(),b=!1,x.restore(),O.restore(),I.restore(),F.restore(),R.restore(),j.restore(),k&&k.restore(),N.procs.refresh(),r(),Y.forEach(function(t){t()})}function o(){H.length=0,n(),q&&(q.removeEventListener(eo,i),q.removeEventListener(ro,a)),O.clear(),j.clear(),R.clear(),F.clear(),D.clear(),I.clear(),k&&k.clear(),Z.forEach(function(t){t()})}function s(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var i=t[n];ge.isDynamic(i)?r[n]=ge.unbox(i,n):e[n]=i}),{dynamic:r,static:e}}function r(t){for(;d.length0)return h.call(this,r(0|t),0|t)}else{if(!Array.isArray(t))return c.call(this,t);if(t.length)return h.call(this,t,t.length)}}de(!!t,"invalid args to regl({...})"),de.type(t,"object","invalid args to regl({...})");var i=e(t.context||{}),a=e(t.uniforms||{}),o=e(t.attributes||{}),s=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=$t({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),l={gpuTime:0,cpuTime:0,count:0},u=N.compile(s,o,a,i,l),c=u.draw,h=u.batch,f=u.scope,d=[];return $t(n,{stats:l})}function l(t,e){var r=0;N.procs.poll();var n=e.color;n&&(v.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=Ka),"depth"in e&&(v.clearDepth(+e.depth),r|=Qa),"stencil"in e&&(v.clearStencil(0|e.stencil),r|=$a),de(!!r,"called regl.clear with no buffer specified"),v.clear(r)}function u(t){if(de("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)K($t({framebuffer:t.framebuffer.faces[e]},t),l);else K(t,l);else l(null,t)}function c(t){function e(){function e(){var t=Zt(H,e);H[t]=H[H.length-1],H.length-=1,H.length<=0&&n()}var r=Zt(H,t);de(r>=0,"cannot cancel a frame twice"),H[r]=e}return de.type(t,"function","regl.frame() callback must be a function"),H.push(t),r(),{cancel:e}}function h(){var t=V.viewport,e=V.scissor_box;t[0]=t[1]=e[0]=e[1]=0,E.viewportWidth=E.framebufferWidth=E.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,E.viewportHeight=E.framebufferHeight=E.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function f(){E.tick+=1,E.time=p(),h(),N.procs.poll()}function d(){h(),N.procs.refresh(),k&&k.update()}function p(){return(ye()-A)/1e3}function m(t,e){de.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return c(e);case"lost":r=G;break;case"restore":r=Y;break;case"destroy":r=Z;break;default:de.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t=0},read:U,destroy:o,_gl:v,_refresh:d,poll:function(){f(),k&&k.update()},now:p,stats:w});return g.onDone(null,Q),Q}var Kt={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},Qt=function(t){return Object.prototype.toString.call(t)in Kt},$t=function(t,e){for(var r=Object.keys(e),n=0;n=2,"invalid renderbuffer shape"),a=0|d[0],o=0|d[1]}else"radius"in f&&(a=o=0|f.radius),"width"in f&&(a=0|f.width),"height"in f&&(o=0|f.height);"format"in f&&(de.parameter(f.format,u,"invalid renderbuffer format"),l=u[f.format])}else"number"==typeof e?(a=0|e,o="number"==typeof n?0|n:a):e?de.raise("invalid arguments to renderbuffer constructor"):a=o=1;if(de(a>0&&o>0&&a<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),a!==h.width||o!==h.height||l!==h.format)return s.width=h.width=a,s.height=h.height=o,h.format=l,t.bindRenderbuffer(xn,h.renderbuffer),t.renderbufferStorage(xn,l,a,o),i.profile&&(h.stats.size=It(h.format,h.width,h.height)),s.format=c[h.format],s}function l(e,n){var a=0|e,o=0|n||a;return a===h.width&&o===h.height?s:(de(a>0&&o>0&&a<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=h.width=a,s.height=h.height=o,t.bindRenderbuffer(xn,h.renderbuffer),t.renderbufferStorage(xn,h.format,a,o),i.profile&&(h.stats.size=It(h.format,h.width,h.height)),s)}var h=new a(t.createRenderbuffer());return f[h.id]=h,n.renderbufferCount++,s(e,o),s.resize=l,s._reglType="renderbuffer",s._renderbuffer=h,i.profile&&(s.stats=h.stats),s.destroy=function(){h.decRef()},s}function l(){xe(f).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(xn,e.renderbuffer),t.renderbufferStorage(xn,e.format,e.width,e.height)}),t.bindRenderbuffer(xn,null)}var u={rgba4:_n,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(u.srgba=35907),e.ext_color_buffer_half_float&&(u.rgba16f=34842,u.rgb16f=34843),e.webgl_color_buffer_float&&(u.rgba32f=34836);var c=[];Object.keys(u).forEach(function(t){var e=u[t];c[e]=t});var h=0,f={};return a.prototype.decRef=function(){--this.refCount<=0&&o(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(f).forEach(function(e){t+=f[e].stats.size}),t}),{create:s,clear:function(){xe(f).forEach(o)},restore:l}},kn=36160,An=36161,Tn=3553,Sn=34069,En=36064,Ln=36096,Cn=36128,zn=33306,In=36053,Dn=6402,Pn=[6408],On=[];On[6408]=4;var Fn=[];Fn[5121]=1,Fn[5126]=4,Fn[36193]=2;var Rn=33189,jn=36168,Nn=34041,Bn=[32854,32855,36194,35907,34842,34843,34836],Un={};Un[In]="complete",Un[36054]="incomplete attachment",Un[36057]="incomplete dimensions",Un[36055]="incomplete, missing attachment",Un[36061]="unsupported";var Vn=5126,qn=35632,Hn=35633,Gn=35718,Yn=35721,Xn=6408,Wn=5121,Zn=3333,Jn=5126,Kn="xyzw".split(""),Qn=5121,$n=1,ti=2,ei=0,ri=1,ni=2,ii=3,ai=4,oi="dither",si="blend.enable",li="blend.color",ui="blend.equation",ci="blend.func",hi="depth.enable",fi="depth.func",di="depth.range",pi="depth.mask",mi="colorMask",gi="cull.enable",vi="cull.face",yi="frontFace",bi="lineWidth",xi="polygonOffset.enable",_i="polygonOffset.offset",wi="sample.alpha",Mi="sample.enable",ki="sample.coverage",Ai="stencil.enable",Ti="stencil.mask",Si="stencil.func",Ei="stencil.opFront",Li="stencil.opBack",Ci="scissor.enable",zi="scissor.box",Ii="viewport",Di="profile",Pi="framebuffer",Oi="vert",Fi="frag",Ri="elements",ji="primitive",Ni="count",Bi="offset",Ui="instances",Vi=Pi+"Width",qi=Pi+"Height",Hi=Ii+"Width",Gi=Ii+"Height",Yi="drawingBufferWidth",Xi="drawingBufferHeight",Wi=[ci,ui,Si,Ei,Li,ki,Ii,zi,_i],Zi=34962,Ji=34963,Ki=3553,Qi=34067,$i=2884,ta=3042,ea=3024,ra=2960,na=2929,ia=3089,aa=32823,oa=32926,sa=32928,la=5126,ua=35664,ca=35665,ha=35666,fa=5124,da=35667,pa=35668,ma=35669,ga=35670,va=35671,ya=35672,ba=35673,xa=35674,_a=35675,wa=35676,Ma=35678,ka=35680,Aa=4,Ta=1028,Sa=1029,Ea=2304,La=2305,Ca=32775,za=32776,Ia=519,Da=7680,Pa=0,Oa=1,Fa=32774,Ra=513,ja=36160,Na=36064,Ba={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Ua=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Va={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},qa={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Ha={frag:35632,vert:35633},Ga={cw:Ea,ccw:La},Ya=new qt(!1,!1,!1,function(){}),Xa=34918,Wa=34919,Za=35007,Ja=function(t,e){function r(){return f.pop()||h.createQueryEXT()}function n(t){f.push(t)}function i(t){var e=r();h.beginQueryEXT(Za,e),d.push(e),u(d.length-1,d.length,t)}function a(){h.endQueryEXT(Za)}function o(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}function s(){return p.pop()||new o}function l(t){p.push(t)}function u(t,e,r){var n=s();n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,m.push(n)}function c(){var t,e,r=d.length;if(0!==r){v.length=Math.max(v.length,r+1),g.length=Math.max(g.length,r+1),g[0]=0,v[0]=0;var i=0;for(t=0,e=0;e=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},{}],497:[function(e,r,n){!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!0&t?"-":""}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 s=new Function("det",r.join(""));return s(t<6?o[t]:o)}function i(){return[0]}function a(t,e){return[[e[0]],[t[0][0]]]}var o=t("robust-determinant"),s=6,l=[i,a];!function(){for(;l.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=3.3306690738754716e-16*n;return o>=s||o<=-s?o:m(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,m=o*s,v=i*u,y=i*l,b=a*s,x=c*(d-p)+h*(m-v)+f*(y-b),_=(Math.abs(d)+Math.abs(p))*Math.abs(c)+(Math.abs(m)+Math.abs(v))*Math.abs(h)+(Math.abs(y)+Math.abs(b))*Math.abs(f),w=7.771561172376103e-16*_;return x>w||-x>w?x:g(t,e,r,n)}];!function(){for(;v.length<=p;)v.push(l(v.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=p;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&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":504}],508:[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),m=-e[h],g=f(m);p=i?(a=d,(c+=1)=i?(a=d,(c+=1)0){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})},{}],511:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],512:[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":67,"reduce-simplicial-complex":494}],513:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--n){n0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}(i[s]),l.push("break;");l.push("}}")}return l.push("}return R;};return getContour",t,"d"),new Function("pool",l.join(""))(a)}function i(t){var e=s[t];return e||(e=s[t]=n(t)),e}e.exports=i;var a=t("typedarray-pool"),o=t("marching-simplex-table"),s={}},{"marching-simplex-table":441,"typedarray-pool":537}],515:[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 h(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==o(t[m],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){if(e0){var t=k[0];return a(0,T-1),T-=1,u(0),t}return-1}function f(t,e){var r=k[t];return y[r]===e?t:(y[r]=-1/0,c(t),h(),y[r]=e,T+=1,c(T-1))}function d(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 p=e.length,m=t.length,g=new Array(p),v=new Array(p),y=new Array(p),b=new Array(p),x=0;x>1;x>=0;--x)u(x);for(;;){var S=h();if(S<0||y[S]>r)break;!function(t){if(!b[t]){b[t]=!0;var e=g[t],r=v[t];g[r]>=0&&(g[r]=e),v[e]>=0&&(v[e]=r),A[e]>=0&&f(A[e],i(e)),A[r]>=0&&f(A[r],i(r))}}(S)}for(var E=[],x=0;x=0&&r>=0&&e!==r){var n=A[e],i=A[r];n!==i&&L.push([n,i])}}),o.unique(o.normalize(L)),{positions:E,edges:L}}e.exports=i;var a=t("robust-orientation"),o=t("simplicial-complex")},{"robust-orientation":504,"simplicial-complex":517}],520:[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":504}],521:[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":520,"binary-search-bounds":64,"functional-red-black-tree":133,"robust-orientation":504}],522:[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":501,"robust-sum":509}],523:[function(e,r,n){!function(){"use strict";function e(t){return i(a(t),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}function i(t,r){var n,i,a,s,l,u,c,h,f,d=1,p=t.length,m="";for(i=0;i=0),s[8]){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,s[6]?parseInt(s[6]):0);break;case"e":n=s[7]?parseFloat(n).toExponential(s[7]):parseFloat(n).toExponential();break;case"f":n=s[7]?parseFloat(n).toFixed(s[7]):parseFloat(n);break;case"g":n=s[7]?String(Number(n.toPrecision(s[7]))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=s[7]?n.substring(0,s[7]):n;break;case"t":n=String(!!n),n=s[7]?n.substring(0,s[7]):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=s[7]?n.substring(0,s[7]):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=s[7]?n.substring(0,s[7]):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}o.json.test(s[8])?m+=n:(!o.number.test(s[8])||h&&!s[3]?f="":(f=h?"+":"-",n=n.toString().replace(o.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(f+n).length,l=s[6]&&c>0?u.repeat(c):"",m+=s[5]?f+n+l:"0"===u?f+l+n:l+f+n)}return m}function a(t){if(s[t])return s[t];for(var e,r=t,n=[],i=0;r;){if(null!==(e=o.text.exec(r)))n.push(e[0]);else if(null!==(e=o.modulo.exec(r)))n.push("%");else{if(null===(e=o.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){i|=1;var a=[],l=e[2],u=[];if(null===(u=o.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(a.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=o.key_access.exec(l)))a.push(u[1]);else{if(null===(u=o.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");a.push(u[1])}e[2]=a}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(e)}r=r.substring(e[0].length)}return s[t]=n}var o={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/},s=Object.create(null);void 0!==n&&(n.sprintf=e,n.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r,"function"==typeof t&&t.amd&&t(function(){return{sprintf:e,vsprintf:r}}))}()},{}],524:[function(t,e,r){"use strict";function n(t){for(var e=t.length,r=new Array(e),n=new Array(e),i=new Array(e),a=new Array(e),o=new Array(e),s=new Array(e),l=0;l0;){e=f[f.length-1];var d=t[e];if(a[e]=0&&s[e].push(o[m])}a[e]=p}else{if(n[e]===r[e]){for(var g=[],v=[],y=0,p=l.length-1;p>=0;--p){var b=l[p];if(i[b]=!1,g.push(b),v.push(s[b]),y+=s[b].length,o[b]=c.length,b===e){l.length=p;break}}c.push(g);for(var x=new Array(y),p=0;p=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return d(d({},t.properties),{cluster:!0,cluster_id:t.id,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 m(t){return t.y}var g=t("kdbush");e.exports=n,i.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,initial:function(){return{}},map:function(t){return t}},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(o);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var a=+Date.now();this.trees[i+1]=g(n,p,m,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]=g(n,p,m,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(u(t[0]),c(t[3]),u(t[2]),c(t[1])),i=[],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),m=new Array(r),g=new Array(r),v=new Array(r),y=0,b=0;bb)&&!(u&1<<_)!=!(u&1<0&&(A="+"+g[x]+"*c");var T=p[x].length/y*.5,S=.5+v[x]/y*.5;k.push("d"+x+"-"+S+"-"+T+"*("+p[x].join("+")+A+")/("+m[x].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}n.push("}},"),h.length>0&&f.push("}}");for(var E=[],u=0;u<1<0&&(f+=.02);for(var p=new Float32Array(h),m=0,g=-.5*f,d=0;d=0?1.2:1))}function i(t,e,r,n,i,o,s){for(var l=0;l.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=H(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 A(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){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function S(t,r){C(t)&&(t="100%");var n=z(t);return t=q(r,H(0,parseFloat(t))),n&&(t=parseInt(t*r,10)/100),e.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function E(t){return q(1,H(0,t))}function L(t){return parseInt(t,16)}function C(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)}function z(t){return"string"==typeof t&&-1!=t.indexOf("%")}function I(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function P(t){return e.round(255*parseFloat(t)).toString(16)}function O(t){return L(t)/255}function F(t){return!!W.CSS_UNIT.exec(t)}function R(t){t=t.replace(N,"").replace(B,"").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=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:L(r[1]),g:L(r[2]),b:L(r[3]),a:O(r[4]),format:e?"name":"hex8"}:(r=W.hex6.exec(t))?{r:L(r[1]),g:L(r[2]),b:L(r[3]),format:e?"name":"hex"}:(r=W.hex4.exec(t))?{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),a:O(r[4]+""+r[4]),format:e?"name":"hex8"}:!!(r=W.hex3.exec(t))&&{r:L(r[1]+""+r[1]),g:L(r[2]+""+r[2]),b:L(r[3]+""+r[3]),format:e?"name":"hex"}}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 N=/^\s+/,B=/\s+$/,U=0,V=e.round,q=e.min,H=e.max,G=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=T(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 h(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*S(this._r,255))+"%",g:V(100*S(this._g,255))+"%",b:V(100*S(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+V(100*S(this._r,255))+"%, "+V(100*S(this._g,255))+"%, "+V(100*S(this._b,255))+"%)":"rgba("+V(100*S(this._r,255))+"%, "+V(100*S(this._g,255))+"%, "+V(100*S(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(X[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;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return 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(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(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(A,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)&&(r[i]="a"===i?t[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:G(),g:G(),b:G()})},n.mix=function(t,e,r){r=0===r?0:r||50;var i=n(t).toRgb(),a=n(e).toRgb(),o=r/100;return n({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})},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=j(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"},X=n.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(Y),W=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==r&&r.exports?r.exports=n:"function"==typeof t&&t.amd?t(function(){return n}):window.tinycolor=n}(Math)},{}],531:[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":471}],532:[function(e,r,n){!function(e,i){"object"==typeof n&&void 0!==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))},m=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 m=d(r,p)/s,g=d(i,p)/s;u=Math.acos(m),l=Math.acos(g)}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],m=this.computedAngle[1],g=Math.cos(p),v=Math.sin(p),y=Math.cos(m),b=Math.sin(m),x=this.computedCenter,_=g*y,w=v*y,M=b,k=-g*b,A=-v*b,T=y,S=this.computedEye,E=this.computedMatrix,o=0;o<3;++o){var L=_*r[o]+w*c[o]+M*e[o];E[4*o+1]=k*r[o]+A*c[o]+T*e[o],E[4*o+2]=L,E[4*o+3]=0}var C=E[1],z=E[5],I=E[9],D=E[2],P=E[6],O=E[10],F=z*O-I*P,R=I*D-C*O,j=C*P-z*D,N=n(F,R,j);F/=N,R/=N,j/=N,E[0]=F,E[4]=R,E[8]=j;for(var o=0;o<3;++o)S[o]=x[o]+E[2+4*o]*d;for(var o=0;o<3;++o){for(var l=0,B=0;B<3;++B)l+=E[o+4*B]*S[B];E[12+o]=-l}E[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var m=[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;m[0]=i[2],m[1]=i[6],m[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,m);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 m=c*e+o*r,g=h*e+s*r,v=f*e+l*r;this.center.move(t,m,g,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),this.radius.set(t,Math.log(y))},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),m=Math.max(f,d,p);f===m?(l=l<0?-1:1,c=h=0):p===m?(h=h<0?-1:1,l=c=0):(c=c<0?-1:1,l=h=0)}else{var g=n(l,c,h);l/=g,c/=g,h/=g}var v=e[s],y=e[s+4],b=e[s+8],x=v*l+y*c+b*h;v-=l*x,y-=c*x,b-=h*x;var _=n(v,y,b);v/=_,y/=_,b/=_;var w=c*b-h*y,M=h*v-l*b,k=l*y-c*v,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,H,G,Y),this.radius.idle(t),this.up.jump(t,l,c,h),this.right.jump(t,v,y,b);var T,S;if(2===o){var E=e[1],L=e[5],C=e[9],z=E*v+L*y+C*b,I=E*w+L*M+C*k;T=F<0?-Math.PI/2:Math.PI/2,S=Math.atan2(I,z)}else{var D=e[2],P=e[6],O=e[10],F=D*l+P*c+O*h,R=D*v+P*y+O*b,j=D*w+P*M+O*k;T=Math.asin(i(F)),S=Math.atan2(j,R)}this.angle.jump(t,S,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,Y=V[14]/q,X=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*X,G-B*X,Y-U*X)},p.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},p.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},p.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},p.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},p.lookAt=function(t,e,r,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,m=p[0],g=p[1],v=p[2],y=o*m+s*g+l*v;m-=y*o,g-=y*s,v-=y*l;var b=n(m,g,v);if(!(b<.01&&(m=s*f-l*h,g=l*c-o*f,v=o*h-s*c,(b=n(m,g,v))<1e-6))){m/=b,g/=b,v/=b,this.up.set(t,o,s,l),this.right.set(t,m,g,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*v-l*g,_=l*m-o*v,w=o*g-s*m,M=n(x,_,w);x/=M,_/=M,w/=M;var k=o*c+s*h+l*f,A=m*c+g*h+v*f,T=x*c+_*h+w*f,S=Math.asin(i(k)),E=Math.atan2(T,A),L=this.angle._state,C=L[L.length-1],z=L[L.length-2];C%=2*Math.PI;var I=Math.abs(C+2*Math.PI-E),D=Math.abs(C-E),P=Math.abs(C-2*Math.PI-E);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 m(t){return x?new Uint8ClampedArray(o(t),0,t):s(t)}function g(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"),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,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 m(t);case"buffer":return v(t);case"data":case"dataview":return g(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=m,r.mallocDataView=g,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":65,buffer:75,dup:123}],538:[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))}},{}],541:[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),m=["'"].concat(p),g=["%","/","?",";","#"].concat(m),v=["/","?","#"],y=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,x={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},w={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},M=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=-1!==n&&n127?P+="x":P+=D[O];if(!P.match(y)){var R=z.slice(0,T),j=z.slice(T+1),N=D.match(b);N&&(R.push(N[1]),j.unshift(N[2])),j.length&&(s="/"+j.join(".")+s),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=l.toASCII(this.hostname));var B=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+B,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!x[p])for(var T=0,I=m.length;T0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.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(!M.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=M.slice(-1)[0],S=(r.host||t.host||M.length>1)&&("."===T||".."===T)||""===T,E=0,L=M.length;L>=0;L--)T=M[L],"."===T?M.splice(L,1):".."===T?(M.splice(L,1),E++):E&&(M.splice(L,1),E--);if(!b&&!x)for(;E--;E)M.unshift("..");!b||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),S&&"/"!==M.join("/").substr(-1)&&M.push("");var C=""===M[0]||M[0]&&"/"===M[0].charAt(0);if(k){r.hostname=r.host=C?"":M.length?M.shift():"";var A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@");A&&(r.auth=A.shift(),r.host=r.hostname=A.shift())}return b=b||r.host&&M.length,b&&!C&&M.unshift(""),M.length?r.pathname=M.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":542,punycode:484,querystring:488}],542:[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}}},{}],543:[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}},{}],544:[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}},{}],545:[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]),m(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 b(i)||(i=l(t,i,n)),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(T(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,x=["{","}"];if(p(e)&&(y=!0,x=["[","]"]),T(e)){v=" [Function"+(e.name?": "+e.name:"")+"]"}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 x[0]+v+x[1];if(n<0)return w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var _;return _=y?h(t,e,n,m,o):o.map(function(r){return f(t,e,n,m,r,y)}),t.seen.pop(),d(_,v,x)}function u(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"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 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;return t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>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 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 b(t){return"string"==typeof t}function x(t){return"symbol"==typeof t}function _(t){return void 0===t}function w(t){return M(t)&&"[object RegExp]"===E(t)}function M(t){return"object"==typeof t&&null!==t}function k(t){return M(t)&&"[object Date]"===E(t)}function A(t){return M(t)&&("[object Error]"===E(t)||t instanceof Error)}function T(t){return"function"==typeof t}function S(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function E(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}function C(){var t=new Date,e=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":");return[t.getDate(),O[t.getMonth()],e].join(" ")}function z(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/%[sdj%]/g;r.format=function(t){if(!b(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":548}],550:[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":551}],551:[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))<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,h=!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(h)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___");h=!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)}}()},{}],556:[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":557}],557:[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},{}],558:[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){return t(e).value=r,this},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":556}],559:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":145}],560:[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){g[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];g[n]||r(n)}} +for(var s,l=Object.keys(a),u=0,c=l.length;u=1888&&t<=2111))throw new Error("Solar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Solar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=31))throw new Error("Solar day outside range 1 - 31");i={year:t,month:e,day:r},a=n||{}}var o=p[i.year-p[0]],s=i.year<<9|i.month<<5|i.day;a.year=s>=o?i.year:i.year-1,o=p[a.year-p[0]];var l,u=o>>9&4095,c=o>>5&15,h=31&o,f=new Date(u,c-1,h),m=new Date(i.year,i.month-1,i.day);l=Math.round((m-f)/864e5);var g,v=d[a.year-d[0]];for(g=0;g<13;g++){var y=v&1<<12-g?30:29;if(l>13;return!b||g=1888&&t<=2111))throw new Error("Lunar year outside range 1888-2111");if(!("number"==typeof e&&e>=1&&e<=12))throw new Error("Lunar month outside range 1 - 12");if(!("number"==typeof r&&r>=1&&r<=30))throw new Error("Lunar day outside range 1 - 30");var s;"object"==typeof n?(s=!1,a=n):(s=!!n,a=i||{}),o={year:t,month:e,day:r,isIntercalary:s}}var l;l=o.day-1;var u,c=d[o.year-d[0]],h=c>>13;u=h?o.month>h?o.month:o.isIntercalary?o.month:o.month-1:o.month-1;for(var f=0;f>9&4095,v=m>>5&15,y=31&m,b=new Date(g,v-1,y+l);return a.year=b.getFullYear(),a.month=1+b.getMonth(),a.day=b.getDate(),a}var o=t("../main"),s=t("object-assign"),l=o.instance();n.prototype=new o.baseCalendar,s(n.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if("string"==typeof t){var r=t.match(c);return r?r[0]:""}var n=this._validateYear(t),i=t.month(),a=""+this.toChineseMonth(n,i);return e&&a.length<2&&(a="0"+a),this.isIntercalaryMonth(n,i)&&(a+="i"),a},monthNames:function(t){if("string"==typeof t){var e=t.match(h);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=this.toChineseMonth(r,n),a=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"][i-1];return this.isIntercalaryMonth(r,n)&&(a="\u95f0"+a),a},monthNamesShort:function(t){if("string"==typeof t){var e=t.match(f);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=this.toChineseMonth(r,n),a=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"][i-1];return this.isIntercalaryMonth(r,n)&&(a="\u95f0"+a),a},parseMonth:function(t,e){t=this._validateYear(t);var r,n=parseInt(e);if(isNaN(n))"\u95f0"===e[0]&&(r=!0,e=e.substring(1)),"\u6708"===e[e.length-1]&&(e=e.substring(0,e.length-1)),n=1+["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(e);else{var i=e[e.length-1];r="i"===i||"I"===i}return this.toMonthIndex(t,n,r)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,e){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw e.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(t,e,r){var n=this.intercalaryMonth(t);if(r&&e!==n||e<1||e>12)throw o.local.invalidMonth.replace(/\{0\}/,this.local.name);return n?!r&&e<=n?e-1:e:e-1},toChineseMonth:function(t,e){t.year&&(t=t.year(),e=t.month());var r=this.intercalaryMonth(t),n=r?12:11;if(e<0||e>n)throw o.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e>13},isIntercalaryMonth:function(t,e){t.year&&(t=t.year(),e=t.month());var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(t,e,r){var n,i=this._validateYear(t,o.local.invalidyear),a=p[i-p[0]],s=a>>9&4095,u=a>>5&15,c=31&a;n=l.newDate(s,u,c),n.add(4-(n.dayOfWeek()||7),"d");var h=this.toJD(t,e,r)-n.toJD();return 1+Math.floor(h/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){t.year&&(e=t.month(),t=t.year()),t=this._validateYear(t);var r=d[t-d[0]];if(e>(r>>13?12:11))throw o.local.invalidMonth.replace(/\{0\}/,this.local.name);return r&1<<12-e?30:29},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,s,r,o.local.invalidDate);t=this._validateYear(n.year()),e=n.month(),r=n.day();var i=this.isIntercalaryMonth(t,e),s=this.toChineseMonth(t,e),u=a(t,s,r,i);return l.toJD(u.year,u.month,u.day)},fromJD:function(t){var e=l.fromJD(t),r=i(e.year(),e.month(),e.day()),n=this.toMonthIndex(r.year,r.month,r.isIntercalary);return this.newDate(r.year,n,r.day)},fromString:function(t){var e=t.match(u),r=this._validateYear(+e[1]),n=+e[2],i=!!e[3],a=this.toMonthIndex(r,n,i),o=+e[4];return this.newDate(r,a,o)},add:function(t,e,r){var i=t.year(),a=t.month(),o=this.isIntercalaryMonth(i,a),s=this.toChineseMonth(i,a),l=Object.getPrototypeOf(n.prototype).add.call(this,t,e,r);if("y"===r){var u=l.year(),c=l.month(),h=this.isIntercalaryMonth(u,s),f=o&&h?this.toMonthIndex(u,s,!0):this.toMonthIndex(u,s,!1);f!==c&&l.month(f)}return l}});var u=/^\s*(-?\d\d\d\d|\d\d)[-\/](\d?\d)([iI]?)[-\/](\d?\d)/m,c=/^\d?\d[iI]?/m,h=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?\u6708/m,f=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?/m;o.calendars.chinese=n;var d=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548],p=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904]},{"../main":577,"object-assign":466}],564:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Coptic",jdEpoch:1825029.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=e.year()+(e.year()<0?1:0);return t%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear||i.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),t<0&&t++,n.day()+30*(n.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,i=e-30*(n-1)+1;return this.newDate(r,n,i)}}),i.calendars.coptic=n},{"../main":577,"object-assign":466}],565:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Discworld",jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),!1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),13},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),400},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/8)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(t,e,r){return(this._validate(t,e,r,i.local.invalidDate).day()+1)%8},weekDay:function(t,e,r){var n=this.dayOfWeek(t,e,r);return n>=2&&n<=6},extraInfo:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return{century:o[Math.floor((n.year()-1)/100)+1]||""}},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year()+(n.year()<0?1:0),e=n.month(),(r=n.day())+(e>1?16:0)+(e>2?32*(e-2):0)+400*(t-1)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1;var e=Math.floor(t/400)+1;t-=400*(e-1),t+=t>15?16:0;var r=Math.floor(t/32)+1,n=t-32*(r-1)+1;return this.newDate(e<=0?e-1:e,r,n)}});var o={20:"Fruitbat",21:"Anchovy"};i.calendars.discworld=n},{"../main":577,"object-assign":466}],566:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=e.year()+(e.year()<0?1:0);return t%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear||i.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),t<0&&t++,n.day()+30*(n.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,i=e-30*(n-1)+1;return this.newDate(r,n,i)}}),i.calendars.ethiopian=n},{"../main":577,"object-assign":466}],567:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}var a=t("../main"),o=t("object-assign");n.prototype=new a.baseCalendar,o(n.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,a.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return t=t<0?t+1:t,i(7*t+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,a.local.invalidYear),this._leapYear(t.year?t.year():t)?13:12},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return t=this._validate(t,this.minMonth,this.minDay,a.local.invalidYear).year(),this.toJD(-1===t?1:t+1,7,1)-this.toJD(t,7,1)},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,a.local.invalidMonth),12===e&&this.leapYear(t)?30:8===e&&5===i(this.daysInYear(t),10)?30:9===e&&3===i(this.daysInYear(t),10)?29:this.daysPerMonth[e-1]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},extraInfo:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);return{yearType:(this.leapYear(n)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(n)%10-3]}},toJD:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var i=t<=0?t+1:t,o=this.jdEpoch+this._delay1(i)+this._delay2(i)+r+1;if(e<7){for(var s=7;s<=this.monthsInYear(t);s++)o+=this.daysInMonth(t,s);for(var s=1;s=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),a.calendars.hebrew=n},{"../main":577,"object-assign":466}],568:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){return(11*this._validate(t,this.minMonth,this.minDay,i.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),e=n.month(),r=n.day(),t=t<=0?t+1:t,r+Math.ceil(29.5*(e-1))+354*(t-1)+Math.floor((3+11*t)/30)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=Math.floor((30*(t-this.jdEpoch)+10646)/10631);e=e<=0?e-1:e;var r=Math.min(12,Math.ceil((t-29-this.toJD(e,1,1))/29.5)+1),n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),i.calendars.islamic=n},{"../main":577,"object-assign":466}],569:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=e.year()<0?e.year()+1:e.year();return t%4==0},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),e=n.month(),r=n.day(),t<0&&t++,e<=2&&(t--,e+=12),Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r-1524.5},fromJD:function(t){var e=Math.floor(t+.5),r=e+1524,n=Math.floor((r-122.1)/365.25),i=Math.floor(365.25*n),a=Math.floor((r-i)/30.6001),o=a-Math.floor(a<14?1:13),s=n-Math.floor(o>2?4716:4715),l=r-i-Math.floor(30.6001*a);return s<=0&&s--,this.newDate(s,o,l)}}),i.calendars.julian=n},{"../main":577,"object-assign":466}],570:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}function a(t,e){return i(t-1,e)+1}var o=t("../main"),s=t("object-assign");n.prototype=new o.baseCalendar,s(n.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,o.local.invalidYear).year();var e=Math.floor(t/400);return t%=400,t+=t<0?400:0,e+"."+Math.floor(t/20)+"."+t%20},forYear:function(t){if(t=t.split("."),t.length<3)throw"Invalid Mayan year";for(var e=0,r=0;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,o.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate),!0},extraInfo:function(t,e,r){var n=this._validate(t,e,r,o.local.invalidDate),i=n.toJD(),a=this._toHaab(i),s=this._toTzolkin(i);return{haabMonthName:this.local.haabMonths[a[0]-1],haabMonth:a[0],haabDay:a[1],tzolkinDayName:this.local.tzolkinMonths[s[0]-1],tzolkinDay:s[0],tzolkinTrecena:s[1]}},_toHaab:function(t){t-=this.jdEpoch;var e=i(t+8+340,365);return[Math.floor(e/20)+1,i(e,20)]},_toTzolkin:function(t){return t-=this.jdEpoch,[a(t+20,20),a(t+4,13)]},toJD:function(t,e,r){var n=this._validate(t,e,r,o.local.invalidDate);return n.day()+20*n.month()+360*n.year()+this.jdEpoch},fromJD:function(t){t=Math.floor(t)+.5-this.jdEpoch;var e=Math.floor(t/360);t%=360,t+=t<0?360:0;var r=Math.floor(t/20),n=t%20;return this.newDate(e,r,n)}}),o.calendars.mayan=n},{"../main":577,"object-assign":466}],571:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar;var o=i.instance("gregorian");a(n.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear||i.regionalOptions[""].invalidYear);return o.leapYear(e.year()+(e.year()<1?1:0)+1469)},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidMonth),t=n.year();t<0&&t++;for(var a=n.day(),s=1;s=this.toJD(e+1,1,1);)e++;for(var r=t-Math.floor(this.toJD(e,1,1)+.5)+1,n=1;r>this.daysInMonth(e,n);)r-=this.daysInMonth(e,n),n++;return this.newDate(e,n,r)}}),i.calendars.nanakshahi=n},{"../main":577,"object-assign":466}],572:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){if(t=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear).year(),void 0===this.NEPALI_CALENDAR_DATA[t])return this.daysPerYear;for(var e=0,r=this.minMonth;r<=12;r++)e+=this.NEPALI_CALENDAR_DATA[t][r];return e},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,i.local.invalidMonth),void 0===this.NEPALI_CALENDAR_DATA[t]?this.daysPerMonth[e-1]:this.NEPALI_CALENDAR_DATA[t][e]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var a=i.instance(),o=0,s=e,l=t;this._createMissingCalendarData(t);var u=t-(s>9||9===s&&r>=this.NEPALI_CALENDAR_DATA[l][0]?56:57);for(9!==e&&(o=r,s--);9!==s;)s<=0&&(s=12,l--),o+=this.NEPALI_CALENDAR_DATA[l][s],s--;return 9===e?(o+=r-this.NEPALI_CALENDAR_DATA[l][0])<0&&(o+=a.daysInYear(u)):o+=this.NEPALI_CALENDAR_DATA[l][9]-this.NEPALI_CALENDAR_DATA[l][0],a.newDate(u,1,1).add(o,"d").toJD()},fromJD:function(t){var e=i.instance(),r=e.fromJD(t),n=r.year(),a=r.dayOfYear(),o=n+56;this._createMissingCalendarData(o);for(var s=9,l=this.NEPALI_CALENDAR_DATA[o][0],u=this.NEPALI_CALENDAR_DATA[o][s]-l+1;a>u;)s++,s>12&&(s=1,o++),u+=this.NEPALI_CALENDAR_DATA[o][s];var c=this.NEPALI_CALENDAR_DATA[o][s]-(u-a);return this.newDate(o,s,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,a.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var o=t-(t>=0?474:473),s=474+i(o,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*s-110)/2816)+365*(s-1)+1029983*Math.floor(o/2820)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=t-this.toJD(475,1,1),r=Math.floor(e/1029983),n=i(e,1029983),a=2820;if(1029982!==n){var o=Math.floor(n/366),s=i(n,366);a=Math.floor((2134*o+2816*s+2815)/1028522)+o+1}var l=a+2820*r+474;l=l<=0?l-1:l;var u=t-this.toJD(l,1,1)+1,c=u<=186?Math.ceil(u/31):Math.ceil((u-6)/30),h=t-this.toJD(l,c,1)+1;return this.newDate(l,c,h)}}),a.calendars.persian=n,a.calendars.jalali=n},{"../main":577,"object-assign":466}],574:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();n.prototype=new i.baseCalendar,a(n.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(e.year());return o.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(n.year());return o.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),t=this._t2gYear(n.year());return o.toJD(t,n.month(),n.day())},fromJD:function(t){var e=o.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)}}),i.calendars.taiwan=n},{"../main":577,"object-assign":466}],575:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();n.prototype=new i.baseCalendar,a(n.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(e.year());return o.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),t=this._t2gYear(n.year());return o.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),t=this._t2gYear(n.year());return o.toJD(t,n.month(),n.day())},fromJD:function(t){var e=o.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)},_g2tYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)}}),i.calendars.thai=n},{"../main":577,"object-assign":466}],576:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar,a(n.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear);return 355===this.daysInYear(e.year())},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var e=0,r=1;r<=12;r++)e+=this.daysInMonth(t,r);return e},daysInMonth:function(t,e){for(var r=this._validate(t,e,this.minDay,i.local.invalidMonth),n=r.toJD()-24e5+.5,a=0,s=0;sn)return o[a]-o[a-1];a++}return 30},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),a=12*(n.year()-1)+n.month()-15292;return n.day()+o[a-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;ne);n++)r++;var i=r+15292,a=Math.floor((i-1)/12),s=a+1,l=i-12*a,u=e-o[r-1]+1;return this.newDate(s,l,u)},isValid:function(t,e,r){var n=i.baseCalendar.prototype.isValid.apply(this,arguments);return n&&(t=null!=t.year?t.year:t,n=t>=1276&&t<=1500),n},_validate:function(t,e,r,n){var a=i.baseCalendar.prototype._validate.apply(this,arguments);if(a.year<1276||a.year>1500)throw n.replace(/\{0\}/,this.local.name);return a}}),i.calendars.ummalqura=n;var o=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":577,"object-assign":466}],577:[function(t,e,r){function n(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function i(t,e,r,n){if(this._calendar=t,this._year=e,this._month=r,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function a(t,e){return t=""+t,"000000".substring(0,e-t.length)+t}function o(){this.shortYearCutoff="+10"}function s(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}var l=t("object-assign");l(n.prototype,{instance:function(t,e){t=(t||"gregorian").toLowerCase(),e=e||"";var r=this._localCals[t+"-"+e];if(!r&&this.calendars[t]&&(r=new this.calendars[t](e),this._localCals[t+"-"+e]=r),!r)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return r},newDate:function(t,e,r,n,i){return n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,i):n)||this.instance(),n.newDate(t,e,r)},substituteDigits:function(t){return function(e){return(e+"").replace(/[0-9]/g,function(e){return t[e]})}},substituteChineseDigits:function(t,e){return function(r){for(var n="",i=0;r>0;){var a=r%10;n=(0===a?"":t[a]+e[i])+n,i++,r=Math.floor(r/10)}return 0===n.indexOf(t[1]+e[1])&&(n=n.substr(1)),n||t[0]}}}),l(i.prototype,{newDate:function(t,e,r){return this._calendar.newDate(null==t?this:t,e,r)},year:function(t){return 0===arguments.length?this._year:this.set(t,"y")},month:function(t){return 0===arguments.length?this._month:this.set(t,"m")},day:function(t){return 0===arguments.length?this._day:this.set(t,"d")},date:function(t,e,r){if(!this._calendar.isValid(t,e,r))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=e,this._day=r,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,e){return this._calendar.add(this,t,e)},set:function(t,e){return this._calendar.set(this,t,e)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(u.local.differentCalendars||u.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name) +;var e=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===e?0:e<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(this.year()<0?"-":"")+a(Math.abs(this.year()),4)+"-"+a(this.month(),2)+"-"+a(this.day(),2)}}),l(o.prototype,{_validateLevel:0,newDate:function(t,e,r){return null==t?this.today():(t.year&&(this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate),r=t.day(),e=t.month(),t=t.year()),new i(this,t,e,r))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+a(Math.abs(e.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear),12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return(r.month()+this.monthsInYear(r)-this.firstMonth)%this.monthsInYear(r)+this.minMonth},fromMonthOfYear:function(t,e){var r=(e+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth),r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){return this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate),{}},add:function(t,e,r){return this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){if(this._validateLevel++,"d"===r||"w"===r){var n=t.toJD()+e*("w"===r?this.daysInWeek():1),i=t.calendar().fromJD(n);return this._validateLevel--,[i.year(),i.month(),i.day()]}try{var a=t.year()+("y"===r?e:0),o=t.monthOfYear()+("m"===r?e:0),i=t.day();"y"===r?(t.month()!==this.fromMonthOfYear(a,o)&&(o=this.newDate(a,t.month(),this.minDay).monthOfYear()),o=Math.min(o,this.monthsInYear(a)),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o)))):"m"===r&&(!function(t){for(;oe-1+t.minMonth;)a++,o-=e,e=t.monthsInYear(a)}(this),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o))));var s=[a,this.fromMonthOfYear(a,o),i];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var i={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],a=r<0?-1:1;e=this._add(t,r*i[0]+a*i[1],i[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),i="m"===r?e:t.month(),a="d"===r?e:t.day();return"y"!==r&&"m"!==r||(a=Math.min(a,this.daysInMonth(n,i))),t.date(n,i,a)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var i=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),u=i-(l>2.5?4716:4715);return u<=0&&u--,this.newDate(u,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate),i=new Date(n.year(),n.month()-1,n.day());return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(0),i.setHours(i.getHours()>12?i.getHours()+2:0),i},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var u=e.exports=new n;u.cdate=i,u.baseCalendar=o,u.calendars.gregorian=s},{"object-assign":466}],578:[function(t,e,r){var n=t("object-assign"),i=t("./main");n(i.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),i.local=i.regionalOptions[""],n(i.cdate.prototype,{formatDate:function(t,e){return"string"!=typeof t&&(e=t,t=""),this._calendar.formatDate(t||"",this,e)}}),n(i.baseCalendar.prototype,{UNIX_EPOCH:i.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:i.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,e,r){if("string"!=typeof t&&(r=e,e=t,t=""),!e)return"";if(e.calendar()!==this)throw i.local.invalidFormat||i.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat,r=r||{};for(var n=r.dayNamesShort||this.local.dayNamesShort,a=r.dayNames||this.local.dayNames,o=r.monthNumbers||this.local.monthNumbers,s=r.monthNamesShort||this.local.monthNamesShort,l=r.monthNames||this.local.monthNames,u=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;g+n1}),c=function(t,e,r,n){var i=""+e;if(u(t,n))for(;i.length1},b=function(t,r){var n=y(t,r),a=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],o=new RegExp("^-?\\d{1,"+a+"}"),s=e.substring(M).match(o);if(!s)throw(i.local.missingNumberAt||i.regionalOptions[""].missingNumberAt).replace(/\{0\}/,M);return M+=s[0].length,parseInt(s[0],10)},x=this,_=function(t,r,n,a){for(var o=y(t,a)?n:r,s=0;s-1){d=1,p=m;for(var T=this.daysInMonth(f,d);p>T;T=this.daysInMonth(f,d))d++,p-=T}return h>-1?this.fromJD(h):this.newDate(f,d,p)},determineDate:function(t,e,r,n,i){r&&"object"!=typeof r&&(i=n,n=r,r=null),"string"!=typeof n&&(i=n,n="");var a=this;return e=e?e.newDate():null,t=null==t?e:"string"==typeof t?function(t){try{return a.parseDate(n,t,i)}catch(t){}t=t.toLowerCase();for(var e=(t.match(/^c/)&&r?r.newDate():null)||a.today(),o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,s=o.exec(t);s;)e.add(parseInt(s[1],10),s[2]||"d"),s=o.exec(t);return e}(t):"number"==typeof t?isNaN(t)||t===1/0||t===-1/0?e:a.today().add(t,"d"):a.newDate(t)}})},{"./main":577,"object-assign":466}],579:[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":108}],580:[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":579}],581:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function u(r,i){return n.coerce(t,e,o,r,i)}s=s||{},l=l||{};var c=u("visible",!l.itemIsNotPlainObject),h=u("clicktoshow");if(!c&&!h)return e;a(t,e,r,u);for(var f=e.showarrow,d=["x","y"],p=[-10,-30],m={_fullLayout:r},g=0;g<2;g++){var v=d[g],y=i.coerceRef(t,e,m,v,"","paper");if(i.coercePosition(e,m,u,y,v,.5),f){var b="a"+v,x=i.coerceRef(t,e,m,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[g]:.4;i.coercePosition(e,m,u,x,b,_)}u(v+"anchor"),u(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),f&&n.noneOrAll(t,e,["ax","ay"]),h){var w=u("xclick"),M=u("yclick");e._xclick=void 0===w?e.x:i.cleanPosition(w,m,e.xref),e._yclick=void 0===M?e.y:i.cleanPosition(M,m,e.yref)}return e}},{"../../lib":721,"../../plots/cartesian/axes":760,"./attributes":583,"./common_defaults":586}],582:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{path:"M-2.4,-3V3L0.6,0Z",backoff:.6},{path:"M-3.7,-2.5V2.5L1.3,0Z",backoff:1.3},{path:"M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z",backoff:1.55},{path:"M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z",backoff:1.6},{path:"M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z",backoff:2},{path:"M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z",backoff:0},{path:"M2,2V-2H-2V2Z",backoff:0}]},{}],583:[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,{}),width:{valType:"number",min:1,dflt:null},height:{valType:"number",min:1,dflt:null},opacity:{valType:"number",min:0,max:1,dflt:1},align:{valType:"enumerated",values:["left","center","right"],dflt:"center"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},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},standoff:{valType:"number",min:0,dflt:0},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"},xshift:{valType:"number",dflt:0},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()]},y:{valType:"any"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto"},yshift:{valType:"number",dflt:0},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1},xclick:{valType:"any"},yclick:{valType:"any"},hovertext:{valType:"string"},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:o({},i,{})},captureevents:{valType:"boolean"},_deprecated:{ref:{valType:"string"}}}},{"../../lib/extend":713,"../../plots/cartesian/constants":765,"../../plots/font_attributes":784,"./arrow_paths":582}],584:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;i.filterVisible(e.annotations).forEach(function(e){var r,n,i=a.getFromId(t,e.xref),o=a.getFromId(t,e.yref),s=3*e.arrowsize*e.arrowwidth||0;i&&i.autorange&&(r=s+e.xshift,n=s-e.xshift,e.axref===e.xref?(a.expand(i,[i.r2c(e.x)],{ppadplus:r,ppadminus:n}),a.expand(i,[i.r2c(e.ax)],{ppadplus:e._xpadplus,ppadminus:e._xpadminus})):a.expand(i,[i.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r),ppadminus:Math.max(e._xpadminus,n)})),o&&o.autorange&&(r=s-e.yshift,n=s+e.yshift,e.ayref===e.yref?(a.expand(o,[o.r2c(e.y)],{ppadplus:r,ppadminus:n}),a.expand(o,[o.r2c(e.ay)],{ppadplus:e._ypadplus,ppadminus:e._ypadminus})):a.expand(o,[o.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r),ppadminus:Math.max(e._ypadminus,n)}))})}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});if(a.list(t).filter(function(t){return t.autorange&&s[t._id]}).length)return i.syncOrAsync([o,n],t)}}},{"../../lib":721,"../../plots/cartesian/axes":760,"./draw":589}],585:[function(t,e,r){"use strict";function n(t,e){var r=a(t,e);return r.on.length>0||r.explicitOff.length>0}function i(t,e){var r,n=a(t,e),i=n.on,o=n.off.concat(n.explicitOff),l={};if(i.length||o.length){for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var s=F.selectAll("a");if(1===s.size()&&s.text()===F.text()){E.insert("a",":first-child").attr({"xlink:xlink:href":s.attr("xlink:href"),"xlink:xlink:show":s.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(I.node())}var u=E.select(".annotation-text-math-group"),h=!u.empty(),p=d.bBox((h?u:F).node()),b=p.width,C=p.height,O=e.width||b,R=e.height||C,j=Math.round(O+2*z),N=Math.round(R+2*z);e._w=O,e._h=R;for(var B=!1,U=["x","y"],V=0;V1)&&(J===Z?((at=K.r2fraction(e["a"+W]))<0||at>1)&&(B=!0):B=!0,B))continue;q=K._offset+K.r2p(e[W]),Y=.5}else"x"===W?(G=e[W],q=w.l+w.w*G):(G=1-e[W],q=w.t+w.h*G),Y=e.showarrow?.5:G;if(e.showarrow){it.head=q;var ot=e["a"+W];X=$*r(.5,e.xanchor)-tt*r(.5,e.yanchor),J===Z?(it.tail=K._offset+K.r2p(ot),H=X):(it.tail=q+ot,H=X+ot),it.text=it.tail+X;var st=_["x"===W?"width":"height"];if("paper"===Z&&(it.head=c.constrain(it.head,1,st-1)),"pixel"===J){var lt=-Math.max(it.tail-3,it.text),ut=Math.min(it.tail+3,it.text)-st;lt>0?(it.tail+=lt,it.text+=lt):ut>0&&(it.tail-=ut,it.text-=ut)}it.tail+=nt,it.head+=nt}else X=et*r(Y,rt),H=X,it.text=q+X;it.text+=nt,X+=nt,H+=nt,e["_"+W+"padplus"]=et/2+H,e["_"+W+"padminus"]=et/2-H,e["_"+W+"size"]=et,e["_"+W+"shift"]=X}if(B)return void E.remove();var ct=0,ht=0;if("left"!==e.align&&(ct=(O-b)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(R-C)*("middle"===e.valign?.5:1)),h)u.select("svg").attr({x:z+ct-1,y:z+ht}).call(d.setClipUrl,D?M:null);else{var ft=z+ht-p.top,dt=z+ct-p.left;F.call(m.positionText,dt,ft).call(d.setClipUrl,D?M:null)}P.select("rect").call(d.setRect,z,z,O,R),I.call(d.setRect,L/2,L/2,j-L,N-L),E.call(d.setTranslate,Math.round(k.x.text-j/2),Math.round(k.y.text-N/2)),S.attr({transform:"rotate("+A+","+k.x.text+","+k.y.text+")"});var pt=function(r,s){T.selectAll(".annotation-arrow-g").remove();var u=k.x.head,h=k.y.head,p=k.x.tail+r,m=k.y.tail+s,g=k.x.text+r,b=k.y.text+s,_=c.rotationXYMatrix(A,g,b),M=c.apply2DTransform(_),L=c.apply2DTransform2(_),C=+I.attr("width"),z=+I.attr("height"),D=g-.5*C,P=D+C,O=b-.5*z,F=O+z,R=[[D,O,D,F],[D,F,P,F],[P,F,P,O],[P,O,D,O]].map(L);if(!R.reduce(function(t,e){return t^!!o(u,h,u+1e6,h+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=o(p,m,u,h,t[0],t[1],t[2],t[3]);e&&(p=e.x,m=e.y)});var j=e.arrowwidth,N=e.arrowcolor,B=T.append("g").style({opacity:f.opacity(N)}).classed("annotation-arrow-g",!0),U=B.append("path").attr("d","M"+p+","+m+"L"+u+","+h).style("stroke-width",j+"px").call(f.stroke,f.rgb(N));if(y(U,e.arrowhead,"end",e.arrowsize,e.standoff),t._context.editable&&U.node().parentNode&&!n){var V=u,q=h;if(e.standoff){var H=Math.sqrt(Math.pow(u-p,2)+Math.pow(h-m,2));V+=e.standoff*(p-u)/H,q+=e.standoff*(m-h)/H}var G,Y,X,W=B.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(p-V)+","+(m-q),transform:"translate("+V+","+q+")"}).style("stroke-width",j+6+"px").call(f.stroke,"rgba(0,0,0,0)").call(f.fill,"rgba(0,0,0,0)");v.init({element:W.node(),gd:t,prepFn:function(){var t=d.getTranslate(E);Y=t.x,X=t.y,G={},i&&i.autorange&&(G[i._name+".autorange"]=!0),a&&a.autorange&&(G[a._name+".autorange"]=!0)},moveFn:function(t,r){var n=M(Y,X),o=n[0]+t,s=n[1]+r;E.call(d.setTranslate,o,s),G[x+".x"]=i?i.p2r(i.r2p(e.x)+t):e.x+t/w.w,G[x+".y"]=a?a.p2r(a.r2p(e.y)+r):e.y-r/w.h,e.axref===e.xref&&(G[x+".ax"]=i.p2r(i.r2p(e.ax)+t)),e.ayref===e.yref&&(G[x+".ay"]=a.p2r(a.r2p(e.ay)+r)),B.attr("transform","translate("+t+","+r+")"),S.attr({transform:"rotate("+A+","+o+","+s+")"})},doneFn:function(e){if(e){l.relayout(t,G);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}};if(e.showarrow&&pt(0,0),t._context.editable){var mt,gt;v.init({element:E.node(),gd:t,prepFn:function(){gt=S.attr("transform"),mt={}},moveFn:function(t,r){var o="pointer";if(e.showarrow)e.axref===e.xref?mt[x+".ax"]=i.p2r(i.r2p(e.ax)+t):mt[x+".ax"]=e.ax+t,e.ayref===e.yref?mt[x+".ay"]=a.p2r(a.r2p(e.ay)+r):mt[x+".ay"]=e.ay+r,pt(t,r);else{if(n)return;if(i)mt[x+".x"]=e.x+t/i._m;else{var s=e._xsize/w.w,l=e.x+(e._xshift-e.xshift)/w.w-s/2;mt[x+".x"]=v.align(l+t/w.w,s,0,1,e.xanchor)}if(a)mt[x+".y"]=e.y+r/a._m;else{var u=e._ysize/w.h,c=e.y-(e._yshift+e.yshift)/w.h-u/2;mt[x+".y"]=v.align(c-r/w.h,u,0,1,e.yanchor)}i&&a||(o=v.getCursor(i?.5:mt[x+".x"],a?.5:mt[x+".y"],e.xanchor,e.yanchor))}S.attr({transform:"translate("+t+","+r+")"+gt}),g(E,o)},doneFn:function(e){if(g(E),e){l.relayout(t,mt);var r=document.querySelector(".js-notes-box-panel");r&&r.redraw(r.selectedObj)}}})}}var b,x,_=t._fullLayout,w=t._fullLayout._size;n?(b="annotation-"+n,x=n+".annotations["+r+"]"):(b="annotation",x="annotations["+r+"]"),_._infolayer.selectAll("."+b+'[data-index="'+r+'"]').remove();var M="clip"+_._uid+"_ann"+r;if(!e._input||!1===e.visible)return void s.selectAll("#"+M).remove();var k={x:{},y:{}},A=+e.textangle||0,T=_._infolayer.append("g").classed(b,!0).attr("data-index",String(r)).style("opacity",e.opacity),S=T.append("g").classed("annotation-text-g",!0),E=S.append("g").style("pointer-events",e.captureevents?"all":null).call(g,"default").on("click",function(){t._dragging=!1;var i={index:r,annotation:e._input,fullAnnotation:e,event:s.event};n&&(i.subplotId=n),t.emit("plotly_clickannotation",i)});e.hovertext&&E.on("mouseover",function(){var r=e.hoverlabel,n=r.font,i=this.getBoundingClientRect(),a=t.getBoundingClientRect();p.loneHover({x0:i.left-a.left,x1:i.right-a.left,y:(i.top+i.bottom)/2-a.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:_._hoverlayer.node(),outerContainer:_._paper.node(),gd:t})}).on("mouseout",function(){p.loneUnhover(_._hoverlayer.node())});var L=e.borderwidth,C=e.borderpad,z=L+C,I=E.append("rect").attr("class","bg").style("stroke-width",L+"px").call(f.stroke,e.bordercolor).call(f.fill,e.bgcolor),D=e.width||e.height,P=_._defs.select(".clips").selectAll("#"+M).data(D?[0]:[]);P.enter().append("clipPath").classed("annclip",!0).attr("id",M).append("rect"),P.exit().remove();var O=e.font,F=E.append("text").classed("annotation-text",!0).text(e.text);t._context.editable?F.call(m.makeEditable,{delegate:E,gd:t}).call(u).on("edit",function(r){e.text=r,this.call(u);var n={};n[x+".text"]=e.text,i&&i.autorange&&(n[i._name+".autorange"]=!0),a&&a.autorange&&(n[a._name+".autorange"]=!0),l.relayout(t,n)}):F.call(u)}function o(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 m=(u*d-c*f)/p,g=(u*h-l*f)/p;return g<0||g>1||m<0||m>1?null:{x:t+l*m,y:e+h*m}}var s=t("d3"),l=t("../../plotly"),u=t("../../plots/plots"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../fx"),m=t("../../lib/svg_text_utils"),g=t("../../lib/setcursor"),v=t("../dragelement"),y=t("./draw_arrow_head");e.exports={draw:n,drawOne:i,drawRaw:a}},{"../../lib":721,"../../lib/setcursor":736,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/cartesian/axes":760,"../../plots/plots":823,"../color":600,"../dragelement":621,"../drawing":624,"../fx":641,"./draw_arrow_head":590,d3:120}],590:[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,u){function c(){t.style("stroke-dasharray","0px,100px")}function h(r,i){d.path&&(e>5&&(i=0),n.select(f.parentNode).append("path").attr({class:t.attr("class"),d:d.path,transform:"translate("+r.x+","+r.y+")rotate("+180*i/Math.PI+")scale("+y+")"}).style({fill:b,opacity:x,"stroke-width":0}))}i(l)||(l=1);var f=t.node(),d=s[e||0];"string"==typeof r&&r||(r="end");var p,m,g,v,y=(o.getPx(t,"stroke-width")||1)*l,b=t.style("stroke")||a.defaultLine,x=t.style("stroke-opacity")||1,_=r.indexOf("start")>=0,w=r.indexOf("end")>=0,M=d.backoff*y+u;if("line"===f.nodeName){p={x:+t.attr("x1"),y:+t.attr("y1")},m={x:+t.attr("x2"),y:+t.attr("y2")};var k=p.x-m.x,A=p.y-m.y;if(g=Math.atan2(A,k),v=g+Math.PI,M){if(M*M>k*k+A*A)return void c();var T=M*Math.cos(g),S=M*Math.sin(g);_&&(p.x-=T,p.y-=S,t.attr({x1:p.x,y1:p.y})),w&&(m.x+=T,m.y+=S,t.attr({x2:m.x,y2:m.y}))}}else if("path"===f.nodeName){var E=f.getTotalLength(),L="";if(E1){u=!0;break}}u?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l.pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":812,"../annotations/draw":589}],596:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"annotations3d",schema:{layout:{"scene.annotations":t("./attributes")}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),convert:t("./convert"),draw:t("./draw")}},{"./attributes":592,"./convert":593,"./defaults":594,"./draw":595}],597:[function(t,e,r){"use strict";e.exports=t("world-calendars/dist/main"),t("world-calendars/dist/plus"),t("world-calendars/dist/calendars/chinese"),t("world-calendars/dist/calendars/coptic"),t("world-calendars/dist/calendars/discworld"),t("world-calendars/dist/calendars/ethiopian"),t("world-calendars/dist/calendars/hebrew"),t("world-calendars/dist/calendars/islamic"),t("world-calendars/dist/calendars/julian"),t("world-calendars/dist/calendars/mayan"),t("world-calendars/dist/calendars/nanakshahi"),t("world-calendars/dist/calendars/nepali"),t("world-calendars/dist/calendars/persian"),t("world-calendars/dist/calendars/taiwan"),t("world-calendars/dist/calendars/thai"),t("world-calendars/dist/calendars/ummalqura")},{"world-calendars/dist/calendars/chinese":563,"world-calendars/dist/calendars/coptic":564,"world-calendars/dist/calendars/discworld":565,"world-calendars/dist/calendars/ethiopian":566,"world-calendars/dist/calendars/hebrew":567,"world-calendars/dist/calendars/islamic":568,"world-calendars/dist/calendars/julian":569,"world-calendars/dist/calendars/mayan":570,"world-calendars/dist/calendars/nanakshahi":571,"world-calendars/dist/calendars/nepali":572,"world-calendars/dist/calendars/persian":573,"world-calendars/dist/calendars/taiwan":574,"world-calendars/dist/calendars/thai":575,"world-calendars/dist/calendars/ummalqura":576,"world-calendars/dist/main":577,"world-calendars/dist/plus":578}],598:[function(t,e,r){"use strict";function n(t,e,r){for(var n,a,o,s,l,u=Math.floor((e+.05)/h)+c,f=i(r).fromJD(u),d=0;-1!==(d=t.indexOf("%",d));)n=t.charAt(d+1),"0"===n||"-"===n||"_"===n?(o=3,a=t.charAt(d+2),"_"===n&&(n="-")):(a=n,n="0",o=2),s=b[a],s?(l=s===y?y:f.formatDate(s[n]),t=t.substr(0,d)+l+t.substr(d+o),d+=l.length):d+=o;return t}function i(t){var e=x[t];return e||(e=x[t]=s.instance(t))}function a(t){return l.extendFlat({},f,{description:t})}function o(t){return"Sets the calendar system to use with `"+t+"` date data."}var s=t("./calendars"),l=t("../../lib"),u=t("../../constants/numerical"),c=u.EPOCHJD,h=u.ONEDAY,f={valType:"enumerated",values:Object.keys(s.calendars),dflt:"gregorian"},d=function(t,e,r,n){var i={};return i[r]=f,l.coerce(t,e,i,r,n)},p=function(t,e,r,n){for(var i=0;i=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;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var u=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||u).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},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return i(o).toRgbString()},o.contrast=function(t,e,r){var n=i(t);return 1!==n.getAlpha()&&(n=i(o.combine(t,u))),(n.isDark()?e?n.lighten(e):u:r?n.darken(r):l).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]-=(ut-s)/2):r.node()&&!r.classed("js-placeholder")&&(ut=d.bBox(r.node()).height),ut){if(ut+=5,"top"===M.titleside)et.domain[1]-=ut/E.h,a[1]*=-1;else{et.domain[0]+=ut/E.h;var u=g.lineCount(r);a[1]+=(1-u)*s}e.attr("transform","translate("+a+")"),et.setScale()}}st.selectAll(".cbfills,.cblines,.cbaxis").attr("transform","translate(0,"+Math.round(E.h*(1-et.domain[1]))+")");var h=st.select(".cbfills").selectAll("rect.cbfill").data(I);h.enter().append("rect").classed("cbfill",!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?C[0]:(I[e]+I[e-1])/2,e===I.length-1?C[1]:(I[e]+I[e+1])/2].map(et.c2p).map(Math.round);e!==I.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:Z,width:Math.max(V,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=st.select(".cblines").selectAll("path.cbline").data(M.line.color&&M.line.width?z:[]);return f.enter().append("path").classed("cbline",!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Z+","+(Math.round(et.c2p(t))+M.line.width/2%1)+"h"+V).call(d.lineGroupStyle,M.line.width,D(t),M.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=Z+V+(M.outlinewidth||0)/2-("outside"===M.ticks?1:0),et.side="right",c.syncOrAsync([function(){return l.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(M.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,i=E.l+(et.position||0)*E.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));A("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:M.titleside,offsetLeft:E.l,offsetTop:E.t,maxShift:S.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function A(e,r){var n,i=w();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:et,propName:n,traceIndex:i.index,dfltName:"colorscale",containerGroup:st.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;st.selectAll("."+o+",."+o+"-math-group").remove(),m.draw(t,e,h(a,r||{}))}function T(){var r=V+M.outlinewidth/2+d.bBox(et._axislayer.node()).width;if(N=lt.select("text"),N.node()&&!N.classed("js-placeholder")){var n,i=lt.select(".h"+et._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(M.titleside)?d.bBox(i).width:d.bBox(lt.node()).right-Z-E.l,r=Math.max(r,n)}var a=2*M.xpad+r+M.borderwidth+M.outlinewidth/2,s=Q-$;st.select(".cbbg").attr({x:Z-M.xpad-(M.borderwidth+M.outlinewidth)/2,y:$-X,width:Math.max(a,2),height:Math.max(s+2*X,2)}).call(p.fill,M.bgcolor).call(p.stroke,M.bordercolor).style({"stroke-width":M.borderwidth}),st.selectAll(".cboutline").attr({x:Z,y:$+M.ypad+("top"===M.titleside?ut:0),width:Math.max(V,2),height:Math.max(s-2*M.ypad-ut,2)}).call(p.stroke,M.outlinecolor).style({fill:"None","stroke-width":M.outlinewidth});var l=({center:.5,right:1}[M.xanchor]||0)*a;st.attr("transform","translate("+(E.l-l)+","+E.t+")"),o.autoMargin(t,e,{x:M.x,y:M.y,l:a*({right:1,center:.5}[M.xanchor]||0),r:a*({left:1,center:.5}[M.xanchor]||0),t:s*({bottom:1,middle:.5}[M.yanchor]||0),b:s*({top:1,middle:.5}[M.yanchor]||0)})}var S=t._fullLayout,E=S._size;if("function"!=typeof M.fillcolor&&"function"!=typeof M.line.color)return void S._infolayer.selectAll("g."+e).remove();var L,C=n.extent(("function"==typeof M.fillcolor?M.fillcolor:M.line.color).domain()),z=[],I=[],D="function"==typeof M.line.color?M.line.color:function(){return M.line.color},P="function"==typeof M.fillcolor?M.fillcolor:function(){return M.fillcolor},O=M.levels.end+M.levels.size/100,F=M.levels.size,R=1.001*C[0]-.001*C[1],j=1.001*C[1]-.001*C[0];for(L=M.levels.start;(L-O)*F<0;L+=F)L>R&&LC[0]&&L1){var ot=Math.pow(10,Math.floor(Math.log(at)/Math.LN10));nt*=ot*c.roundUp(at/ot,[2,5,10]),(Math.abs(M.levels.start)/M.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[K+W,K+G-W],et.setScale();var st=S._infolayer.selectAll("g."+e).data([0]);st.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)}),st.attr("transform","translate("+Math.round(E.l)+","+Math.round(E.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(E.l)+",-"+Math.round(E.t)+")");et._axislayer=st.select(".cbaxis");var ut=0;if(-1!==["top","bottom"].indexOf(M.titleside)){var ct,ht=E.l+(M.x+Y)*E.w,ft=et.titlefont.size;ct="top"===M.titleside?(1-(K+G-W))*E.h+E.t+3+.75*ft:(1-(K+W))*E.h+E.t-3-.25*ft,A(et._id+"title",{attributes:{x:ht,y:ct,"text-anchor":"start"}})}var dt=c.syncOrAsync([o.previousPromises,k,o.previousPromises,T],t);if(dt&&dt.then&&(t._promises||[]).push(dt),t._context.editable){var pt,mt,gt;u.init({element:st.node(),gd:t,prepFn:function(){pt=st.attr("transform"),f(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),mt=u.align(J+t/E.w,q,0,1,M.xanchor),gt=u.align(K-e/E.h,G,0,1,M.yanchor);var r=u.getCursor(mt,gt,M.xanchor,M.yanchor);f(st,r)},doneFn:function(e){f(st),e&&void 0!==mt&&void 0!==gt&&a.restyle(t,{"colorbar.x":mt,"colorbar.y":gt},w().index)}})}return dt}function w(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=m,s.reversescale&&(m=a(m)),s.colorscale=m)}},{"../../lib":721,"./flip_scale":611,"./scales":618}],607:[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":713,"./attributes":605,"./scales.js":618}],608:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":618}],609:[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,m=h?i.nestedProperty(e,d).get()||{}:e,g=p[f+"min"],v=p[f+"max"],y=p.colorscale;u(h+f+"auto",!(n(g)&&n(v)&&g=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],612:[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":608,"./is_valid_scale_array":616,"./scales":618}],613:[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}},{}],620:[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":721}],621:[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=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var c=t("./unhover");u.unhover=c.wrapped,u.unhoverRaw=c.raw,u.init=function(t){function e(e){return m._dragged=!1,m._dragging=!0,c=e.clientX,h=e.clientY,p=e.target,f=(new Date).getTime(),f-m._mouseDownTimev&&(g=Math.max(g-1,1)), +t.doneFn&&t.doneFn(m._dragged,g,e),!m._dragged){var r;try{r=new MouseEvent("click",e)}catch(t){r=document.createEvent("MouseEvents"),r.initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}p.dispatchEvent(r)}return i(m),m._dragged=!1,o.pauseEvent(e)}var c,h,f,d,p,m=t.gd,g=1,v=l.DBLCLICKDELAY;m._mouseDownTime||(m._mouseDownTime=0),t.element.onmousedown=e,t.element.style.pointerEvents="all"},u.coverSlip=n},{"../../constants/interactions":701,"../../lib":721,"../../plotly":755,"../../plots/cartesian/constants":765,"./align":619,"./cursor":620,"./unhover":622}],622:[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,i=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":712}],623:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},{}],624:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){if(u.traceIs(r,"symbols")){var l=y(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:v.isBubble(r)?l(t.ms):(a.size||6)/2,t.mrc=e;var n=b.symbolNumber(t.mx||a.symbol)||0,i=n%100;return t.om=n%200>=100,b.symbolFuncs[i](e)+(n>=200?w:"")}).style("opacity",function(t){return(t.mo+1||a.opacity+1)-1})}var h,f,d,p=!1;if(t.so?(d=o.outlierwidth,f=o.outliercolor,h=a.outliercolor):(d=(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)?c.defaultLine:o.color,Array.isArray(a.color)&&(h=c.defaultLine,p=!0),h="mc"in t?t.mcc=n(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(c.stroke,h).style({"stroke-width":(d||1)+"px",fill:"none"});else{e.style("stroke-width",d+"px");var m=a.gradient,g=t.mgt;if(g?p=!0:g=m&&m.type,g&&"none"!==g){var x=t.mgc;x?p=!0:x=m.color;var _="g"+s._fullLayout._uid+"-"+r.uid;p&&(_+="-"+t.i),e.call(b.gradient,s,_,g,h,x)}else e.call(c.fill,h);d&&e.call(c.stroke,f)}}function i(t,e,r,n){var i=t[0]-e[0],a=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],u=Math.pow(i*i+a*a,T/2),c=Math.pow(s*s+l*l,T/2),h=(c*c*i-u*u*s)*n,f=(c*c*a-u*u*l)*n,d=3*c*(u+c),p=3*u*(u+c);return[[o.round(e[0]+(d&&h/d),2),o.round(e[1]+(d&&f/d),2)],[o.round(e[0]-(p&&h/p),2),o.round(e[1]-(p&&f/p),2)]]}function a(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var o=t("d3"),s=t("fast-isnumeric"),l=t("tinycolor2"),u=t("../../registry"),c=t("../color"),h=t("../colorscale"),f=t("../../lib"),d=t("../../lib/svg_text_utils"),p=t("../../constants/xmlns_namespaces"),m=t("../../constants/alignment"),g=m.LINE_SPACING,v=t("../../traces/scatter/subtypes"),y=t("../../traces/scatter/make_bubble_size_func"),b=e.exports={};b.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(c.fill,n)},b.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},b.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},b.setRect=function(t,e,r,n,i){t.call(b.setPosition,e,r).call(b.setSize,n,i)},b.translatePoint=function(t,e,r,n){var i=t.xp||r.c2p(t.x),a=t.yp||n.c2p(t.y);return!!(s(i)&&s(a)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0)},b.translatePoints=function(t,e,r,n){t.each(function(t){var i=o.select(this);b.translatePoint(t,i,e,r,n)})},b.getPx=function(t,e){return Number(t.style(e).replace(/px$/,""))},b.crispRound=function(t,e,r){return e&&s(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},b.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||"";c.stroke(e,n||a.color),b.dashLine(e,s,o)},b.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},a=e||i.width||0,s=n||i.dash||"";o.select(this).call(c.stroke,r||i.color).call(b.dashLine,s,a)})},b.dashLine=function(t,e,r){r=+r||0,e=b.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},b.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},b.singleFillStyle=function(t){var e=o.select(t.node()),r=e.data(),n=(((r[0]||[])[0]||{}).trace||{}).fillcolor;n&&t.call(c.fill,n)},b.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=o.select(this);try{r.call(c.fill,e[0].trace.fillcolor)}catch(e){f.error(e,t),r.remove()}})};var x=t("./symbol_defs");b.symbolNames=[],b.symbolFuncs=[],b.symbolNeedLines={},b.symbolNoDot={},b.symbolList=[],Object.keys(x).forEach(function(t){var e=x[t];b.symbolList=b.symbolList.concat([e.n,t,e.n+100,t+"-open"]),b.symbolNames[e.n]=t,b.symbolFuncs[e.n]=e.f,e.needLine&&(b.symbolNeedLines[e.n]=!0),e.noDot?b.symbolNoDot[e.n]=!0:b.symbolList=b.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var _=b.symbolNames.length,w="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";b.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=b.symbolNames.indexOf(t),t>=0&&(t+=e)}return t%100>=_||t>=400?0:Math.floor(Math.max(t,0))};var M={x1:1,x2:0,y1:0,y2:0},k={x1:0,x2:0,y1:1,y2:0};b.gradient=function(t,e,r,n,i,a){var s=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+i+a],f.identity);s.exit().remove(),s.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=o.select(this);"horizontal"===n?t.attr(M):"vertical"===n&&t.attr(k),t.attr("id",r);var e=l(i),s=l(a);t.append("stop").attr({offset:"0%","stop-color":c.tinyRGB(s),"stop-opacity":s.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":c.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},b.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},b.singlePointStyle=function(t,e,r,i,a,o){var s=r.marker;n(t,e,r,i,a,s,s.line,o)},b.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,i=b.tryColorscale(n,""),a=b.tryColorscale(n,"line");t.each(function(t){b.singlePointStyle(t,o.select(this),e,i,a,r)})}},b.tryColorscale=function(t,e){var r=e?f.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?h.makeColorScaleFunc(h.extractScale(n,r.cmin,r.cmax)):f.identity};var A={start:1,end:-1,middle:0,bottom:1,top:-1};b.textPointStyle=function(t,e,r){t.each(function(t){var n=o.select(this),i=t.tx||e.text;if(!i||Array.isArray(i))return void n.remove();var a=t.tp||e.textposition,l=-1!==a.indexOf("top")?"top":-1!==a.indexOf("bottom")?"bottom":"middle",u=-1!==a.indexOf("left")?"end":-1!==a.indexOf("right")?"start":"middle",c=t.ts||e.textfont.size,h=t.mrc?t.mrc/.8+1:0;c=s(c)&&c>0?c:0,n.call(b.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).attr("text-anchor",u).text(i).call(d.convertToTspans,r);var f=o.select(this.parentNode),p=(d.lineCount(n)-1)*g+1,m=A[u]*h,v=.75*c+A[l]*h+(A[l]-1)*p*c/2;f.attr("transform","translate("+m+","+v+")")})};var T=.5;b.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],a=[];for(r=1;r=1e4&&(b.savedBBoxes={},L=0),e&&(b.savedBBoxes[e]=g),L++,f.extendFlat({},g)},b.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.split("#")[0]+r),t.attr("clip-path","url("+r+")")},b.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",i=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+i[0]||0,y:+i[1]||0}},b.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,i=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[i]("transform")||"";return e=e||0,r=r||0,o=o.replace(n,"").trim(),o+=" translate("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},b.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"",i=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+i[0]||1,y:+i[1]||1}},b.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,i=t.attr?"attr":"getAttribute",a=t.attr?"attr":"setAttribute",o=t[i]("transform")||"";return e=e||1,r=r||1,o=o.replace(n,"").trim(),o+=" scale("+e+", "+r+")",o=o.trim(),t[a]("transform",o),o},b.setPointGroupScale=function(t,e,r){var n,i,a;return e=e||1,r=r||1,i=1===e&&1===r?"":" scale("+e+","+r+")",a=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(a,""),n+=i,n=n.trim(),this.setAttribute("transform",n)}),i};var C=/translate\([^)]*\)\s*$/;b.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=o.select(this),i=n.select("text"),a=parseFloat(i.attr("x")||0),s=parseFloat(i.attr("y")||0),l=(n.attr("transform")||"").match(C);t=1===e&&1===r?[]:["translate("+a+","+s+")","scale("+e+","+r+")","translate("+-a+","+-s+")"],l&&t.push(l),n.attr("transform",t.join(" "))})}},{"../../constants/alignment":696,"../../constants/xmlns_namespaces":704,"../../lib":721,"../../lib/svg_text_utils":740,"../../registry":838,"../../traces/scatter/make_bubble_size_func":1037,"../../traces/scatter/subtypes":1042,"../color":600,"../colorscale":614,"./symbol_defs":625,d3:120,"fast-isnumeric":129,tinycolor2:530}],625:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(-.309*t,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),u=n.round(.118*e,2),c=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+u+"L"+o+","+c+"L0,"+n.round(.382*e,2)+"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:120}],626:[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"}}}},{}],627:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=a.visible&&-1!==["linear","log"].indexOf(r.type),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 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(r.duration).style("opacity",1),m.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 m=d.width;h="M"+(o.x-m)+","+o.yh+"h"+2*m+"m-"+m+",0V"+o.ys,o.noYS||(h+="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(r.duration).ease(r.easing)),g.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":1042,d3:120,"fast-isnumeric":129}],632:[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":600,d3:120}],633:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0},bordercolor:{valType:"color",arrayOk:!0},font:{family:n({},i.family,{arrayOk:!0}),size:n({},i.size,{arrayOk:!0}),color:n({},i.color,{arrayOk:!0})}}}},{"../../lib/extend":713,"../../plots/font_attributes":784}],634:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||i.identity,Array.isArray(t)&&(e[0][r]=n(t))}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){for(var e=t.calcdata,r=t._fullLayout,o=0;o=0&&r.indexQ.width||J<0||J>Q.height)return b.unhoverRaw(t,e)}if(P="xval"in e?w.flat(f,e.xval):w.p2c(S,Z),O="yval"in e?w.flat(f,e.yval):w.p2c(E,J),!h(P[0])||!h(O[0]))return d.warn("Fx.hover failed",e,t),b.unhoverRaw(t,e)}var $=1/0;for(R=0;RY&&(X.splice(0,Y),$=X[0].distance)}if(0===X.length)return b.unhoverRaw(t,e);X.sort(function(t,e){return t.distance-e.distance});var it=t._hoverdata,at=[];for(F=0;F1,ut=y.combine(m.plot_bgcolor||y.background,m.paper_bgcolor),ct={hovermode:D,rotateLabels:lt,bgColor:ut,container:m._hoverlayer,outerContainer:m._paperdiv,commonLabelOpts:m.hoverlabel},ht=i(X,ct,t);if(a(X,lt?"xa":"ya"),o(ht,lt),e.target&&e.target.tagName){var ft=_.getComponentMethod("annotations","hasClickToShow")(t,at);g(c.select(e.target),ft?"pointer":"")}e.target&&!n&&u(t,e,it)&&(it&&t.emit("plotly_unhover",{event:e,points:it}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:S,yaxes:E,xvals:P,yvals:O}))}function i(t,e,r){var n,i,a=e.hovermode,o=e.rotateLabels,s=e.bgColor,l=e.container,u=e.outerContainer,h=e.commonLabelOpts||{},f=e.fontFamily||M.HOVERFONT,d=e.fontSize||M.HOVERFONTSIZE,p=t[0],g=p.xa,b=p.ya,x="y"===a?"yLabel":"xLabel",_=p[x],w=(String(_)||"").split(" ")[0],A=u.node().getBoundingClientRect(),T=A.top,S=A.width,E=A.height,z=p.distance<=M.MAXDIST&&("x"===a||"y"===a);for(n=0;n15&&(n=n.substr(0,12)+"...")),void 0!==t.extraText&&(i+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(i+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(i+="y: "+t.yLabel+"
"),i+=(i?"z: ":"")+t.zLabel):z&&t[a+"Label"]===_?i=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(i=t.yLabel):i=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(i+=(i?"
":"")+t.text),""===i&&(""===n&&e.remove(),i=n);var p=e.select("text.nums").call(v.font,t.fontFamily||f,t.fontSize||d,t.fontColor||h).text(i).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,r),g=e.select("text.name"),b=0;n&&n!==i?(g.call(v.font,t.fontFamily||f,t.fontSize||d,u).text(n).attr("data-notex",1).call(m.positionText,0,0).call(m.convertToTspans,r),b=g.node().getBoundingClientRect().width+2*C):(g.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:h});var x,w,M=p.node().getBoundingClientRect(),A=t.xa._offset+(t.x0+t.x1)/2,I=t.ya._offset+(t.y0+t.y1)/2,D=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=M.width+L+C+b;t.ty0=T-M.top,t.bx=M.width+2*C,t.by=M.height+2*C,t.anchor="start",t.txwidth=M.width,t.tx2width=b,t.offset=0,o?(t.pos=A,x=I+P/2+O<=E,w=I-P/2-O>=0,"top"!==t.idealAlign&&x||!w?x?(I+=P/2,t.anchor="start"):t.anchor="middle":(I-=P/2,t.anchor="end")):(t.pos=I,x=A+D/2+O<=S,w=A-D/2-O>=0,"left"!==t.idealAlign&&x||!w?x?(A+=D/2,t.anchor="start"):t.anchor="middle":(A-=D/2,t.anchor="end")),p.attr("text-anchor",t.anchor),b&&g.attr("text-anchor",t.anchor),e.attr("transform","translate("+A+","+I+")"+(o?"rotate("+k+")":""))}),P}function a(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)?T: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===m.pmin&&p.pmax===m.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 g=h[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 o(t,e){t.each(function(t){var r=c.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*(L+C),s=o+a*(t.txwidth+C),l=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-E,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*L+l)+","+(L+u)+"v"+(t.by/2-L)+"h"+n*t.bx+"v-"+t.by+"H"+(n*L+l)+"V"+(u-L)+"Z"),i.call(m.positionText,o+l,u+t.ty0-t.by/2+C),t.tx2width&&(r.select("text.name").call(m.positionText,s+a*C+l,u+t.ty0-t.by/2+C),r.select("rect").call(v.setRect,s+(a-1)*t.tx2width/2+l,u-t.by/2-1,t.tx2width,t.by+2))})}function s(t,e){function r(e,r,o){var s;if(a[r])s=a[r];else if(i[r]){var l=i[r];Array.isArray(l)&&Array.isArray(l[t.index[0]])&&(s=l[t.index[0]][t.index[1]])}else s=d.nestedProperty(n,o).get();s&&(t[e]=s)}var n=t.trace||{},i=t.cd[0],a=t.cd[t.index]||{};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=d.constrain(t.x0,0,t.xa._length),t.x1=d.constrain(t.x1,0,t.xa._length),t.y0=d.constrain(t.y0,0,t.ya._length),t.y1=d.constrain(t.y1,0,t.ya._length);var o;if(void 0!==t.xLabelVal){o="log"===t.xa.type&&t.xLabelVal<=0;var s=x.tickText(t.xa,t.xa.c2l(o?-t.xLabelVal:t.xLabelVal),"hover");o?0===t.xLabelVal?t.xLabel="0":t.xLabel="-"+s.text:t.xLabel=s.text,t.xVal=t.xa.c2d(t.xLabelVal)}if(void 0!==t.yLabelVal){o="log"===t.ya.type&&t.yLabelVal<=0;var l=x.tickText(t.ya,t.ya.c2l(o?-t.yLabelVal:t.yLabelVal),"hover");o?0===t.yLabelVal?t.yLabel="0":t.yLabel="-"+l.text:t.yLabel=l.text,t.yVal=t.ya.c2d(t.yLabelVal)}if(void 0!==t.zLabelVal&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var u=x.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+u+" / -"+x.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+u,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=x.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+x.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var h=t.hoverinfo||t.trace.hoverinfo;return"all"!==h&&(h=h.split("+"),-1===h.indexOf("x")&&(t.xLabel=void 0),-1===h.indexOf("y")&&(t.yLabel=void 0),-1===h.indexOf("z")&&(t.zLabel=void 0),-1===h.indexOf("text")&&(t.text=void 0),-1===h.indexOf("name")&&(t.name=void 0)),t}function l(t,e){var r=e.hovermode,n=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"===r&&(s||l)){var u=e.fullLayout,c=a._offset+(i.x0+i.x1)/2,h=o._offset+(i.y0+i.y1)/2,d=y.combine(u.plot_bgcolor,u.paper_bgcolor),p=f.readability(i.color,d)<1.5?y.contrast(d):i.color;if(l){var m=o.spikemode,g=o.spikethickness,b=o.spikecolor||p,x=o._boundingBox,_=(x.left+x.right)/2=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 c=t("d3"),h=t("fast-isnumeric"),f=t("tinycolor2"),d=t("../../lib"),p=t("../../lib/events"),m=t("../../lib/svg_text_utils"),g=t("../../lib/override_cursor"),v=t("../drawing"),y=t("../color"),b=t("../dragelement"),x=t("../../plots/cartesian/axes"),_=t("../../registry"),w=t("./helpers"),M=t("./constants"),k=M.YANGLE,A=Math.PI*k/180,T=1/Math.sin(A),S=Math.cos(A),E=Math.sin(A),L=M.HOVERARROWSIZE,C=M.HOVERTEXTPAD;r.hover=function(t,e,r,i){if("string"==typeof t&&(t=document.getElementById(t)),void 0===t._lastHoverTime&&(t._lastHoverTime=0),void 0!==t._hoverTimer&&(clearTimeout(t._hoverTimer),t._hoverTimer=void 0),Date.now()>t._lastHoverTime+M.HOVERMINTIME)return n(t,e,r,i),void(t._lastHoverTime=Date.now());t._hoverTimer=setTimeout(function(){n(t,e,r,i),t._lastHoverTime=Date.now(),t._hoverTimer=void 0},M.HOVERMINTIME)},r.loneHover=function(t,e){var r={color:t.color||y.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=c.select(e.container),a=e.outerContainer?c.select(e.outerContainer):n,s={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||y.background,container:n,outerContainer:a},l=i([r],s,e.gd);return o(l,s.rotateLabels),l.node()}},{"../../lib":721,"../../lib/events":712,"../../lib/override_cursor":730,"../../lib/svg_text_utils":740,"../../plots/cartesian/axes":760,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"./constants":636,"./helpers":638,d3:120,"fast-isnumeric":129,tinycolor2:530}],640:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){i=i||{},r("hoverlabel.bgcolor",i.bgcolor),r("hoverlabel.bordercolor",i.bordercolor),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":721}],641:[function(t,e,r){"use strict";function n(t){var e=s.isD3Selection(t)?t:o.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()}function i(t,e,r){return s.castOption(t,e,"hoverlabel."+r)}function a(t,e,r){function n(r){return s.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return s.castOption(t,r,"hoverinfo",n)}var o=t("d3"),s=t("../../lib"),l=t("../dragelement"),u=t("./helpers"),c=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:c},attributes:t("./attributes"),layoutAttributes:c,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:u.getDistanceFunction,getClosest:u.getClosest,inbox:u.inbox,appendArrayPointValue:u.appendArrayPointValue,castHoverOption:i,castHoverinfo:a,hover:t("./hover").hover,unhover:l.unhover,loneHover:t("./hover").loneHover,loneUnhover:n,click:t("./click")}},{"../../lib":721,"../dragelement":621,"./attributes":633,"./calc":634,"./click":635,"./constants":636,"./defaults":637,"./helpers":638,"./hover":639,"./layout_attributes":642,"./layout_defaults":643,"./layout_global_defaults":644,d3:120}],642:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat,i=t("../../plots/font_attributes"),a=t("./constants");e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom"},hovermode:{valType:"enumerated",values:["x","y","closest",!1]},hoverlabel:{bgcolor:{valType:"color"},bordercolor:{valType:"color"},font:{family:n({},i.family,{dflt:a.HOVERFONT}),size:n({},i.size,{dflt:a.HOVERFONTSIZE}),color:n({},i.color)}}}},{"../../lib/extend":713,"../../plots/font_attributes":784,"./constants":636}],643:[function(t,e,r){"use strict";function n(t){for(var e=!0,r=0;r=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}},{}],651:[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":713,"../../plots/font_attributes":784,"../color/attributes":599}],652:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],653:[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={},m=0,g="normal",v=0;v1)){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",g),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":721,"../../plots/layout_attributes":814,"../../registry":838,"./attributes":651,"./helpers":656}],654:[function(t,e,r){"use strict";function n(t,e){function r(r){y.convertToTspans(r,e,function(){o(t,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,s=p.traceIs(a,"pie"),l=a.index,u=s?n.label:a.name,c=t.selectAll("text.legendtext").data([0]);c.enter().append("text").classed("legendtext",!0),c.attr("text-anchor","start").classed("user-select-none",!0).call(g.font,i.legend.font).text(u),e._context.editable&&!s?c.call(y.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r),this.text()||(t=" ");var i,a=n.trace._fullInput||{};if(-1!==["ohlc","candlestick"].indexOf(a.type)){var o=n.trace.transforms;i=o[o.length-1].direction+".name"}else i="name";h.restyle(e,i,t,l)}):c.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(v.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){r=(new Date).getTime(),r-e._legendMouseDownTimeS&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){a(t,e,n)},S):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,a(t,e,n))}})}function a(t,e,r){if(!e._dragged&&!e._editing){var n,i,a=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],o=t.data()[0][0],s=e._fullData,l=o.trace,u=l.legendgroup,c=[];if(1===r&&T&&e.data&&e._context.showTips?(f.notifier("Double click on legend to isolate individual trace","long"),T=!1):T=!1,p.traceIs(l,"pie")){var d=o.label,m=a.indexOf(d);1===r?-1===m?a.push(d):a.splice(m,1):2===r&&(a=[],e.calcdata[0].forEach(function(t){d!==t.label&&a.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===a.length&&-1===m&&(a=[])),h.relayout(e,"hiddenlabels",a)}else{var g,v=[],y=[];for(g=0;gn.width-(n.margin.r+n.margin.l)&&(y=0,p+=m,i.height=i.height+m,m=0),g.setTranslate(this,a+y,5+a+e.height/2+p),i.width+=o+r,i.height=Math.max(i.height,e.height),y+=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];c.select(this).select(".legendtoggle").call(g.setRect,0,-r.height/2,t._context.editable?0:i.width,r.height)})}}function l(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.isCenterAnchor(r)&&(n="center");var i="top";A.isBottomAnchor(r)?i="bottom":A.isMiddleAnchor(r)&&(i="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}[i]||0),t:r.height*({bottom:1,middle:.5}[i]||0)})}function u(t){var e=t._fullLayout,r=e.legend,n="left";A.isRightAnchor(r)?n="right":A.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"),h=t("../../plotly"),f=t("../../lib"),d=t("../../plots/plots"),p=t("../../registry"),m=t("../dragelement"),g=t("../drawing"),v=t("../color"),y=t("../../lib/svg_text_utils"),b=t("./constants"),x=t("../../constants/interactions"),_=t("../../constants/alignment").LINE_SPACING,w=t("./get_legend_data"),M=t("./style"),k=t("./helpers"),A=t("./anchor_utils"),T=!0,S=x.DBLCLICKDELAY;e.exports=function(t){function e(t,e){L.attr("data-scroll",e).call(g.setTranslate,0,e),C.call(g.setRect,N,t,b.scrollBarWidth,b.scrollBarHeight),T.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,o="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,x=r.showlegend&&w(t.calcdata,y),_=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+o).remove(),void d.autoMargin(t,"legend");var k=r._infolayer.selectAll("g.legend").data([0]);k.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+o).data([0]);T.enter().append("clipPath").attr("id",o).append("rect");var E=k.selectAll("rect.bg").data([0]);E.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),E.call(v.stroke,y.bordercolor),E.call(v.fill,y.bgcolor),E.style("stroke-width",y.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(v.fill,"#808BA4");var z=L.selectAll("g.groups").data(x);z.enter().append("g").attr("class","groups"),z.exit().remove();var I=z.selectAll("g.traces").data(f.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.call(M,t).style("opacity",function(t){var e=t[0].trace;return p.traceIs(e,"pie")?-1!==_.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){c.select(this).call(n,t).call(i,t)});var D=0!==k.enter().size();D&&(s(t,z,I),l(t));var P=r.width,O=r.height;s(t,z,I),y.height>O?u(t):l(t);var F=r._size,R=F.l+F.w*y.x,j=F.t+F.h*(1-y.y);A.isRightAnchor(y)?R-=y.width:A.isCenterAnchor(y)&&(R-=y.width/2),A.isBottomAnchor(y)?j-=y.height:A.isMiddleAnchor(y)&&(j-=y.height/2);var N=y.width,B=F.w;N>B?(R=F.l,N=B):(R+N>P&&(R=P-N),R<0&&(R=0),N=Math.min(P-R,y.width));var U=y.height,V=F.h;U>V?(j=F.t,U=V):(j+U>O&&(j=O-U),j<0&&(j=0),U=Math.min(O-j,y.height)),g.setTranslate(k,R,j);var q,H,G=U-b.scrollBarHeight-2*b.scrollBarMargin,Y=y.height-U;if(y.height<=U||t._context.staticPlot)E.attr({width:N-y.borderwidth,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),g.setTranslate(L,0,0),T.select("rect").attr({width:N-2*y.borderwidth,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),L.call(g.setClipUrl,o);else{q=b.scrollBarMargin,H=L.attr("data-scroll")||0,E.attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:N-2*y.borderwidth+b.scrollBarWidth+b.scrollBarMargin,height:U-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-H}),L.call(g.setClipUrl,o),D&&e(q,H),k.on("wheel",null),k.on("wheel",function(){H=f.constrain(L.attr("data-scroll")-c.event.deltaY/G*Y,-Y,0),q=b.scrollBarMargin-H/Y*G,e(q,H),0!==H&&H!==-Y&&c.event.preventDefault()}),C.on(".drag",null),L.on(".drag",null);var X=c.behavior.drag().on("drag",function(){q=f.constrain(c.event.y-b.scrollBarHeight/2,b.scrollBarMargin,b.scrollBarMargin+G),H=-(q-b.scrollBarMargin)/G*Y,e(q,H)});C.call(X),L.call(X)}if(t._context.editable){var W,Z,J,K;k.classed("cursor-move",!0),m.init({element:k.node(),gd:t,prepFn:function(){var t=g.getTranslate(k);J=t.x,K=t.y},moveFn:function(t,e){var r=J+t,n=K+e;g.setTranslate(k,r,n),W=m.align(r,0,F.l,F.l+F.w,y.xanchor),Z=m.align(n,0,F.t+F.h,F.t,y.yanchor)},doneFn:function(e,n,i){if(e&&void 0!==W&&void 0!==Z)h.relayout(t,{"legend.x":W,"legend.y":Z});else{var o=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return i.clientX>=t.left&&i.clientX<=t.right&&i.clientY>=t.top&&i.clientY<=t.bottom});o.size()>0&&(1===n?k._clickTimeout=setTimeout(function(){a(o,t,n)},S):2===n&&(k._clickTimeout&&clearTimeout(k._clickTimeout),a(o,t,n)))}}})}}}},{"../../constants/alignment":696,"../../constants/interactions":701,"../../lib":721,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/plots":823,"../../registry":838,"../color":600,"../dragelement":621,"../drawing":624,"./anchor_utils":650,"./constants":652,"./get_legend_data":655,"./helpers":656,"./style":658,d3:120}],655:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),u=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var a,o,s={},l=[],u=!1,c={},h=0;for(a=0;ar[1])return r[1]}return i}function i(t){return t[0]}var s,u,c=t[0],h=c.trace,f=l.hasMarkers(h),d=l.hasText(h),p=l.hasLines(h);if(f||d||p){var m={},g={};f&&(m.mc=r("marker.color",i),m.mo=r("marker.opacity",a.mean,[.2,1]),m.ms=r("marker.size",a.mean,[2,16]),m.mlc=r("marker.line.color",i),m.mlw=r("marker.line.width",a.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(g.line={width:r("line.width",i,[0,10])}),d&&(m.tx="Aa",m.tp=r("textposition",i),m.ts=10,m.tc=r("textfont.color",i),m.tf=r("textfont.family",i)),s=[a.minExtend(c,m)],u=a.minExtend(h,g)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(f?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,u,e),f&&(s[0].mrc=3);var b=v.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,u,e)}function h(t){var e=t[0].trace,r=e.marker||{},a=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||r.color),o&&e.call(s.stroke,i.mlc||a.color)})}function f(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.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(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.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(u,t[0],e)}t.each(function(t){var e=n.select(this),r=e.selectAll("g.layers").data([0]);r.enter().append("g").classed("layers",!0),r.style("opacity",t[0].trace.opacity),r.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0),r.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var i=r.selectAll("g.legendsymbols").data([t]);i.enter().append("g").classed("legendsymbols",!0),i.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(h).each(f).each(d).each(r).each(c)}},{"../../lib":721,"../../registry":838,"../../traces/pie/style_one":1008,"../../traces/scatter/subtypes":1042,"../color":600,"../drawing":624,d3:120}],659:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},u=f.list(t,null,!0),h="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,g=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),o(g,r);c&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"])),f&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"]));var v=i(s),y=[];return((u||p)&&!v||m)&&(y=["zoom2d","pan2d"]),(u||m||p)&&a(l)&&(y.push("select2d"),y.push("lasso2d")),y.length&&n(y),!u&&!p||v||m||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),u&&d?n(["toggleHover"]):p?n(["hoverClosestGl2d"]):u?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):d&&n(["hoverClosestPie"]),o(g,r)}function i(t){for(var e=l.list({_fullLayout:t},null,!0),r=!0,n=0;n0)){var p=i(e,r,l);h("x",p[0]),h("y",p[1]),a.noneOrAll(t,e,["x","y"]),h("xanchor"),h("yanchor"),a.coerceFont(h,"font",r.font);var m=h("bgcolor");h("activecolor",o.contrast(m,u.lightAmount,u.darkAmount)),h("bordercolor"),h("borderwidth")}}},{"../../lib":721,"../color":600,"./attributes":663,"./button_attributes":664,"./constants":665}],667:[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;sY&&n>X&&!t.shiftKey?p.getCursor(i/r,1-a/n):"move";m(e,o),G=o.split("-")[0]}function a(e){N=h.getFromId(t,r.xref),B=h.getFromId(t,r.yref),U=v.getDataToPixel(t,N),V=v.getDataToPixel(t,B,!0),q=v.getPixelToData(t,N),H=v.getPixelToData(t,B,!0);var a="shapes["+n+"]";"path"===r.type?(R=r.path,j=a+".path"):(g=U(r.x0),y=V(r.y0),b=U(r.x1),x=V(r.y1),_=a+".x0",w=a+".y0",M=a+".x1",k=a+".y1"),gX&&(d[L]=r[D]=H(u),d[C]=r[P]=H(c)),f-h>Y&&(d[z]=r[O]=q(h),d[I]=r[F]=q(f))}e.attr("d",o(t,r))}var d,g,y,b,x,_,w,M,k,A,T,S,E,L,C,z,I,D,P,O,F,R,j,N,B,U,V,q,H,G,Y=10,X=10,W={element:e.node(),gd:t,prepFn:a,doneFn:s},Z=W.element.getBoundingClientRect();p.init(W),e.node().onmousemove=i}function o(t,e){var r,n,i,a,o=e.type,l=h.getFromId(t,e.xref),u=h.getFromId(t,e.yref),c=t._fullLayout._size;if(l?(r=v.shapePositionToRange(l),n=function(t){return l._offset+l.r2p(r(t,!0))}):n=function(t){return c.l+c.w*t},u?(i=v.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return c.t+c.h*(1-t)},"path"===o)return l&&"date"===l.type&&(n=v.decodeDate(n)),u&&"date"===u.type&&(a=v.decodeDate(a)),s(e.path,n,a);var f=n(e.x0),d=n(e.x1),p=a(e.y0),m=a(e.y1);if("line"===o)return"M"+f+","+p+"L"+d+","+m;if("rect"===o)return"M"+f+","+p+"H"+d+"V"+m+"H"+f+"Z";var g=(f+d)/2,y=(p+m)/2,b=Math.abs(g-f),x=Math.abs(y-p),_="A"+b+","+x,w=g+b+","+y;return"M"+w+_+" 0 1,1 "+g+","+(y-x)+_+" 0 0,1 "+w+"Z"}function s(t,e,r){return t.replace(g.segmentRE,function(t){var n=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i],l=t.substr(1).replace(g.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.*/,""),c.log("Ignoring extra params in segment "+t)),i+l})}function l(t,e,r){return t.replace(g.segmentRE,function(t){var n=0,i=t.charAt(0),a=g.paramIsX[i],o=g.paramIsY[i],s=g.numParams[i];return i+t.substr(1).replace(g.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var u=t("../../plotly"),c=t("../../lib"),h=t("../../plots/cartesian/axes"),f=t("../color"),d=t("../drawing"),p=t("../dragelement"),m=t("../../lib/setcursor"),g=t("./constants"),v=t("./helpers");e.exports={draw:n,drawOne:i}},{"../../lib":721,"../../lib/setcursor":736,"../../plotly":755,"../../plots/cartesian/axes":760,"../color":600,"../dragelement":621,"../drawing":624,"./constants":678,"./helpers":681}],681:[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}},{}],682:[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":676,"./calc_autorange":677,"./defaults":679,"./draw":680}],683:[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)}if(s=s||{},l=l||{},!u("visible",!l.itemIsNotPlainObject))return e;u("layer"),u("opacity"),u("fillcolor"),u("line.color"),u("line.width"),u("line.dash");for(var c=t.path?"path":"rect",h=u("type",c),f=["x","y"],d=0;d<2;d++){var p=f[d],m={_fullLayout:r},g=i.coerceRef(t,e,m,p,"","paper");if("path"!==h){var v,y,b;"paper"!==g?(v=i.getFromId(m,g),b=o.rangeToShapePosition(v),y=o.shapePositionToRange(v)):y=b=n.identity;var x=p+"0",_=p+"1",w=t[x],M=t[_];t[x]=y(t[x],!0),t[_]=y(t[_],!0),i.coercePosition(e,m,u,g,x,.25),i.coercePosition(e,m,u,g,_,.75),e[x]=b(e[x]),e[_]=b(e[_]),t[x]=w,t[_]=M}}return"path"===h?u("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":721,"../../plots/cartesian/axes":760,"./attributes":676,"./helpers":681}],684:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}};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":713,"../../plots/animation_attributes":756,"../../plots/font_attributes":784,"../../plots/pad_attributes":822,"./constants":685}],685:[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,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}},{}],686:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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),n("currentvalue.visible")&&(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;l=r.steps.length&&(r.active=0),e.call(s,r).call(x,r).call(c,r).call(p,r).call(b,t,r).call(l,t,r),A.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(g,r,r.active/(r.steps.length-1),!1),e.call(s,r)}function s(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-E.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=E.currentValueInset,i="left"}a.enter().append("text").classed(E.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(A.font,e.currentvalue.font).text(o).call(T.convertToTspans,e.gd);var s=T.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*L;return T.positionText(a,n,l),a}}function l(t,e,r){var n=t.selectAll("rect."+E.gripRectClass).data([0]);n.enter().append("rect").classed(E.gripRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:E.gripWidth,height:E.gripHeight,rx:E.gripRadius,ry:E.gripRadius}).call(k.stroke,r.bordercolor).call(k.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function u(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(E.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(A.font,r.font).text(e.step.label).call(T.convertToTspans,r.gd),n}function c(t,e){var r=t.selectAll("g."+E.labelsClass).data([0]);r.enter().append("g").classed(E.labelsClass,!0);var n=r.selectAll("g."+E.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(E.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=w.select(this);r.call(u,t,e),A.setTranslate(r,v(e,t.fraction),E.tickOffset+e.ticklen+e.font.size*L+E.labelOffset+e.currentValueTotalHeight)})}function h(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&f(t,e,r,a,!0,i)}function f(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(g,r,r.active/(r.steps.length-1),a),e.call(s,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),l&&l.method&&i&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:l,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&M.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function d(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=w.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+E.gripRectClass);w.event.stopPropagation(),w.event.preventDefault(),o.call(k.fill,t.activebgcolor);var s=y(t,w.mouse(i)[0]);h(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=y(t,w.mouse(i)[0]);h(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(k.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function p(t,e){var r=t.selectAll("rect."+E.tickRectClass).data(e.steps);r.enter().append("rect").classed(E.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=w.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(k.fill,e.tickcolor),A.setTranslate(i,v(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?E.tickOffset:E.minorTickOffset)+e.currentValueTotalHeight)})}function m(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r0&&(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 b(t,e,r){var n=t.selectAll("rect."+E.railTouchRectClass).data([0]);n.enter().append("rect").classed(E.railTouchRectClass,!0).call(d,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,E.tickOffset+r.ticklen+r.labelHeight)}).call(k.fill,r.bgcolor).attr("opacity",0),A.setTranslate(n,0,r.currentValueTotalHeight)}function x(t,e){var r=t.selectAll("rect."+E.railRectClass).data([0]);r.enter().append("rect").classed(E.railRectClass,!0);var n=e.inputAreaLength-2*E.railInset;r.attr({width:n,height:E.railWidth,rx:E.railRadius,ry:E.railRadius,"shape-rendering":"crispEdges"}).call(k.stroke,e.bordercolor).call(k.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),A.setTranslate(r,E.railInset,.5*(e.inputAreaWidth-E.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(E.containerClassName,!0).style("cursor","ew-resize"),s.exit().remove(),s.exit().size()&&_(t),0!==r.length){var l=s.selectAll("g."+E.groupClassName).data(r,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||f<0){var m={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[x.side];e.attr("transform","translate("+m+")")}}}var g=r.propContainer,v=r.propName,y=r.traceIndex,b=r.dfltName,x=r.avoid||{},_=r.attributes,w=r.transform,M=r.containerGroup,k=t._fullLayout,A=g.titlefont.family,T=g.titlefont.size,S=g.titlefont.color,E=1,L=!1,C=g.title.trim(),z=t._context.editable;""===C&&(E=0),C.match(f)&&(E=.2,L=!0,z||(C=""));var I=C||z;M||(M=k._infolayer.selectAll(".g-"+e).data([0]),M.enter().append("g").classed("g-"+e,!0));var D=M.selectAll("text").data(I?[0]:[]);if(D.enter().append("text"),D.text(C).attr("class",e),D.exit().remove(),I){D.call(d);var P="Click to enter "+b+" title";z&&(C?D.on(".opacity",null):function(){E=0,L=!0,C=P,D.text(C).on("mouseover.opacity",function(){n.select(this).transition().duration(h.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(h.HIDE_PLACEHOLDER).style("opacity",0)})}(),D.call(c.makeEditable,{gd:t}).on("edit",function(e){void 0!==y?a.restyle(t,v,e,y):a.relayout(t,v,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(c.positionText,_.x,_.y)})),D.classed("js-placeholder",L)}}},{"../../constants/interactions":701,"../../lib":721,"../../lib/svg_text_utils":740,"../../plotly":755,"../../plots/plots":823,"../color":600,"../drawing":624,d3:120,"fast-isnumeric":129}],690:[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","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}};e.exports={_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons: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":713,"../../plots/font_attributes":784,"../../plots/pad_attributes":822,"../color/attributes":599}],691:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],692:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return a.coerce(t,e,s,r,n)}n("visible",i(t,e).length>0)&&(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(a.enter().append("g").classed(L.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&_(t),0!==r.length){var c=a.selectAll("g."+L.headerGroupClassName).data(r,i);c.enter().append("g").classed(L.headerGroupClassName,!0);var h=a.selectAll("g."+L.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(L.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var f=0;fM,T=n.barLength+2*n.barPad,S=n.barWidth+2*n.barPad,E=p,L=g+v;L+S>u&&(L=u-S);var C=this.container.selectAll("rect.scrollbar-horizontal").data(A?[0]:[]);C.exit().on(".drag",null).remove(),C.enter().append("rect").classed("scrollbar-horizontal",!0).call(a.fill,n.barColor),A?(this.hbar=C.attr({rx:n.barRadius,ry:n.barRadius,x:E,y:L,width:T,height:S}),this._hbarXMin=E+T/2,this._hbarTranslateMax=M-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var z=v>k,I=n.barWidth+2*n.barPad,D=n.barLength+2*n.barPad,P=p+m,O=g;P+I>l&&(P=l-I);var F=this.container.selectAll("rect.scrollbar-vertical").data(z?[0]:[]);F.exit().on(".drag",null).remove(),F.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),z?(this.vbar=F.attr({rx:n.barRadius,ry:n.barRadius,x:P,y:O,width:I,height:D}),this._vbarYMin=O+D/2,this._vbarTranslateMax=k-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,j=c-.5,N=z?h+I+.5:h+.5,B=f-.5,U=A?d+S+.5:d+.5,V=s._topdefs.selectAll("#"+R).data(A||z?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",R).append("rect"),A||z?(this._clipRect=V.select("rect").attr({x:Math.floor(j),y:Math.floor(B),width:Math.ceil(N)-Math.floor(j),height:Math.ceil(U)-Math.floor(B)}),this.container.call(o.setClipUrl,R),this.bg.attr({x:p,y:g,width:m,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),A||z){var q=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(q);var H=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));A&&this.hbar.on(".drag",null).call(H),z&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":721,"../color":600,"../drawing":624,d3:120}],696:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},LINE_SPACING:1.3}},{}],697:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],698:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,i={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},a={},o=Object.keys(i),s=0;s",nbsp:"\xa0",times:"\xd7",plusmn:"\xb1",deg:"\xb0"},unicodeToEntity:{"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#x27","/":"#x2F"}}},{}],704:[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}},{}],705:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.28.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/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),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=t("./components/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":591,"./components/annotations3d":596,"./components/fx":641,"./components/images":649,"./components/legend":657,"./components/rangeselector":669,"./components/rangeslider":675,"./components/shapes":682,"./components/sliders":688,"./components/updatemenus":694,"./fonts/mathjax_config":706,"./lib/queue":733,"./plot_api/plot_schema":749,"./plot_api/register":750,"./plot_api/set_plot_config":751,"./plot_api/to_image":753,"./plot_api/validate":754,"./plotly":755,"./snapshot":843,"./snapshot/download":840,"./traces/scatter":1032,d3:120,"es6-promise":126}],706:[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},{}],707:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){Array.isArray(t)&&(e[r]=t[n])}},{}],708:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":702,"fast-isnumeric":129}],709:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=/^([2-9]|[1-9][0-9]+)$/;r.valObjects={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},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;if("string"==typeof t&&t.substr(0,n)===r&&l.test(t.substr(n)))return void e.set(t);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(-1!==(n.extras||[]).indexOf(t))return void e.set(t);for(var i=t.split("+"),a=0;a0&&(o=o.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+o}return n}function l(t){return t.formatDate("yyyy")}function u(t){return t.formatDate("M yyyy")}function c(t){return t.formatDate("M d")}function h(t){return t.formatDate("M d, yyyy")}var f=t("d3"),d=t("fast-isnumeric"),p=t("./loggers").error,m=t("./mod"),g=t("../constants/numerical"),v=g.BADNUM,y=g.ONEDAY,b=g.ONEHOUR,x=g.ONEMIN,_=g.ONESEC,w=g.EPOCHJD,M=t("../registry"),k=f.time.format.utc,A=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,T=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,S=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?M.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:M.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?M.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var E,L;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return t=Number(t)-t.getTimezoneOffset()*x,t>=E&&t<=L?t:v;if("string"!=typeof t&&"number"!=typeof t)return v;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?T:A);if(!s)return v;var l=s[1],u=s[3]||"1",c=Number(s[5]||1),h=Number(s[7]||0),f=Number(s[9]||0),d=Number(s[11]||0);if(i){if(2===l.length)return v;l=Number(l);var p;try{var m=M.getComponentMethod("calendars","getCal")(e);if(o){var g="i"===u.charAt(u.length-1);u=parseInt(u,10),p=m.newDate(l,m.toMonthIndex(l,u,g),c)}else p=m.newDate(l,Number(u),c)}catch(t){return v}return p?(p.toJD()-w)*y+h*b+f*x+d*_:v}l=2===l.length?(Number(l)+2e3-S)%100+S:Number(l),u-=1;var k=new Date(Date.UTC(2e3,u,c,h,f));return k.setUTCFullYear(l),k.getUTCMonth()!==u?v:k.getUTCDate()!==c?v:k.getTime()+d*_},E=r.MIN_MS=r.dateTime2ms("-9999"),L=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==v};var C=90*y,z=3*b,I=5*x;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=E&&t<=L))return v;e||(e=0);var i,o,s,l,u,c,h=Math.floor(10*m(t+.05,1)),f=Math.round(t-h/10);if(n(r)){var d=Math.floor(f/y)+w,p=Math.floor(m(t,y));try{i=M.getComponentMethod("calendars","getCal")(r).fromJD(d).formatDate("yyyy-mm-dd")}catch(t){i=k("G%Y-%m-%d")(new Date(f))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e=E+y&&t<=L-y))return v;var e=Math.floor(10*m(t+.05,1)),r=new Date(Math.round(t-e/10));return a(f.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return p("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,i))return p("unrecognized date",t),e;return t};var D=/%\d?f/g,P=[59,59.9,59.99,59.999,59.9999],O=k("%Y"),F=k("%b %Y"),R=k("%b %-d"),j=k("%b %-d, %Y");r.formatDate=function(t,e,r,i){var a,f;if(i=n(i)&&i,e)return o(e,t,i);if(i)try{var d=Math.floor((t+.05)/y)+w,p=M.getComponentMethod("calendars","getCal")(i).fromJD(d);"y"===r?f=l(p):"m"===r?f=u(p):"d"===r?(a=l(p),f=c(p)):(a=h(p),f=s(t,r))}catch(t){return"Invalid"}else{var m=new Date(Math.floor(t+.05));"y"===r?f=O(m):"m"===r?f=F(m):"d"===r?(a=O(m),f=R(m)):(a=j(m),f=s(t,r))}return f+(a?"\n"+a:"")};var N=3*y;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=m(t,y);if(t=Math.round(t-i),r)try{var a=Math.round(t/y)+w,o=M.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-w)*y+i}catch(e){p("invalid ms "+t+" in calendar "+r)}var l=new Date(t+N);return l.setUTCMonth(l.getUTCMonth()+e)+i-N},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&M.getComponentMethod("calendars","getCal")(e),c=0;c0&&(i.push(a),a=[])}return a.length>0&&i.push(a),i},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(no?s:i(t)?Number(t):s):s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):l},l.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},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,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},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l}},{"../constants/numerical":702,"./clean_number":708,"./coerce":709,"./dates":710,"./ensure_array":711,"./extend":713,"./filter_unique":714,"./filter_visible":715,"./identity":720,"./is_array":722,"./is_plain_object":723,"./loggers":724,"./matrix":725,"./mod":726,"./nested_property":727,"./noop":728,"./notifier":729,"./push_unique":732,"./relink_private":734,"./search":735,"./stats":738,"./to_log_range":741,d3:120,"fast-isnumeric":129}],722:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],723:[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}},{}],724:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r1){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][0],a=t[e][1],l=!1,d(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}function c(t){return void 0===t||null===t||"object"==typeof t&&(d(t)?!t.length:!Object.keys(t).length)}function h(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"),p=t("./is_plain_object"),m=t("../plot_api/container_array_match");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(".");s/g),s=0;so||n===i||nl)&&(!e||!c(t))}function r(t,e){var r=t[0],u=t[1];if(r===i||ro||u===i||ul)return!1;var c,h,f,d,p,m=n.length,g=n[0][0],v=n[0][1],y=0;for(c=1;cMath.max(h,g)||u>Math.max(f,v)))if(uc||Math.abs(n(o,f))>i)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var u=l+1;u1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":702,"./matrix":725}],732:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ra.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":129}],739:[function(t,e,r){"use strict";function n(t){var e=i(t);return e.length?e:[0,0,0,1]}var i=t("color-rgba");e.exports=n},{"color-rgba":93}],740:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t){return t.replace(v,"\\lt ").replace(y,"\\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){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function s(t,e){if(!t)return"";for(var r=0;r1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),a=u[u.length-1].node}(k);else{var O=y[4],F={type:k},R=o(O,C);if(R?(R=R.replace(P,"$1 fill:"),A&&(R+=";"+A)):A&&(R=A),R&&(F.style=R),"a"===k){s=!0;var j=o(O,z);if(j){var N=document.createElement("a");N.href=j,-1!==M.indexOf(N.protocol)&&(F.href=j,F.target=o(O,I)||"_blank",F.popup=o(O,D))}}n(F)}}return s}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"),m=t("../constants/alignment").LINE_SPACING,g=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,i){function o(){c.empty()||(f=t.attr("class")+"-math",c.select("svg."+f).remove()),t.text("").style("white-space","pre"),u(t.node(),s)&&t.style("pointer-events","all"),r.positionText(t),i&&i.call(t)}var s=t.text(),l=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&s.match(g),c=h.select(t.node().parentNode);if(!c.empty()){var f=t.attr("class")?t.attr("class").split(" ")[0]:"text";return f+="-math",c.selectAll("svg."+f).remove(),c.selectAll("g."+f+"-group").remove(),t.style("display",null).attr({"data-unformatted":s,"data-math":"N"}),l?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r={fontSize:parseInt(t.style("font-size"),10)};a(l[2],r,function(r,a,l){c.selectAll("svg."+f).remove(),c.selectAll("g."+f+"-group").remove();var u=r&&r.select("svg");if(!u||!u.node())return o(),void e();var h=c.append("g").classed(f+"-group",!0).attr({"pointer-events":"none","data-unformatted":s,"data-math":"Y"});h.node().appendChild(u.node()),a&&a.node()&&u.node().insertBefore(a.node().cloneNode(!0),u.node().firstChild),u.attr({class:f,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.style("fill")||"black";u.select("g").attr({fill:d,stroke:d});var p=n(u,"width"),m=n(u,"height"),g=+t.attr("x")-p*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],v=parseInt(t.style("font-size"),10)||n(t,"height"),y=-v/4;"y"===f[0]?(h.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-p/2,y-m/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===f[0]?u.attr({x:t.attr("x"),y:y-m/2}):"a"===f[0]?u.attr({x:0,y:y}):u.attr({x:g,y:+t.attr("y")+y-m/2}),i&&i.call(t,h),e(h)})})):o(),t}};var v=/(<|<|<)/g,y=/(>|>|>)/g,b={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},x={sub:"0.3em",sup:"-0.6em"},_={sub:"-0.21em",sup:"0.42em"},w="\u200b",M=["http:","https:","mailto:","",void 0,":"],k=new RegExp("]*)?/?>","g"),A=Object.keys(p.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:p.entityToUnicode[t]}}),T=/(\r\n?|\n)/g,S=/(<[^<>]*>)/,E=/<(\/?)([^ >]*)(\s+(.*))?>/i,L=//i,C=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,z=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,I=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,D=/(^|[\s"'])popup\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,P=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(k," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=h.select(this),i=t("x",e),a=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:i,y:a})})},r.makeEditable=function(t,e){function r(){i(),t.style({opacity:0});var e,r=l.attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(t.node().parentNode).select(e).style({opacity:0})}function n(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}function i(){var r=h.select(a),i=r.select(".svg-container"),o=i.append("div");o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":t.style("font-family")||"Arial","font-size":t.style("font-size")||12,color:e.fill||t.style("fill")||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-parseFloat(t.style("font-size"))/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(c(t,i,e)).on("blur",function(){a._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=h.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&h.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;h.select(this).transition().duration(0).remove(),h.select(document).on("mouseup",null),s.edit.call(t,n)}).on("focus",function(){var t=this;a._editing=!0,h.select(document).on("mouseup",function(){if(h.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===h.event.which?(a._editing=!1,t.style({opacity:1}),h.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),s.cancel.call(t,this.textContent)):(s.input.call(t,this.textContent),h.select(this).call(c(t,i,e)))}).on("keydown",function(){13===h.event.which&&this.blur()}).call(n)}var a=e.gd,o=e.delegate,s=h.dispatch("edit","input","cancel"),l=o||t;if(t.style({"pointer-events":o?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():l.on("click",r),h.rebind(t,s,"on")}},{"../constants/alignment":696,"../constants/string_mappings":703,"../constants/xmlns_namespaces":704,"../lib":721,d3:120}],741:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":129}],742:[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":786,"topojson-client":532}],743:[function(t,e,r){"use strict";function n(t,e){for(var r=new Float32Array(e),n=0;n0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),u=t("../registry"),c=t("../lib"),h=t("../plots/plots"),f=t("../plots/cartesian/axes"),d=t("../components/color");r.getGraphDiv=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t},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 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=h.getSubplotIds(t,"gl3d");for(e=0;e1&&o.warn("Full array edits are incompatible with other edits",h);var y=r[""][""];if(c(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",h,y),!0;e.set(y)}return!m&&(f(g,v),d(t),!0)}var b,x,_,w,M,k,A,T=Object.keys(r).map(Number).sort(s),S=e.get(),E=S||[],L=n(v,h).get(),C=[],z=-1,I=E.length;for(b=0;bE.length-(A?0:1))o.warn("index out of range",h,_);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",h,_),c(k)?C.push(_):A?("add"===k&&(k={}),E.splice(_,0,k),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",h,_,k),-1===z&&(z=_);else for(x=0;x=0;b--)E.splice(C[b],1),L&&L.splice(C[b],1);if(E.length?S||e.set(E):e.set(null),m)return!1;if(f(g,v),p!==a){var D;if(-1===z)D=T;else{for(I=Math.max(E.length,I),D=[],b=0;b=z);b++)D.push(_);for(b=z;b=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(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),s(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&s(t,r,"newIndices"),void 0!==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(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n=0&&lV.range[0]?[1,2]:[2,1]);else{var G=V.range[0],Y=V.range[1];q?(G<=0&&Y<=0&&r(F+".autorange",!0),G<=0?G=Y/1e6:Y<=0&&(Y=G/1e6),r(F+".range[0]",Math.log(G)/Math.LN10),r(F+".range[1]",Math.log(Y)/Math.LN10)):(r(F+".range[0]",Math.pow(10,G)),r(F+".range[1]",Math.pow(10,Y)))}else r(F+".autorange",!0);w.getComponentMethod("annotations","convertCoords")(t,N,S,r),w.getComponentMethod("images","convertCoords")(t,N,S,r)}else r(F+".autorange",!0);b.nestedProperty(u,F+"._inputRange").set(null)}else if(P.match(D.AX_NAME_PATTERN)){var X=b.nestedProperty(u,A).get(),W=(S||{}).type;W&&"-"!==W||(W="linear"),w.getComponentMethod("annotations","convertCoords")(t,X,W,r),w.getComponentMethod("images","convertCoords")(t,X,W,r)}var Z=C.containerArrayMatch(A);if(Z){a=Z.array,o=Z.index;var J=Z.property,K=b.nestedProperty(l,a),Q=(K||[])[o]||{};if(""===o)-1===A.indexOf("updatemenus")&&(v.docalc=!0);else if(""===J){var $=S;C.isAddVal(S)?_[A]=null:C.isRemoveVal(S)?(_[A]=Q,$=Q):b.warn("unrecognized full object value",e),(n($,"x")||n($,"y")&&-1===A.indexOf("updatemenus"))&&(v.docalc=!0)}else!n(Q,"x")&&!n(Q,"y")||b.containsAny(A,["color","opacity","align","dash","updatemenus"])||(v.docalc=!0);f[a]||(f[a]={});var tt=f[a][o];tt||(tt=f[a][o]={}),tt[J]=S,delete e[A]}else if("reverse"===P)j.range?j.range.reverse():(r(F+".autorange",!0),j.range=[1,0]),N.autorange?v.docalc=!0:v.doplot=!0;else{var et=String(T.parts[1]||"");0===I.indexOf("scene")?"camera"===T.parts[1]?v.docamera=!0:v.doplot=!0:0===I.indexOf("geo")?v.doplot=!0:0===I.indexOf("ternary")?v.doplot=!0:"paper_bgcolor"===A?v.doplot=!0:"margin"===I||"autorange"===et||"rangemode"===et||"type"===et||"domain"===et||"fixedrange"===et||"scaleanchor"===et||"scaleratio"===et||-1!==A.indexOf("calendar")||A.match(/^(bar|box|font)/)?v.docalc=!0:!u._has("gl2d")||-1===A.indexOf("axis")&&"plot_bgcolor"!==A?!u._has("gl2d")||"dragmode"!==A||"lasso"!==S&&"select"!==S||"lasso"===B||"select"===B?"hiddenlabels"===A?v.docalc=!0:-1!==I.indexOf("legend")?v.dolegend=!0:-1!==A.indexOf("title")?v.doticks=!0:-1!==I.indexOf("bgcolor")?v.dolayoutstyle=!0:E>1&&b.containsAny(et,["tick","exponent","grid","zeroline"])?v.doticks=!0:-1!==A.indexOf(".linewidth")&&-1!==A.indexOf("axis")?v.doticks=v.dolayoutstyle=!0:E>1&&-1!==et.indexOf("line")?v.dolayoutstyle=!0:E>1&&"mirror"===et?v.doticks=v.dolayoutstyle=!0:"margin.pad"===A?v.doticks=v.dolayoutstyle=!0:-1!==["hovermode","dragmode"].indexOf(A)||-1!==A.indexOf("spike")?v.domodebar=!0:-1===["height","width","autosize"].indexOf(A)&&(v.doplot=!0):v.docalc=!0:v.doplot=!0,T.set(S)}}}for(a in f){C.applyContainerArrayChanges(t,b.nestedProperty(l,a),f[a],v)||(v.doplot=!0)}var rt=u._axisConstraintGroups;for(g in k)for(o=0;o=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),!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=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(){t.emit("plotly_animated"),window.cancelAnimationFrame(o._animationRaf),o._animationRaf=null}function h(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,M.transition(t,e.frame.data,e.frame.layout,z.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else c()}function f(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&h()};e()}function d(t){return Array.isArray(s)?g>=s.length?t.transitionOpts=s[g]:t.transitionOpts=s[0]:t.transitionOpts=s,g++,t}var p,m,g=0,v=[],y=void 0===e||null===e,x=Array.isArray(e);if(y||x||!b.isPlainObject(e)){if(y||-1!==["string","number"].indexOf(typeof e))for(p=0;p0&&kk)&&A.push(m);v=A}}v.length>0?function(e){if(0!==e.length){for(var s=0;s=0;i--)if(b.isPlainObject(e[i])){var f=(u[e[i].name]||{}).name,d=e[i].name;f&&d&&"number"==typeof d&&u[f]&&(n++,b.warn('addFrames: overwriting frame "'+u[f].name+'" with a frame whose name of type "number" also equates to "'+f+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&b.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h.push({frame:M.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:c+i})}h.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if(a=h[i].frame,"number"==typeof a.name&&b.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!a.name)for(;u[a.name="frame "+t._transitionData._counter++];);if(u[a.name]){for(o=0;o=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),x.purge(t),e._container&&e._container.remove(),delete t._context,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,delete t._hmpixcount,delete t._hmlumcount,t}},{"../components/drawing":624,"../components/errorbars":630,"../constants/xmlns_namespaces":704,"../lib":721,"../lib/events":712,"../lib/queue":733,"../lib/svg_text_utils":740,"../plotly":755,"../plots/cartesian/axis_ids":763,"../plots/cartesian/constants":765,"../plots/cartesian/constraints":767,"../plots/cartesian/graph_interact":769,"../plots/plots":823,"../plots/polar":826,"../registry":838,"./helpers":745,"./manage_arrays":746,"./subroutines":752,d3:120,"fast-isnumeric":129}],748:[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,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!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:[]}},{}],749:[function(t,e,r){"use strict";function n(t){var e,r;"area"===t?(e={attributes:b},r={}):(e=d.modules[t]._module,r=e.basePlotModule);var n={};n.type=null,w(n,m),w(n,e.attributes),r.attributes&&w(n,r.attributes),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.schema&&r.schema.traces&&r.schema.traces[t]&&Object.keys(r.schema.traces[t]).forEach(function(e){f(n,r.schema.traces[t][e],e)})}),n.type=t;var i={meta:e.meta||{},attributes:s(n)};if(e.layoutAttributes){var a={};w(a,e.layoutAttributes),i.layoutAttributes=s(a)}return i}function i(){var t={};return w(t,g),Object.keys(d.subplotsRegistry).forEach(function(e){var r=d.subplotsRegistry[e];if(r.layoutAttributes)if("cartesian"===r.name)h(t,r,"xaxis"),h(t,r,"yaxis");else{var n="subplot"===r.attr?r.name:r.attr;h(t,r,n)}}),t=c(t),Object.keys(d.componentsRegistry).forEach(function(e){var r=d.componentsRegistry[e];r.layoutAttributes&&(r.schema&&r.schema.layout?Object.keys(r.schema.layout).forEach(function(e){f(t,r.schema.layout[e],e)}):f(t,r.layoutAttributes,r.name))}),{layoutAttributes:s(t)}}function a(t){var e=d.transformsRegistry[t],r=w({},e.attributes);return Object.keys(d.componentsRegistry).forEach(function(e){var n=d.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){f(r,n.schema.transforms[t][e],e)})}),{attributes:s(r)}}function o(){var t={frames:p.extendDeep({},v)};return s(t),t.frames}function s(t){return l(t),u(t),t}function l(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)):!0===t.arrayOk&&(i[n+"src"]=e(n)):p.isPlainObject(t)&&(t.role="object")}r.crawl(t,n)}function u(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 _(t,{radialaxis:x.radialaxis,angularaxis:x.angularaxis}),_(t,x.layout),t}function h(t,e,r){var n=p.nestedProperty(t,r),i=w({},e.layoutAttributes);i[M]=!0,n.set(i)}function f(t,e,r){var n=p.nestedProperty(t,r);n.set(w(n.get()||{},e))}var d=t("../registry"),p=t("../lib"),m=t("../plots/attributes"),g=t("../plots/layout_attributes"),v=t("../plots/frame_attributes"),y=t("../plots/animation_attributes"),b=t("../plots/polar/area_attributes"),x=t("../plots/polar/axis_attributes"),_=p.extendFlat,w=p.extendDeep,M="_isSubplotObj",k="_isLinkedToArray",A=[M,k,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=M,r.IS_LINKED_TO_ARRAY=k,r.DEPRECATED="_deprecated",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]=a(t)}),{defs:{valObjects:p.valObjects,metaKeys:A.concat(["description","role"])},traces:t,layout:i(),transforms:e,frames:o(),animation:s(y)}},r.crawl=function(t,e,n){var i=n||0;Object.keys(t).forEach(function(n){var a=t[n];-1===A.indexOf(n)&&(e(a,n,t,i),r.isValObject(a)||p.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){if(a=a.slice(0,s).concat([r]),e&&("data_array"===e.valType||!0===e.arrayOk)){var l=n(a),u=p.nestedProperty(t,l).get();Array.isArray(u)&&i.push(l)}}function n(t){return t.join(".")}var i=[],a=[];if(r.crawl(m,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var o=t.transforms,s=0;s=t[1]||i[1]<=t[0])&&(a[0]e[0]))return!0}return!1}var i=t("d3"),a=t("../plotly"),o=t("../registry"),s=t("../plots/plots"),l=t("../lib"),u=t("../components/color"),c=t("../components/drawing"),h=t("../components/titles"),f=t("../components/modebar"),d=t("../plots/cartesian/graph_interact");r.layoutStyles=function(t){return l.syncOrAsync([s.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){var e,o=t._fullLayout,s=o._size,l=a.Axes.list(t);for(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.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(h).then(function(t){r(t)}).catch(function(t){n(t)})})}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":721,"../plotly":755,"../snapshot/cloneplot":839,"../snapshot/helpers":842,"../snapshot/svgtoimg":844,"../snapshot/tosvg":846,"fast-isnumeric":129}],754:[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,g=r.length,v=0;v.3*h||a(n)||a(i))){var f=r.dtick/2;t+=t+f.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=P.tickIncrement(t,"M6","reverse")+1.5*C:a.exactMonths>.8?t=P.tickIncrement(t,"M1","reverse")+15.5*C:t-=C/2;var s=P.tickIncrement(t,r);if(s<=n)return s}return t}function a(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=_.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],u=1.0001*o[1]-1e-4*o[0],c=Math.min(s,u),h=Math.max(s,u),f=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1)),r=0;rc&&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>=I&&i<=16||e>=z)t._tickround="M";else if(e>=D&&i<=19||e>=I)t._tickround="S";else{var a=t.l2r(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 l(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}function u(t,e,r,n){var i=t._tickround,a=r&&t.hoverformat||t.tickformat;n&&(i=b(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=_.formatDate(e.x,a,i,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="
"+o,t._prevDateHead=o)),e.text=s}function c(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=d(Math.pow(10,o),t,i,n);else if(b(a)||"D"===a.charAt(0)&&_.mod(o+.01,1)<.1)if(-1!==["e","E","power"].indexOf(t.exponentformat)){var s=Math.round(o);e.text=0===s?1:1===s?"10":s>1?"10"+s+"":"10\u2212"+-s+"",e.fontSize*=1.25}else e.text=d(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,_.mod(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 h(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=d(e.x,t,i,n)}function d(t,e,r,n){var i=t<0,a=e._tickround,o=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:b(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};s(h),a=(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,-a)/2;if("none"===o&&(l=0),(t=Math.abs(t))12||l<-15)?t+="e"+m:"E"===o?t+="E"+m:"power"===o?t+="\xd710"+m+"":"B"===o&&9===l?t+="B":"SI"!==o&&"B"!==o||(t+=q[l/3+5])}return i?"\u2212"+t:t}function p(t,e){var r,n,i=[];for(r=0;r1)for(n=1;n2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.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 m=n-1,g=n+1;r="tozero"===t.rangemode?n<0?[m,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,g)]:[m,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(),_.simpleMap(r,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),t._r=t.range.slice(),t._rl=_.simpleMap(t._r,t.r2l);var r=t._input;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=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||!!_.nestedProperty(t,"rangeslider.autorange").get())&&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,m,g=e.length,v=r.padded?.05*t._length:0,y=r.tozero&&("linear"===t.type||"-"===t.type);v&&"domain"===t.constrain&&t._inputDomain&&(v*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var x=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),M=n(r.vpadplus||r.vpad),k=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=g-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,a,o){var s=_.aggNums(Math.min,null,t),l=_.aggNums(Math.max,null,t);if(o||(o=e.calendar),"category"===e.type)return{start:s-.5,end:l+.5,size:1};var u;if(r)u=(l-s)/r;else{var c=_.distinctVals(t),h=Math.pow(10,Math.floor(Math.log(c.minDiff)/Math.LN10)),f=h*_.roundUp(c.minDiff/h,[.9,1.9,4.9,9.9],!0);u=Math.max(f,2*_.stdev(t)/Math.pow(t.length,a?.25:.4)),b(u)||(u=1)}var d;d="log"===e.type?{type:"linear",range:[s,l]}:{type:e.type,range:_.simpleMap([s,l],e.c2r,0,o),calendar:o},P.setConvert(d),P.autoTicks(d,u);var p,m=P.tickIncrement(P.tickFirst(d),d.dtick,"reverse",o);if("number"==typeof d.dtick){m=n(m,t,d,s,l);p=m+(1+Math.floor((l-m)/d.dtick))*d.dtick}else for("M"===d.dtick.charAt(0)&&(m=i(m,t,d.dtick,s,o)),p=m;p<=l;)p=P.tickIncrement(p,d.dtick,!1,o);return{start:e.c2r(m,0,o),end:e.c2r(p,0,o),size:d.dtick}},P.calcTicks=function(t){var e=_.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=_.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),P.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),s(t),"array"===t.tickmode)return a(t);t._tmin=P.tickFirst(t);var i=e[1]=l:u<=l)&&(o.push(u),!(o.length>1e3));u=P.tickIncrement(u,t.dtick,i,t.calendar));t._tmax=o[o.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var c=new Array(o.length),h=0;hE?(e/=E,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*o(e,r,R)):n>L?(e/=L,t.dtick="M"+o(e,1,j)):n>C?(t.dtick=o(e,C,B),t.tick0=_.dateTick0(t.calendar,!0)):n>z?t.dtick=o(e,z,j):n>I?t.dtick=o(e,I,N):n>D?t.dtick=o(e,D,N):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=o(e,r,R))}else if("log"===t.type){t.tick0=0;var i=_.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var a=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/a,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+o(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=o(e,r,R));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,n){var i=r?-1:1;if(b(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return _.incrementMonth(t,o,n);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?V:U,l=t+.01*i,u=_.roundUp(_.mod(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=_.simpleMap(t.range,e),n=r[1]1&&e2*i}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,e){return i(t,e)?"date":a(t)?"category":n(t)?"linear":"-"}},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],762:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),u=t("./tick_mark_defaults"),c=t("./tick_label_defaults"),h=t("./category_order_defaults"),f=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,m){function g(r,n){return a.coerce2(t,e,s,r,n)}var v=p.letter,y=p.font||{},b="Click to enter "+(p.title||v.toUpperCase()+" axis")+" title",x=r("visible",!p.cheateronly),_=e.type;if("date"===_){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}if(f(e,m),r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),h(t,e,r),e._initialCategories="category"===_?d(v,e.categoryorder,e.categoryarray,p.data):[],!x)return e;var w=r("color"),M=w===t.color?w:y.color;r("title",b),a.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:M}),l(t,e,r,_),c(t,e,r,_,p),u(t,e,r,p);var k=g("linecolor",w),A=g("linewidth"),T=r("showline",!!k||!!A);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var S=g("gridcolor",n(w,p.bgColor,o).toRgbString()),E=g("gridwidth");r("showgrid",p.showGrid||!!S||!!E)||(delete e.gridcolor,delete e.gridwidth);var L=g("zerolinecolor",w),C=g("zerolinewidth");return r("zeroline",p.showGrid||!!L||!!C)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":599,"../../lib":721,"../../registry":838,"./category_order_defaults":764,"./layout_attributes":771,"./ordered_categories":773,"./set_convert":777,"./tick_label_defaults":778,"./tick_mark_defaults":779,"./tick_value_defaults":780,tinycolor2:530}],763:[function(t,e,r){"use strict";function n(t,e,r){function n(t,r){for(var n=Object.keys(t),i=/^[xyz]axis[0-9]*/,a=[],o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],765:[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]*$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4]}},{}],766:[function(t,e,r){"use strict";function n(t,e,r,n){var i,a,s,l,u=n[o(e)].type,c=[];for(a=0;ao*v)||_)for(r=0;rz&&DL&&(L=D);var F=(L-E)/(2*C);h/=F,E=l.l2r(E),L=l.l2r(L),l.range=l._input.range=A=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function u(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}function c(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function h(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:T.background,stroke:T.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function f(t){t.selectAll(".select-outline").remove()}function d(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function p(t){x.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function m(t){return-1!==["lasso","select"].indexOf(t)}function g(t,e){return"M"+(t.l-.5)+","+(e-j-.5)+"h-3v"+(2*j+1)+"h3ZM"+(t.r+.5)+","+(e-j-.5)+"h3v"+(2*j+1)+"h-3Z"}function v(t,e){return"M"+(e-j-.5)+","+(t.t-.5)+"v-3h"+(2*j+1)+"v3ZM"+(e-j-.5)+","+(t.b+.5)+"v3h"+(2*j+1)+"v-3Z"}function y(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,j)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function b(t,e,r){var n,i,a,o,s,l,u=!1,c={},h={};for(n=0;nj||s>j?(kt="xy",o/at>s/ot?(s=o*ot/at,bt>a?xt.t=bt-s:xt.b=bt+s):(o=s*at/ot,yt>i?xt.l=yt-o:xt.r=yt+o),Tt.attr("d",y(xt))):n():!lt||szoom back out","long"),N=!1)}function X(e,r){var n=1===(U+V).length;if(e)Q();else if(2!==r||n){if(1===r&&n){var i=U?rt[0]:et[0],o="s"===U||"w"===V?0:1,s=i._name+".range["+o+"]",l=a(i,o),u="left",c="middle";if(i.fixedrange)return;U?(c="n"===U?"top":"bottom","right"===i.side&&(u="right")):"e"===V&&(u="right"),t._context.showAxisRangeEntryBoxes&&x.select(gt).call(A.makeEditable,{gd:t,immediate:!0,background:dt.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:u,verticalAlign:c}).on("edit",function(e){var r=i.d2r(e);void 0!==r&&w.relayout(t,s,r)})}}else K()}function W(e){function r(t,e,r){function n(e){return t.l2r(a+(e-a)*r)}if(!t.fixedrange){var i=k.simpleMap(t.range,t.r2l),a=i[0]+(i[1]-i[0])*e;t.range=i.map(n)}}if(t._context.scrollZoom||dt._enablescrollzoom){if(t._transitioningWithDuration)return k.pauseEvent(e);var n=t.querySelector(".plotly");if(q(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(Lt);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),!isFinite(i))return void k.log("Did not find wheel motion attributes: ",e);var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/100),s=zt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,u=(s.bottom-e.clientY)/s.height;if(V||ct){for(V||(l=.5),a=0;ac[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return e}},{"../../lib":721,"fast-isnumeric":129}],775:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var i=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=i[0]+(i[1]-i[0])*r;t.range=t._input.range=[t.l2r(a+(i[0]-a)*e),t.l2r(a+(i[1]-a)*e)]}},{"../../constants/alignment":696}],776:[function(t,e,r){"use strict";function n(t){return t._id}function i(t,e){if(Array.isArray(t))for(var r=e.cd[0].trace,n=0;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*w*Math.abs(n-i))}return d}function h(e,r,n){var i=u(e,n||t.calendar);if(i===d){if(!a(e))return d;i=u(new Date(+e))}return i}function g(e,r,n){return l(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(a(e))return+e}function x(e){return a(e)?i.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=10;t.c2l="log"===t.type?r:c,t.l2c="log"===t.type?n:c,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(s(e))},t.p2d=t.p2r=_,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=c,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=_,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=h,t.c2d=t.c2r=t.l2d=t.l2r=g,t.d2p=t.r2p=function(e,r,n){return t.l2p(h(e,0,n))},t.p2d=t.p2r=function(t,e,r){return g(_(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,i=o.nestedProperty(t,e).get(),s=(t._id||"x").charAt(0);if(n="date"===t.type?o.dfltRange(t.calendar):"y"===s?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),!i||2!==i.length)return void o.nestedProperty(t,e).set(n);for("date"===t.type&&(i[0]=o.cleanDate(i[0],d,t.calendar),i[1]=o.cleanDate(i[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r],t.calendar)){t[e]=n;break}if(t.r2l(i[0])===t.r2l(i[1])){var l=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(l-1e3),i[1]=t.l2r(l+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]<-f?i[r]=-f:i[r]>f&&(i[r]=f),i[0]===i[1]){var u=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=u,i[1]+=u}}},t.setScale=function(r){var n=e._size,i=t._id.charAt(0);if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=m.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var s=r&&t._r?"_r":"range",l=t.calendar;t.cleanRange(s);var u=t.r2l(t[s][0],l),c=t.r2l(t[s][1],l);if("y"===i?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(u-c),t._b=-t._m*c):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-u),t._b=-t._m*u),!isFinite(t._m)||!isFinite(t._b))throw o.notifier("Something went wrong with axis scaling","long"),e._replotting=!1,new Error("axis scaling")},t.makeCalcdata=function(e,r){var n,i,a,o="date"===t.type&&e[r+"calendar"];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?i.dateTick0(e.calendar):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 m=r("tickvals");void 0===m?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],781:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=/((x|y)([2-9]|[1-9][0-9]+)?)axis$/;e.exports=function(t,e,r,u){function c(e,r){function n(e,r){for(i=0;ir.duration?(d(),k=window.cancelAnimationFrame(m)):k=window.requestAnimationFrame(m)}var g=t._fullLayout,v=[],y=function(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=g[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,v.push(s),o[s]=a}return o}(e),b=Object.keys(y),x=function(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var 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]||-1===e.indexOf(u)&&-1===e.indexOf(c)||s.push(l)}}return s}(g,b,y);if(!x.length)return!1;var _;u&&(_=u());var w,M,k,A=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(k),k=null,p()}),w=Date.now(),k=window.requestAnimationFrame(m),Promise.resolve()}},{"../../components/drawing":624,"../../plotly":755,"../../registry":838,"./axes":760,d3:120}],782:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var u=i(e,r,n);if(u){if("histogram"===u.type&&n==={v:"y",h:"x"}[u.orientation||"v"])return void(t.type="linear");var c=n+"calendar",h=u[c];if(o(u,n)){for(var f,d=a(u),p=[],m=0;m0?".":"")+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;he*Math.PI/180},w.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":600,"../../components/drawing":624,"../../components/fx":641,"../../lib/topojson_utils":742,"../cartesian/axes":760,"../plots":823,"./constants":786,"./projections":794,"./set_scale":795,"./zoom":796,"./zoom_reset":797,d3:120,"topojson-client":532}],788:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/plots");r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attrRegex=/^geo([2-9]|[1-9][0-9]+)?$/,r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,a=i.getSubplotIds(e,"geo");void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var o=0;on^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?z:t<-1?-z:Math.asin(t)}function l(t){return t>1?0:t<-1?C:Math.acos(t)}function u(t,e){var r=(2+z)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>E;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 m(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)>E&&--i>0);return e/2}}function g(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}function v(t,e){var r,n=Math.min(18,36*Math.abs(e)/C),i=Math.floor(n),a=n-i,o=(r=j[i])[0],s=r[1],l=(r=j[++i])[0],u=r[1],c=(r=j[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?z:-z)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function y(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 x(t,e){var r=b(t,e);return[(r[0]+t/z)/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&&_.hasOwnProperty(t.type)?_[t.type]:r)(t,n)};var _={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},w=[],M=[],k={point:function(t,e){w.push([t,e])},result:function(){var t=w.length?w.length<2?{type:"Point",coordinates:w[0]}:{type:"MultiPoint",coordinates:w}:null;return w=[],t}},A={lineStart:n,point:function(t,e){w.push([t,e])},lineEnd:function(){w.length&&(M.push(w),w=[])},result:function(){var t=M.length?M.length<2?{type:"LineString",coordinates:M[0]}:{type:"MultiLineString",coordinates:M}:null;return M=[],t}},T={polygonStart:n,lineStart:n,point:function(t,e){w.push([t,e])},lineEnd:function(){var t=w.length;if(t){do{w.push(w[0].slice())}while(++t<4);M.push(w),w=[]}},polygonEnd:n,result:function(){if(!M.length)return null;var t=[],e=[];return M.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])}),M=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},S={Point:k,MultiPoint:k,LineString:A,MultiLineString:A,Polygon:T,MultiPolygon:T,Sphere:T},E=1e-6,L=E*E,C=Math.PI,z=C/2,I=(Math.sqrt(C),C/180),D=180/C,P=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=[];++aE&&--i>0);return[t/(.8707+(a=n*n)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return P(g)}).raw=g;var j=[[.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]];j.forEach(function(t){t[1]*=1.0144}),v.invert=function(t,e){var r=e/z,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=j[a][1],s=j[a+1][1],l=j[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,m=50;do{i=Math.min(18,Math.abs(n)/5),a=Math.floor(i),d=i-a,o=j[a][1],s=j[a+1][1],l=j[Math.min(19,a+2)][1],n-=(p=(e>=0?z:-z)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*D}while(Math.abs(p)>L&&--m>0);break}}while(--a>=0);var g=j[a][0],v=j[a+1][0],y=j[Math.min(19,a+2)][0];return[t/(v+d*(y-g)/2+d*d*(y-2*v+g)/2),n*I]},(t.geo.robinson=function(){return P(v)}).raw=v,y.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return P(y)}).raw=y,b.invert=function(t,e){if(!(t*t+4*e*e>C*C+E)){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,m=s*s,g=1-p*u*u,v=g?l(h*u)*Math.sqrt(a=1/g):a=0,y=2*v*h*s-t,b=v*c-e,x=a*(p*m+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*m*h),k=_*w-M*x;if(!k)break;var A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>E||Math.abs(T)>E)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return P(b)}).raw=b,x.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),m=p*p,g=1-h*d*d,v=g?l(o*d)*Math.sqrt(a=1/g):a=0,y=.5*(2*v*o*p+r/z)-t,b=.5*(v*s+n)-e,x=.5*a*(h*m+v*o*d*c)+.5/z,_=a*(f*u/4-v*s*p),w=.125*a*(u*p-v*s*h*f),M=.5*a*(c*d+v*m*o)+.5,k=_*w-M*x,A=(b*_-y*M)/k,T=(y*w-b*x)/k;r-=A,n-=T}while((Math.abs(A)>E||Math.abs(T)>E)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return P(x)}).raw=x}e.exports=n},{}],795:[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,m=o.range[1]-s,g=n._fullRange[0]+s,v=n._fullRange[1]-s,y=o._fullRange[0]+s,b=o._fullRange[1]-s;r._translate0=[e.l+c/2,e.t+h/2];var x=d-f,_=m-p,w=[f+x/2,p+_/2],M=r._rotate;return r._center=[w[0]+M[0],w[1]+M[1]],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,x,_=e.scale(),w=r._translate0,M=i(f,p,d,m),k=i(g,y,v,b);l=a(e,M),o=n(l),x=a(e,k),r._fullScale=n(x),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}}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":786,d3:120}],796:[function(t,e,r){"use strict";function n(t,e){return(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(k)}function n(){o.scale(_.event.scale).translate(_.event.translate),t.render()}function a(){_.select(this).style(A)}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 g.invert(t)}function n(t){var e=g(r(t));return Math.abs(e[0]-t[0])>y||Math.abs(e[1]-t[1])>y}function a(){_.select(this).style(k),l=_.mouse(this),u=g.rotate(),c=g.translate(),h=u,f=r(l)}function o(){if(d=_.mouse(this),n(l))return v.scale(g.scale()),void v.translate(g.translate());g.scale(_.event.scale),g.translate([c[0],_.event.translate[1]]),f?r(d)&&(m=r(d),p=[h[0]+(m[0]-f[0]),u[1],u[2]],g.rotate(p),h=p):(l=d,f=r(l)),t.render()}function s(){_.select(this).style(A)}var l,u,c,h,f,d,p,m,g=t.projection,v=i(g,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),m=x(p,"zoomstart","zoom","zoomend"),v=0,y=p.on;return p.on("zoomstart",function(){_.select(this).style(k);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=g(c(v,p)),b=d.r=f(y,o,i);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=i),s.rotate(b),i=b}}else t=r,o=l(s,t);n(m.of(this,arguments))}),r(m.of(this,arguments))}).on("zoomend",function(){_.select(this).style(A),y.call(p,"zoom",null),a(m.of(this,arguments))}).on("zoom.redraw",function(){t.render()}),_.rebind(p,m,"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=b(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=m(e,2,t[0]);n=m(n,1,t[1]),n=m(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 g=180-a-2*f,v=(Math.atan2(h,u)-Math.atan2(l,i))*M,y=(Math.atan2(h,u)-Math.atan2(l,-i))*M;return d(r[0],r[1],a,v)<=d(r[0],r[1],g,y)?[a,v,r[2]]:[g,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 m(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 g(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;nMath.abs(h)?(u.boxEnd[1]=u.boxStart[1]+Math.abs(c)*w*(h>=0?1:-1),u.boxEnd[1]f[3]&&(u.boxEnd[1]=f[3],u.boxEnd[0]=u.boxStart[0]+(f[3]-u.boxStart[1])/Math.abs(w))):(u.boxEnd[0]=u.boxStart[0]+Math.abs(h)/w*(c>=0?1:-1),u.boxEnd[0]f[2]&&(u.boxEnd[0]=f[2],u.boxEnd[1]=u.boxStart[1]+(f[2]-u.boxStart[0])*Math.abs(w)))}}else u.boxEnabled?(c=u.boxStart[0]!==u.boxEnd[0],h=u.boxStart[1]!==u.boxEnd[1],c||h?(c&&(o(0,u.boxStart[0],u.boxEnd[0]),t.xaxis.autorange=!1),h&&(o(1,u.boxStart[1],u.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),u.boxEnabled=!1,u.boxInited=!1):u.boxInited&&(u.boxInited=!1);break;case"pan":u.boxEnabled=!1,u.boxInited=!1,n?(u.panning||(u.dragStart[0]=i,u.dragStart[1]=a),Math.abs(u.dragStart[0]-i)f[p+2]&&(f[p]=-1,f[p+2]=1),d=this[_[p]],d._length=o.viewBox[p+2]-o.viewBox[p],l.doAutoRange(d),d.setScale();b(s),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},w.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])]},w.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])]},w.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;rMath.abs(e))u.rotate(a,0,0,-t*r*Math.PI*p.rotateSpeed/window.innerWidth);else{var o=-p.zoomSpeed*n*e/window.innerHeight*(a-u.lastT())/100;u.pan(a,0,0,h*(Math.exp(o)-1))}}},!0),p}e.exports=n;var i=t("right-now"),a=t("3d-view"),o=t("mouse-change"),s=t("mouse-wheel"),l=t("mouse-event-offset")},{"3d-view":35,"mouse-change":448,"mouse-event-offset":449,"mouse-wheel":451,"right-now":498}],803:[function(t,e,r){"use strict";var n=t("./scene"),i=t("../plots"),a=t("../../lib"),o=t("../../constants/xmlns_namespaces");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){for(var e=t._fullLayout,r=t._fullData,o=i.getSubplotIds(e,"gl3d"),s=0;s1;s(t,e,r,{type:"gl3d",attributes:u,handleDefaults:n,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:a,paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":600,"../../../lib":721,"../../../registry":838,"../../subplot_defaults":830,"./axis_defaults":806,"./layout_attributes":809}],809:[function(t,e,r){"use strict";function n(t,e,r){return{x:{valType:"number",dflt:t},y:{valType:"number",dflt:e},z:{valType:"number",dflt:r}}}var i=t("./axis_attributes"),a=t("../../../lib/extend").extendFlat;e.exports={_arrayAttrRegexps:[/^scene([2-9]|[1-9][0-9]+)?\.annotations/],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},camera:{up:a(n(0,0,1),{}),center:a(n(0,0,0),{}),eye:a(n(1.25,1.25,1.25),{})},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]}},aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto"},aspectratio:{x:{valType:"number",min:0},y:{valType:"number",min:0},z:{valType:"number",min:0}},xaxis:i,yaxis:i,zaxis:i,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest"},_deprecated:{cameraposition:{valType:"info_array"}}}},{"../../../lib/extend":713,"./axis_attributes":805}],810:[function(t,e,r){"use strict";function n(){this.enabled=[!0,!0,!0],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.drawSides=[!0,!0,!0],this.lineWidth=[1,1,1]}function i(t){var e=new n;return e.merge(t),e}var a=t("../../../lib/str2rgbarray"),o=["xaxis","yaxis","zaxis"];n.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[o[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=a(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=i},{"../../../lib/str2rgbarray":739}],811:[function(t,e,r){"use strict";function n(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],i=new Array(n.length),a=0;af[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,this.convertAnnotations(this),a=0;am[1][a])m[0][a]=-1,m[1][a]=1;else{var A=m[1][a]-m[0][a];m[0][a]-=A/32,m[1][a]+=A/32}}else{var S=l.range;m[0][a]=l.r2l(S[0]),m[1][a]=l.r2l(S[1])}m[0][a]===m[1][a]&&(m[0][a]-=1,m[1][a]+=1),g[a]=m[1][a]-m[0][a],this.glplot.bounds[0][a]=m[0][a]*d[a],this.glplot.bounds[1][a]=m[1][a]*d[a]}var E=[1,1,1];for(a=0;a<3;++a){l=c[T[a]],u=l.type;var L=v[u];E[a]=Math.pow(L.acc,1/L.count)/d[a]}var C;if("auto"===c.aspectmode)C=Math.max.apply(null,E)/Math.min.apply(null,E)<=4?E:[1,1,1];else if("cube"===c.aspectmode)C=[1,1,1];else if("data"===c.aspectmode)C=E;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var z=c.aspectratio;C=[z.x,z.y,z.z]}c.aspectratio.x=h.aspectratio.x=C[0],c.aspectratio.y=h.aspectratio.y=C[1],c.aspectratio.z=h.aspectratio.z=C[2],this.glplot.aspect=C;var I=c.domain||null,D=e._size||null;if(I&&D){var P=this.container.style;P.position="absolute",P.left=D.l+I.x[0]*D.w+"px",P.top=D.t+(1-I.y[1])*D.h+"px",P.width=D.w*(I.x[1]-I.x[0])+"px",P.height=D.h*(I.y[1]-I.y[0])+"px"}this.glplot.redraw()}},A.destroy=function(){this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null},A.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),u(this.glplot.camera)},A.setCamera=function(t){this.glplot.camera.lookAt.apply(this,l(t))},A.saveCamera=function(t){var e=this.getCamera(),r=m.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;if(void 0===n)i=!0;else for(var a=0;a<3;a++)for(var o=0;o<3;o++)if(!function(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]]}(e,n,a,o)){i=!0;break}return i&&r.set(e),i},A.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},A.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":721,"./convert_text_opts":816}],819:[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={_arrayAttrRegexps:[/^mapbox([2-9]|[1-9][0-9]+)?\.layers/],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":600,"../../lib":721,"../../traces/scatter/attributes":1022,"../font_attributes":784}],820:[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()?" - ":"")}},g.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"});return n.append("input").attr({type:"text",name:"data"}).node().value=g.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},g.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||g.createTransitionData(t),r._initialAutoSizeIsDone){var u=r.width,h=r.height;g.supplyLayoutGlobalDefaults(a,n),a.width||(n.width=u),a.height||(n.height=h)}else{g.supplyLayoutGlobalDefaults(a,n);var f=!a.width||!a.height,d=n.autosize,p=t._context&&t._context.autosizable;f&&(d||p)?g.plotAutoSize(t,a,n):f&&g.sanitizeMargins(t),!d&&f&&(a.width=n.width,a.height=n.height)}n._initialAutoSizeIsDone=!0,n._dataLength=l.length,n._globalTransforms=(t._context||{}).globalTransforms,g.supplyDataDefaults(l,s,a,n),n._has=g._hasPlotType.bind(n);var m=n._modules;for(e=0;e0){var c=o(t._boundingBoxMargins),h=c.left+c.right,f=c.bottom+c.top,p=1-2*s,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(m.width-h)),i=Math.round(p*(m.height-f))}else{var v=l?window.getComputedStyle(t):{};n=parseFloat(v.width)||r.width,i=parseFloat(v.height)||r.height}var y=g.layoutAttributes.width.min,b=g.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}),g.sanitizeMargins(r)},g.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];n._replotting||g.doAutoMargin(t)}},g.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(!1!==e.margin.autoexpand){l.base={l:{val:0,size:i},r:{val:1,size:a},t:{val:1,size:o},b:{val:0,size:s}};for(var h=Object.keys(l),f=0;fg){var k=(v*w+(M-e.width)*g)/(w-g),A=(M*(1-g)+(v-e.width)*(1-w))/(w-g);k>=0&&A>=0&&k+A>i+a&&(i=k,a=A)}}if(u(b)&&l[_].t){var T=l[_].t.val,S=l[_].t.size;if(T>y){var E=(b*T+(S-e.height)*y)/(T-y),L=(S*(1-y)+(b-e.height)*(1-T))/(T-y);E>=0&&L>=0&&E+L>s+o&&(s=E,o=L)}}}}if(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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return c.plot(t)},g.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(d.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!d.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):d.isJSDate(t)?d.ms2DateTimeLocal(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&g.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,u={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(u.layout=a(s)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=a(l)),"object"===n?u:JSON.stringify(u)},g.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(){x=!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,f=t._fullLayout._basePlotModules,p=!1;if(r)for(s=0;s=0,E=S?h.angularAxis.domain:n.extent(M),L=Math.abs(M[1]-M[0]);A&&!k&&(L=0);var C=E.slice();T&&k&&(C[1]+=L);var z=h.angularAxis.ticksCount||4;z>8&&(z=z/(z/8)+z%8),h.angularAxis.ticksStep&&(z=(C[1]-C[0])/z);var I=h.angularAxis.ticksStep||(C[1]-C[0])/(z*(h.minorTicks+1));w&&(I=Math.max(Math.round(I),1)),C[2]||(C[2]=I);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=T?L:0,void 0===(e=n.select(this).select("svg.chart-root"))||e.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),O=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));e=n.select(O)}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,R=e.select(".chart-group"),j={fill:"none",stroke:h.tickColor},N={"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){F=e.select(".legend-group").attr({transform:"translate("+[b,h.margin.top]+")"}).style({display:"block"});var B=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=void 0===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:B,reverseOrder:h.legend.reverseOrder})})();var U=F.node().getBBox();b=Math.min(h.width-U.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,b=Math.max(10,b),_=[h.margin.left+b,h.margin.top+b],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:h.width,height:h.height}).style({opacity:h.opacity}),R.attr("transform","translate("+_+")").style({cursor:"crosshair"});var V=[(h.width-(h.margin.left+h.margin.right+2*b+(U?U.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*b))/2];if(V[0]=Math.max(0,V[0]),V[1]=Math.max(0,V[1]),e.select(".outer-group").attr("transform","translate("+V+")"),h.title){ +var q=e.select("g.title-group text").style(N).text(h.title),H=q.node().getBBox();q.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var G=e.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var Y=G.selectAll("circle.grid-circle").data(i.ticks(5));Y.enter().append("circle").attr({class:"grid-circle"}).style(j),Y.attr("r",i),Y.exit().remove()}G.select("circle.outside-circle").attr({r:b}).style(j);var X=e.select("circle.background-circle").attr({r:b}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var W=n.svg.axis().scale(i).ticks(5).tickSize(5);G.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),G.selectAll(".domain").style(j),G.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(N).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,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),G.selectAll("g>line").style({stroke:"black"})}var Z=e.select(".angular.axis-group").selectAll("g.angular-tick").data(D),J=Z.enter().append("g").classed("angular-tick",!0);Z.attr({transform:function(t,e){return"rotate("+l(t,e)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),Z.exit().remove(),J.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(j),J.selectAll(".minor").style({stroke:h.minorTickColor}),Z.select("line.grid-line").attr({x1:h.tickLength?b-h.tickLength:0,x2:b}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),J.append("text").classed("axis-text",!0).style(N);var K=Z.select("text.axis-text").attr({x:b+h.labelOffset,dy:".35em",transform:function(t,e){var r=l(t,e),n=b+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?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?"":w?w[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(N);h.angularAxis.rewriteTicks&&K.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var Q=n.max(R.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));F.attr({transform:"translate("+[b+Q,h.margin.top]+")"});var $=e.select("g.geometry-group").selectAll("g").size()>0,tt=e.select("g.geometry-group").selectAll("g.geometry").data(d);if(tt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),tt.exit().remove(),d[0]||$){var et=[];d.forEach(function(t,e){var r={};r.radialScale=i,r.angularScale=s,r.container=tt.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=h.orientation,r.direction=h.direction,r.index=e,et.push({data:t,geometryConfig:r})});var rt=n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(et),nt=[];rt.forEach(function(t,e){"unstacked"===t.key?nt=nt.concat(t.values.map(function(t,e){return[t]})):nt.push(t.values)}),nt.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 it,at,ot=e.select(".guides-group"),st=e.select(".tooltips-group"),lt=o.tooltipPanel().config({container:st,fontSize:8})(),ut=o.tooltipPanel().config({container:st,fontSize:8})(),ct=o.tooltipPanel().config({container:st,hasTick:!0})();if(!k){var ht=ot.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});R.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(X).angle;ht.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;it=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);lt.text(o.util.round(it)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){ot.select("line").style({opacity:0})})}var ft=ot.select("circle").style({stroke:"grey",fill:"none"});R.on("mousemove.radial-guide",function(t,e){var r=o.util.getMousePos(X).radius;ft.attr({r:r}).style({opacity:.5}),at=i.invert(o.util.getMousePos(X).radius);var n=o.util.convertToCartesian(r,h.radialAxis.orientation);ut.text(o.util.round(at)).move([n[0]+_[0],n[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ft.style({opacity:0}),ct.hide(),lt.hide(),ut.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=w[t[0]]);var c="t: "+u.t+", r: "+u.r,h=this.getBoundingClientRect(),f=e.node().getBoundingClientRect(),d=[h.left+h.width/2-V[0]-f.left,h.top+h.height/2-V[1]-f.top];ct.config({color:s}).text(c),ct.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){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&&ct.show()}).on("mouseout.tooltip",function(t,e){ct.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){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var 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 g.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return g.stroke(r,i,a)},"stroke-width":function(t,e){return g["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return g["stroke-dasharray"](r,i,a)},opacity:function(t,e){return g.opacity(r,i,a)},display:function(t,e){return g.display(r,i,a)}})}};var d=t.angularScale.range(),p=Math.abs(d[1]-d[0])/l[0].length*Math.PI/180,m=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:m,transform:function(e,r){return"rotate("+(t.orientation+u(e[0])+90)+")"}})};var g={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 i[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===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(g).each(h[t.geometryType]),y.exit().remove(),v.exit().remove()})}var e=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),i={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),a(e[r],o.PolyChart.defaultConfig()),a(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},o.PolyChart.defaultConfig=function(){return{data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:!1,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:!0,visibleInLegend:!0},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){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||void 0===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 m=n.range(o.length),g=n.scale[c?"linear":"ordinal"]().domain(m).range(l),v=n.scale[c?"linear":"ordinal"]().domain(m)[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":-1!=n.svg.symbolTypes.indexOf(t)?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,v(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return g(e)}}),x.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){return{data:["a","b","c"],legendConfig:{elements:[{symbol:"line",color:"red"},{symbol:"square",color:"yellow"},{symbol:"diamond",color:"limegreen"}],height:150,colorBandWidth:30,fontSize:12,container:"body",isContinuous:null,textColor:"grey",reverseOrder:!1}}},o.tooltipPanel=function(){var t,e,r,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=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+10,dy:.3*+i.fontSize}),l};return l.text=function(a){var o=n.hsl(i.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",c=a||"";e.style({fill:u,"font-size":i.fontSize+"px"}).text(c);var h=i.padding,f=e.node().getBBox(),d={fill:i.color,stroke:s,"stroke-width":"2px"},p=f.width+2*h+10,m=f.height+2*h;return r.attr({d:"M"+[[10,-m/2],[10,-m/4],[i.hasTick?0:10,0],[10,m/4],[10,m/2],[p,m/2],[p,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[10,-m/2+2*h]+")"}),t.style({display:"block"}),l},l.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),l},l.hide=function(){if(t)return t.style({display:"none"}),l},l.show=function(){if(t)return t.style({display:"block"}),l},l.config=function(t){return a(i,t),l},l},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);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var 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);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=a({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],u=["top","right","bottom","left","pad"],c={};n.entries(s.margin).forEach(function(t,e){c[u[l.indexOf(t.key)]]=t.value}),s.margin=c}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":721,d3:120}],828:[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":600,"../../lib":721,"./micropolar":827,"./undo_manager":829,d3:120}],829:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n=o&&(d.min=0,p.min=0,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),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":600,"../../subplot_defaults":830,"./axis_defaults":834,"./layout_attributes":836}],836:[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":599,"./axis_attributes":833}],837:[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("../plots"),p=t("../cartesian/axes"),m=t("../../components/dragelement"),g=t("../../components/fx"),v=t("../../components/titles"),y=t("../cartesian/select"),b=t("../cartesian/constants");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=this,n=e[r.id],i=e._size;r.adjustLayout(n,i),d.generalUpdatePerTraceModule(r,t,n),r.layers.plotbg.select("path").call(u.fill,n.bgcolor)},x.makeFramework=function(){var t=this,e=t.defs.selectAll("g.clips").data([0]);e.enter().append("g").classed("clips",!0);var r="clip"+t.layoutId+t.id;t.clipDef=e.selectAll("#"+r).data([0]),t.clipDef.enter().append("clipPath").attr("id",r).append("path").attr("d","M0,0Z"),t.plotContainer=t.container.selectAll("g."+t.id).data([0]),t.plotContainer.enter().append("g").classed(t.id,!0),t.layers={};var n=["draglayer","plotbg","backplot","grids","frontplot","zoom","aaxis","baxis","caxis","axlines"];t.plotContainer.selectAll("g.toplevel").data(n).enter().append("g").attr("class",function(t){return"toplevel "+t}).each(function(e){var r=a.select(this);t.layers[e]=r,"frontplot"===e?r.append("g").classed("scatterlayer",!0):"backplot"===e?r.append("g").classed("maplayer",!0):"plotbg"===e?r.append("path").attr("d","M0,0Z"):"axlines"===e&&r.selectAll("path").data(["aline","bline","cline"]).enter().append("path").each(function(t){a.select(this).classed(t,!0)})}),t.plotContainer.select(".grids").selectAll("g.grid").data(["agrid","bgrid","cgrid"]).enter().append("g").attr("class",function(t){return"grid "+t}).each(function(e){t.layers[e]=a.select(this)}),t.plotContainer.selectAll(".backplot,.frontplot,.grids").call(c.setClipUrl,r),t.graphDiv._context.staticPlot||t.initInteractions()};var _=Math.sqrt(4/3);x.adjustLayout=function(t,e){var r,n,i,a,o,s,l=this,c=t.domain,d=(c.x[0]+c.x[1])/2,p=(c.y[0]+c.y[1])/2,m=c.x[1]-c.x[0],g=c.y[1]-c.y[0],v=m*e.w,y=g*e.h,b=t.sum,x=t.aaxis.min,w=t.baxis.min,M=t.caxis.min;v>_*y?(a=y,i=a*_):(i=v,a=i/_),o=m*i/v,s=g*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=b,l.xaxis={type:"linear",range:[x+2*M-b,b-x-2*w],domain:[d-o/2,d+o/2],_id:"x"},h(l.xaxis,l.graphDiv._fullLayout),l.xaxis.setScale(),l.yaxis={type:"linear",range:[x,b-w-M],domain:[p-s/2,p+s/2],_id:"y"},h(l.yaxis,l.graphDiv._fullLayout),l.yaxis.setScale();var k=l.yaxis.domain[0],A=l.aaxis=f({},t.aaxis,{visible:!0,range:[x,b-w-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[k,k+s*_],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(A,l.graphDiv._fullLayout),A.setScale();var T=l.baxis=f({},t.baxis,{visible:!0,range:[b-x-M,w],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});h(T,l.graphDiv._fullLayout),T.setScale(),A._counteraxis=T;var S=l.caxis=f({},t.caxis,{visible:!0,range:[b-x-w,M],side:"right", +_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[k,k+s*_],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});h(S,l.graphDiv._fullLayout),S.setScale();var E="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",E),l.layers.plotbg.select("path").attr("d",E);var L="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer,.zoom").attr("transform",L);var C="translate("+r+","+(n+a)+")";l.layers.baxis.attr("transform",C),l.layers.bgrid.attr("transform",C);var z="translate("+(r+i/2)+","+n+")rotate(30)";l.layers.aaxis.attr("transform",z),l.layers.agrid.attr("transform",z);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 D=l.layers.axlines;D.select(".aline").attr("d",A.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),D.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"),D.select(".cline").attr("d",S.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,S.linecolor||"#000").style("stroke-width",(S.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(p.doTicks(r,i,!0),p.doTicks(r,a,!0),p.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));v.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;v.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"}}),v.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=b.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",k="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=!0;x.initInteractions=function(){function t(t,e,r){var n=F.getBoundingClientRect();x=e-n.left,w=r-n.top,S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=S,E=O.aaxis.range[1]-S.a,C=o(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),z="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",I=!1,D=j.append("path").attr("class","zoombox").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",z),P=j.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=x+t,o=w+i,s=Math.max(0,Math.min(1,e(x,w),e(a,o))),l=Math.max(0,Math.min(1,r(x,w),r(a,o))),u=Math.max(0,Math.min(1,n(x,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,m=p-d/_;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),P.transition().style("opacity",1).duration(200),I=!0)}function c(t,e){if(L===S)return 2===e&&v(),i(R);i(R);var r={};r[O.id+".aaxis.min"]=L.a,r[O.id+".baxis.min"]=L.b,r[O.id+".caxis.min"]=L.c,s.relayout(R,r),T&&R.data&&R._context.showTips&&(l.notifier("Double-click to
zoom back out","long"),T=!1)}function h(){S={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=S}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m;L={a:S.a-n,b:S.b+(r+n)/2,c:S.c-(r-n)/2};var i=[L.a,L.b,L.c].sort(),a={a:i.indexOf(L.a),b:i.indexOf(L.b),c:i.indexOf(L.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),L={a:i[a.a],b:i[a.b],c:i[a.c]},e=(S.a-L.a)*O.yaxis._m,t=(S.c-L.c-S.b+L.b)*O.xaxis._m);var o="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",o),O.aaxis.range=[L.a,O.sum-L.b-L.c],O.baxis.range=[O.sum-L.a-L.c,L.b],O.caxis.range=[O.sum-L.a-L.b,L.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1)}function d(t,e){if(t){var r={};r[O.id+".aaxis.min"]=L.a,r[O.id+".baxis.min"]=L.b,r[O.id+".caxis.min"]=L.c,s.relayout(R,r)}else 2===e&&v()}function p(){O.plotContainer.selectAll(".select-outline").remove()}function v(){var t={};t[O.id+".aaxis.min"]=0,t[O.id+".baxis.min"]=0,t[O.id+".caxis.min"]=0,R.emit("plotly_doubleclick",null),s.relayout(R,t)}var x,w,S,E,L,C,z,I,D,P,O=this,F=O.layers.plotbg.select("path").node(),R=O.graphDiv,j=O.layers.zoom,N={element:F,gd:R,plotinfo:{plot:j},doubleclick:v,subplot:O.id,prepFn:function(e,r,n){N.xaxes=[O.xaxis],N.yaxes=[O.yaxis];var i=R._fullLayout.dragmode;e.shiftKey&&(i="pan"===i?"zoom":"pan"),N.minDrag="lasso"===i?1:void 0,"zoom"===i?(N.moveFn=a,N.doneFn=c,t(e,r,n)):"pan"===i?(N.moveFn=f,N.doneFn=d,h(),p()):"select"!==i&&"lasso"!==i||y(e,r,n,N,i)}};F.onmousemove=function(t){g.hover(R,t,O.id),R._fullLayout._lasthover=F,R._fullLayout._hoversubplot=O.id},F.onmouseout=function(t){R._dragging||m.unhover(R,t)},F.onclick=function(t){g.click(R,t,O.id)},m.init(N)}},{"../../components/color":600,"../../components/dragelement":621,"../../components/drawing":624,"../../components/fx":641,"../../components/titles":689,"../../lib":721,"../../lib/extend":713,"../../plotly":755,"../cartesian/axes":760,"../cartesian/constants":765,"../cartesian/select":776,"../cartesian/set_convert":777,"../plots":823,d3:120,tinycolor2:530}],838:[function(t,e,r){"use strict";function n(t){if(t.layoutAttributes){var e=t.layoutAttributes._arrayAttrRegexps;if(e)for(var n=0;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),h=l({},u,n(e.tileClass)),f=t._context||{};if(e.width&&(h.width=e.width),e.height&&(h.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){h.annotations=[];var d=Object.keys(h);for(r=0;r")?"":e.html(t).text()});return e.remove(),r}function i(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}var a=t("d3"),o=t("../components/drawing"),s=t("../components/color"),l=t("../constants/xmlns_namespaces"),u=/"/g,c=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");e.exports=function(t,e){var r,h=t._fullLayout,f=h._paper,d=h._toppaper;f.insert("rect",":first-child").call(o.setRect,0,0,h.width,h.height).call(s.fill,h.paper_bgcolor);var p=h._basePlotModules||[];for(r=0;r0&&A>0,N=M<=F&&A<=R,B=M<=R&&A<=F,U="h"===v?F>=M*(R/A):R>=A*(F/M);j&&(N||B||U)?b="inside":(b="outside",x.remove(),x=null)}else b="inside";if(!x&&(x=m(e,y,"outside"===b?E:S),_=k.bBox(x.node()),M=_.width,A=_.height,M<=0||A<=0))return void x.remove();var V;V="outside"===b?a(o,f,d,p,_,v):i(o,f,d,p,_,v),x.attr("transform",V)}}}function i(t,e,r,n,i,a){var s,l,u,c,h,f=i.width,d=i.height,p=(i.left+i.right)/2,m=(i.top+i.bottom)/2,g=Math.abs(e-t),v=Math.abs(n-r);g>2*I&&v>2*I?(h=I,g-=2*h,v-=2*h):h=0;var y,b;return f<=g&&d<=v?(y=!1,b=1):f<=v&&d<=g?(y=!0,b=1):fr?(u=(t+e)/2,c=n-h-l/2):(u=(t+e)/2,c=n+h+l/2),o(p,m,u,c,b,y)}function a(t,e,r,n,i,a){var s,l="h"===a?Math.abs(n-r):Math.abs(e-t);l>2*I&&(s=I,l-=2*s);var u,c,h,f,d="h"===a?Math.min(1,l/i.height):Math.min(1,l/i.width),p=(i.left+i.right)/2,m=(i.top+i.bottom)/2;return u=d*i.width,c=d*i.height,"h"===a?er?(h=(t+e)/2,f=n+s+c/2):(h=(t+e)/2,f=n-s-c/2),o(p,m,h,f,d,!1)}function o(t,e,r,n,i,a){var o,s;return i<1?o="scale("+i+") ":(i=1,o=""),s=a?"rotate("+a+" "+t+" "+e+") ":"","translate("+(r-i*t)+" "+(n-i*e)+")"+o+s}function s(t,e){var r=d(t.text,e);return p(S,r)}function l(t,e){var r=d(t.textposition,e);return m(E,r)}function u(t,e,r){return f(L,t.textfont,e,r)}function c(t,e,r){return f(C,t.insidetextfont,e,r)}function h(t,e,r){return f(z,t.outsidetextfont,e,r)}function f(t,e,r,n){e=e||{};var i=d(e.family,r),a=d(e.size,r),o=d(e.color,r);return{family:p(t.family,i,n.family),size:g(t.size,a,n.size),color:v(t.color,o,n.color)}}function d(t,e){var r;return Array.isArray(t)?ei))return e}return void 0!==r?r:t.dflt}function v(t,e,r){return x(e).isValid()?e:void 0!==r?r:t.dflt}var y=t("d3"),b=t("fast-isnumeric"),x=t("tinycolor2"),_=t("../../lib"),w=t("../../lib/svg_text_utils"),M=t("../../components/color"),k=t("../../components/drawing"),A=t("../../components/errorbars"),T=t("./attributes"),S=T.text,E=T.textposition,L=T.textfont,C=T.insidetextfont,z=T.outsidetextfont,I=3;e.exports=function(t,e,r){var i=e.xaxis,a=e.yaxis,o=t._fullLayout,s=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);s.enter().append("g").attr("class","trace bars"),s.append("g").attr("class","points").each(function(e){var r=e[0].t,s=e[0].trace,l=r.poffset,u=Array.isArray(l);y.select(this).selectAll("g.point").data(_.identity).enter().append("g").classed("point",!0).each(function(r,c){function h(t){return 0===o.bargap&&0===o.bargroupgap?y.round(Math.round(t)-A,2):t}function f(t,e){return Math.abs(t-e)>=2?h(t):t>e?Math.ceil(t):Math.floor(t)}var d,p,m,g,v=r.p+(u?l[c]:l),x=v+r.w,_=r.b,w=_+r.s;if("h"===s.orientation?(m=a.c2p(v,!0),g=a.c2p(x,!0),d=i.c2p(_,!0),p=i.c2p(w,!0)):(d=i.c2p(v,!0),p=i.c2p(x,!0),m=a.c2p(_,!0),g=a.c2p(w,!0)),!(b(d)&&b(p)&&b(m)&&b(g)&&d!==p&&m!==g))return void y.select(this).remove();var k=(r.mlw+1||s.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,A=y.round(k/2%1,2);if(!t._context.staticPlot){var T=M.opacity(r.mc||s.marker.color),S=T<1||k>.01?h:f;d=S(d,p),p=S(p,d),m=S(m,g),g=S(g,m)}var E=y.select(this);E.append("path").attr("d","M"+d+","+m+"V"+g+"H"+p+"V"+m+"Z"),n(t,E,e,c,d,p,m,g)})}),s.call(A.plot,e)}},{"../../components/color":600,"../../components/drawing":624,"../../components/errorbars":630,"../../lib":721,"../../lib/svg_text_utils":740,"./attributes":848,d3:120,"fast-isnumeric":129,tinycolor2:530}],856:[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;uu+s||!y(l))&&(h=!0,f(c,t))}for(var i=r.traces,a=v(e),o="fraction"===t._fullLayout.barnorm?1:100,s=o/1e9,l=e.l2c(e.c2l(0)),u="stack"===t._fullLayout.barmode?o:l,c=[l,u],h=!1,d=0;d1||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":600,"../../components/drawing":624,"../../components/errorbars":630,d3:120}],859:[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":600,"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613}],860:[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"},xcalendar:n.xcalendar,ycalendar:n.ycalendar,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":599,"../../lib/extend":713,"../scatter/attributes":1022}],861:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,o,s,l,u,c,h,f,d,p=a.getFromId(t,e.xaxis||"x"),m=a.getFromId(t,e.yaxis||"y"),g=e.orientation,v=[];"h"===g?(r=p,o="x",u=m,c="y"):(r=m,o="y",u=p,c="x"),s=r.makeCalcdata(e,o),a.expand(r,s,{padded:!0}),h=function(t,e,r,a,o){var s;return r in e?h=a.makeCalcdata(e,r):(s=r+"0"in e?e[r+"0"]:"name"in e&&("category"===a.type||n(e.name)&&-1!==["linear","log"].indexOf(a.type)||i.isDateTime(e.name)&&"date"===a.type)?e.name:t.numboxes,s=a.d2c(s,0,e[r+"calendar"]),h=o.map(function(){return s})),h}(t,e,c,u,s);var y=i.distinctVals(h);return f=y.vals,d=y.minDiff/2,l=function(t,e,r,a,o){var s,l,u,c,h=a.length,f=e.length,d=[],p=[];for(s=0;s=0&&u1,m=r.dPos*(1-c.boxgap)*(1-c.boxgroupgap)/(p?t.numboxes:1),g=p?2*r.dPos*((r.boxnum+.5)/t.numboxes-.5)*(1-c.boxgap):0,v=m*d.whiskerwidth;if(!0!==d.visible||r.emptybox)return void a.select(this).remove();"h"===d.orientation?(l=f,u=h):(l=h,u=f),r.bPos=g,r.bdPos=m,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+g,!0),r=l.c2p(t.pos+g-m,!0),n=l.c2p(t.pos+g+m,!0),i=l.c2p(t.pos+g-v,!0),s=l.c2p(t.pos+g+v,!0),c=u.c2p(t.q1,!0),h=u.c2p(t.q3,!0),f=o.constrain(u.c2p(t.med,!0),Math.min(c,h)+1,Math.max(c,h)-1),p=u.c2p(!1===d.boxpoints?t.min:t.lf,!0),y=u.c2p(!1===d.boxpoints?t.max:t.uf,!0);"h"===d.orientation?a.select(this).attr("d","M"+f+","+r+"V"+n+"M"+c+","+r+"V"+n+"H"+h+"V"+r+"ZM"+c+","+e+"H"+p+"M"+h+","+e+"H"+y+(0===d.whiskerwidth?"":"M"+p+","+i+"V"+s+"M"+y+","+i+"V"+s)):a.select(this).attr("d","M"+r+","+f+"H"+n+"M"+r+","+c+"H"+n+"V"+h+"H"+r+"ZM"+e+","+c+"V"+p+"M"+e+","+h+"V"+y+(0===d.whiskerwidth?"":"M"+i+","+p+"H"+s+"M"+i+","+y+"H"+s))}),d.boxpoints&&a.select(this).selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=r,t.trace=d}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,r,n,a,s,l,u,c="all"===d.boxpoints?t.val:t.val.filter(function(e){return et.uf}),h=Math.max((t.max-t.min)/10,t.q3-t.q1),f=1e-9*h,p=.01*h,v=[],y=0;if(d.jitter){if(0===h)for(y=1,v=new Array(c.length),e=0;et.lo&&(n.so=!0),n})}).enter().append("path").call(s.translatePoints,h,f),d.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+g,!0),r=l.c2p(t.pos+g-m,!0),n=l.c2p(t.pos+g+m,!0),i=u.c2p(t.mean,!0),o=u.c2p(t.mean-t.sd,!0),s=u.c2p(t.mean+t.sd,!0);"h"===d.orientation?a.select(this).attr("d","M"+i+","+r+"V"+n+("sd"!==d.boxmean?"":"m0,0L"+o+","+e+"L"+i+","+r+"L"+s+","+e+"Z")):a.select(this).attr("d","M"+r+","+i+"H"+n+("sd"!==d.boxmean?"":"m0,0L"+e+","+o+"L"+r+","+i+"L"+e+","+s+"Z"))})})}},{"../../components/drawing":624,"../../lib":721,d3:120}],868:[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;o=10)return null;for(var r=1/0,i=-1/0,a=t.length,o=0;o0?Math.floor:Math.ceil,I=L>0?Math.ceil:Math.floor,D=L>0?Math.min:Math.max,P=L>0?Math.max:Math.min,O=z(S+C),F=I(E-C);c=T(S);var R=[[c]];for(i=O;i*L=0;i--)a[c-i]=t[h][i],o[c-i]=e[h][i];for(s.push({x:a,y:o,bicubic:l}),i=h,a=[],o=[];i>=0;i--)a[h-i]=t[i][0],o[h-i]=e[i][0];return s.push({x:a,y:o,bicubic:u}),s}},{}],882:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e,r,a){function o(e){var n,i,o,s,l,u,c,h,f,d,p,g,v=[],y=[],b={};if("b"===r)for(i=t.b2j(e),o=Math.floor(Math.max(0,Math.min(P-2,i))),s=i-o,b.length=P,b.crossLength=D,b.xy=function(e){return t.evalxy([],e,i)},b.dxy=function(e,r){return t.dxydi([],e,o,r,s)},n=0;n0&&(f=t.dxydi([],n-1,o,0,s),v.push(l[0]+f[0]/3),y.push(l[1]+f[1]/3),d=t.dxydi([],n-1,o,1,s),v.push(h[0]-d[0]/3),y.push(h[1]-d[1]/3)),v.push(h[0]),y.push(h[1]),l=h;else for(n=t.a2i(e),u=Math.floor(Math.max(0,Math.min(D-2,n))),c=n-u,b.length=D,b.crossLength=P,b.xy=function(e){return t.evalxy([],n,e)},b.dxy=function(e,r){return t.dxydj([],u,e,c,r)},i=0;i0&&(p=t.dxydj([],u,i-1,c,0),v.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),g=t.dxydj([],u,i-1,c,1),v.push(h[0]-g[0]/3),y.push(h[1]-g[1]/3)),v.push(h[0]),y.push(h[1]),l=h;return b.axisLetter=r,b.axis=M,b.crossAxis=E,b.value=e,b.constvar=a,b.index=m,b.x=v,b.y=y,b.smoothing=E.smoothing,b}function s(e){var n,i,o,s,l,u=[],c=[],h={};if(h.length=w.length,h.crossLength=S.length,"b"===r)for(o=Math.max(0,Math.min(P-2,e)),l=Math.min(1,Math.max(0,e-o)),h.xy=function(r){return t.evalxy([],r,e)},h.dxy=function(e,r){return t.dxydi([],e,o,r,l)},n=0;nw.length-1||k.push(i(s(u),{color:M.gridcolor,width:M.gridwidth}));for(m=d;mw.length-1||y<0||y>w.length-1))for(b=w[c],x=w[y],l=0;lw[w.length-1]||A.push(i(o(v),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&T.push(i(s(0),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&T.push(i(s(w.length-1),{color:M.endlinecolor,width:M.endlinewidth}))}else{for(h=5e-15,f=[Math.floor((w[w.length-1]-M.tick0)/M.dtick*(1+h)),Math.ceil((w[0]-M.tick0)/M.dtick/(1+h))].sort(function(t,e){return t-e}),d=f[0],p=f[1],m=d;m<=p;m++)g=M.tick0+M.dtick*m,k.push(i(o(g),{color:M.gridcolor,width:M.gridwidth}));for(m=d-1;mw[w.length-1]||A.push(i(o(v),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&T.push(i(o(w[0]),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&T.push(i(o(w[w.length-1]),{color:M.endlinecolor,width:M.endlinewidth}))}}},{"../../lib/extend":713,"../../plots/cartesian/axes":760}],883:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e){var r,a,o,s=e._labels=[],l=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t[n]=t[n].slice(0,e.length)):t[n]=[],i=0;i90&&(d-=180,l=-l),{angle:d,flip:l,p:t.c2p(n,e,r),offsetMultplier:u}}},{}],899:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll(e+"."+r).data([0]);return n.enter().append(e).classed(r,!0),n}function i(t,e,r){var i=r[0],u=r[0].trace,c=e.xaxis,h=e.yaxis,f=u.aaxis,d=u.baxis,p=t._fullLayout,m=e.plot.selectAll(".carpetlayer"),g=n(p._defs,"g","clips"),v=n(m,"g","carpet"+u.uid).classed("trace",!0),y=n(v,"g","minorlayer"),b=n(v,"g","majorlayer"),x=n(v,"g","boundarylayer"),_=n(v,"g","labellayer");v.style("opacity",u.opacity),o(c,h,b,f,"a",f._gridlines),o(c,h,b,d,"b",d._gridlines),o(c,h,y,f,"a",f._minorgridlines),o(c,h,y,d,"b",d._minorgridlines),o(c,h,x,f,"a-boundary",f._boundarylines),o(c,h,x,d,"b-boundary",d._boundarylines),l(t,_,u,i,c,h,s(t,c,h,u,i,_,f._labels,"a-label"),s(t,c,h,u,i,_,d._labels,"b-label")),a(u,i,g,c,h)}function a(t,e,r,i,a){var o,s,l,u;t.clipPathId="clip"+t.uid+"carpet";var c=r.select("#"+t.clipPathId);c.size()||(c=r.append("clipPath").classed("carpetclip",!0));var h=n(c,"path","carpetboundary"),p=e.clipsegments,m=[];for(u=0;u0?"start":"end","data-notex":1}).call(h.font,i.font).text(i.text).call(m.convertToTspans,t),f=h.bBox(this);l.attr("transform","translate("+a.p[0]+","+a.p[1]+") rotate("+a.angle+")translate("+i.axis.labelpadding*s+","+.3*f.height+")"),u=Math.max(u,f.width+i.axis.labelpadding)}),l.exit().remove(),u}function l(t,e,r,n,i,a,o,s){var l,c,h,f;l=.5*(r.a[0]+r.a[r.a.length-1]),c=r.b[0],h=r.ab2xy(l,c,!0),f=r.dxyda_rough(l,c),u(t,e,r,n,h,f,r.aaxis,i,a,o,"a-title"),l=r.a[0],c=.5*(r.b[0]+r.b[r.b.length-1]),h=r.ab2xy(l,c,!0),f=r.dxydb_rough(l,c),u(t,e,r,n,h,f,r.baxis,i,a,s,"b-title")}function u(t,e,r,n,i,a,o,s,l,u,f){var d=[];o.title&&d.push(o.title);var g=e.selectAll("text."+f).data(d);g.enter().append("text").classed(f,!0),g.each(function(){var e=p(r,s,l,i,a);-1===["start","both"].indexOf(o.showticklabels)&&(u=0),u+=o.titlefont.size+o.titleoffset,c.select(this).text(o.title||"").call(m.convertToTspans,t).attr("transform","translate("+e.p[0]+","+e.p[1]+") rotate("+e.angle+") translate(0,"+u+")").classed("user-select-none",!0).attr("text-anchor","middle").call(h.font,o.titlefont)}),g.exit().remove()}var c=t("d3"),h=t("../../components/drawing"),f=t("./map_1d_array"),d=t("./makepath"),p=t("./orient_text"),m=t("../../lib/svg_text_utils");e.exports=function(t,e,r){for(var n=0;nd&&tm&&ep||eg},h.c2p=function(t){return t},f.c2p=function(t){return t},t.setScale=function(){var e=t.x,r=t.y,n=a(t.xctrl,t.yctrl,e,r,h.smoothing,f.smoothing);t.xctrl=n[0],t.yctrl=n[1],t.evalxy=o([t.xctrl,t.yctrl],u,c,h.smoothing,f.smoothing),t.dxydi=s([t.xctrl,t.yctrl],h.smoothing,f.smoothing),t.dxydj=l([t.xctrl,t.yctrl],h.smoothing,f.smoothing)},t.i2a=function(t){var r=Math.max(0,Math.floor(t[0]),u-2),n=t[0]-r;return(1-n)*e[r]+n*e[r+1]},t.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),u-2),n=t[1]-e;return(1-n)*r[e]+n*r[e+1]},t.ij2ab=function(e){return[t.i2a(e[0]),t.j2b(e[1])]},t.a2i=function(t){var r=Math.max(0,Math.min(i(t,e),u-2)),n=e[r],a=e[r+1];return Math.max(0,Math.min(u-1,r+(t-n)/(a-n)))},t.b2j=function(t){var e=Math.max(0,Math.min(i(t,r),c-2)),n=r[e],a=r[e+1];return Math.max(0,Math.min(c-1,e+(t-n)/(a-n)))},t.ab2ij=function(e){return[t.a2i(e[0]),t.b2j(e[1])]},t.i2c=function(e,r){return t.evalxy([],e,r)},t.ab2xy=function(n,i,a){if(!a&&(ne[u-1]|ir[c-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(i),l=t.evalxy([],o,s);if(a){var h,f,d,p,m=0,g=0,v=[];ne[u-1]?(h=u-2,f=1,m=(n-e[u-1])/(e[u-1]-e[u-2])):(h=Math.max(0,Math.min(u-2,Math.floor(o))),f=o-h),ir[c-1]?(d=c-2,p=1,g=(i-r[c-1])/(r[c-1]-r[c-2])):(d=Math.max(0,Math.min(c-2,Math.floor(s))),p=s-d),m&&(t.dxydi(v,h,d,f,p),l[0]+=v[0]*m,l[1]+=v[1]*m),g&&(t.dxydj(v,h,d,f,p),l[0]+=v[0]*g,l[1]+=v[1]*g)}return l},t.c2p=function(t,e,r){return[e.c2p(t[0]),r.c2p(t[1])]},t.p2x=function(t,e,r){return[e.p2c(t[0]),r.p2c(t[1])]},t.dadi=function(t){var r=Math.max(0,Math.min(e.length-2,t));return e[r+1]-e[r]},t.dbdj=function(t){var e=Math.max(0,Math.min(r.length-2,t));return r[e+1]-r[e]},t.dxyda=function(e,r,n,i){var a=t.dxydi(null,e,r,n,i),o=t.dadi(e,n);return[a[0]/o,a[1]/o]},t.dxydb=function(e,r,n,i){var a=t.dxydj(null,e,r,n,i),o=t.dbdj(r,i);return[a[0]/o,a[1]/o]},t.dxyda_rough=function(e,r,n){var i=v*(n||.1),a=t.ab2xy(e+i,r,!0),o=t.ab2xy(e-i,r,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dxydb_rough=function(e,r,n){var i=y*(n||.1),a=t.ab2xy(e,r+i,!0),o=t.ab2xy(e,r-i,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}},{"../../lib/search":735,"./compute_control_points":886,"./constants":887,"./create_i_derivative_evaluator":888,"./create_j_derivative_evaluator":889,"./create_spline_evaluator":890}],901:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a,o,s=[],l=[],u=t[0].length,c=t.length,h=0;for(i=0;i0&&void 0!==(n=t[r][e-1])&&(a++,i+=n),e0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r0&&a0&&i1e-5);return n.log("Smoother converged to",M,"after",k,"iterations"),t}},{"../../lib":721}],902:[function(t,e,r){"use strict";var n=t("./has_columns"),i=t("../heatmap/convert_column_xyz");e.exports=function(t,e,r){var a=[],o=r("x");o&&!n(o)&&a.push("x"),e._cheater=!o;var s=r("y");if(s&&!n(s)&&a.push("y"),o||s)return a.length&&i(e,e.aaxis,e.baxis,"a","b",a),!0}},{"../heatmap/convert_column_xyz":943,"./has_columns":892}],903:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend").extendFlat,l=n.marker.line;e.exports=s({},{locations:{valType:"data_array"},locationmode:n.locationmode,z:{valType:"data_array"},text:{valType:"data_array"},marker:{line:{color:l.color,width:s({},l.width,{dflt:1})}},hoverinfo:s({},o.hoverinfo,{flags:["location","z","text","name"]})},i,{colorbar:a})},{"../../components/colorbar/attributes":601,"../../components/colorscale/attributes":605,"../../lib/extend":713,"../../plots/attributes":758,"../scattergeo/attributes":1059}],904:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){n(e,e.z,"","z")}},{"../../components/colorscale/calc":606}],905:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,o){function s(r,i){return n.coerce(t,e,a,r,i)}var l,u=s("locations");if(u&&(l=u.length),!u||!l)return void(e.visible=!1);var c=s("z");if(!Array.isArray(c))return void(e.visible=!1);c.length>l&&(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"})}},{"../../components/colorscale/defaults":609,"../../lib":721,"./attributes":903}],906:[function(t,e,r){"use strict";e.exports=function(t,e){return t.location=e.location,t.z=e.z,t}},{}],907:[function(t,e,r){"use strict";function n(t,e,r,n){var o=e.hoverinfo,s="all"===o?a.hoverinfo.flags:o.split("+"),l=-1!==s.indexOf("name"),u=-1!==s.indexOf("location"),c=-1!==s.indexOf("z"),h=-1!==s.indexOf("text"),f=!l&&u,d=[];f?t.nameOverride=r.id:(l&&(t.nameOverride=e.name),u&&d.push(r.id)),c&&d.push(function(t){return i.tickText(n,n.c2l(t),"hover").text}(r.z)),h&&d.push(r.tx),t.extraText=d.join("
")}var i=t("../../plots/cartesian/axes"),a=t("./attributes");e.exports=function(t){var e=t.cd,r=e[0].trace,i=t.subplot,a=i.choroplethHoverPt;if(a){var o=i.projection(a.properties.ct);return t.x0=t.x1=o[0],t.y0=t.y1=o[1],t.index=a.index,t.location=a.id,t.z=a.z,n(t,r,a,i.mockAxis),[t]}}},{"../../plots/cartesian/axes":760,"./attributes":903}],908:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":788,"../heatmap/colorbar":942,"./attributes":903,"./calc":904,"./defaults":905,"./event_data":906,"./hover":907,"./plot":909}],909:[function(t,e,r){"use strict";function n(t,e){for(var r,n=[],i=t.locations,a=i.length,o=u(t,e),s=(t.marker||{}).line||{},l=0;l0&&(n[0].trace=t),n}function i(t){t.framework.selectAll("g.trace.choropleth").each(function(t){var e=t[0].trace,r=a.select(this),n=e.marker||{},i=n.line||{},u=l.makeColorScaleFunc(l.extractScale(e.colorscale,e.zmin,e.zmax));r.selectAll("path.choroplethlocation").each(function(t){a.select(this).attr("fill",function(t){return u(t.z)}).call(o.stroke,t.mlc||i.color).call(s.dashLine,"",t.mlw||i.width||0)})})}var a=t("d3"),o=t("../../components/color"),s=t("../../components/drawing"),l=t("../../components/colorscale"),u=t("../../lib/topojson_utils").getTopojsonFeatures,c=t("../../lib/geo_location_utils").locationToFeature,h=t("../../lib/array_to_calc_item"),f=t("../../plots/geo/constants");e.exports=function(t,e,r){function o(t){return t[0].trace.uid}var s,l=t.framework,u=l.select("g.choroplethlayer"),c=l.select("g.baselayer"),h=l.select("g.baselayeroverchoropleth"),d=f.baseLayersOverChoropleth,p=u.selectAll("g.trace.choropleth").data(e,o);p.enter().append("g").attr("class","trace choropleth"),p.exit().remove(),p.each(function(e){var r=e[0].trace,i=n(r,t.topojson),o=a.select(this).selectAll("path.choroplethlocation").data(i);o.enter().append("path").classed("choroplethlocation",!0).on("mouseover",function(e){t.choroplethHoverPt=e}).on("mouseout",function(){t.choroplethHoverPt=null}),o.exit().remove()}),h.selectAll("*").remove();for(var m=0;ms.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),a(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var u=s.start,c=s.end,h=e._input.contours;if(u>c&&(s.start=h.start=c,c=s.end=h.end=u,u=s.start),!(s.size>0)){var f;f=u===c?1:n(u,c,e.ncontours).dtick,h.size=s.size=f}}return r}},{"../../lib":721,"../../plots/cartesian/axes":760,"../heatmap/calc":940}],912:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../components/colorbar/draw"),a=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),!r.showscale)return void n.autoMargin(t,s);var l=i(t,s);e[0].t.cb=l;var u=r.contours,c=r.line,h=u.size||1,f=u.coloring,d=a(r,{isColorbar:!0});"heatmap"===f&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===f||"heatmap"===f?d:"").line({color:"lines"===f?d:c.color,width:!1!==u.showlines?c.width:0,dash:c.dash}).levels({start:u.start,end:o(u),size:h}).options(r.colorbar)()}},{"../../components/colorbar/draw":603,"../../plots/plots":823,"./end_plus":916,"./make_color_map":920}],913:[function(t,e,r){"use strict";e.exports.BOTTOMSTART=[1,9,13,104,713],e.exports.TOPSTART=[4,6,7,104,713],e.exports.LEFTSTART=[8,12,14,208,1114],e.exports.RIGHTSTART=[2,3,11,208,1114],e.exports.NEWDELTA=[null,[-1,0],[0,-1],[-1,0],[1,0],null,[0,-1],[-1,0],[0,1],[0,1],null,[0,1],[1,0],[1,0],[0,-1]],e.exports.CHOOSESADDLE={104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},e.exports.SADDLEREMAINDER={1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11}},{}],914:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){var a,o=n.coerce2(t,e,i,"contours.start"),s=n.coerce2(t,e,i,"contours.end"),l=!1===o||!1===s,u=r("contours.size");!(a=l?e.autocontour=!0:r("autocontour",!1))&&u||r("ncontours")}},{"../../lib":721,"./attributes":910}],915:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/has_columns"),a=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,u){function c(r,i){return n.coerce(t,e,l,r,i)}if(!a(t,e,c,u))return void(e.visible=!1);c("text"),c("connectgaps",i(e)),o(t,e,c),s(t,e,c,u)}},{"../../lib":721,"../heatmap/has_columns":946,"../heatmap/xyz_defaults":954,"./attributes":910,"./contours_defaults":914,"./style_defaults":924}],916:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],917:[function(t,e,r){"use strict";function n(t,e,r,n){return Math.abs(t[0]-e[0])20?(m=u.CHOOSESADDLE[m][(g[0]||g[1])<0?0:1],t.crossings[p]=u.SADDLEREMAINDER[m]):delete t.crossings[p],!(g=u.NEWDELTA[m])){l.log("Found bad marching index:",m,e,t.level);break}v.push(s(t,e,g)),e[0]+=g[0],e[1]+=g[1],n(v[v.length-1],v[v.length-2],a,c)&&v.pop(),p=e.join(",");var _=g[0]&&(e[0]<0||e[0]>x-2)||g[1]&&(e[1]<0||e[1]>b-2);if(p===d&&g.join(",")===y||r&&_)break;m=t.crossings[p]}1e4===f&&l.log("Infinite loop in contour?");var w,M,k,A,T,S,E,L=n(v[0],v[v.length-1],a,c),C=0,z=.2*t.smoothing,I=[],D=0;for(f=1;f=D;f--)if((w=I[f])=D&&w+I[M]20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==u.BOTTOMSTART.indexOf(t)?i=1:-1!==u.LEFTSTART.indexOf(t)?n=1:-1!==u.TOPSTART.indexOf(t)?i=-1:n=-1,[n,i]}function s(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)]}var l=t("../../lib"),u=t("./constants");e.exports=function(t,e,r){var n,i,o,s,u;for(e=e||.01,r=r||.01,o=0;ot?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r){return t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208}return 15===r?0:r}var i=t("./constants");e.exports=function(t){var e,r,a,o,s,l,u,c,h,f=t[0].z,d=f.length,p=f[0].length,m=2===d||2===p;for(r=0;r1e3){d.warn("Too many contours, clipping at 1000",t);break}return i}function a(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 o(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 s(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=l(t,r);e?f.select(this).attr("d",e).style("stroke","none"):f.select(this).remove()})}function l(t,e){function r(t){return Math.abs(t[0]-e[2][0])<.01}for(var n,i,a,o,s,l,u=Math.min(t.z[0][0],t.z[0][1]),c=t.edgepaths.length||u<=t.level?"":"M"+e.join("L")+"Z",h=0,f=t.edgepaths.map(function(t,e){return e}),m=!0;f.length;){for(l=p.smoothopen(t.edgepaths[h],t.smoothing),c+=m?l:l.replace(/^M/,"L"),f.splice(f.indexOf(h),1), +n=t.edgepaths[h][t.edgepaths[h].length-1],o=-1,a=0;a<4;a++){if(!n){d.log("Missing end?",h,t);break}for(!function(t){return Math.abs(t[1]-e[0][1])<.01}(n)||r(n)?!function(t){return Math.abs(t[0]-e[0][0])<.01}(n)?!function(t){return Math.abs(t[1]-e[2][1])<.01}(n)?r(n)&&(i=e[2]):i=e[3]:i=e[0]:i=e[1],s=0;s=0&&(i=g,o=s):Math.abs(n[1]-i[1])<.01?Math.abs(n[1]-g[1])<.01&&(g[0]-n[0])*(i[0]-g[0])>=0&&(i=g,o=s):d.log("endpt to newendpt is not vert. or horz.",n,i,g)}if(n=i,o>=0)break;c+="L"+i}if(o===t.edgepaths.length){d.log("unclosed perimeter path");break}h=o,m=-1===f.indexOf(h),m&&(h=f[0],c+="Z")}for(h=0;hS){r("a scale is not linear");break}}if(s.length&&"fast"===A){var E=(s[s.length-1]-s[0])/(s.length-1),L=Math.abs(E/100);for(x=0;xL){r("b scale is not linear");break}}}var C=d(b),z="scaled"===e.xtype?"":n,I=g(e,z,i,o,C,w),D="scaled"===e.ytype?"":s,P=g(e,D,v,y,b.length,M),O={a:I,b:P,z:b};return"levels"===e.contours.type&&u(e,b,"","z"),[O]}var a=t("../../lib"),o=t("../../plots/cartesian/axes"),s=t("../../lib").extendFlat,l=t("../../registry"),u=t("../../components/colorscale/calc"),c=t("../heatmap/has_columns"),h=t("../heatmap/convert_column_xyz"),f=t("../heatmap/clean_2d_array"),d=t("../heatmap/max_row_length"),p=t("../heatmap/interp2d"),m=t("../heatmap/find_empties"),g=t("../heatmap/make_bound_array"),v=t("./defaults"),y=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=y(t,e);if(r&&r.visible&&"legendonly"!==r.visible){if(!e.a||!e.b){var a=t.data[r.index],l=t.data[e.index];l.a||(l.a=a.a),l.b||(l.b=a.b),v(l,e,e._defaultColor,t._fullLayout)}var u=i(t,e),c=e.contours;if(!0===e.autocontour){var h=n(e.zmin,e.zmax,e.ncontours);c.size=h.dtick,c.start=o.tickFirst(h),h.range.reverse(),c.end=o.tickFirst(h),c.start===e.zmin&&(c.start+=c.size),c.end===e.zmax&&(c.end-=c.size),c.start>c.end&&(c.start=c.end=(c.start+c.end)/2),e._input.contours=s({},c)}else{var f=c.start,d=c.end,p=e._input.contours;if(f>d&&(c.start=p.start=d,d=c.end=p.end=f,f=c.start),!(c.size>0)){var m;m=f===d?1:n(f,d,e.ncontours).dtick,p.size=c.size=m}}return u}}},{"../../components/colorscale/calc":606,"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"../carpet/lookup_carpetid":894,"../heatmap/clean_2d_array":941,"../heatmap/convert_column_xyz":943,"../heatmap/find_empties":945,"../heatmap/has_columns":946,"../heatmap/interp2d":949,"../heatmap/make_bound_array":950,"../heatmap/max_row_length":951,"./defaults":932}],927:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i,a,o,s=n.a.length,l=n.b.length,u=n.z,c=-1/0,h=1/0;for(i=0;i":case">=":n.contours.value>c&&(t[0].prefixBoundary=!0);break;case"<":case"<=":n.contours.valuec&&(t[0].prefixBoundary=!0);break;case"][":case")(":a=Math.min.apply(null,n.contours.value),o=Math.max.apply(null,n.contours.value),ac&&(t[0].prefixBoundary=!0)}}},{}],928:[function(t,e,r){"use strict";e.exports={INEQUALITY_OPS:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"]}},{}],929:[function(t,e,r){"use strict";function n(t,e){function r(t){return s(t)?+t:null}var n,i=Array.isArray(e);return-1!==o.INEQUALITY_OPS.indexOf(t)?n=r(i?e[0]:e):-1!==o.INTERVAL_OPS.indexOf(t)?n=i?[r(e[0]),r(e[1])]:[r(e),r(e)]:-1!==o.SET_OPS.indexOf(t)&&(n=i?e.map(r):[r(e)]),n}function i(t){return function(e){e=n(t,e);var r=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return{start:r,end:i,size:i-r}}}function a(t){return function(e){return e=n(t,e),{start:e,end:1/0,size:1/0}}}var o=t("./constants"),s=t("fast-isnumeric");e.exports["[]"]=i("[]"),e.exports["()"]=i("()"),e.exports["[)"]=i("[)"),e.exports["(]"]=i("(]"),e.exports["]["]=i("]["),e.exports[")("]=i(")("),e.exports[")["]=i(")["),e.exports["]("]=i("]("),e.exports[">"]=a(">"),e.exports[">="]=a(">="),e.exports["<"]=a("<"),e.exports["<="]=a("<="),e.exports["="]=a("=")},{"./constants":928,"fast-isnumeric":129}],930:[function(t,e,r){"use strict";var n=t("./constraint_mapping"),i=t("fast-isnumeric");e.exports=function(t,e){var r;-1===["=","<","<=",">",">="].indexOf(e.operation)?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:i(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),i(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0));var a=n[e.operation](e.value);e.start=a.start,e.end=a.end,e.size=a.size}},{"./constraint_mapping":929,"fast-isnumeric":129}],931:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r,i,a,o=function(t){return t.reverse()},s=function(t){return t};switch(e){case"][":case")[":case"](":case")(":var l=o;o=s,s=l;case"[]":case"[)":case"(]":case"()":if(2!==t.length)return void n.warn("Contour data invalid for the specified inequality range operation.");for(i=t[0],a=t[1],r=0;r=":case">":if(1!==t.length)return void n.warn("Contour data invalid for the specified inequality operation.");for(i=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return a}},{"../../lib":721}],934:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../contour/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.moduleType="trace",n.name="contourcarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","carpet","contour","symbols","showLegend","hasLines","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":770,"../contour/colorbar":912,"./attributes":925,"./calc":926,"./defaults":932,"./plot":937,"./style":938}],935:[function(t,e,r){"use strict";var n=t("../../components/drawing"),i=t("../carpet/axis_aligned_line"),a=t("../../lib");e.exports=function(t,e,r,o,s,l,u,c){function h(t){return Math.abs(t[1]-r[0][1])=0&&(y=L,x=_):Math.abs(v[1]-y[1])=0&&(y=L,x=_):a.log("endpt to newendpt is not vert. or horz.",v,y,L)}if(x>=0)break;M+=m(v,y),v=y}if(x===e.edgepaths.length){a.log("unclosed perimeter path");break}g=x,A=-1===k.indexOf(g),A&&(g=k[0],M+=m(v,y)+"Z",v=null)}for(g=0;g=0;R--)P=d.clipsegments[R],O=h([],P.x,A.c2p),F=h([],P.y,T.c2p),O.reverse(),F.reverse(),N.push(f(O,F,P.bicubic));var B="M"+N.join("L")+"Z";l(j,d.clipsegments,A,T,C,M.coloring),u(i,j,A,T,L,z,n,c,d,M.coloring,B),s(j,L,M),a(j,c)}}function a(t,e){t.attr("clip-path","url(#"+e.clipPathId+")")}function o(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).classed("trace",!0).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n}function s(t,e,r){var n=e[0].smoothing,i=t.selectAll("g.contourlevel").data(!1===r.showlines?[]:e);i.enter().append("g").classed("contourlevel",!0),i.exit().remove();var a=i.selectAll("path.openline").data(function(t){return t.pedgepaths});a.enter().append("path").classed("openline",!0),a.exit().remove(),a.attr("d",function(t){return d.smoothopen(t,n)}).style("vector-effect","non-scaling-stroke");var o=i.selectAll("path.closedline").data(function(t){return t.ppaths});o.enter().append("path").classed("closedline",!0),o.exit().remove(),o.attr("d",function(t){return d.smoothclosed(t,n)}).style("vector-effect","non-scaling-stroke").style("stroke-miterlimit",1)}function l(t,e,r,i,a,o){var s,l,u,c,d=n(t,"g","contourbg"),p=d.selectAll("path").data("fill"!==o||a?[]:[0]);p.enter().append("path"),p.exit().remove();var m=[];for(c=0;cz){r("x scale is not linear");break}}if(y.length&&"fast"===E){var I=(y[y.length-1]-y[0])/(y.length-1),D=Math.abs(I/100);for(w=0;wD){r("y scale is not linear");break}}}var P=c(_),O="scaled"===e.xtype?"":m,F=p(e,O,g,v,P,M),R="scaled"===e.ytype?"":y,j=p(e,R,b,x,_.length,k);S||(a.expand(M,F),a.expand(k,j));var N={x:F,y:j,z:_,text:e.text};if(s(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};N.xfill=p(B,O,g,v,P,M),N.yfill=p(B,R,b,x,_.length,k)}return[N]}},{"../../components/colorscale/calc":606,"../../lib":721,"../../plots/cartesian/axes":760,"../../registry":838,"../histogram2d/calc":968,"./clean_2d_array":941,"./convert_column_xyz":943,"./find_empties":945,"./has_columns":946,"./interp2d":949,"./make_bound_array":950,"./max_row_length":951}],941:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,i,a,o,s,l;if(e){for(r=0,s=0;s=0;o--)a=f[o],r=a[0],i=a[1],(s=((h[[r-1,i]]||m)[2]+(h[[r+1,i]]||m)[2]+(h[[r,i-1]]||m)[2]+(h[[r,i+1]]||m)[2])/20)&&(l[a]=[r,i,s],f.splice(o,1),u=!0);if(!u)throw"findEmpties iterated with no new neighbors";for(a in l)h[a]=l[a],c.push(l[a])}return c.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":951}],946:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],947:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../lib"),a=n.constants.MAXDIST;e.exports=function(t,e,r,o,s){if(!(t.distance=y[0].length||h<0||h>y.length)return}else{if(n.inbox(e-g[0],e-g[g.length-1])>a||n.inbox(r-v[0],r-v[v.length-1])>a)return;if(s){var w;for(x=[2*g[0]-g[1]],w=1;wm&&(v=Math.max(v,Math.abs(t[i][a]-p)/(g-m))))}return v}var a=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o.01;o++)l=i(t,e,n(l));return l>.01&&a.log("interp2d didn't converge quickly",l),t}},{"../../lib":721}],950:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i,a,o){var s,l,u,c=[],h=n.traceIs(t,"contour"),f=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!f&&"category"!==o.type){var p=e.length;if(!(p<=a))return h?e.slice(0,a):e.slice(0,a+1);if(h||d)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]],u=1;u0;)b=p.c2p(A[M]),M--;for(b0;)w=m.c2p(T[M]),M--;if(w<_&&(x=_,_=w,w=x,I=!0),S&&(A=r[0].xfill,T=r[0].yfill),"fast"!==E){var D="best"===E?0:.5;y=Math.max(-D*p._length,y),b=Math.min((1+D)*p._length,b),_=Math.max(-D*m._length,_),w=Math.min((1+D)*m._length,w)}var P=Math.round(b-y),O=Math.round(w-_),F=P<=0||O<=0,R=e.plot.select(".imagelayer").selectAll("g.hm."+v).data(F?[]:[0]);if(R.enter().append("g").classed("hm",!0).classed(v,!0),R.exit().remove(),!F){var j,N;"fast"===E?(j=C,N=L):(j=P,N=O);var B=document.createElement("canvas");B.width=j,B.height=N;var U,V,q=B.getContext("2d"),H=s.makeColorScaleFunc(s.extractScale(f.colorscale,f.zmin,f.zmax),{ +noNumericCheck:!0,returnArray:!0});"fast"===E?(U=z?function(t){return C-1-t}:o.identity,V=I?function(t){return L-1-t}:o.identity):(U=function(t){return o.constrain(Math.round(p.c2p(A[t])-y),0,P)},V=function(t){return o.constrain(Math.round(m.c2p(T[t])-_),0,O)});var G,Y,X,W,Z,J,K,Q=V(0),$=[Q,Q],tt=z?0:1,et=I?0:1,rt=0,nt=0,it=0,at=0;if(E){var ot,st=0;try{ot=new Uint8Array(P*O*4)}catch(t){ot=new Array(P*O*4)}if("best"===E){var lt,ut,ct,ht=new Array(A.length),ft=new Array(T.length),dt=new Array(P);for(M=0;M0&&a0&&s0&&(n=!0);for(var s=0;sa){var o=a-r[t];return r[t]=a,o}}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]=0;a--)i(a);else if("increasing"===e){for(a=1;a=0;a--)t[a]+=t[a+1];"exclude"===r&&(t.push(0),t.shift())}}var i=t("fast-isnumeric"),a=t("../../lib"),o=t("../../plots/cartesian/axes"),s=t("../bar/arrays_to_calcdata"),l=t("./bin_functions"),u=t("./norm_functions"),c=t("./average"),h=t("./clean_bins");e.exports=function(t,e){if(!0===e.visible){var r,f=[],d=[],p=o.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),m="h"===e.orientation?"y":"x",g={x:"y",y:"x"}[m],v=e[m+"calendar"],y=e.cumulative;h(e,p,m);var b,x=p.makeCalcdata(e,m),_=m+"bins";!1===e["autobin"+m]&&_ in e?b=e[_]:(b=o.autoBin(x,p,e["nbins"+m],!1,v),y.enabled&&"include"!==y.currentbin&&("decreasing"===y.direction?b.start=p.c2r(p.r2c(b.start)-b.size):b.end=p.c2r(p.r2c(b.end)+b.size)),e._input[_]=e[_]=b);var w,M,k,A="string"==typeof b.size,T=A?[]:b,S=[],E=[],L=0,C=e.histnorm,z=e.histfunc,I=-1!==C.indexOf("density");y.enabled&&I&&(C=C.replace(/ ?density$/,""),I=!1);var D,P="max"===z||"min"===z,O=P?null:0,F=l.count,R=u[C],j=!1,N=function(t){return p.r2c(t,0,v)};for(Array.isArray(e[g])&&"count"!==z&&(D=e[g],j="avg"===z,F=l[z]),r=N(b.start),M=N(b.end)+(r-o.tickIncrement(r,b.size,!1,v))/1e6;r=0&&kq;r--)if(d[r]){H=r;break}for(r=q;r<=H;r++)i(f[r])&&i(d[r])&&V.push({p:f[r],s:d[r],b:0});return s(V,e),V}}},{"../../lib":721,"../../plots/cartesian/axes":760,"../bar/arrays_to_calcdata":847,"./average":959,"./bin_functions":961,"./clean_bins":963,"./norm_functions":966,"fast-isnumeric":129}],963:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical"),o=a.ONEDAY,s=a.BADNUM;e.exports=function(t,e,r){var a=e.type,l=r+"bins",u=t[l];u||(u=t[l]={});var c="date"===a?function(t){return t||0===t?i(t,s,u.calendar):null}:function(t){return n(t)?Number(t):null};u.start=c(u.start),u.end=c(u.end);var h="date"===a?o:1,f=u.size;if(n(f))u.size=f>0?Number(f):h;else if("string"!=typeof f)u.size=h;else{var d=f.charAt(0),p=f.substr(1);p=n(p)?Number(p):0,(p<=0||"date"!==a||"M"!==d||p!==Math.round(p))&&(u.size=h)}var m="autobin"+r;"boolean"!=typeof t[m]&&(t[m]=!((u.start||0===u.start)&&(u.end||0===u.end))),t[m]||delete t["nbins"+r]}},{"../../constants/numerical":702,"../../lib":721,"fast-isnumeric":129}],964:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),s=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),u=t("./attributes");e.exports=function(t,e,r,c){function h(r,n){return i.coerce(t,e,u,r,n)}var f=h("x"),d=h("y");h("cumulative.enabled")&&(h("cumulative.direction"),h("cumulative.currentbin")),h("text");var p=h("orientation",d&&!f?"h":"v"),m=e["v"===p?"x":"y"];if(!m||!m.length)return void(e.visible=!1);n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],c),e["h"===p?"x":"y"]&&h("histfunc"),o(t,e,h,"h"===p?["y"]:["x"]),s(t,e,h,r,c),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"})}},{"../../components/color":600,"../../components/errorbars/defaults":629,"../../lib":721,"../../registry":838,"../bar/style_defaults":859,"./attributes":958,"./bin_defaults":960}],965:[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":770,"../bar/hover":851,"../bar/layout_attributes":853,"../bar/layout_defaults":854,"../bar/plot":855,"../bar/set_positions":856,"../bar/style":858,"../scatter/colorbar":1025,"./attributes":958,"./calc":962,"./defaults":964}],966:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;ik&&m.splice(k,m.length-k),v.length>k&&v.splice(k,v.length-k),!e.autobinx&&"xbins"in e||(e.xbins=i.autoBin(m,p,e.nbinsx,"2d",y),"histogram2dcontour"===e.type&&(e.xbins.start=w(i.tickIncrement(x(e.xbins.start),e.xbins.size,!0,y)),e.xbins.end=w(i.tickIncrement(x(e.xbins.end),e.xbins.size,!1,y))),e._input.xbins=e.xbins),!e.autobiny&&"ybins"in e||(e.ybins=i.autoBin(v,g,e.nbinsy,"2d",b),"histogram2dcontour"===e.type&&(e.ybins.start=M(i.tickIncrement(_(e.ybins.start),e.ybins.size,!0,b)),e.ybins.end=M(i.tickIncrement(_(e.ybins.end),e.ybins.size,!1,b))),e._input.ybins=e.ybins),f=[];var A,T,S=[],E=[],L="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,z=L?[]:e.xbins,I=C?[]:e.ybins,D=0,P=[],O=e.histnorm,F=e.histfunc,R=-1!==O.indexOf("density"),j="max"===F||"min"===F,N=j?null:0,B=a.count,U=o[O],V=!1,q=[],H=[],G="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";G&&"count"!==F&&(V="avg"===F,B=a[F]);var Y=e.xbins,X=x(Y.start),W=x(Y.end)+(X-i.tickIncrement(X,Y.size,!1,y))/1e6;for(d=X;d=0&&A=0&&T0)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.vertexIntensityBounds=[t.cmin,t.cmax],p.colormap=i(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolor[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":739,"alpha-shape":41,"convex-hull":101,"delaunay-triangulate":121,"gl-mesh3d":203,tinycolor2:530}],979:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function u(t){var e=t.map(function(t){var e=l(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var c=u(["x","y","z"]),h=u(["i","j","k"]);if(!c)return void(e.visible=!1);h&&h.forEach(function(t){for(var e=0;eo?a=!0:e1)){var h=s.simpleMap(c.x,e.d2c,0,r.xcalendar),f=s.distinctVals(h).minDiff;a=Math.min(a,f)}}for(a===1/0&&(a=1),u=0;u") +;w.push(o,o,o,o,o,o,null)}(C,p[C],m[C],g[C],v[C]));e.x=x,e.y=_,e.text=w}},{"../../lib":721,"../../plots/cartesian/axes":760,"../../plots/cartesian/axis_ids":763,"./helpers":984,"fast-isnumeric":129}],988:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/colorbar/attributes"),a=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendDeep,u=t("../../lib/extend").extendFlat;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]}},labelfont:u({},s,{}),tickfont:u({},s,{}),rangefont:u({},s,{}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string"},tickvals:o.tickvals,ticktext:o.ticktext,tickformat:{valType:"string",dflt:"3s"},visible:{valType:"boolean",dflt:!0},range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},constraintrange:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},values:{valType:"data_array",dflt:[]}},line:u({},l({},n("line"),{colorscale:l({},n("line").colorscale,{dflt:a.Viridis}),autocolorscale:l({},n("line").autocolorscale,{dflt:!1})}),{showscale:{valType:"boolean",dflt:!1},colorbar:i})}},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/colorscale/scales":618,"../../lib/extend":713,"../../plots/cartesian/layout_attributes":771,"../../plots/font_attributes":784}],989:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("./plot"),o=t("../../constants/xmlns_namespaces"),s=t("./constants");r.name="parcoords",r.attr="type",r.plot=function(t){var e=i.getSubplotCalcData(t.calcdata,"parcoords","parcoords");e.length&&a(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("parcoords"),a=e._has&&e._has("parcoords");i&&!a&&(n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords-line-layers").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){function e(e){var n=this,i=n.toDataURL("image/png"),a=r.append("svg:image"),l=t._fullLayout._size,u=t._fullData[e.model.key].domain;a.attr({xmlns:o.svg,"xlink:href":i,x:l.l+l.w*u.x[0]-s.overdrag,y:l.t+l.h*(1-u.y[1]),width:(u.x[1]-u.x[0])*l.w+2*s.overdrag,height:(u.y[1]-u.y[0])*l.h,preserveAspectRatio:"none"})}var r=t._fullLayout._glimages,i=n.selectAll(".svg-container");i.filter(function(t,e){return e===i.size()-1}).selectAll(".parcoords-lines.context, .parcoords-lines.focus").each(e),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":704,"../../plots/plots":823,"./constants":992,"./plot":997,d3:120}],990:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("../../lib");e.exports=function(t,e){var r=!!e.line.colorscale&&a.isArray(e.line.color),o=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),s=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&i(e,e.line.color,"line","c"),[{lineColor:o,cscale:s}]}},{"../../components/colorscale/calc":606,"../../components/colorscale/has_colorscale":613,"../../lib":721}],991:[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.line,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":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],992:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0}}},{}],993:[function(t,e,r){"use strict";function n(t,e,r,n,i){i("line.color",r),s(t,"line")&&a.isArray(t.line.color)?(i("line.colorscale"),l(t,e,n,i,{prefix:"line.",cLetter:"c"})):i("line.color",r)}function i(t,e){function r(t,e){return a.coerce(n,i,o.dimensions,t,e)}var n,i,s,l=t.dimensions||[],c=e.dimensions=[],h=1/0;for(l.length>u&&(a.log("parcoords traces support up to "+u+" dimensions at the moment"),l.splice(u)),s=0;s0);d&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),h=Math.min(h,i.values.length)),i._index=s,c.push(i)}if(isFinite(h))for(s=0;sh&&(i.values=i.values.slice(0,h));return c}var a=t("../../lib"),o=t("./attributes"),s=t("../../components/colorscale/has_colorscale"),l=t("../../components/colorscale/defaults"),u=t("./constants").maxDimensionCount;e.exports=function(t,e,r,s){function l(r,n){return a.coerce(t,e,o,r,n)}var u=i(t,e);n(t,e,r,s,l),l("domain.x"),l("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var c={family:s.font.family,size:Math.round(s.font.size*(10/12)),color:s.font.color};a.coerceFont(l,"labelfont",c),a.coerceFont(l,"tickfont",c),a.coerceFont(l,"rangefont",c)}},{"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613,"../../lib":721,"./attributes":988,"./constants":992}],994:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","noOpacity"],n.meta={},e.exports=n},{"./attributes":988,"./base_plot":989,"./calc":990,"./colorbar":991,"./defaults":993,"./plot":997}],995:[function(t,e,r){"use strict";function n(t){t.read({x:0,y:0,width:1,height:1,data:x})}function i(t,e,r,n,i){var a=t._gl;a.enable(a.SCISSOR_TEST),a.scissor(e,r,n,i),t.clear({color:[0,0,0,0],depth:1})}function a(t,e,r,a,o,s){function l(n){var c;c=Math.min(a,o-n*a),s.offset=v*n*a,s.count=v*c,0===n&&(window.cancelAnimationFrame(r.currentRafs[u]),delete r.currentRafs[u],i(t,s.scissorX,s.scissorY,s.scissorWidth,s.viewBoxSize[1])),r.clearOnly||(e(s),n*a+c>>8*e)%256/255}function u(t,e,r,n){for(var i=[],a=0;a=g-4?l(a,g-2-s):.5);return i}function c(t,e,r){var n,i,a,o=[];for(i=0;if&&(f=t[l].dim2.canvasX,c=l),t[l].dim1.canvasXi)return a;i=o,a=n[r]}return n[n.length-1]}function l(t,e,r){var n=o(r);return r.tickvals?_.scale.ordinal().domain(r.tickvals).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):_.scale.linear().domain(n).range([t-e,e])}function u(t,e){return _.scale.linear().range([t-e,e])}function c(t){return _.scale.linear().domain(o(t))}function h(t){var e=o(t);return t.tickvals&&_.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}function f(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}),n=r.map(function(t){return _.rgb(t)}),i=function(t){return function(e){return e[t]}},a="rgb".split("").map(function(t){return _.scale.linear().clamp(!0).domain(e).range(n.map(i(t)))});return function(t){return a.map(function(e){return e(t)})}}function d(t){return t[0]}function p(t,e,r){var n=d(e),i=n.trace,o=n.lineColor,s=n.cscale,l=i.line,u=i.domain,h=i.dimensions,p=t.width,m=i.labelfont,g=i.tickfont,v=i.rangefont,y=x.extendDeep({},l,{color:o.map(c({values:o,range:[l.cmin,l.cmax]})),blockLineCount:b.blockLineCount,canvasOverdrag:b.overdrag*b.canvasPixelRatio}),_=Math.floor(p*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),M=t.margin||{l:80,r:80,t:100,b:80},k=_,A=w;return{key:r,colCount:h.filter(a).length,dimensions:h,tickDistance:b.tickDistance,unitToColor:f(s),lines:y,labelFont:m,tickFont:g,rangeFont:v,translateX:u.x[0]*p,translateY:t.height-u.y[1]*t.height,pad:M,canvasWidth:k*b.canvasPixelRatio+2*y.canvasOverdrag,canvasHeight:A*b.canvasPixelRatio,width:k,height:A,canvasPixelRatio:b.canvasPixelRatio}}function m(t){var e=t.width,r=t.height,n=t.dimensions,i=t.canvasPixelRatio,o=function(r){return e*r/Math.max(1,t.colCount-1)},s=b.verticalPadding/(r*i),f=1-2*s,d=function(t){return s+f*t},p={key:t.key,xScale:o,model:t},m={};return p.dimensions=n.filter(a).map(function(e,n){var a=c(e),s=m[e.label];return m[e.label]=(s||0)+1,{key:e.label+(s?"__"+s:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:b.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(a).map(d),xScale:o,x:o(n),canvasX:o(n)*i,unitScale:u(r,b.verticalPadding),domainScale:l(r,b.verticalPadding,e),ordinalScale:h(e),domainToUnitScale:a,filter:e.constraintrange?e.constraintrange.map(a):[0,1],parent:p,model:t}}),p}function g(t){return b.layers.map(function(e){return{key:e,context:"contextLineLayer"===e,pick:"pickLineLayer"===e,viewModel:t,model:t.model}})}function v(t){t.classed("axisExtentText",!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var y=t("./lines"),b=t("./constants"),x=t("../../lib"),_=t("d3"),w=t("../../components/drawing");e.exports=function(t,e,r,a,o){function l(t){var e=t.selectAll("defs").data(i,n);e.enter().append("defs");var r=e.selectAll("#filterBarPattern").data(i,n);r.enter().append("pattern").attr("id","filterBarPattern").attr("patternUnits","userSpaceOnUse"),r.attr("x",-b.bar.width).attr("width",b.bar.capturewidth).attr("height",function(t){return t.model.height});var a=r.selectAll("rect").data(i,n);a.enter().append("rect").attr("shape-rendering","crispEdges"),a.attr("height",function(t){return t.model.height}).attr("width",b.bar.width).attr("x",b.bar.width/2).attr("fill",b.bar.fillcolor).attr("fill-opacity",b.bar.fillopacity).attr("stroke",b.bar.strokecolor).attr("stroke-opacity",b.bar.strokeopacity).attr("stroke-width",b.bar.strokewidth)}function u(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function c(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),i=n.length-1,a=0;a<1;a++)for(var o=0;o=r||s>=n)return;var l=t.lineLayer.readPixel(a,n-1-s),u=0!==l[3],c=u?l[2]+256*(l[1]+256*l[0]):null,h={x:a,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};c!==I&&(u?o.hover(h):o.unhover&&o.unhover(h),I=c)}}),C.style("margin",function(t){var e=t.model.pad;return e.t+"px "+e.r+"px "+e.b+"px "+e.l+"px"}).attr("width",function(t){return t.model.canvasWidth}).attr("height",function(t){return t.model.canvasHeight}).style("width",function(t){return t.model.width+2*b.overdrag+"px"}).style("height",function(t){return t.model.height+"px"}).style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var D=e.selectAll(".parcoords").data(E,n);D.exit().remove(),D.enter().append("g").classed("parcoords",!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(l),D.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var P=D.selectAll(".parcoordsControlView").data(i,n);P.enter().append("g").classed("parcoordsControlView",!0).style("box-sizing","content-box"),P.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var O=P.selectAll(".yAxis").data(function(t){return t.dimensions},n);O.enter().append("g").classed("yAxis",!0).each(function(t){z.dimensions.push(t)}),P.each(function(t){f(O,t)}),C.each(function(t){t.lineLayer=y(this,t.model.lines,t.model.canvasWidth,t.model.canvasHeight,t.viewModel.dimensions,t.viewModel.panels,t.model.unitToColor,t.context,t.pick,b.scatter),t.viewModel[t.key]=t.lineLayer,z.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}),O.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),O.call(_.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;S=!1,T||(t.x=Math.max(-b.overdrag,Math.min(t.model.width+b.overdrag,_.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,O.sort(function(t,e){return t.x-e.x}).each(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e.xIndex),e.canvasX=e.x*e.model.canvasPixelRatio}),f(O,e),O.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),_.select(this).attr("transform","translate("+t.x+", 0)"),O.each(function(r,n,i){i===t.parent.key&&(e.dimensions[n]=r)}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer.render&&e.focusLineLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;if(T)return void("ending"===T&&(T=!1));t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,f(O,e),_.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLineLayer&&e.contextLineLayer.render(e.panels,!1,!u(e)),e.focusLineLayer&&e.focusLineLayer.render(e.panels),e.pickLineLayer&&e.pickLineLayer.render(e.panels,!0),S=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex}))})),O.exit().remove();var F=O.selectAll(".axisOverlays").data(i,n);F.enter().append("g").classed("axisOverlays",!0),F.selectAll(".axis").remove();var R=F.selectAll(".axis").data(i,n);R.enter().append("g").classed("axis",!0),R.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain(),i=t.ticktext;_.select(this).call(_.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n.map(function(t,e){return i&&i[e]||t}):null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),w.font(R.selectAll("text"),t.model.tickFont)}),R.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),R.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var j=F.selectAll(".axisHeading").data(i,n);j.enter().append("g").classed("axisHeading",!0);var N=j.selectAll(".axisTitle").data(i,n);N.enter().append("text").classed("axisTitle",!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),N.attr("transform","translate(0,"+-b.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){w.font(N,t.model.labelFont)});var B=F.selectAll(".axisExtent").data(i,n);B.enter().append("g").classed("axisExtent",!0);var U=B.selectAll(".axisExtentTop").data(i,n);U.enter().append("g").classed("axisExtentTop",!0),U.attr("transform","translate(0,"+-b.axisExtentOffset+")");var V=U.selectAll(".axisExtentTopText").data(i,n);V.enter().append("text").classed("axisExtentTopText",!0).attr("alignment-baseline","after-edge").call(v),V.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){w.font(V,t.model.rangeFont)});var q=B.selectAll(".axisExtentBottom").data(i,n);q.enter().append("g").classed("axisExtentBottom",!0),q.attr("transform",function(t){return"translate(0,"+(t.model.height+b.axisExtentOffset)+")"});var H=q.selectAll(".axisExtentBottomText").data(i,n);H.enter().append("text").classed("axisExtentBottomText",!0).attr("alignment-baseline","before-edge").call(v),H.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){w.font(H,t.model.rangeFont)});var G=F.selectAll(".axisBrush").data(i,n),Y=G.enter().append("g").classed("axisBrush",!0);G.each(function(t){t.brush||(t.brush=_.svg.brush().y(t.unitScale).on("brushstart",M).on("brush",k).on("brushend",A),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),_.select(this).call(t.brush))}),Y.selectAll("rect").attr("x",-b.bar.capturewidth/2).attr("width",b.bar.capturewidth),Y.selectAll("rect.extent").attr("fill","url(#filterBarPattern)").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),Y.selectAll(".resize rect").attr("height",b.bar.handleheight).attr("opacity",0).style("visibility","visible"),Y.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",b.bar.handleoverlap-b.bar.handleheight),Y.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",b.bar.handleoverlap);var X=!1,W=!1;return z}},{"../../components/drawing":624,"../../lib":721,"./constants":992,"./lines":995,d3:120}],997:[function(t,e,r){"use strict";var n=t("./parcoords");e.exports=function(t,e){var r=t._fullLayout,i=r._paper,a=r._paperdiv,o={},s={},l=r._size;e.forEach(function(e,r){o[r]=t.data[r].dimensions,s[r]=t.data[r].dimensions.slice()});var u=function(e,r,n){var i=s[e][r],a=i.constraintrange;a&&2===a.length||(a=i.constraintrange=[]),a[0]=n[0],a[1]=n[1],t.emit("plotly_restyle")},c=function(e){t.emit("plotly_hover",e)},h=function(e){t.emit("plotly_unhover",e)},f=function(e,r){function n(t){return!("visible"in t)||t.visible}function i(t,e,r){var n=e.indexOf(r),i=t.indexOf(n);return-1===i&&(i+=e.length),i}var a=function(t){return function(e,n){return i(r,t,e)-i(r,t,n)}}(s[e].filter(n));o[e].sort(a),s[e].filter(function(t){return!n(t)}).sort(function(t){return s[e].indexOf(t)}).forEach(function(t){o[e].splice(o[e].indexOf(t),1),o[e].splice(s[e].indexOf(t),0,t)}),t.emit("plotly_restyle")};n(a,i,e,{width:l.w,height:l.h,margin:{t:l.t,r:l.r,b:l.b,l:l.l}},{filterChanged:u,hover:c,unhover:h,axesMoved:f})}},{"./parcoords":996}],998:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=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:n.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}}},text:{valType:"data_array"},hovertext:{valType:"string",dflt:"",arrayOk:!0},scalegroup:{valType:"string",dflt:""},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"]},hoverinfo:o({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0},textfont:o({},i,{}),insidetextfont:o({},i,{}),outsidetextfont:o({},i,{}),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":599,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/font_attributes":784}],999:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n")}return m};var l},{"../../components/color":600,"./helpers":1002,"fast-isnumeric":129,tinycolor2:530}],1001:[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")),o("marker.line.width")&&o("marker.line.color");var c=o("marker.colors");Array.isArray(c)||(e.marker.colors=[]),o("scalegroup");var h=o("text"),f=o("textinfo",Array.isArray(h)?"text+percent":"percent");if(o("hovertext"),f&&"none"!==f){var d=o("textposition"),p=Array.isArray(d)||"auto"===d,m=p||"inside"===d,g=p||"outside"===d;if(m||g){var v=s(o,"textfont",a.font);m&&s(o,"insidetextfont",v),g&&s(o,"outsidetextfont",v)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":721,"./attributes":998}],1002:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)}},{"../../lib":721}],1003:[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":998,"./base_plot":999,"./calc":1e3,"./defaults":1001,"./layout_attributes":1004,"./layout_defaults":1005,"./plot":1006,"./style":1007,"./style_one":1008}],1004:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array"}}},{}],1005:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){!function(r,a){n.coerce(t,e,i,r,a)}("hiddenlabels")}},{"../../lib":721,"./layout_attributes":1004}],1006:[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)),m=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),g={scale:2*m/t.width,rCenter:Math.cos(m/r.r)-m/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=g.scale>f.scale?g:f;return u.scale<1&&v.scale>u.scale?v:u}function i(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function 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]}var i,a,o,s,l,u,c,h,f,d,p,m,g;for(a=0;a<2;a++)for(o=a?r:n,l=a?Math.max:Math.min,c=a?1:-1,i=0;i<2;i++){for(s=i?Math.max:Math.min,u=i?1:-1,h=t[a][i],h.sort(o),f=t[1-a][i],d=f.concat(h),m=[],p=0;p0&&(t.labelExtraY=b),Array.isArray(e.pull))for(i=0;i=e.pull[o.i]||((t.pxmid[1]-o.pxmid[1])*c>0?(h=o.cyFinal+l(o.px0[1],o.px1[1]),(b=h-g-t.labelExtraY)*c>0&&(t.labelExtraY+=b)):(v+t.labelExtraY-y)*c>0&&(n=3*u*Math.abs(i-d.indexOf(t)),f=o.cxFinal+s(o.px0[0],o.px1[0]),(p=f+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*u>0&&(t.labelExtraX+=p)))}(m[p],v)}}}function s(t,e){var r,n,i,a,o,s,l,c,h,f,d=[];for(i=0;ic&&(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&&-1===d.indexOf(s.scalegroup)&&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("../../components/fx"),f=t("../../components/color"),d=t("../../components/drawing"),p=t("../../lib/svg_text_utils"),m=t("./helpers");e.exports=function(t,e){var r=t._fullLayout;s(e,r._size);var u=r._pielayer.selectAll("g.trace").data(e);u.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),u.exit().remove(),u.order(),u.each(function(e){var s=c.select(this),u=e[0],g=u.trace,v=(g.depth||0)*u.r*Math.sin(0)/2,y=g.tiltaxis||0,b=y*Math.PI/180,x=[v*Math.sin(b),v*Math.cos(b)],_=u.r*Math.cos(0),w=s.selectAll("g.part").data(g.tilt?["top","sides"]:["top"]);w.enter().append("g").attr("class",function(t){return t+" part"}),w.exit().remove(),w.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(e){function o(n){n.originalEvent=c.event;var a=t._fullLayout,o=t._fullData[g.index],s=h.castHoverinfo(o,a,e.i);if("all"===s&&(s="label+text+value+percent+name"),t._dragging||!1===a.hovermode||"none"===s||"skip"===s||!s)return void h.hover(t,n,"pie");var l=i(e,u),f=w+e.pxmid[0]*(1-l),d=M+e.pxmid[1]*(1-l),p=r.separators,v=[];-1!==s.indexOf("label")&&v.push(e.label),-1!==s.indexOf("text")&&(o.hovertext?v.push(Array.isArray(o.hovertext)?o.hovertext[e.i]:o.hovertext):o.text&&o.text[e.i]&&v.push(o.text[e.i])),-1!==s.indexOf("value")&&v.push(m.formatPieValue(e.v,p)),-1!==s.indexOf("percent")&&v.push(m.formatPiePercent(e.v/u.vTotal,p)),h.loneHover({x0:f-l*u.r,x1:f+l*u.r,y:d,text:v.join("
"),name:-1!==s.indexOf("name")?o.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:h.castHoverOption(g,e.i,"bgcolor")||e.color,borderColor:h.castHoverOption(g,e.i,"bordercolor"),fontFamily:h.castHoverOption(g,e.i,"font.family"),fontSize:h.castHoverOption(g,e.i,"font.size"),fontColor:h.castHoverOption(g,e.i,"font.color")},{container:a._hoverlayer.node(),outerContainer:a._paper.node(),gd:t}),h.hover(t,n,"pie"),T=!0}function s(e){e.originalEvent=c.event,t.emit("plotly_unhover",{event:c.event,points:[e]}),T&&(h.loneUnhover(r._hoverlayer.node()),T=!1)}function f(){t._hoverdata=[e],t._hoverdata.trace=u.trace,h.click(t,c.event)}function b(t,r,n,i){return"a"+i*u.r+","+i*_+" "+y+" "+e.largeArc+(n?" 1 ":" 0 ")+i*(r[0]-t[0])+","+i*(r[1]-t[1])}if(e.hidden)return void c.select(this).selectAll("path,g").remove();l[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var w=u.cx+x[0],M=u.cy+x[1],k=c.select(this),A=k.selectAll("path.surface").data([e]),T=!1;if(A.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),k.select("path.textline").remove(),k.on("mouseover",o).on("mouseout",s).on("click",f),g.pull){var S=+(Array.isArray(g.pull)?g.pull[e.i]:g.pull)||0;S>0&&(w+=S*e.pxmid[0],M+=S*e.pxmid[1])}e.cxFinal=w,e.cyFinal=M;var E=g.hole;if(e.v===u.vTotal){var L="M"+(w+e.px0[0])+","+(M+e.px0[1])+b(e.px0,e.pxmid,!0,1)+b(e.pxmid,e.px0,!0,1)+"Z";E?A.attr("d","M"+(w+E*e.px0[0])+","+(M+E*e.px0[1])+b(e.px0,e.pxmid,!1,E)+b(e.pxmid,e.px0,!1,E)+"Z"+L):A.attr("d",L)}else{var C=b(e.px0,e.px1,!0,1);if(E){var z=1-E;A.attr("d","M"+(w+E*e.px1[0])+","+(M+E*e.px1[1])+b(e.px1,e.px0,!1,E)+"l"+z*e.px0[0]+","+z*e.px0[1]+C+"Z")}else A.attr("d","M"+w+","+M+"l"+e.px0[0]+","+e.px0[1]+C+"Z")}var I=Array.isArray(g.textposition)?g.textposition[e.i]:g.textposition,D=k.selectAll("g.slicetext").data(e.text&&"none"!==I?[0]:[]);D.enter().append("g").classed("slicetext",!0),D.exit().remove(),D.each(function(){var r=c.select(this).selectAll("text").data([0]);r.enter().append("text").attr("data-notex",1),r.exit().remove(),r.text(e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(d.font,"outside"===I?g.outsidetextfont:g.insidetextfont).call(p.convertToTspans,t);var i,o=d.bBox(r.node());"outside"===I?i=a(o,e):(i=n(o,e,u),"auto"===I&&i.scale<1&&(r.call(d.font,g.outsidetextfont),g.outsidetextfont.family===g.insidetextfont.family&&g.outsidetextfont.size===g.insidetextfont.size||(o=d.bBox(r.node())),i=a(o,e)));var s=w+e.pxmid[0]*i.rCenter+(i.x||0),l=M+e.pxmid[1]*i.rCenter+(i.y||0);i.outside&&(e.yLabelMin=l-o.height/2,e.yLabelMid=l,e.yLabelMax=l+o.height/2,e.labelExtraX=0,e.labelExtraY=0,v=!0),r.attr("transform","translate("+s+","+l+")"+(i.scale<1?"scale("+i.scale+")":"")+(i.rotate?"rotate("+i.rotate+")":"")+"translate("+-(o.left+o.right)/2+","+-(o.top+o.bottom)/2+")")})}),v&&o(l,g),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],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]);Math.abs(s)>Math.abs(l)?a+="l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+o):a+="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,g.outsidetextfont.color).attr({"stroke-width":Math.min(2,g.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":600,"../../components/drawing":624,"../../components/fx":641,"../../lib/svg_text_utils":740,"./helpers":1002,d3:120}],1007:[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":1008,d3:120}],1008:[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}).call(n.fill,e.color).call(n.stroke,i)}},{"../../components/color":600}],1009:[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":1066}],1010:[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.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=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),m=o(t.marker.border.color),g=t.opacity*t.marker.opacity;p[3]*=g,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){v=l.length<100||u.length<100}this.pointcloudOptions.blend=v,m[3]*=g,this.pointcloudOptions.borderColor=m;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},u.expandAxesFast=function(t,e){for(var r,n,i,a=e||.5,o=0;o<2;o++)r=this.scene[l[o]],n=r._min,n||(n=[]),n.push({val:t[o],pad:a}),i=r._max,i||(i=[]),i.push({val:t[o+2],pad:a})},u.dispose=function(){this.pointcloud.dispose()},e.exports=i},{"../../lib/str2rgbarray":739,"../scatter/get_trace_color":1030,"gl-pointcloud2d":228}],1011:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}a("x"),a("y"),a("xbounds"),a("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),a("text"),a("marker.color",r),a("marker.opacity"),a("marker.blend"),a("marker.sizemin"),a("marker.sizemax"),a("marker.border.color",r),a("marker.border.arearatio")}},{"../../lib":721,"./attributes":1009}],1012:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":800,"../scatter3d/calc":1046,"./attributes":1009,"./convert":1010,"./defaults":1011}],1013:[function(t,e,r){"use strict";var n=t("../../components/shapes/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=t("../../components/color/attributes"),s=t("../../lib/extend").extendFlat;e.exports={hoverinfo:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),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]}},orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:i,node:{label:{valType:"data_array",dflt:[]},color:s({},n.fillcolor,{arrayOk:!0}),line:{color:{valType:"color",dflt:o.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20}},link:{label:{valType:"data_array",dflt:[]},color:s({},n.fillcolor,{arrayOk:!0}),line:{color:{valType:"color",dflt:o.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]}}}},{"../../components/color/attributes":599,"../../components/shapes/attributes":676,"../../lib/extend":713,"../../plots/attributes":758,"../../plots/font_attributes":784}],1014:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("./plot");r.name="sankey",r.attr="type",r.plot=function(t){var e=n.getSubplotCalcData(t.calcdata,"sankey","sankey");e.length&&i(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("sankey"),a=e._has&&e._has("sankey");i&&!a&&n._paperdiv.selectAll(".sankey").remove()}},{"../../plots/plots":823,"./plot":1019}],1015:[function(t,e,r){"use strict";function n(t,e,r){for(var n=t.map(function(){return[]}),a=0;a1})}var i=t("strongly-connected-components"),a=t("../../lib");e.exports=function(t,e){return n(e.node.label,e.link.source,e.link.target)&&(a.error("Circularity is present in the Sankey data. Removing all nodes and links."),e.link.label=[],e.link.source=[],e.link.target=[],e.link.value=[],e.link.color=[],e.node.label=[],e.node.color=[]),[{link:e.link,node:e.node}]}},{"../../lib":721,"strongly-connected-components":524}],1016:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"cubic-in-out"}},{}],1017:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color/attributes").defaults,o=t("../../components/color"),s=t("tinycolor2");e.exports=function(t,e,r,l){function u(r,a){return n.coerce(t,e,i,r,a)}u("node.label"),u("node.pad"),u("node.thickness"),u("node.line.color"),u("node.line.width");var c=function(t){return a[t%a.length]};u("node.color",e.node.label.map(function(t,e){return o.addOpacity(c(e),.8)})),u("link.label"),u("link.source"),u("link.target"),u("link.value"),u("link.line.color"),u("link.line.width"),u("link.color",e.link.value.map(function(){return s(l.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)"})),u("domain.x"),u("domain.y"),u("orientation"),u("valueformat"),u("valuesuffix"),u("arrangement"),n.coerceFont(u,"textfont",n.extendFlat({},l.font));var h=function(t,r){return-1===e.link.source.indexOf(r)&&-1===e.link.target.indexOf(r)};e.node.label.some(h)&&n.warn("Some of the nodes are neither sources nor targets, they will not be displayed.")}},{"../../components/color":600,"../../components/color/attributes":599,"../../lib":721,"./attributes":1013,tinycolor2:530}],1018:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.moduleType="trace",n.name="sankey",n.basePlotModule=t("./base_plot"),n.categories=["noOpacity"],n.meta={},e.exports=n},{"./attributes":1013,"./base_plot":1014,"./calc":1015,"./defaults":1017,"./plot":1019}],1019:[function(t,e,r){"use strict";function n(t){return""!==t}function i(t,e){return t.filter(function(t){return t.key===e.traceId})}function a(t,e){p.select(t).select("path").style("fill-opacity",e),p.select(t).select("rect").style("fill-opacity",e)}function o(t){p.select(t).select("text.name").style("fill","black")}function s(t){return function(e){return-1!==t.node.sourceLinks.indexOf(e.link)||-1!==t.node.targetLinks.indexOf(e.link)}}function l(t){return function(e){return-1!==e.node.sourceLinks.indexOf(t.link)||-1!==e.node.targetLinks.indexOf(t.link)}}function u(t,e,r){e&&r&&i(r,e).selectAll(".sankeyLink").filter(s(e)).call(h.bind(0,e,r,!1))}function c(t,e,r){e&&r&&i(r,e).selectAll(".sankeyLink").filter(s(e)).call(f.bind(0,e,r,!1))}function h(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",.4),a&&i(e,t).selectAll(".sankeyLink").filter(function(t){return t.link.label===a}).style("fill-opacity",.4),r&&i(e,t).selectAll(".sankeyNode").filter(l(t)).call(u)}function f(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha}),a&&i(e,t).selectAll(".sankeyLink").filter(function(t){return t.link.label===a}).style("fill-opacity",function(t){return t.tinyColorAlpha}),r&&i(e,t).selectAll(".sankeyNode").filter(l(t)).call(c)}function d(t,e){var r=t.hoverlabel||{},n=y.nestedProperty(r,e).get();return!Array.isArray(n)&&n}var p=t("d3"),m=t("./render"),g=t("../../components/fx"),v=t("../../components/color"),y=t("../../lib");e.exports=function(t,e){var r=t._fullLayout,i=r._paper,s=r._size,l=function(r,n){t._hoverdata=[n.link],t._hoverdata.trace=e.trace,g.click(t,{target:!0})},y=function(e,r,n){p.select(e).call(h.bind(0,r,n,!0)),g.hover(t,r.link,"sankey")},b=function(e,i){var s=t._fullData[i.traceId],l=t.getBoundingClientRect(),u=e.getBoundingClientRect(),c=u.left+u.width/2,h=u.top+u.height/2,f=g.loneHover({x:c-l.left,y:h-l.top,name:p.format(i.valueFormat)(i.link.value)+i.valueSuffix,text:[i.link.label,["Source:",i.link.source.label].join(" "),["Target:",i.link.target.label].join(" ")].filter(n).join("
"),color:d(s,"bgcolor")||v.addOpacity(i.tinyColorHue,1),borderColor:d(s,"bordercolor"),fontFamily:d(s,"font.family"),fontSize:d(s,"font.size"),fontColor:d(s,"font.color"),idealAlign:p.event.x"),color:d(s,"bgcolor")||i.tinyColorHue,borderColor:d(s,"bordercolor"),fontFamily:d(s,"font.family"),fontSize:d(s,"font.size"),fontColor:d(s,"font.color"),idealAlign:"left"},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t});a(v,.85),o(v)},k=function(e,n,i){p.select(e).call(c,n,i),t.emit("plotly_unhover",{points:[n.node]}),g.loneUnhover(r._hoverlayer.node())};m(i,e,{width:s.w,height:s.h,margin:{t:s.t,r:s.r,b:s.b,l:s.l}},{linkEvents:{hover:y,follow:b,unhover:x,select:l},nodeEvents:{hover:w,follow:M,unhover:k,select:_}})}},{"../../components/color":600,"../../components/fx":641,"../../lib":721,"./render":1020,d3:120}],1020:[function(t,e,r){"use strict";function n(t){return t.key}function i(t){return[t]}function a(t){return t[0]}function o(t){var e,r=[];for(e=0;e1||t.linkLineWidth>0}function _(t){return"translate("+t.translateX+","+t.translateY+")"+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function w(t){return"translate("+(t.horizontal?0:t.labelY)+" "+(t.horizontal?t.labelY:0)+")"}function M(t){return P.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+D.nodeTextOffsetHorizontal:D.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-D.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-D.nodeTextOffsetHorizontal,0]])}function k(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function A(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function T(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function S(t){return t.horizontal&&t.left?"100%":"0%"}function E(t,e,r){t.on(".basic",null).on("mouseover.basic",function(t){t.interactionState.dragInProgress||(r.hover(this,t,e),t.interactionState.hovered=[this,t])}).on("mousemove.basic",function(t){t.interactionState.dragInProgress||(r.follow(this,t),t.interactionState.hovered=[this,t])}).on("mouseout.basic",function(t){t.interactionState.dragInProgress||(r.unhover(this,t,e),t.interactionState.hovered=!1)}).on("click.basic",function(t){t.interactionState.hovered&&(r.unhover(this,t,e),t.interactionState.hovered=!1),t.interactionState.dragInProgress||r.select(this,t,e)})}function L(t,e,r){var n=P.behavior.drag().origin(function(t){return t.node}).on("dragstart",function(n){if("fixed"!==n.arrangement&&(this.parentNode.appendChild(this),n.interactionState.dragInProgress=n.node,s(n.node),n.interactionState.hovered&&(r.nodeEvents.unhover.apply(0,n.interactionState.hovered),n.interactionState.hovered=!1),"snap"===n.arrangement)){var i=n.traceId+"|"+Math.floor(n.node.originalX);n.forceLayouts[i]?n.forceLayouts[i].alpha(1):C(t,i,n),z(t,e,n,i)}}).on("drag",function(r){if("fixed"!==r.arrangement){var n=P.event.x,i=P.event.y;"snap"===r.arrangement?(r.node.x=n,r.node.y=i):("freeform"===r.arrangement&&(r.node.x=n),r.node.y=Math.max(r.node.dy/2,Math.min(r.size-r.node.dy/2,i))),s(r.node),"snap"!==r.arrangement&&(r.sankey.relayout(),y(t.filter(l(r)),e),t.call(p))}}).on("dragend",function(t){ +t.interactionState.dragInProgress=!1});t.on(".drag",null).call(n)}function C(t,e,r){var n=r.sankey.nodes().filter(function(t){return t.originalX===r.node.originalX});r.forceLayouts[e]=N.forceSimulation(n).alphaDecay(0).force("collide",N.forceCollide().radius(function(t){return t.dy/2+r.nodePad/2}).strength(1).iterations(D.forceIterations)).force("constrain",I(t,e,n,r)).stop()}function z(t,e,r,n){window.requestAnimationFrame(function i(){for(var a=0;a0&&window.requestAnimationFrame(i)})}function I(t,e,r,n){return function(){for(var i=0,a=0;a0&&(n.forceLayouts[e].alpha(0),window.setTimeout(function(){t.call(p)},30))}}var D=t("./constants"),P=t("d3"),O=t("tinycolor2"),F=t("../../components/color"),R=t("../../components/drawing"),j=t("@plotly/d3-sankey").sankey,N=t("d3-force"),B=t("../../lib");e.exports=function(t,e,r,s){var l=t.selectAll(".sankey").data(e.filter(function(t){return a(t).trace.visible}).map(h.bind(null,r)),n);l.exit().remove(),l.enter().append("g").classed("sankey",!0).style("box-sizing","content-box").style("position","absolute").style("left",0).style("shape-rendering","geometricPrecision").style("pointer-events","auto").style("box-sizing","content-box").attr("transform",_),l.transition().ease(D.ease).duration(D.duration).attr("transform",_);var u=l.selectAll(".sankeyLinks").data(i,n);u.enter().append("g").classed("sankeyLinks",!0).style("fill","none");var c=u.selectAll(".sankeyLink").data(function(t){var e={};return t.sankey.links().filter(function(t){return t.value}).map(f.bind(null,e,t))},n);c.enter().append("path").classed("sankeyLink",!0).attr("d",g).call(E,l,s.linkEvents),c.style("stroke",function(t){return x(t)?F.tinyRGB(O(t.linkLineColor)):t.tinyColorHue}).style("stroke-opacity",function(t){return x(t)?F.opacity(t.linkLineColor):t.tinyColorAlpha}).style("stroke-width",function(t){return x(t)?t.linkLineWidth:1}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha}),c.transition().ease(D.ease).duration(D.duration).attr("d",g),c.exit().transition().ease(D.ease).duration(D.duration).style("opacity",0).remove();var p=l.selectAll(".sankeyNodeSet").data(i,n);p.enter().append("g").style("shape-rendering","geometricPrecision").classed("sankeyNodeSet",!0),p.style("cursor",function(t){switch(t.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var v=p.selectAll(".sankeyNode").data(function(t){var e=t.sankey.nodes(),r={};return o(e),e.filter(function(t){return t.value}).map(d.bind(null,r,t))},n);v.enter().append("g").classed("sankeyNode",!0).call(m).call(E,l,s.nodeEvents),v.call(L,c,s),v.transition().ease(D.ease).duration(D.duration).call(m),v.exit().transition().ease(D.ease).duration(D.duration).style("opacity",0).remove();var y=v.selectAll(".nodeRect").data(i);y.enter().append("rect").classed("nodeRect",!0).call(b),y.style("stroke-width",function(t){return t.nodeLineWidth}).style("stroke",function(t){return F.tinyRGB(O(t.nodeLineColor))}).style("stroke-opacity",function(t){return F.opacity(t.nodeLineColor)}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha}),y.transition().ease(D.ease).duration(D.duration).call(b);var C=v.selectAll(".nodeCapture").data(i);C.enter().append("rect").classed("nodeCapture",!0).style("fill-opacity",0),C.attr("x",function(t){return t.zoneX}).attr("y",function(t){return t.zoneY}).attr("width",function(t){return t.zoneWidth}).attr("height",function(t){return t.zoneHeight});var z=v.selectAll(".nodeCentered").data(i);z.enter().append("g").classed("nodeCentered",!0).attr("transform",w),z.transition().ease(D.ease).duration(D.duration).attr("transform",w);var I=z.selectAll(".nodeLabelGuide").data(i);I.enter().append("path").classed("nodeLabelGuide",!0).attr("id",function(t){return t.uniqueNodeLabelPathId}).attr("d",M).attr("transform",k),I.transition().ease(D.ease).duration(D.duration).attr("d",M).attr("transform",k);var P=z.selectAll(".nodeLabel").data(i);P.enter().append("text").classed("nodeLabel",!0).attr("transform",A).style("user-select","none").style("cursor","default").style("fill","black"),P.style("text-shadow",function(t){return t.horizontal?"-1px 1px 1px #fff, 1px 1px 1px #fff, 1px -1px 1px #fff, -1px -1px 1px #fff":"none"}).each(function(t){R.font(P,t.textFont)}),P.transition().ease(D.ease).duration(D.duration).attr("transform",A);var j=P.selectAll(".nodeLabelTextPath").data(i);j.enter().append("textPath").classed("nodeLabelTextPath",!0).attr("alignment-baseline","middle").attr("xlink:href",function(t){return"#"+t.uniqueNodeLabelPathId}).attr("startOffset",S).style("fill",T),j.text(function(t){return t.horizontal||t.node.dy>5?t.node.label:""}).attr("text-anchor",function(t){return t.horizontal&&t.left?"end":"start"}),j.transition().ease(D.ease).duration(D.duration).attr("startOffset",S).style("fill",T)}},{"../../components/color":600,"../../components/drawing":624,"../../lib":721,"./constants":1016,"@plotly/d3-sankey":36,d3:120,"d3-force":116,tinycolor2:530}],1021:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;rm&&d.splice(m,d.length-m),p.length>m&&p.splice(m,p.length-m);var g={padded:!0},v={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var y={type:"linear"};i.setConvert(y),u=y.makeCalcdata(e.marker,"size"),u.length>m&&u.splice(m,u.length-m)}var b,x=1.6*(e.marker.sizeref||1);b="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(u)?u.map(b):b(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(g.padded=!1,g.ppad=0):g.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||d[0]===d[m-1]&&p[0]===p[m-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(v.padded=!1):v.tozero=!0,i.expand(h,d,g),i.expand(f,p,v);var _=new Array(m);for(c=0;c=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],1025:[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":603,"../../components/colorscale":614,"../../lib":721,"../../plots/plots":823,"fast-isnumeric":129}],1026:[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":606,"../../components/colorscale/has_colorscale":613,"./subtypes":1042}],1027:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],1028:[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 m(r,a){return n.coerce(t,e,i,r,a)}var g=s(t,e,p,m),v=gV!=P>=V&&(z=L[S-1][0],I=L[S][0],C=z+(I-z)*(V-D)/(P-D),j=Math.min(j,C),N=Math.max(N,C));j=Math.max(j,0),N=Math.min(N,f._length);var q=s.defaultLine;return s.opacity(h.fillcolor)?q=h.fillcolor:s.opacity((h.line||{}).color)&&(q=h.line.color),n.extendFlat(t,{distance:l+10,x0:j,x1:N,y0:V,y1:V,color:q}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":600,"../../components/errorbars":630,"../../components/fx":641,"../../lib":721,"./get_trace_color":1030}],1032:[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":770,"./arrays_to_calcdata":1021,"./attributes":1022,"./calc":1023,"./clean_data":1024,"./colorbar":1025,"./defaults":1028,"./hover":1031,"./plot":1039,"./select":1040,"./style":1041,"./subtypes":1042}],1033:[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,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613}],1034:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;e.exports=function(t,e){function r(e){var r=_.c2p(t[e].x),i=w.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function i(t){var e=t[0]/_._length,r=t[1]/w._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}var a,o,s,l,u,c,h,f,d,p,m,g,v,y,b,x,_=e.xaxis,w=e.yaxis,M=e.simplify,k=e.connectGaps,A=e.baseTolerance,T=e.linear,S=[],E=.2,L=new Array(t.length),C=0;for(M||(A=E=-1),a=0;ai(c))break;s=c,v=p[0]*d[0]+p[1]*d[1],v>m?(m=v,l=c,f=!1):v=t.length||!c)break;L[C++]=c,o=c}}else L[C++]=l}S.push(L.slice(0,C))}return S}},{"../../constants/numerical":702}],1035:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1036:[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":129}],1038:[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,u){var c,h=o.isBubble(t),f=(t.line||{}).color;if(u=u||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",h?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u.noLine||(c=f&&!Array.isArray(f)&&e.marker.color!==f?f:h?n.background:n.defaultLine,l("marker.line.color",c),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",h?1:0)),h&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),u.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":600,"../../components/colorscale/defaults":609,"../../components/colorscale/has_colorscale":613,"./subtypes":1042}],1039:[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,f,p){function m(t){return M?t.transition():t}function g(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(t){if(t.ids)return v}function b(){return!1}function x(e){var r,n,i,a=e[0].trace,u=o.select(this),h=c.hasMarkers(a),f=c.hasText(a),d=y(a),p=b,v=b;h&&(p=a.marker.maxdisplayed||a._needsCull?g:s.identity),f&&(v=a.marker.maxdisplayed||a._needsCull?g:s.identity),n=u.selectAll("path.point"),r=n.data(p,d);var x=r.enter().append("path").classed("point",!0);M&&x.call(l.pointStyle,a,t).call(l.translatePoints,k,A,a).style("opacity",0).transition().style("opacity",1);var _=h&&l.tryColorscale(a.marker,""),w=h&&l.tryColorscale(a.marker,"line");r.order(),r.each(function(e){var r=o.select(this),n=m(r);i=l.translatePoint(e,n,k,A),i?(l.singlePointStyle(e,n,a,_,w,t),a.customdata&&r.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):n.remove()}),M?r.exit().transition().style("opacity",0).remove():r.exit().remove(),n=u.selectAll("g"),r=n.data(v,d),r.enter().append("g").classed("textpoint",!0).append("text"),r.order(),r.each(function(t){var e=o.select(this),r=m(e.select("text"));(i=l.translatePoint(t,r,k,A))||e.remove()}),r.selectAll("text").call(l.textPointStyle,a,t).each(function(t){var e=t.xp||k.c2p(t.x),r=t.yp||A.c2p(t.y);o.select(this).selectAll("tspan.line").each(function(){m(o.select(this)).attr({x:e,y:r})})}),r.exit().remove()}var _,w;a(t,e,r,n,i);var M=!!p&&p.duration>0,k=r.xaxis,A=r.yaxis,T=n[0].trace,S=T.line,E=o.select(f);if(E.call(u.plot,r,p),!0===T.visible){m(E).style("opacity",T.opacity);var L,C,z=T.fill.charAt(T.fill.length-1);"x"!==z&&"y"!==z&&(z=""),n[0].node3=E;var I="",D=[],P=T._prevtrace;P&&(I=P._prevRevpath||"",C=P._nextFill,D=P._polygons);var O,F,R,j,N,B,U,V,q,H="",G="",Y=[],X=[],W=s.noop;if(L=T._ownFill,c.hasLines(T)||"none"!==T.fill){for(C&&C.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(S.shape)?(R=l.steps(S.shape),j=l.steps(S.shape.split("").reverse().join(""))):R=j="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")},N=function(t){return j(t.reverse())},Y=h(n,{xaxis:k,yaxis:A,connectGaps:T.connectgaps,baseTolerance:Math.max(S.width||1,3)/4,linear:"linear"===S.shape,simplify:S.simplify}),q=T._polygons=new Array(Y.length),w=0;w1}),W=function(t){return function(e){if(O=R(e),F=N(e),H?z?(H+="L"+O.substr(1),G=F+"L"+G.substr(1)):(H+="Z"+O,G=F+"Z"+G):(H=O,G=F),c.hasLines(T)&&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 Z=E.selectAll(".js-line").data(X);m(Z.exit()).style("opacity",0).remove(),Z.each(W(!1)),Z.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(l.lineGroupStyle).each(W(!0)),Y.length&&(L?B&&V&&(z?("y"===z?B[1]=V[1]=A.c2p(0,!0):"x"===z&&(B[0]=V[0]=k.c2p(0,!0)),m(L).attr("d","M"+V+"L"+B+"L"+H.substr(1)).call(l.singleFillStyle)):m(L).attr("d",H+"Z").call(l.singleFillStyle)):"tonext"===T.fill.substr(0,6)&&H&&I&&("tonext"===T.fill?m(C).attr("d",H+"Z"+I+"Z").call(l.singleFillStyle):m(C).attr("d",H+"L"+I.substr(1)+"Z").call(l.singleFillStyle),T._polygons=T._polygons.concat(D)),T._prevRevpath=G,T._prevPolygons=q);var J=E.selectAll(".points");_=J.data([n]),J.each(x),_.enter().append("g").classed("points",!0).each(x),_.exit().remove()}}function a(t,e,r,n,i){var a=r.xaxis,l=r.yaxis,u=o.extent(s.simpleMap(a.range,a.r2c)),h=o.extent(s.simpleMap(l.range,l.r2c)),f=n[0].trace;if(c.hasMarkers(f)){var d=f.marker.maxdisplayed;if(0!==d){var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=h[0]&&t.y<=h[1]}),m=Math.ceil(p.length/d),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),f(t,e,r),n(t,p),l=0,u={};lu[e[0].trace.uid]?1:-1}),g){s&&(d=s());o.transition().duration(a.duration).ease(a.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()}).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)});m&&h.exit().remove(),p.selectAll("path:not([d])").remove()}},{"../../components/drawing":624,"../../components/errorbars":630,"../../lib":721,"../../lib/polygon":731,"./line_points":1034,"./link_traces":1036,"./subtypes":1042,d3:120}],1040:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],h=s[0].trace,f=h.marker,d=!n.hasMarkers(h)&&!n.hasText(h);if(!0===h.visible&&!d){var p=Array.isArray(f.opacity)?1:f.opacity;if(!1===e)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=g(f),this.delaunayMesh._trace=this,this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},A.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":699,"../../constants/gl3d_markers":700,"../../lib":721,"../../lib/gl_format_color":718,"../../lib/str2rgbarray":739,"../scatter/make_bubble_size_func":1037,"./calc_errors":1047,"delaunay-triangulate":121,"gl-error3d":159,"gl-line3d":170,"gl-mesh3d":203,"gl-scatter3d":249}],1049:[function(t,e,r){"use strict";function n(t,e,r,n){var a=0,o=r("x"),s=r("y"),l=r("z");return i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],n),o&&s&&l&&(a=Math.min(o.length,s.length,l.length),a=0&&f("surfacecolor",d||p);for(var m=["x","y","z"],g=0;g<3;++g){var v="projection."+m[g];f(v+".show")&&(f(v+".opacity"),f(v+".scale"))}c(t,e,r,{axis:"z"}),c(t,e,r,{axis:"y",inherit:"z"}),c(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":629,"../../lib":721,"../../registry":838,"../scatter/line_defaults":1033,"../scatter/marker_defaults":1038,"../scatter/subtypes":1042,"../scatter/text_defaults":1043,"./attributes":1045}],1050:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl3d_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl3d_markers":700,"../../plots/gl3d":803,"../scatter/colorbar":1025,"./attributes":1045,"./calc":1046,"./convert":1048,"./defaults":1049}],1051:[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={carpet:{valType:"string"},a:{valType:"data_array"},b:{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)),gradient:l.gradient},a("marker"),{showscale:l.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,hoverinfo:s({},i.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1052:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../scatter/subtypes"),o=t("../scatter/colorscale_calc"),s=t("../scatter/arrays_to_calcdata"),l=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=l(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var u;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var c,h,f=e.a.length,d=new Array(f),p=!1;for(u=0;uf&&y.splice(f,y.length-f)}return o(e),s(d,e),d}}},{"../../plots/cartesian/axes":760,"../carpet/lookup_carpetid":894,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"../scatter/subtypes":1042,"fast-isnumeric":129}],1053:[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)}d("carpet"),e.xaxis="x",e.yaxis="y";var p,m=d("a"),g=d("b");if(!(p=Math.min(m.length,g.length)))return void(e.visible=!1);m&&p0?t.labelprefix:t._hovertitle+": ")+e.toFixed(3)+t.labelsuffix)}var o=n(t,e,r,i);if(o&&!1!==o[0].index){var s=o[0];if(void 0===s.index){var l=1-s.y0/t.ya._length,u=t.xa._length,c=u*l/2,h=u-c;return s.x0=Math.max(Math.min(s.x0,h),c),s.x1=Math.max(Math.min(s.x1,h),c),o}var f=s.cd[s.index];s.a=f.a,s.b=f.b,s.xLabelVal=void 0,s.yLabelVal=void 0;var d=s.trace,p=d._carpet,m=d.hoverinfo.split("+"),g=[];-1!==m.indexOf("all")&&(m=["a","b"]),-1!==m.indexOf("a")&&a(p.aaxis,f.a),-1!==m.indexOf("b")&&a(p.baxis,f.b);var v=p.ab2ij([f.a,f.b]),y=Math.floor(v[0]),b=v[0]-y,x=Math.floor(v[1]),_=v[1]-x,w=p.evalxy([],y,x,b,_);return g.push("y: "+w[1].toFixed(3)),s.extraText=g.join("
"),o}}},{"../scatter/hover":1031}],1055:[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="scattercarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["carpet","symbols","markerColorscale","showLegend","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":770,"../scatter/colorbar":1025,"./attributes":1051,"./calc":1052,"./defaults":1053,"./hover":1054,"./plot":1056,"./select":1057,"./style":1058}],1056:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../plots/cartesian/axes");e.exports=function(t,e,r){var a,o,s,l=r[0][0].carpet,u={xaxis:i.getFromId(t,l.xaxis||"x"),yaxis:i.getFromId(t,l.yaxis||"y"),plot:e.plot};for(n(t,u,r),a=0;a")}var i=t("../../components/fx"),a=t("../../plots/cartesian/axes"),o=t("../../constants/numerical").BADNUM,s=t("../scatter/get_trace_color"),l=t("./attributes");e.exports=function(t){function e(t){return h.projection(t)}function r(t){var r=t.lonlat;if(r[0]===o)return 1/0;if(h.isLonLatOverEdges(r))return 1/0;var n=e(r),i=u.c2p(),a=c.c2p(),s=Math.abs(i-n[0]),l=Math.abs(a-n[1]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(s*s+l*l)-f,1-3/f)}var a=t.cd,l=a[0].trace,u=t.xa,c=t.ya,h=t.subplot;if(i.getClosest(a,r,t),!1!==t.index){var f=a[t.index],d=f.lonlat,p=e(d),m=f.mrc||1;return t.x0=p[0]-m,t.x1=p[0]+m,t.y0=p[1]-m,t.y1=p[1]+m,t.loc=f.loc,t.lat=d[0],t.lon=d[1],t.color=s(l,f),t.extraText=n(l,f,h.mockAxis),[t]}}},{"../../components/fx":641,"../../constants/numerical":702,"../../plots/cartesian/axes":760,"../scatter/get_trace_color":1030,"./attributes":1059}],1064:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.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":788,"../scatter/colorbar":1025,"./attributes":1059,"./calc":1060,"./defaults":1061,"./event_data":1062,"./hover":1063,"./plot":1065}],1065:[function(t,e,r){"use strict";function n(t,e){var r=t[0].trace;if(Array.isArray(r.locations))for(var n=c(r,e),i=r.locationmode,a=0;a=e.length?i:e[a]);return n}function o(t,e,r){return l(O(t,r),P(e,r),r)}function s(t,e,r,n){var i=k(t,e,n);return i=Array.isArray(i[0])?i:a(y.identity,[i],n),l(i,P(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;iZ?W-Z:0),!H||q.noBorder||q.noFill?c(this.scatter.options.colors,Y,f,B,G):c(this.scatter.options.colors,I,f,0),c(this.scatter.options.borderColors,X,f,B,G);N?(this.scatter.options.positions=null,this.fancyScatter.update(),this.scatter.options.positions=k):this.fancyScatter.update()}else this.fancyScatter.clear();this.scatter.clear(),this.expandAxesFancy(l,h,j)},D.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,a=this.xData,s=this.yData;for(n=new Float64Array(2*a.length),r=0;r")}var i=t("../../components/fx"),a=t("../scatter/get_trace_color"),o=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){function s(t){var e=t.lonlat;if(e[0]===o)return 1/0;var n=Math.abs(c.c2p(e)-c.c2p([p,e[1]])),i=Math.abs(h.c2p(e)-h.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 l=t.cd,u=l[0].trace,c=t.xa,h=t.ya,f=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),d=360*f,p=e-d;if(i.getClosest(l,s,t),!1!==t.index){var m=l[t.index],g=m.lonlat,v=[g[0]+d,g[1]],y=c.c2p(v),b=h.c2p(v),x=m.mrc||1;return t.x0=y-x,t.x1=y+x,t.y0=b-x,t.y1=b+x,t.color=a(u,m),t.extraText=n(u,m),[t]}}},{"../../components/fx":641,"../../constants/numerical":702,"../scatter/get_trace_color":1030}],1077:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("../scattergeo/calc"),n.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":817,"../scatter/colorbar":1025,"../scattergeo/calc":1060,"./attributes":1072,"./defaults":1074,"./event_data":1075,"./hover":1076,"./plot":1078}],1078:[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":1073}],1079:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/colorbar/attributes"),s=t("../../components/drawing/attributes").dash,l=t("../../lib/extend").extendFlat,u=n.marker,c=n.line,h=u.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),line:{color:c.color,width:c.width,dash:s,shape:l({},c.shape,{values:["linear","spline"]}),smoothing:c.smoothing},connectgaps:n.connectgaps,fill:l({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:l({},{symbol:u.symbol,opacity:u.opacity,maxdisplayed:u.maxdisplayed,size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,line:l({},{width:h.width},a("marker".line)),gradient:u.gradient},a("marker"),{showscale:u.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,hoverinfo:l({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":601,"../../components/colorscale/color_attributes":607,"../../components/drawing/attributes":623,"../../lib/extend":713,"../../plots/attributes":758,"../scatter/attributes":1022}],1080:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../scatter/subtypes"),o=t("../scatter/colorscale_calc"),s=t("../scatter/arrays_to_calcdata"),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,m=t._fullLayout[e.subplot],g=m.sum,v=e.sum||g;for(r=0;rk&&S.splice(k,S.length-k)}return o(e),s(A,e),A}},{"../../plots/cartesian/axes":760,"../scatter/arrays_to_calcdata":1021,"../scatter/colorscale_calc":1026,"../scatter/subtypes":1042,"fast-isnumeric":129}],1081:[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,m=d("a"),g=d("b"),v=d("c");if(m?(p=m.length,g?(p=Math.min(p,g.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):g&&v&&(p=Math.min(g.length,v.length)),!p)return void(e.visible=!1);m&&p"),s}}},{"../../plots/cartesian/axes":760,"../scatter/hover":1031}],1083:[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":831,"../scatter/colorbar":1025,"./attributes":1079,"./calc":1080,"./defaults":1081,"./hover":1082,"./plot":1084,"./select":1085,"./style":1086}],1084:[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=0;a":return function(t){return f(t)>i};case">=":return function(t){return f(t)>=i};case"[]":return function(t){var e=f(t);return e>=i[0]&&e<=i[1]};case"()":return function(t){var e=f(t);return e>i[0]&&e=i[0]&&ei[0]&&e<=i[1]};case"][":return function(t){var e=f(t);return e<=i[0]||e>=i[1]};case")(":return function(t){var e=f(t);return ei[1]};case"](":return function(t){var e=f(t);return e<=i[0]||e>i[1]};case")[":return function(t){var e=f(t);return e=i[1]};case"{}":return function(t){return-1!==i.indexOf(f(t))};case"}{":return function(t){return-1===i.indexOf(f(t))}}}var i=t("../lib"),a=t("../registry"),o=t("../plots/cartesian/axes"),s=["=","!=","<",">=",">","<="],l=["[]","()","[)","(]","][",")(","](",")["],u=["{}","}{"];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(s).concat(l).concat(u),dflt:"="},value:{valType:"any",dflt:0},preservegaps:{valType:"boolean",dflt:!1}},r.supplyDefaults=function(t){function e(e,a){return i.coerce(t,n,r.attributes,e,a)}var n={};if(e("enabled")){e("preservegaps"),e("operation"),e("value"),e("target");var o=a.getComponentMethod("calendars","handleDefaults");o(t,n,"valuecalendar",null),o(t,n,"targetcalendar",null)}return n},r.calcTransform=function(t,e,r){function a(t,r){for(var n=0;n